Skip to content

Commit

Permalink
drivers: intc: plic: implement irq affinity configuration
Browse files Browse the repository at this point in the history
- Implement irq-set-affinity in RISCV PLIC.
- Added new affinity shell command to get/set the irq(s)
  affinity in runtime, when `0` is sent as the `local_irq`, it
  means set/get all IRQs affinity.
- Some minor optimizations

Updated the build_all test to build this new configuration.

Signed-off-by: Yong Cong Sin <[email protected]>
Signed-off-by: Yong Cong Sin <[email protected]>
  • Loading branch information
ycsin authored and MaureenHelm committed Oct 2, 2024
1 parent 155f3f3 commit c710f88
Show file tree
Hide file tree
Showing 5 changed files with 431 additions and 69 deletions.
6 changes: 5 additions & 1 deletion arch/riscv/core/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ void arch_secondary_cpu_init(int hartid)
#endif
#ifdef CONFIG_SMP
irq_enable(RISCV_IRQ_MSOFT);
#endif
#ifdef CONFIG_PLIC_IRQ_AFFINITY
/* Enable on secondary cores so that they can respond to PLIC */
irq_enable(RISCV_IRQ_MEXT);
#endif /* CONFIG_PLIC_IRQ_AFFINITY */
#endif /* CONFIG_SMP */
riscv_cpu_init[cpu_num].fn(riscv_cpu_init[cpu_num].arg);
}

Expand Down
32 changes: 32 additions & 0 deletions drivers/interrupt_controller/Kconfig.plic
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,43 @@ config PLIC

if PLIC

config PLIC_IRQ_AFFINITY
bool "Configure IRQ affinity"
depends on SMP
depends on MP_MAX_NUM_CPUS > 1
help
Enable configuration of IRQ affinity.

config PLIC_IRQ_AFFINITY_MASK
hex "Default IRQ affinity mask"
depends on PLIC_IRQ_AFFINITY
default 0x1
help
Default mask for the driver when IRQ affinity is enabled.

config PLIC_SHELL
bool "PLIC shell commands"
depends on SHELL
help
Enable additional shell commands useful for debugging.
Caution: This can use quite a bit of RAM (PLICs * IRQs * sizeof(uint16_t)).

if PLIC_SHELL

config PLIC_SHELL_IRQ_COUNT
bool "IRQ count shell commands"
default y
help
Records the number of hits per interrupt line and provide shell commands to access them.
Caution: This can use quite a bit of RAM (PLICs * IRQs * sizeof(PLIC_IRQ_COUNT_TYPE)).

config PLIC_SHELL_IRQ_AFFINITY
bool "Shell commands to configure IRQ affinity"
default y
depends on PLIC_IRQ_AFFINITY
help
Provide shell commands to configure IRQ affinity in runtime.

endif # PLIC_SHELL

endif # PLIC
Loading

0 comments on commit c710f88

Please sign in to comment.