Commit graph

402 commits

Author SHA1 Message Date
Sudan Landge
feb8f7766e tests: update for MPS4
MPS4, similar to MPS3 Corstone-310, splits code between DTCM and SRAM
and thus requires similar handling.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-06-09 14:35:12 -07:00
Sreeram Tatapudi
b3067bde98 board: infineon: add XMC7200 Eval board support
- Support for kit_xmc72_evk

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
Signed-off-by: Yurii Lozynskyi <yurii.lozynskyi@infineon.com>
2025-05-28 21:29:20 +02:00
Andrzej Głąbek
da74ae83cf tests: arch: arm_interrupt: Fix stack overflows in .no_optimizations
With e337b7b65d, the test started to
fail with stack overflows in the no_optimizations scenario, so give
the ztest thread a little more space.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-05-26 17:59:34 +02:00
Krzysztof Chruściński
6ea6e5704d tests: arch: Fix zassert string
Fix wrong parameters used in zassert macros.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-05-22 16:17:23 +02:00
Daniel Leung
5413270502 tests: stack_unwind/x86: no need to force no optimizations
Previously, forcing no compiler optimizations is required for
x86_64 to unwind stack. However, this is not the case anymore
as long as frame pointers are not omitted. So update custom
kconfigs for x86 in the stack_unwind test.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-05-20 22:37:57 +02:00
Andrzej Głąbek
610a7e2241 tests: arch: arm_irq_vector_table: Fix IRQ number used by nRF GRTC
Instead of using hard-coded GRTC_0_IRQn value, obtain information from
DT to get the IRQ number actually used by the nrf_grtc_timer driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-05-20 18:28:13 +02:00
Duy Nguyen
f7db912e70 test: Test accumulator register save for RX arch
Add new test cases to check for accumulator register save
on RX architecture

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-05-02 09:18:16 +02:00
Anas Nashif
e5f841c183 tests: kernel/arch: various doxygen fixes
Group test using doxygen and other doxygen fixups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-04-22 14:03:29 +02:00
Sudan Landge
a1e3083def tests: arm: adjust test for relocated rom
Add a memory barrier to make sure write to NVIC is completed
before continuing with the test fails in scenarios where
CONFIG_ROMSTART_RELOCATION_ROM is enabled for boards like MPS3
Corstone310 and k_sem_take is called before the isr's are called.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-03-31 11:30:55 +02:00
Sudan Landge
5f91f17e68 boards: arm: Enable default testing of MPS3 boards
Enable tests by default for CS300 and CS310 since they support
simulation and FVP's are available in upstream docker.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-03-31 11:30:55 +02:00
Anisetti Avinash Krishna
98dba7da7c include: zephyr: sys: time_units: Type cast SYS_CLOCK_HW_CYCLES_PER_SEC
Type case CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC to uint32_t
while defining sys_clock_hw_cycles_per_sec_runtime_get()
to extend the range of frequency to 0xffffffff.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2025-03-28 12:21:07 +01:00
Yangbo Lu
1ecf5698f6 tests: arm: exclude i.mx95 m7 for some interrupt tests
i.MX95 M7 is using multi-level interrupts with custom
interrupt handling. So, arm_custom_interrupt and
arm_irq_vector_table tests should exclude it.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-03-25 05:59:30 +01:00
Martin Hoff
eeb709927f tests: drivers: add overlay/testcase for silabs xg29_rb4412a board
Add some overlay files for the silabs xg29_rb4412a board to enable tests
on the board. Also add the platform to some testcase.yaml files.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-03-20 17:14:35 +01:00
Sudan Landge
0161118913 tests: arch: arm: verify Armv8.1-M MPU PXN
Adds a test to verify Armv8.1-M MPU architecture's PXN attribute.

Verify PXN via static mpu config by utilizing existing __ramfunc MPU region
Since previous commit changes the behaviour of __ramfunc region,
executing userspace code in this region in privileged mode will
result in an MPU fault while execution in unprivileged mode should
work fine.

Verify PXN via DT by creating a custom section in the unused SRAM region.
Since the overlay sets the PXN attribute for the SRAM, executing code
in this region in privileged mode will result in an MPU fault while,
execution in unprivileged mode should work fine.
Also, instead of testing DT config for each board, do it only for MPS3
boards that which can be tested with simulation.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-03-20 12:17:11 +01:00
Sudan Landge
637bd8f587 arch: arm: Add PXN attr for userspace MPU regions
What is the change?
 - PXN attributes is set for static mpu regions such that
   __ramfunc and __ram_text_reloc having userspace code
   cannot be executed in privileged mode.
 - Updated the notable change section to inform about the change in
   behaviour of code executed from __ramfunc and __ram_text_reloc MPU
   regions.

