Commit graph

30 commits

Author SHA1 Message Date
Jisheng Zhang
9842b062bb cpuidle: optimize out weak stub function call for !TRACING
For !TRACING, most arch_cpu_idle and arch_cpu_atomic_idle implementation
relies on the fact that there's weak stub implementations in
subsys/tracing/tracing_none.c, this works, but the arch_cpu_idle sits in
hot code path, so we'd better to make it as efficient as possible.

Take the riscv implementation for example,
Before the patch:

80000a66 <arch_cpu_idle>:
80000a66:	1141                	addi	sp,sp,-16
80000a68:	c606                	sw	ra,12(sp)
80000a6a:	37c5                	jal	80000a4a <sys_trace_idle>
80000a6c:	10500073          	wfi
80000a70:	3ff1                	jal	80000a4c <sys_trace_idle_exit>
80000a72:	47a1                	li	a5,8
80000a74:	3007a073          	csrs	mstatus,a5
80000a78:	40b2                	lw	ra,12(sp)
80000a7a:	0141                	addi	sp,sp,16
80000a7c:	8082                	ret

NOTE: the sys_trace_idle and sys_trace_idle_exit are just stubs when
!TRACING

after the patch:
80000a62 <arch_cpu_idle>:
80000a62:	10500073          	wfi
80000a66:	47a1                	li	a5,8
80000a68:	3007a073          	csrs	mstatus,a5
80000a6c:	8082                	ret

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
2026-03-11 23:17:29 -04:00
Fin Maaß
617a903946 snps: riscv: use riscv,isa-extensions dt prop
use riscv,isa-extensions dt prop for
snps riscv cpus.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-26 14:15:18 +01:00
Daniel Leung
ee8f9915a4 soc: arc: mark nsim_vpx5 as supporting MPU
This selects CONFIG_CPU_HAS_MPU for nsim_vpx5 series SoC as
it supports ARC MPUv3.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2026-01-21 11:23:33 +00:00
Daniel Leung
2c911b1b8a soc: snps: vpx5: no -Hccm compiler option for userspace
With -Hccm, the linker automatically moves stuff in RODATA
section into DATA section. Our current kobject related
scripts cannot accommodate this, resulting in space not
being reserved correctly. So for now, disable -Hccm
compiler option if userspace is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2026-01-21 11:23:33 +00:00
Mohamed Moawad
c75ee62562 soc: arc_iot: add configurable custom CPU idle for UART retention
The ARC IoT SoC (used on iotdk board) has a hardware limitation where
entering CPU sleep mode causes some peripherals (e.g., UART) to lose
power, preventing the board from waking up via peripheral interrupts.

Add a configurable custom CPU idle option (CONFIG_ARC_IOT_CUSTOM_CPU_IDLE)
that enables interrupts without executing the sleep instruction. This
allows the system to remain responsive while keeping peripherals powered.

The option defaults to disabled (n) to preserve normal CPU sleep behavior
for most use cases. Tests that require continuous UART operation during
idle (pytest/shell harnesses) can enable it via platform-specific
extra_configs.

This approach allows timer-based idle to work correctly by default while
providing a workaround for tests that need UART retention.

Signed-off-by: Mohamed Moawad <moawad@synopsys.com>
2026-01-14 13:00:22 -06:00
Josuah Demangeon
23662f1e5d style: soc: apply coding style on CMakeLists.txt files
Apply the CMake style guidelines to CMakeList.txt files in soc/.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Afonso Oliveira
e7c6a28a1f soc: snps: nsim: arc_v: rhx: add RHX SoC configuration
Add RISC-V RHX SoC series configuration for ARC-V RHX cores.
Enables RV32IMAC ISA with bitmanip extensions (ZBA, ZBB, ZBC, ZBS).
Configures PMP with 16 slots and 8-byte granularity.
Sets RISCV_SOC_INTERRUPT_INIT enabled for interrupt initialization.
Configures 32 IRQs.
Adds MetaWare CCAC toolchain support with RHX-specific compiler flags.

Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>
2025-10-14 18:51:25 +02:00
Afonso Oliveira
6927160adf soc: snps: nsim: arc_v: rmx: add PMP_GRANULARITY configuration
Add explicit PMP_GRANULARITY default value of 8 to RMX SoC configuration.
This makes the PMP configuration more explicit and easier to understand.

