Commit Graph

11 Commits

Author SHA1 Message Date
Jimmy Zheng a7096fac7d drivers: interrupt_controller: nuclei_eclic: always use clic common entry
When CONFIG_RISCV_VECTORED_MODE is disabled, CLIC claims interrupts using
CSR 'mnxti' and handles all pending interrupts before exiting the ISR.

When CONFIG_RISCV_VECTORED_MODE is enabled, all interrupts use vector mode
and are claimed automatically. The RISC-V common ISR is used for interrupts
hooked into SW ISR table, but it only handle one pending interrupt per ISR.

This commit enhances CLIC to set vector mode for direct ISRs only and use
the CLIC common entry for regular ISRs to handles multiple pending
interrupts in an ISR.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2024-08-26 17:05:53 +02:00
Jimmy Zheng d55950c23f drivers: interrupt_controller: nuclei_eclic: support vector mode setting
Implement riscv_clic_irq_vector_set() for Nuclei CLIC driver.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2024-08-26 17:05:53 +02:00
Jimmy Zheng 91e524862d soc: common: riscv-privileged: add riscv_clic_irq_vector_set() for clic
Introduce riscv_clic_irq_vector_set() to implement z_riscv_irq_vector_set()
for CLIC. This commit also introduces CONFIG_CLIC_SMCLICSHV_EXT to indicate
support for the smclicshv extenion and riscv_clic_irq_vector_set().

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2024-08-26 17:05:53 +02:00
Jimmy Zheng f989ed949a driver: interrupt_controller: nuclei_eclic: fixed interrupt level
CLIC should be the first level interrupt controller because it replaces
the basic RISC-V local interrupt.
The interrupt level in CLIC controls preemption between IRQs, rather than
specifying the number of nested interrupt controllers.
Removed CONFIG_MULTI_LEVEL_INTERRUPTS and the incorrect interrupt level.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2024-07-12 16:09:22 -04:00
Yong Cong Sin c57f9f12a2 drivers: intc: VPR CLIC should make sure GEN_IRQ_VECTOR_TABLE is enabled
VPR cores CLIC supports vectored mode only. Select
`GEN_IRQ_VECTOR_TABLE` such that it can't be disabled.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-25 11:24:32 +03:00
Marcin Szymczyk 5bba170ea7 drivers: interrupt_controller: add intc_nrfx_clic
Add interrupt controller driver for Nordic Semiconductor
VPR CLIC.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-04-23 15:35:12 +02:00
Greter Raffael 08a2ca5b9b riscv: irq: Correct interrupt handling in clic non-vectored mode
According to the clic specification
(https://github.com/riscv/riscv-fast-interrupt), the mnxti register has
be written, in order to clear the pending bit for non-vectored
interrupts. For vectored interrupts, this is automatically done.

From the spec:
"If the pending interrupt is edge-triggered, hardware will automatically
clear the corresponding pending bit when the CSR instruction that
accesses xnxti includes a write."

I added a kconfig `RISCV_SOC_HAS_CUSTOM_IRQ_HANDLING` to allow custom
irq handling. If enabled, `__soc_handle_all_irqs` has to be implemented.

For clic, non-vectored mode, I added a `__soc_handle_all_irqs`, that
handles the pending interrupts according to the pseudo code in the spec.

Signed-off-by: Greter Raffael <rgreter@baumer.com>
2024-01-18 10:53:27 +01:00
Greter Raffael ef5c28cab2 riscv: irq: Set selective hardware vectoring
The mechanism for hardware vectoring has changed in the clic spec
(https://github.com/riscv/riscv-fast-interrupt) in 2019. Before
vectoring was enabled via `mode` bits in `mtvec`. Support for this was
added in fc480c9382.

With more current clic implementations, this does not work anymore.
Changing the `mode` bits is reserved. Vectoring can be enabled
individually in the `shv` bit of `clicintattr[i]`.

Since the old mechanism is still used, I added a new Kconfig for it.

If this Kconfig is not set, we use the `shv` bit for harware vectoring.

Signed-off-by: Greter Raffael <rgreter@baumer.com>
2024-01-18 10:53:27 +01:00
Anas Nashif 01264d23db drivers: intc: manage multi-level interrupt configs
Multilevel interrupt configs are leaking into every single build without
this option being enabled, so guard the Kconfig and include files to
avoid this.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-11 18:23:23 -05:00
Kumar Gala 8423f23b9c drivers: intc: Update drivers to use devicetree Kconfig symbol
Update intc drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:25:36 +02:00
Carlo Caione 31c5dc2230 Kconfig: Introduce RISCV_HAS_CLIC
Introduce a new RISCV_HAS_CLIC symbol for platforms using CLIC,
reorganize the Kconfigs and make the Nuclei ECLIC depending on the new
symbol.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-11 14:31:39 +02:00