Commit Graph

22528 Commits

Author SHA1 Message Date
Filipe Cavalcanti a64171f059 arch/xtensa/esp32s3: fix timer initialization 2024-09-28 10:43:49 +08:00
dulibo1 14f278ab89 sim:fix oneshot sim_cancel assert
when CONFIG_PM and CONFIG_CPULOAD_ONESHOT are defined
sim_cancel may assert:
[429492.185400] [ 0] [ EMERG] [ap] _assert: Current Version: NuttX ap 12.3.0 5ffeb16111-dirty Dec  4 2023 14:32:27 sim
[429492.185400] [ 0] [ EMERG] [ap] _assert: Assertion failed : at file: sim/sim_oneshot.c:367 task: Idle_Task process: Kernel 0x323254d
[429492.185400] [ 0] [ EMERG] [ap] backtrace:
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0xf7941ad5>] _fini+0xf0753010/0xf8e1155b
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x71def50>] host_backtrace+0x41/0x72
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x65b68bd>] up_backtrace+0x126/0x2f8
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x6554ceb>] sched_backtrace+0x70/0x8a
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x37585d2>] sched_dumpstack+0xed/0x494
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x3694d8e>] _assert+0x93b/0xa82
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x33223eb>] __assert+0x3e/0x4c
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x336b6d5>] sim_cancel+0xde/0x392
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x36a4301>] nxsched_oneshot_pmnotify+0x2aa/0x2ee
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x36bce77>] pm_changeall+0x478/0x526
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x36bd71f>] pm_changestate+0x380/0x82c
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x336297b>] up_idle+0x54/0xa6
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x32347b8>] nx_start+0x226b/0x226e
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x31d49f5>] main+0x54/0x70
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0xf6bbcfa1>] _fini+0xef9ce4dc/0xf8e1155b
[429492.185400] [ 0] [ EMERG] [ap] [ 0] [<0x31914ac>] _start+0x31/0x46

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 10:43:09 +08:00
hujun5 e98dd37534 xtensa: g_current_regs is only used to determine if we are in irq,
with other functionalities removed.

reason:
by doing this we can reduce context switch time,
When we exit from an interrupt handler, we directly use tcb->xcp.regs

before
text    data     bss     dec     hex filename
178368     876  130604  309848   4ba58 nuttx
after
text    data     bss     dec     hex filename
178120     876  130212  309208   4b7d8 nuttx

