Skip to content

Commit c37ce23

Browse files
committed
efi/arm64: Move EFI runtime call setup/teardown helpers out of line
Only the arch_efi_call_virt() macro that some architectures override needs to be a macro, given that it is variadic and encapsulates calls via function pointers that have different prototypes. The associated setup and teardown code are not special in this regard, and don't need to be instantiated at each call site. So turn them into ordinary C functions and move them out of line. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent f6e6e95 commit c37ce23

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

arch/arm64/include/asm/efi.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,16 @@ int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
3030
int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md,
3131
bool has_bti);
3232

33-
#define arch_efi_call_virt_setup() \
34-
({ \
35-
efi_virtmap_load(); \
36-
__efi_fpsimd_begin(); \
37-
raw_spin_lock(&efi_rt_lock); \
38-
})
39-
4033
#undef arch_efi_call_virt
4134
#define arch_efi_call_virt(p, f, args...) \
4235
__efi_rt_asm_wrapper((p)->f, #f, args)
4336

44-
#define arch_efi_call_virt_teardown() \
45-
({ \
46-
raw_spin_unlock(&efi_rt_lock); \
47-
__efi_fpsimd_end(); \
48-
efi_virtmap_unload(); \
49-
})
50-
51-
extern raw_spinlock_t efi_rt_lock;
5237
extern u64 *efi_rt_stack_top;
5338
efi_status_t __efi_rt_asm_wrapper(void *, const char *, ...);
5439

40+
void arch_efi_call_virt_setup(void);
41+
void arch_efi_call_virt_teardown(void);
42+
5543
/*
5644
* efi_rt_stack_top[-1] contains the value the stack pointer had before
5745
* switching to the EFI runtime stack.

arch/arm64/kernel/efi.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,21 @@ asmlinkage efi_status_t efi_handle_corrupted_x18(efi_status_t s, const char *f)
158158
return s;
159159
}
160160

161-
DEFINE_RAW_SPINLOCK(efi_rt_lock);
161+
static DEFINE_RAW_SPINLOCK(efi_rt_lock);
162+
163+
void arch_efi_call_virt_setup(void)
164+
{
165+
efi_virtmap_load();
166+
__efi_fpsimd_begin();
167+
raw_spin_lock(&efi_rt_lock);
168+
}
169+
170+
void arch_efi_call_virt_teardown(void)
171+
{
172+
raw_spin_unlock(&efi_rt_lock);
173+
__efi_fpsimd_end();
174+
efi_virtmap_unload();
175+
}
162176

163177
asmlinkage u64 *efi_rt_stack_top __ro_after_init;
164178

0 commit comments

Comments
 (0)