Why do we need this change?
 - The current static MPU regions allows executing userspace/unprivileged
   code from privileged mode which may not be expected and can lead to
   secure privileged escalation attacks.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-03-20 12:17:11 +01:00
Nhut Nguyen
a853460382 tests: arch: arm64: arm64_high_address: Exclude Renesas RZ/A3UL SMARC
Exclude RZ/A3UL SMARC board as the redefined CONFIG_SRAM_BASE_ADDRESS
degrades the BUILD_OUTPUT_ADJUST_LMA option that will generate a bin
file >10GB

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-03-19 03:34:15 +01:00
Anas Nashif
895d91169e tests/samples: use integration platforms where possible
When possible, add integration_platforms to samples/tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-11 11:35:15 +01:00
Wilfried Chauveau
caafe23891 arch: arm: cortex_m: Apply clang-format on cortex_m related code
This commit updates cortex_m related code to align it with the rules from
.clang-format. This is done to simplify future changes in these files as
we are about to implement use_switch support.

Some rules conflict with checkpatch and therefore some small part of the
code locally disable clang-format.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2025-02-13 16:42:48 +01:00
Wilfried Chauveau
1ad33e2d71 tests: arch: arm: Correctly report skipped tests as skipped
test_arm_user_interrupt and test_arm_null_pointer_exception currently
only print "Skipped" but reports as PASS in twister. This fixes that
misleading report.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2025-02-08 10:09:01 +01:00
Georgios Vasilakis
8ef1b348c2 tests: arm_irq_vector_table: Disable bellboard for nRF54/nRF92
This test uses the bellboard interrupts for the application
and the radio core builds on nRF54H20 and nRF9280.
Since it uses the bellboard interrupts it makes sense to ensure
that bellboard is disabled in device tree to avoid runtime issues.

This is preparation work, bellboard is planned to be enabled
by default later and this makes sure that the test will
continue to work.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2025-01-22 13:43:47 +01:00
Adam Kondraciuk
2b91df8810 tests: arch: arm: arm_irq_vector_table: Fix for nRF54H20
Fix failing tests for nRF54H20 targets.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2025-01-14 15:38:32 +01:00
Nicolas Pitre
46aa6717ff Revert "arch: deprecate _current"
Mostly a revert of commit b1def7145f ("arch: deprecate `_current`").

This commit was part of PR #80716 whose initial purpose was about providing
an architecture specific optimization for _current. The actual deprecation
was sneaked in later on without proper discussion.

The Zephyr core always used _current before and that was fine. It is quite
prevalent as well and the alternative is proving rather verbose.
Furthermore, as a concept, the "current thread" is not something that is
necessarily architecture specific. Therefore the primary abstraction
should not carry the arch_ prefix.

Hence this revert.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-10 07:49:08 +01:00
Robin Kastberg
3405648b7d tests: arm: remove GNUC ifdef
It is better to get compile error rather than #error

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2024-12-19 04:18:48 +01:00
Sandra Schmidt
ad6ef7de09 test: arm: irq: Add overlay files for cy8ckit_062s2_ai
Changed interrupt priority for GPIO.
See https://github.com/zephyrproject-rtos/zephyr/pull/81464

Signed-off-by: Sandra Schmidt <sandra.schmidt@arrow.com>
2024-12-17 03:39:18 +01:00
Valerio Setti
522b1f2bba Revert "tests: disable NRF5 entropy driver on some bsim/qemu tests"
This reverts commit e0fcb8552428fb45164ea2b4271b3b0206695b7f.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-12-12 00:15:39 +00:00
Peter Mitsis
909ff45f0c kernel: arch: move arch_swap() declaration
Moves the arch_swap() declaration out of kernel_arch_interface.h
and into the various architectures' kernel_arch_func.h. This
permits the arch_swap() to be inlined on ARM, but extern'd on
the other architectures that still implement arch_swap().

