Commit Graph

22519 Commits

Author SHA1 Message Date
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
hujun5 4972a8e02e arm: 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
size nuttx
   text    data     bss     dec     hex filename
 225920     409   30925  257254   3ece6 nuttx

after
   text    data     bss     dec     hex filename
 225604     409   30925  256938   3ebaa nuttx

 szie change -316

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 08:58:20 +08:00
chao an 9bbecc27ab cmake/tricore/tasking: add cmake build for tasking toolchain
cmake build for tasking toolchain

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-25 08:43:28 +08:00
chao an a01d9e9ce0 arch/tricore: fix build error on tricore
ctc E333: ["arch/tricore/src/common/tricore_svcall.c" 123/23] incompatible types at assignment
ctc E333: ["arch/tricore/src/common/tricore_doirq.c" 98/39] incompatible types at argument #2

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 23:11:01 +08:00
Xiang Xiao dc6eeba453 Revert "arm64: refine the fatal handler"
This reverts commit 291d5a2acc.
2024-09-24 10:21:42 -03:00
Xiang Xiao 9e8df3b3fa Revert "arm64: save FPU regs every time"
This reverts commit 3c4f3c1008.
2024-09-24 10:21:42 -03:00
Xiang Xiao f6f072ee1c Revert "arm64: add arm64_current_el to obtain current EL"
This reverts commit e38f2b2a6d.
2024-09-24 10:21:42 -03:00
Xiang Xiao 0a2a6dfa57 Revert "arm64: simply the vectors"
This reverts commit 370679c65b.
2024-09-24 10:21:42 -03:00
Xiang Xiao 24fba43591 Revert "Kernel build: enter exception save sp_sl0,exit exception restroe sp_el0"
This reverts commit 52a4fb6fab.
2024-09-24 10:21:42 -03:00
chao an a5251161c6 syslog/channel: rename syslog_channel() to syslog_channel_register()
Change syslog API naming more reasonable:

1. rename syslog_channel() to syslog_channel_register()
2. rename syslog_channel_remove() to syslog_channel_unregister()

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 19:28:49 +08:00