No functional change as RISCV_PMP was already enabled and PMP_GRANULARITY
already defaulted to this value.

Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>
2025-10-14 18:51:25 +02:00
Afonso Oliveira
bf5412ebb5 soc: snps: nsim: arc_v: rmx: drop hardcoded MWDT flags
- Remove SoC-level ccac core/ISA flags (-av5rmx, -Z*)
- Depend on arcmwdt toolchain to derive flags from Kconfig
- Keep SOC linker script selection unchanged

Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>
2025-10-14 18:51:25 +02:00
Afonso Oliveira
d0de9456f2 soc: snps: nsim: arc_v: rmx: revert to shorter SOC configuration names
Uses shorter names for the RMX SOC configuration.

Changes:
- SOC_SERIES_NSIM_ARC_V_RMX -> SOC_SERIES_RMX
- SOC_NSIM_ARC_V_RMX100 -> SOC_RMX100

Also updates board Kconfig to use the shorter names.

Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>
2025-10-14 18:51:25 +02:00
Afonso Oliveira
aa5e13f227 dts: cpu: add device tree bindings for Synopsys ARC-V RMX RISC-V CPU
Add device tree binding file for the Synopsys ARC-V RMX RISC-V
CPU core. This binding enables proper device tree property parsing by
the Enhanced Device Tree (EDT) system, allowing Kconfig device tree
macros to access CPU properties like clock-frequency.

The binding includes the standard RISC-V CPU properties by extending
riscv,cpus.yaml, which provides access to properties defined in cpu.yaml
such as clock-frequency.

Also removes hardcoded SYS_CLOCK_HW_CYCLES_PER_SEC from board level
and adds DT-derived value to RMX SoC level.

Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>
2025-10-14 18:51:25 +02:00
Benjamin Cabé
d7a5d84b1c boards: snps: use correct revision scheme
revisons must be major.minor.patch so add the missing patch

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-22 17:49:08 -04:00
Afonso Oliveira
3cf92af0a7 soc: snps: nsim: arc_v: rmx: remove redudant compiler filtering
Remove CONFIG_SOC_SERIES_NSIM_ARC_V_RMX conditional check from
zephyr_compile_options_ifdef and apply all extensions
unconditionally when using arcmwdt compiler.

Since this CMakeLists.txt is already SoC-specific, the
additional config check is redundant.

Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>
2025-08-18 15:59:41 +02:00
Afonso Oliveira
1bef065c8e soc: snps: nsim: arc_v: rename SOC configuration symbols
Rename SOC configuration symbols from generic names to more specific
ones that include the vendor and platform information. This improves
clarity and prevents potential naming conflicts.

Changes:
- SOC_SERIES_RMX -> SOC_SERIES_NSIM_ARC_V_RMX
- SOC_RMX100 -> SOC_NSIM_ARC_V_RMX100

Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>
2025-08-18 15:59:41 +02:00
Ilya Tagunov
6a427995b0 soc: snps: rmx: replace custom buildlib with generic RMX linker option
Do not use the custom buildlib configuration for the RMX series as it
was replaced with several even more specific configurations in the
recent MWDT release. Pass the generic RMX option to the linker instead.

Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
2025-08-12 21:32:18 +02:00
Fin Maaß
514258aa23 riscv: select ATOMIC_OPERATIONS based on RISCV_ISA_EXT_A
use RISCV_ISA_EXT_A to select ATOMIC_OPERATIONS_BUILTIN or
ATOMIC_OPERATIONS_C.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-06-30 15:17:47 -05: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
Jamie McCrae
2f800cea8f soc: Remove re-defining some defined types
Removes re-defining some Kconfigs that are already defined
e.g. in arch

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-11-18 07:41:23 -05:00
Evgeniy Paltsev
6d083cac7e Revert "arch: arc: replace ARC_EARLY_SOC_INIT with PLATFORM_RESET_HOOK"
The commit introduced regression for hsdk4xd platform.
The hsdk4xd SoC setup from soc_early_asm_init_percpu need to be done
in early code before any C code execution.

