Skip to content

Commit c710f88

Browse files
ycsinMaureenHelm
authored andcommitted
drivers: intc: plic: implement irq affinity configuration
- 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 <ycsin@meta.com> Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
1 parent 155f3f3 commit c710f88

File tree

5 files changed

+431
-69
lines changed

5 files changed

+431
-69
lines changed

arch/riscv/core/smp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ void arch_secondary_cpu_init(int hartid)
7474
#endif
7575
#ifdef CONFIG_SMP
7676
irq_enable(RISCV_IRQ_MSOFT);
77-
#endif
77+
#ifdef CONFIG_PLIC_IRQ_AFFINITY
78+
/* Enable on secondary cores so that they can respond to PLIC */
79+
irq_enable(RISCV_IRQ_MEXT);
80+
#endif /* CONFIG_PLIC_IRQ_AFFINITY */
81+
#endif /* CONFIG_SMP */
7882
riscv_cpu_init[cpu_num].fn(riscv_cpu_init[cpu_num].arg);
7983
}
8084

drivers/interrupt_controller/Kconfig.plic

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,43 @@ config PLIC
1313

1414
if PLIC
1515

16+
config PLIC_IRQ_AFFINITY
17+
bool "Configure IRQ affinity"
18+
depends on SMP
19+
depends on MP_MAX_NUM_CPUS > 1
20+
help
21+
Enable configuration of IRQ affinity.
22+
23+
config PLIC_IRQ_AFFINITY_MASK
24+
hex "Default IRQ affinity mask"
25+
depends on PLIC_IRQ_AFFINITY
26+
default 0x1
27+
help
28+
Default mask for the driver when IRQ affinity is enabled.
29+
1630
config PLIC_SHELL
1731
bool "PLIC shell commands"
1832
depends on SHELL
1933
help
2034
Enable additional shell commands useful for debugging.
2135
Caution: This can use quite a bit of RAM (PLICs * IRQs * sizeof(uint16_t)).
2236

37+
if PLIC_SHELL
38+
39+
config PLIC_SHELL_IRQ_COUNT
40+
bool "IRQ count shell commands"
41+
default y
42+
help
43+
Records the number of hits per interrupt line and provide shell commands to access them.
44+
Caution: This can use quite a bit of RAM (PLICs * IRQs * sizeof(PLIC_IRQ_COUNT_TYPE)).
45+
46+
config PLIC_SHELL_IRQ_AFFINITY
47+
bool "Shell commands to configure IRQ affinity"
48+
default y
49+
depends on PLIC_IRQ_AFFINITY
50+
help
51+
Provide shell commands to configure IRQ affinity in runtime.
52+
53+
endif # PLIC_SHELL
54+
2355
endif # PLIC

0 commit comments

Comments
 (0)