Commit Graph

22496 Commits

Author SHA1 Message Date
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
lipengfei28 52a4fb6fab Kernel build: enter exception save sp_sl0,exit exception restroe sp_el0
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 23:43:24 +08:00
ligd 370679c65b arm64: simply the vectors
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-23 23:43:24 +08:00
qinwei1 e38f2b2a6d 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-23 23:43:24 +08:00
ligd 3c4f3c1008 arm64: save FPU regs every time
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-23 23:43:24 +08:00
qinwei1 291d5a2acc 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-23 23:43:24 +08:00
liwenxiang1 a5bc9a9da2 arch/x86_64:Add FP backtrace function
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-09-23 23:15:01 +08:00
Tim Hardisty 5a4d31f315 SAMA5 sam_mcan.c unitialized variable 2024-09-23 10:13:29 -03:00
Tiago Medicci Serrano cdeb720bf8 xtensa/esp32[|s2|s3]: Fix task backtrace dump
- Fix `MAKE_PC_FROM_RA` macro to consider the instruction region
base address;
- Add sanity check for calculated PC and SP registers;
- Check if the stack pointer is within the interrupt stack to
enable backtrace dump if an exception occurs during the ISR;
2024-09-23 20:40:58 +08:00
Tiago Medicci Serrano d6ee1742a9 xtensa/Kconfig: Fix dependency for backtrace dump on Xtensas
`CONFIG_XTENSA_INTBACKTRACE` is necessary to enable backtrace dump
for the tasks because exceptions are treated like interrupts (even
when an exception occurs during a normal task execution). It's now
automatically selected when `CONFIG_SCHED_BACKTRACE` is enabled.
This commit also removes outdated Kconfig options.
2024-09-23 20:40:58 +08:00
chenrun1 ab4d72756e arch/samd2l2:Ignore atomic warning when using clang compiler
When the toolchain does not support atomic, it will use the version implemented by NuttX (low performance version). This scenario is consistent with the original design, so we can ignore it.

see bug here:
https://bugs.llvm.org/show_bug.cgi?id=43603

Error: inode/fs_inodeaddref.c:50:7: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0  bytes) [-Werror,-Watomic-alignment]
   50 |       atomic_fetch_add(&inode->i_crefs, 1);
      |       ^
/tools/clang-arm-none-eabi/lib/clang/17/include/stdatomic.h:152:43: note: expanded from macro 'atomic_fetch_add'
  152 | #define atomic_fetch_add(object, operand) __c11_atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST)
      |                                           ^
1 error generated.
make[1]: *** [Makefile:83: fs_inodeaddref.o] Error 1
Error: inode/fs_inodefind.c:74:7: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0  bytes) [-Werror,-Watomic-alignment]
   74 |       atomic_fetch_add(&node->i_crefs, 1);

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
chenrun1 4cec713dbf fs_inode:Change the type of i_crefs to atomic_int
Summary:
  1.Modified the i_crefs from int16_t to atomic_int
  2.Modified the i_crefs add, delete, read, and initialize interfaces to atomic operations
The purpose of this change is to avoid deadlock in cross-core scenarios, where A Core blocks B Core’s request for a write operation to A Core when A Core requests a read operation to B Core.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
hujun5 e4a0470527 riscv: add a return value to riscv_swint indicating whether a context switch is required
This commit fixes the regression from https://github.com/apache/nuttx/pull/13561

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-22 09:38:26 -03:00
Ville Juven 10b40abecc arm64_task/pthread_start: Convert the C / inline ASM code to assembly
The aforementioned functions can/will fail if the C compiler decides
to use the stack for the incoming entrypt/etc. parameters.

Fix this issue by converting the jump to user part into pure assembly,
ensuring the stack is NOT used for the parameters.
2024-09-21 23:24:02 +08:00
Ville Juven 6e15994f4c arm64_addrenv: Add support for 4 level MMU translations
The original code made the incorrect assumption that the amount of
translation levels is 3, but this is incorrect. The amount of levels is 4
and the amount of levels that are utilized / in use is set dynamically
from the amount of VA bits in use.
2024-09-21 08:36:23 -03:00
Ville Juven a559f3495a arm64_addrenv: Fix the amount of page table levels
The VMSAv8-64 translation system has 4 page table levels in total, ranging
from 0-3. The address environment code assumes only 3 levels, from 1-3 but
this is wrong; the amount of levels _utilized_ depends on the configured
VA size CONFIG_ARM64_VA_BITS. With <= 39 bits 3 levels is enough, while
if the va range is larger, the 4th translation table level is taken into
use dynamically by shifting the base translation table level.

