Skip to content

Commit 3e72b9e

Browse files
leitaowilldeacon
authored andcommitted
arm64: remove CONFIG_VMAP_STACK checks from SDEI stack handling
With VMAP_STACK now always enabled on arm64, remove all CONFIG_VMAP_STACK conditionals from SDEI stack allocation and initialization in arch/arm64/kernel/sdei.c. This change unconditionally defines the SDEI stack pointers and replaces runtime checks with BUILD_BUG_ON() assertions, ensuring that the code is only built when VMAP_STACK is enabled. This simplifies the logic and reflects the mandatory use of VMAP_STACK for all arm64 kernel builds. Signed-off-by: Breno Leitao <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 907cb5c commit 3e72b9e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

arch/arm64/kernel/sdei.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ unsigned long sdei_exit_mode;
3434
DECLARE_PER_CPU(unsigned long *, sdei_stack_normal_ptr);
3535
DECLARE_PER_CPU(unsigned long *, sdei_stack_critical_ptr);
3636

37-
#ifdef CONFIG_VMAP_STACK
3837
DEFINE_PER_CPU(unsigned long *, sdei_stack_normal_ptr);
3938
DEFINE_PER_CPU(unsigned long *, sdei_stack_critical_ptr);
40-
#endif
4139

4240
DECLARE_PER_CPU(unsigned long *, sdei_shadow_call_stack_normal_ptr);
4341
DECLARE_PER_CPU(unsigned long *, sdei_shadow_call_stack_critical_ptr);
@@ -65,8 +63,7 @@ static void free_sdei_stacks(void)
6563
{
6664
int cpu;
6765

68-
if (!IS_ENABLED(CONFIG_VMAP_STACK))
69-
return;
66+
BUILD_BUG_ON(!IS_ENABLED(CONFIG_VMAP_STACK));
7067

7168
for_each_possible_cpu(cpu) {
7269
_free_sdei_stack(&sdei_stack_normal_ptr, cpu);
@@ -91,8 +88,7 @@ static int init_sdei_stacks(void)
9188
int cpu;
9289
int err = 0;
9390

94-
if (!IS_ENABLED(CONFIG_VMAP_STACK))
95-
return 0;
91+
BUILD_BUG_ON(!IS_ENABLED(CONFIG_VMAP_STACK));
9692

9793
for_each_possible_cpu(cpu) {
9894
err = _init_sdei_stack(&sdei_stack_normal_ptr, cpu);

0 commit comments

Comments
 (0)