Inlining this function on ARM has shown at least a +5% performance
boost according to the thread_metric benchmark on the disco_l475_iot1
board.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-12-11 21:33:49 +01:00
Valerio Setti
22e30e04f5 tests: disable NRF5 entropy driver on some bsim/qemu tests
CONFIG_ENTROPY_GENERATOR is now enabled by default as soon as
"zephyr,entropy" is set in the device-tree. Since the sub-Kconfig
CONFIG_ENTROPY_NRF5_RNG is also enabled by default on nrf boards,
this means that the driver is pulled in the build and intialized
at boot. This might cause runtime issues during some IRQ/kernel
tests, so it's better to remove "zephyr,entropy" on these tests.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-12-10 08:05:33 +01:00
Gerard Marull-Paretas
d4a67e321b samples, tests: remove usage of space-separated lists
Convert them to native YAML lists. Support for space-separated
lists was deprecated in Twister a long time ago.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2024-12-04 14:14:53 -05:00
Georgios Vasilakis
28bd478a0b tests: arm_thread_swap: Add overlay for nRF54H20
Disable the IPC communication between the domains
for the arm_thread_swap test since it is not needed
and it causes a flash oveflow for the no opmitization
test case.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2024-12-03 13:07:03 +01:00
Yong Cong Sin
e6dd68ec89 arch: riscv: introduce CONFIG_RISCV_GP_PURPOSE choice
Introduce `CONFIG_RISCV_GP_PURPOSE` choice to make sure that only
one of `CONFIG_RISCV_GP` or `CONFIG_RISCV_CURRENT_VIA_GP` can be
enabled, instead of relying of dependencies.

To do that, introduce a new
`CONFIG_RISCV_SOC_HAS_GP_RELATIVE_ADDRESSING` that can be selected
by SoC when it implemented global pointer (GP) initialization for
relative addressing in its linker.

`CONFIG_RISCV_GP` will be the default choice when
`CONFIG_RISCV_SOC_HAS_GP_RELATIVE_ADDRESSING=y`

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-11-28 12:51:09 +01:00
Yong Cong Sin
033804e266 arch: riscv: support CONFIG_USERSPACE in CONFIG_RISCV_CURRENT_VIA_GP
Reset the the `gp` register to `_kernel->cpus[i].current` when
`CONFIG_USERSPACE` is enabled on exception to keep it sane.

Updated the testcase to test both `CONFIG_RISCV_GP` and
`CONFIG_RISCV_CURRENT_VIA_GP`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-11-28 12:51:09 +01:00
Yong Cong Sin
b1def7145f arch: deprecate _current
`_current` is now functionally equals to `arch_curr_thread()`, remove
its usage in-tree and deprecate it instead of removing it outright,
as it has been with us since forever.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-11-23 20:12:24 -05:00
Volodymyr Fialko
1310856348 tests: riscv: test PMP stack guards
Test if PMP protected regions prevents write access.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
2024-11-20 08:25:49 -05:00
Jakub Wasilewski
84434ba006 arch: riscv: add Kconfig option for imprecise FPU state tracking
According to the RISC-V Instruction Set Manual: Volume II, Version 20240411
(Section 3.1.6.6), some implementations may choose to track the dirtiness
of the floating-point register state imprecisely by reporting the state to
be dirty even when it has not been modified. This option reflects that.

Also add a filter in `tests/arch/riscv/fpu_sharing/` based on imprecise
FPU state tracking

Signed-off-by: Jakub Wasilewski <jwasilewski@internships.antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2024-11-20 10:15:03 +00:00
Nazar Palamar
6172092730 test: arm: irq: Add overlays files for Infineon boards
Changed interrupt priority for GPIO, default 6 is not suitable for
for the ZERO_LATENCY_IRQS function used in this test.
used in this test.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-11-19 17:50:44 -05:00
Yong Cong Sin
408c151282 tests: arch: riscv: make sure that gp reg can't be corrupted
Add a test to make sure that the `gp` global pointer register used for
relative addressing when `CONFIG_RISCV_GP` is enabled can't be
corrupted by a rogue user thread.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-11-13 19:08:54 -08:00
Sudan Landge
3092d96e5b boards: mps3: Add support for corstone300/an552
What is changed?
 - Added a new mps3 board an552 for the soc corstone300.
   The qualifier to build/run application with board mps3/an552 is
   `mps3/corstone300/an552` for secure and
   `mps3/corstone300/an552/ns` for non-secure.
 - Added FVP variant to enable FVP testing with corstone300
   and it uses the ARM FVP `FVP_Corstone_SSE-300_Ethos-U55`.
   The qualifier to build/run application with FVP is
   `mps3/corstone300/fvp` for secure and
   `mps3/corstone300/fvp/ns` for non-secure.
 - Note: the qualifier to build/run application with board mps3/an547
   is now changed to
   `mps3/corstone300/an547` for secure and
   `mps3/corstone300/an547/ns` for non-secure.

How is it changed?
 - Moved common code from mps3/an547 to corstone300.
 - Renamed soc for an547 to corstone300 and added
   a new soc corstone300/an552.