The current approach has multiple issues
 - we call function (which can be easily implemented in C for
   this or other SoC) from the place where we haven't setup stack
   pointer (so we can't use stack) - which is very error-prone
 - we never return back from soc_reset_hook on hsdk4xd platform

So let's just revert it for now. If any other ARC SoC need to use
soc_reset_hook - than it can be implemented properly.

This reverts commit 8c32a82e47.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2024-10-22 18:28:37 -04:00
Yong Cong Sin
52a202309b zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY
Change instances of:

DT_NODE_HAS_STATUS(<node_id>, okay)

to

DT_NODE_HAS_STATUS_OKAY(<node_id>)

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-10-03 17:06:52 +01:00
Anas Nashif
49f7204530 soc: snps: move init code from SYS_INIT to hooks
Replace SYS_INIT with SoC hooks and adapt SoC init code

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-09-20 13:15:31 +02:00
Anas Nashif
8c32a82e47 arch: arc: replace ARC_EARLY_SOC_INIT with PLATFORM_RESET_HOOK
Use generic hook infrastrucutre instead of custom Kconfig and hooks for
ARC.

Replace soc_early_asm_init_percpu() with platform_reset()

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-09-09 10:07:33 +02:00
Marcio Ribeiro
cb583995b8 arch: riscv: imply XIP config pushed to SoC level
'imply XIP' pushed from arch/Kconfig/'config RISCV' to riscv SoCs Kconfig
files to allow riscv SoCs having XIP enabled (or not) at SoC level

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2024-08-31 06:47:52 -04:00
Evgeniy Paltsev
5869926063 arc: nsim: vpx5: fix SoC config issue which leads to cmake error
After recent nsim SoCs & boards reorganization the SOC_SERIES_*
config is missing for vpx5 SoC which leads to cmake errors
when building against nsim/nsim_vpx5 configuration.

Fix that and align soc series name in soc.yml

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-07-17 16:18:40 -04:00
Evgeniy Paltsev
59667d19ed snps: board: rmx100: add pmp
Add RV PMP to the SoC configuration and to simulator options

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-06-14 21:05:36 -04:00
Nikolay Agishev
efedf1cff3 ARCMWDT: Add compiler support for nSIM RMX platform
Add MetaWare compiller support for nSIM RMX platform

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2024-06-14 19:01:06 -04:00
Nikolay Agishev
57af793bb4 ARC: nSIM: Add RMX100 platform
This PR adds support for new Synopsys nSIM RMX100 platform.
New platform based on RISC-V ISA instead of classic ARC.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2024-06-12 12:54:03 -04:00
Nikolay Agishev
ea7a876cff ARC: nSIM: Make reorganization of board and SoC structure
Change source tree organization for Synopsys nSIM platform.
Classical ARC architectures arc_v2 arc_v3 moved to arc_classic
SoC and boards family.
nSIM SoCs were separated regarding series: EM, HS, SEM, VPX2.
This PR sould be seeing as the preparation for
addition new nSIM platform based on the RISC-V architecture.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2024-06-12 12:54:03 -04:00
Evgeniy Paltsev
39971ad447 ARC: nSIM: hs5x: align sys clock with other SMP nSIM configs
Align SYS_CLOCK_HW_CYCLES_PER_SEC with other SMP nSIM
configurations and set it to 1000000.

This significantly reduce verification time on HS5x platforms.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-05-16 15:51:34 +02:00
Jamie McCrae
f103c82c31 boards/socs: Rename folders to have proper vendor prefix in
Replaces inaccurate or wrong vendor prefixes in board and soc
folder names with those from thr vendor prefix file

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-03-22 00:56:51 +01:00