szie change -248

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-27 23:44:04 +08:00
guoshichao c7d801fd9c greenhills: fix the arch_interface archive error
: && cxarm cr arch/libarch_interface.a  arch/CMakeFiles/arch_interface.dir/arm/src/common/gnu/arm_signal_handler.S.obj  && echo arch/libarch_interface.a && :
[elxr] (error #16) cannot find file cr

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-27 23:39:56 +08:00
dulibo1 3107822c08 smp:fix sim build error under config CONFIG_SMP
CC:  sim/sim_smpsignal.c init/nx_smpstart.c: In function ‘nx_idle_trampoline’:
init/nx_smpstart.c:68:21: warning: unused variable ‘tcb’ [-Wunused-variable]
   68 |   FAR struct tcb_s *tcb = this_task_inirq();
      |                     ^~~
sim/sim_smpsignal.c: In function ‘host_cpu_started’:
sim/sim_smpsignal.c:271:17: warning: unused variable ‘tcb’ [-Wunused-variable]
  271 |   struct tcb_s *tcb = this_task();

sim/sim_smpsignal.c:249:33: error: ‘cpu’ undeclared (first use in this function)
  249 |   restore_critical_section(tcb, cpu);
      |                                 ^~~

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-27 23:30:40 +08:00
Jani Paalijarvi 21f9fc2b28 mpfs_serial.c: Add RX flowcontrol
Disable RX interrupts and clear the fifo in case of full RX buffer.
Enable RX interrupts in case of empty buffer.
2024-09-27 10:53:12 -03:00
hujun5 3e459c0477 riscv: use g_running_task store current regs
This commit fixes the regression from https://github.com/apache/nuttx/pull/13561

In order to determine whether a context switch has occurred,
we can use g_running_task to store the current regs.
This allows us to compare the current register state with the previously
stored state to identify if a context switch has taken place.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-27 18:07:31 +08:00
ligd 981fd0cf53 xtesa: fix lost save & restore states caused by merge code
this is caused by:
35c8c80a00

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-27 16:18:36 +08:00
Jinliang Li 19230e3a2b arm/armv8-r: fix armv8 build error without neon
Fix the build error:
armv8-r/arm_vectors.S:205:Error: VFP single precision
register expected -- `vstmdb.64 sp!,{d16-d31}'
armv8-r/arm_vectors.S:242:Error: VFP single precision
register expected -- `vldmia.64 r0!,{d16-d31}'

Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
2024-09-27 11:23:05 +08:00
Ville Juven 9ef76e3735 riscv_fork.c: Fix race condition when handling parent integer registers
We need to record the parent's integer register context upon exception
entry to a separate non-volatile area. Why?

Because xcp.regs can move due to a context switch within the fork() system
call, be it either via interrupt or a synchronization point.

Fix this by adding a "sregs" area where the saved user context is placed.
The critical section within fork() is also unnecessary.
2024-09-27 10:22:43 +08:00
Ville Juven 172d2a8491 riscv_fork.c: Fix vfork() for kernel mode + SMP
There was an error in the fork() routine when system calls are in use:
the child context is saved on the child's user stack, which is incorrect,
the context must be saved on the kernel stack instead.

The result is a full system crash if (when) the child executes on a
different CPU which does not have the same MMU mappings active.
2024-09-27 10:22:43 +08:00
ligd 35c8c80a00 arch: change nxsched_suspend/resume_scheduler() called position
for the citimon stats:

thread 0:                     thread 1:
enter_critical (t0)
up_switch_context
note suspend thread0 (t1)

                              thread running
                              IRQ happen, in ISR:
                                post thread0
                                up_switch_context
                                note resume thread0 (t2)
                                ISR continue f1
                                ISR continue f2
                                ...
                                ISR continue fn

leave_critical (t3)

You will see, the thread 0, critical_section time is:
(t1 - t0) + (t3 - t2)

BUT, this result contains f1 f2 .. fn time spent, it is wrong
to tell user thead0 hold the critical lots of time but actually
not belong to it.

Resolve:
change the nxsched_suspend/resume_scheduler to real hanppends

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-27 09:53:33 +08:00
guoshichao dbe09c1505 greenhills: add -Osize build option to reduce the size
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-27 00:17:58 +08:00
guoshichao 8c651d3d05 greenhills: add support for cortex-m4 platform
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-27 00:17:58 +08:00
qinwei1 8ae35754e5 arm64: add arm64_current_el to obtain current EL
Summary
  Add a macro to obtain current execute level

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2024-09-27 00:16:41 +08:00
qinwei1 c535fb1438 arm64: refine the fatal handler
Summary
  The original implement for exception handler is very simple and
haven't framework for breakpoint/watchpoint routine or brk instruction.
  I refine the fatal handler and add framework for debug handler to
register or unregister. this is a prepare for watchpoint/breakpoint
implement

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2024-09-27 00:16:41 +08:00
ligd 551e6ce3ab compile: add DEBUG_SYMBOLS_LEVEL allow custom the level
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-27 00:13:07 +08:00
anjiahao c76e83beaa Debug option:change -g to -g3, add macro information to elf
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-27 00:13:07 +08:00
YAMAMOTO Takashi 08dcef4de0 xtensa_macros.S: fix tab/space mismatches 2024-09-27 00:10:42 +08:00
lipengfei28 56f57e5f9b add pci irq interface
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 00:10:19 +08:00
ouyangxiangzhen f3973c7e46 imx8qm-mek: Fix early print
Function `arm64_lowputc` corrupted the x1 register which is used in function `boot_stage_puts`.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-27 00:09:50 +08:00
nuttxs 1dfea8798b arch/xtensa/esp32s3: Adding an ioctl interface ota_invalidate_bootseq()
to the ESP32-S3 partitions, by deleting the corresponding otadata, makes
the boot sequence (ota_0/1) invalid.
2024-09-26 23:52:17 +08:00
guoshichao 74d627f5f0 greenhills: fix the arm_signal_handler.S build error
[asarm] (error #2067) /home/guoshichao/work_profile/vela_os/vela_car_6/nuttx/arch/arm/src/common/gnu/arm_signal_handler.S 35: unknown instruction
  .syntax unified
--^

[asarm] (error #2067) /home/guoshichao/work_profile/vela_os/vela_car_6/nuttx/arch/arm/src/common/gnu/arm_signal_handler.S 70: unknown instruction
  .thumb_func
--^

[asarm] (error #2230) /home/guoshichao/work_profile/vela_os/vela_car_6/nuttx/arch/arm/src/common/gnu/arm_signal_handler.S 72: bad directive
  .type up_signal_handler , function
----------------------------^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-26 23:15:07 +08:00
Huang Qi d9b95c5ca0 riscv: Remove some unnecessary macro guards
If CONFIG_SMP is not enabled, riscv_cpuindex.c will not be compiled
anyway.

And for CONFIG_ARCH_FPU, if it's not enabled, riscv_fpucmp.c will not
be compiled.

So we can remove the unnecessary macro guard for up_cpu_index() and
up_fpucmp().

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-26 16:23:48 +08:00
chao an a04e44ea75 syslog/channel: move syslog channel map into rodata
add SYSLOG_REGISTER to support disable syslog channel register

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-26 16:10:29 +08:00
chao an 9abe737ef3 syslog/channel: add constant attribute if SYSLOG_IOCTL is not enabled
move all private channel define from data to rodata

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-26 16:10:29 +08:00
Jukka Laitinen 950b63c7f1 arch/risc-v/src/mpfs/mpfs_opensbi.c: Fix conflicting datatypes defined by NuttX vs. opensbi
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-26 16:10:09 +08:00
Jukka Laitinen 82ef3813bd arch/risc-v/src/mpfs: Make mpfs_hart_index2id table modifiable by bootloader
This is actually the same table as entrypoints, so just use the same data, which
can be set before booting any of the harts

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-26 16:10:09 +08:00
Ville Juven 27648479bc mpfs_mpucfg.h: Add missing MPUCFG registers
Now all registers are defined
2024-09-26 16:09:54 +08:00
Jukka Laitinen 06b3416384 arch/risc-v/src/common/riscv_initialstate.c: Fix stack pointer in coloration
The logical CPU index should be retrieved with this_cpu(); the
riscv_mhartid() returns the actual hart id of the SoC.

For mpfs target for example, NuttX can run on a single HART, for example on mhartid 2, but there is still just one logical CPU for the NuttX.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-26 08:35:42 +08:00
adriendesp 6d72a8d676 [arch/xmc4] added register description for ERU and POSIF peripherals
Register map of ERU and POSIF peripherals, from the Ref. Manuals for both XMC45 and XMC4[7-8]
2024-09-25 19:05:12 -03:00
Bowen Wang dbe43b0ae9 rptun: move rptun cmd definition before the resource table
Because locate the command at the end the resource table is unfriendly
when we want to support multi virtio devices instead only one virtio
rpmsg device.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
Yongrong Wang 10e8b6c9f6 rptun/rpmsg_virtio: remove chip cmd and reuse the common ones
Add more common command for rptun and rpmsg_virtio frameworks,
also modify the rptun and rpmsg_virtio driver to use the common
commands.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-09-26 00:04:05 +08:00
Yongrong Wang 420af99797 sim_rptun.c: remove sim_rptun_panic
Because we can use the common part implemented in rptun

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-09-26 00:04:05 +08:00
Yongrong Wang 7c7d08d13a rptun.c/rpmsg_virtio.c: move panic logic from chip to rptun/rpmsg_virtio
Move the panic logic in common places, later we can move more logic to
the framework instead of having the drivers implement it repeatedly.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
Bowen Wang 9cceccb14a sim/sim_rptun: add 64-bit support for sim_rptun
add remote addrenv to make the da is start from 0, so the uint32_t
da in resource table can store the correct address

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
wangyongrong 5668a3e283 x86_64_pci.c: x86_64_pci_read/write_io memory support
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-26 00:00:03 +08:00
Eero Nurkkala 737d4bf418 risc-v/mpfs: emmcsd: enforce HS DDR mode
Previously, address 0x03b70000u was written with shift bits
that only changed the bit width, not the mode. HS mode is
changed via 0x03B90100, which is required, according to Jedec
specs, for DDR mode. HS mode was not applied before. Enforce
DDR mode (50 MHz) for now.

The real boost, however, comes from removing the DMA limitation
at 0x08xxxxxx address space, which now seems unnecessary.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2024-09-25 23:58:08 +08:00
Eero Nurkkala 6db0f7f009 risc-v/mpfs: emmcsd: deny unaligned access
Don't allow unaligned access with the DMA requests.
Return -EFAULT in case the provided address is unaligned.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2024-09-25 23:58:08 +08:00
Jari Nippula 9b60f8d9d0 emmc interrupt blackout issue fix
sendfifo() function need enable BWR_IE before checking if BWE is enabled
to avoid BWE to be activated between the BWE check and BWR interrupt
enabling, which causes the interrupt to be missed and Data Timeout error.
2024-09-25 23:58:08 +08:00
Ville Juven c23babbcc7 mpfs/emmcsd: Set 8-bit data width and DDR HS mode for eMMC
This is not the correct way to do this, but it gives a nice perf. boost
2024-09-25 23:58:08 +08:00
Ville Juven c36bdba3cb mpfs/emmcsd: Set same base clock for SDR/DDR modes 2024-09-25 23:58:08 +08:00
Huang Qi c1b41fefeb riscv_cpuinfo: Add support for RVV extension in CPU info
Add missing info for RVV ISA extention, which is already supported
by NuttX.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-25 23:54:19 +08:00
Jani Paalijarvi 3613eb209a arch/risc-v/src/mpfs/mpfs_corepwm.c: Disable PWM channels in setup
Set frequency to zero and disable channels in pwm_setup()
to avoid unexpected behaviour when starting PWM.

Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
2024-09-25 21:47:15 +08:00
Jukka Laitinen 7e6e18697c arch/risc-v/src/mpfs: Remove CONFIG_MPFS_COREPWMx_PWMCLK configs
These are always the same as FPGA peripheral clock, so use that directly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-25 21:47:15 +08:00
hujun5 efdb4322fc arm: we should use tcb->xcp.regs instead of up_current_regs() as the basis for judging whether to call restore_critical_section.
This commit fixes the regression from https://github.com/apache/nuttx/pull/13444

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 17:10:14 +09:00
chao an 542e2ba625 CMake/preprocess: fix typo PREPROCES -> PREPROCESS
correct the marco define from PREPROCES to PREPROCESS

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-25 11:55:06 +08:00
hujun5 b0f8b6e2ca arm64: g_current_regs is only used to determine if we are in irq,
with other functionalities removed.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 08:58:20 +08:00
hujun5 c9bdb598b7 irq: use up_interrupt_context to replace up_current_regs
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 08:58:20 +08:00
hujun5 349268a536 arm: tc32 nested interrupts are not supported
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 08:58:20 +08:00