Why do we need this change?
 - This enables FVP support and testing for corstone300.
 - SOC/qualifier for mps3/an547 was renamed to reduce code redundancy
 - A separate FVP variant was added for AN552 because, the TFM board
   used for non-secure variant differs for FPGA and FVP.
   TFM board `arm/mps3/corstone300/fvp` should be used when testing
   AN552 with FVP and `arm/mps3/corstone300/an552` should be used when
   testing with AN552 FPGA.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2024-10-26 03:58:05 +01:00
Anas Nashif
dfc7860ab1 twister: rework board handling
We now use hwmv2 to list boards instead of relying on twister specific
config files.
One yaml files (twister.yaml for now) will have all the data needed for
all possible targets and variations of a board reusing most of the data
where possible and variations can override the top level data.

Twister keeps track of 'aliases' of boards and identifies that for
example native_sim is the same as native_sim/native, so either names
will be possible in both test yaml files or on the command line,
however, the reporting will always use the full name, so no there is no
confusion about what is being tested/built.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-10-22 18:31:09 -04:00
Peter Mitsis
091c6664c5 tests: arc_vpx_lock
Add tests to verify arc_vpx_lock/unlock API.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-10-17 15:49:49 -04:00
Grzegorz Swiderski
13b1cfa5ec boards: nordic: Align with updated Nordic owned memory bindings
Apply the following changes to `nrf54h20dk` and `nrf9280pdk`:

* Convert `perm-*` properties to the newly introduced `nordic,access`,
  both in board files and tests.

* Redefine shared regions to specify multiple access owners per node,
  and ensure that each such region is reserved by one domain at a time.
  `cpuapp_cpurad_ram0x_region` is only enabled by Radiocore, while
  `cpuapp_cpucell_ram0x_region` is only enabled by Application core.

* Divide `shared_ram3x_region` so that each sub-region is owned by a
  different domain. Their addresses must be rounded down to fit the
  current UICR format.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-10-15 04:11:21 -04:00
Yong Cong Sin
4da4ee8ece tests: arch: riscv: test csf registers value
Test if callee-saved-registers values are as expected.

Signed-off-by: David Reiss <dreiss@meta.com>
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-10-02 09:48:02 +02:00
Pisit Sawangvonganan
442a0686fc style: tests: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-11 07:40:35 -04:00
Nicolas Pitre
6255bf1ef4 arch/arm64/mmu: allow partial unmap of block mappings again
Before commit baa70d8d36 ("arch/arm64/mmu: fix page table reference
counting part 2")  it was possible to perform a partial unmap of a block
mapping. Restore that ability and provide a test case to validate it.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-08-27 15:14:43 -04:00
Yong Cong Sin
74f46bd421 arch: riscv: stacktrace: print additional arg when fatal error
Print `sp`/`fp` in traces.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-08-26 14:44:53 -04:00
Yong Cong Sin
074931057c subsys/debug: remove CONFIG_EXCEPTION_STACK_TRACE_SYMTAB
Having `CONFIG_EXCEPTION_STACK_TRACE_SYMTAB` to select the
`CONFIG_SYMTAB` or to explicitly not print the symbol name
during exception stack unwind seems unnecessary, as the extra
code to print the symbol name is negligible when compared with
the symbol table, so just remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-08-26 14:44:53 -04:00
Yong Cong Sin
ab676fdb86 arch: arm64: implement arch_stack_walk()
Currently it supports `esf` based unwinding only.

Then, update the exception stack unwinding to use
`arch_stack_walk()`, and update the Kconfigs & testcase
accordingly.

Also, `EXCEPTION_STACK_TRACE_MAX_FRAMES` is unused and
made redundant after this change, so remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-08-26 14:44:53 -04:00
Yong Cong Sin
06a8c35316 arch: x86: implement arch_stack_walk()
Currently it supports `esf` based unwinding only.

Then, update the exception stack unwinding to use
`arch_stack_walk()`, and update the Kconfigs & testcase
accordingly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-08-26 14:44:53 -04:00
Emanuele Di Santo
b41054340d tests: arch: arm: arm_irq_vector_table: fix compilation for nRF9280
Fix compilation for nRF9280.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2024-08-22 14:24:38 -04:00
Yong Cong Sin
0787744684 tests: arch: common: stack_unwind: add qemu_riscv32e
qemu_riscv32e uses a different ISA and is kinda special, add it
to the testcase for better coverage.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-08-07 19:00:53 -04:00
Yong Cong Sin
49e8c98996 tests: arch: common: stack_unwind: fix symtab test
The symtab test should have the
`CONFIG_EXCEPTION_STACK_TRACE_SYMTAB` enabled. This was not
caught in the CI previously as the regex was also wrong, '['
and ']' are regex syntax and should be escaped.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-07-09 19:44:08 -04:00