From arm64_mmu.c, where va_bits is the amount of va bits used in address
translations:
(va_bits <= 21)       - base level 3
(22 <= va_bits <= 30) - base level 2
(31 <= va_bits <= 39) - base level 1
(40 <= va_bits <= 48) - base level 0

The base level is what is configured as the page directory root. This also
affects the performance of address translations i.e. if the VA range is
smaller, address translations are also faster as the page table walk is
shorter.
2024-09-21 08:36:23 -03:00
Tiago Medicci Serrano 72acec7275 esp32s3: Fix faulty `esp32s3-devkit:stack` example
This defconfig is an example of the recorded stack and it became
faulty recently after the implementation of the `up_current_regs`
functions. The `noinstrument_function` directive must be used for
preventing it from being looped when instrumentation is enabled.
Also, this commit places `sched/instrument/stack_record.c` in IRAM.
2024-09-21 10:42:06 +08:00
hujun5 c5ecc49c10 riscv: 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
 138805     337   24256  163398   27e46 nuttx

after
   text    data     bss     dec     hex filename
 138499     337   24240  163076   27d04 nuttx

 szie change -322
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-21 02:59:57 +08:00
wangmingrong1 469418f3c9 mm/kasan: Kasan global support setting alignment length
1. Similar to asan, supports single byte out of bounds detection
2. Fix the script to address the issue of not supporting the big end

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 21:47:23 +08:00
wangmingrong1 071af0c993 mm/kasan: Tag kasan and generic kasan use the same instrumentation options
1. Tested on QEMU, the two sockets were basically the same, and their performance was not affected. The size of the generated bin file was also the same
2. Extract global detection as a separate file, both types of Kasan support global variable out of bounds detection simultaneously

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 21:47:23 +08:00
wangjianyu3 b14b15ac2d nrf91: Update GPS to GNSS
Related: 03f4ec7765

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-20 14:38:43 +08:00
simbit18 6a0c0722e2 CI: Improvement to speed up compilation and reduce download errors.
The simple improvement is designed to speed up compilation and reduce download errors on github and local.

Added a folder nxtmpdir for storing third-party packages

nuttxworkspace
|
|- nuttx
|- apps
|- nxtmpdir

tools/Unix.mk:
added export NXTMPDIR := $(WSDIR)/nxtmpdir

tools/configure.sh:
added option -S creates the nxtmpdir folder for third-party packages.

tools/Config.mk:
added macro
CLONE - Git clone repository.
CHECK_COMMITSHA - Check if the branch contains the commit SHA-1.

tools/testbuild.sh:
added option -S

For now I added in the folder this package

ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty.git

ARCH
arch/xtensa/src/esp32/Make.defs
arch/xtensa/src/esp32s2/Make.defs
arch/xtensa/src/esp32s3/Make.defs
arch/risc-v/src/common/espressif/Make.defs
arch/risc-v/src/esp32c3-legacy/Make.defs

but you can also add other packages (maybe also of apps)
2024-09-20 11:26:01 +08:00
Stuart Ianna b60a8b216b arch/risc-v/src/litex_ticked: Set initial tick count to known value.
The tick count should be manually set as there is no guarantee that the
previous boot stage hasn't modified this count since reset.
2024-09-20 10:51:45 +08:00
chao an b82717b9e6 arm/cortex-a,r: replace cp15 instruct to macros to align operation
This is continue work of https://github.com/apache/nuttx/pull/13486

Discussion here:
https://github.com/apache/nuttx/pull/13486#discussion_r1764354675

1. move cp15.h to arch public
2. replace cp15 instruct to macros to align operation
3. add memory barrier to avoid compiler optimization

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-20 09:29:57 +08:00