Skip to content

Commit ac0477f

Browse files
evgeniy-paltsevcfriedt
authored andcommitted
ARC: forbid FIRQ or multiple register banks w/ 1 IRQ priority level
Don't allow to enable multiple register banks / fast interrupts if we have only one interrupt priority level. NOTE: we duplicate some checks by adding dependencies to ARC Kconfig and adding build-time checks in C code. We do it intentionally as for some reason we can violate dependencies in architecture-level Kconfig by adding incorrect default in SoC-level Kconfig. Such violation happens without any warnings / errors from the Kconfig. Signed-off-by: Eugeniy Paltsev <[email protected]> Signed-off-by: Evgeniy Paltsev <[email protected]>
1 parent cb4ed62 commit ac0477f

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

arch/arc/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ config NUM_IRQS
136136
config RGF_NUM_BANKS
137137
int "Number of General Purpose Register Banks"
138138
depends on ARC_FIRQ
139+
depends on NUM_IRQ_PRIO_LEVELS > 1
139140
range 1 2
140141
default 2
141142
help
@@ -145,17 +146,26 @@ config RGF_NUM_BANKS
145146
If fast interrupts are supported but there is only 1
146147
register bank, the fast interrupt handler must save
147148
and restore general purpose registers.
149+
NOTE: it's required to have more than one interrupt priority level
150+
to use second register bank - otherwise all interrupts will use
151+
same register bank. Such configuration isn't supported in software
152+
and it is not beneficial from the performance point of view.
148153

149154
config ARC_FIRQ
150155
bool "FIRQ enable"
151156
depends on ISA_ARCV2
157+
depends on NUM_IRQ_PRIO_LEVELS > 1
152158
default y
153159
help
154160
Fast interrupts are supported (FIRQ). If FIRQ enabled, for interrupts
155161
with highest priority, status32 and pc will be saved in aux regs,
156162
other regs will be saved according to the number of register bank;
157163
If FIRQ is disabled, the handle of interrupts with highest priority
158164
will be same with other interrupts.
165+
NOTE: we don't allow the configuration with FIRQ enabled and only one
166+
interrupt priority level (so all interrupts are FIRQ). Such
167+
configuration isn't supported in software and it is not beneficial
168+
from the performance point of view.
159169

160170
config ARC_FIRQ_STACK
161171
bool "Enable separate firq stack"

include/arch/arc/arch.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,40 @@
4343
#endif
4444
#endif
4545

46+
#if defined(CONFIG_ARC_FIRQ) && defined(CONFIG_ISA_ARCV3)
47+
#error "Unsupported configuration: ARC_FIRQ and ISA_ARCV3"
48+
#endif
49+
50+
/*
51+
* We don't allow the configuration with FIRQ enabled and only one interrupt priority level
52+
* (so all interrupts are FIRQ). Such configuration isn't supported in software and it is not
53+
* beneficial from the performance point of view.
54+
*/
55+
#if defined(CONFIG_ARC_FIRQ) && CONFIG_NUM_IRQ_PRIO_LEVELS < 2
56+
#error "Unsupported configuration: ARC_FIRQ and (NUM_IRQ_PRIO_LEVELS < 2)"
57+
#endif
58+
59+
#if CONFIG_RGF_NUM_BANKS > 1 && !defined(CONFIG_ARC_FIRQ)
60+
#error "Unsupported configuration: (RGF_NUM_BANKS > 1) and !ARC_FIRQ"
61+
#endif
62+
63+
/*
64+
* It's required to have more than one interrupt priority level to use second register bank
65+
* - otherwise all interrupts will use same register bank. Such configuration isn't supported in
66+
* software and it is not beneficial from the performance point of view.
67+
*/
68+
#if CONFIG_RGF_NUM_BANKS > 1 && CONFIG_NUM_IRQ_PRIO_LEVELS < 2
69+
#error "Unsupported configuration: (RGF_NUM_BANKS > 1) and (NUM_IRQ_PRIO_LEVELS < 2)"
70+
#endif
71+
72+
#if defined(CONFIG_ARC_FIRQ_STACK) && !defined(CONFIG_ARC_FIRQ)
73+
#error "Unsupported configuration: ARC_FIRQ_STACK and !ARC_FIRQ"
74+
#endif
75+
76+
#if defined(CONFIG_ARC_FIRQ_STACK) && CONFIG_RGF_NUM_BANKS < 2
77+
#error "Unsupported configuration: ARC_FIRQ_STACK and (RGF_NUM_BANKS < 2)"
78+
#endif
79+
4680
#ifndef _ASMLANGUAGE
4781

4882
#ifdef __cplusplus

0 commit comments

Comments
 (0)