aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/efi.h2
-rw-r--r--drivers/firmware/efi/runtime-wrappers.c17
2 files changed, 4 insertions, 15 deletions
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index abba1fe1db5e..408ad6d3222e 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -86,8 +86,6 @@ extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size,
86 86
87#endif /* CONFIG_X86_32 */ 87#endif /* CONFIG_X86_32 */
88 88
89#define efi_in_nmi() in_nmi()
90
91extern struct efi_scratch efi_scratch; 89extern struct efi_scratch efi_scratch;
92extern void __init efi_set_executable(efi_memory_desc_t *md, bool executable); 90extern void __init efi_set_executable(efi_memory_desc_t *md, bool executable);
93extern int __init efi_memblock_x86_reserve_range(void); 91extern int __init efi_memblock_x86_reserve_range(void);
diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c
index 4349206198b2..228bbf910461 100644
--- a/drivers/firmware/efi/runtime-wrappers.c
+++ b/drivers/firmware/efi/runtime-wrappers.c
@@ -86,9 +86,6 @@ static DEFINE_SPINLOCK(efi_runtime_lock);
86 * for QueryVariableInfo() and SetVariable(), as these can be reached in NMI 86 * for QueryVariableInfo() and SetVariable(), as these can be reached in NMI
87 * context through efi_pstore_write(). 87 * context through efi_pstore_write().
88 */ 88 */
89#ifndef efi_in_nmi
90#define efi_in_nmi() (0)
91#endif
92 89
93/* 90/*
94 * As per commit ef68c8f87ed1 ("x86: Serialize EFI time accesses on rtc_lock"), 91 * As per commit ef68c8f87ed1 ("x86: Serialize EFI time accesses on rtc_lock"),
@@ -189,14 +186,11 @@ static efi_status_t virt_efi_set_variable(efi_char16_t *name,
189{ 186{
190 unsigned long flags; 187 unsigned long flags;
191 efi_status_t status; 188 efi_status_t status;
192 bool __in_nmi = efi_in_nmi();
193 189
194 if (!__in_nmi) 190 spin_lock_irqsave(&efi_runtime_lock, flags);
195 spin_lock_irqsave(&efi_runtime_lock, flags);
196 status = efi_call_virt(set_variable, name, vendor, attr, data_size, 191 status = efi_call_virt(set_variable, name, vendor, attr, data_size,
197 data); 192 data);
198 if (!__in_nmi) 193 spin_unlock_irqrestore(&efi_runtime_lock, flags);
199 spin_unlock_irqrestore(&efi_runtime_lock, flags);
200 return status; 194 return status;
201} 195}
202 196
@@ -225,17 +219,14 @@ static efi_status_t virt_efi_query_variable_info(u32 attr,
225{ 219{
226 unsigned long flags; 220 unsigned long flags;
227 efi_status_t status; 221 efi_status_t status;
228 bool __in_nmi = efi_in_nmi();
229 222
230 if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION) 223 if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION)
231 return EFI_UNSUPPORTED; 224 return EFI_UNSUPPORTED;
232 225
233 if (!__in_nmi) 226 spin_lock_irqsave(&efi_runtime_lock, flags);
234 spin_lock_irqsave(&efi_runtime_lock, flags);
235 status = efi_call_virt(query_variable_info, attr, storage_space, 227 status = efi_call_virt(query_variable_info, attr, storage_space,
236 remaining_space, max_variable_size); 228 remaining_space, max_variable_size);
237 if (!__in_nmi) 229 spin_unlock_irqrestore(&efi_runtime_lock, flags);
238 spin_unlock_irqrestore(&efi_runtime_lock, flags);
239 return status; 230 return status;
240} 231}
241 232