mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-04 04:04:19 +00:00
First set of EFI fixes for v6.6:
- Missing x86 patch for the runtime cleanup that was merged in -rc1 - Kconfig tweak for kexec on x86 so EFI support does not get disabled inadvertently - Use the right EFI memory type for the unaccepted memory table so kexec/kdump exposes it to the crash kernel as well - Work around EFI implementations which do not implement QueryVariableInfo, which is now called by statfs() on efivarfs -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQQm/3uucuRGn1Dmh0wbglWLn0tXAUCZQGDxwAKCRAwbglWLn0t XApcAP4+Fv6orQy4h/nmkDhWJa8vg36gWu1CDmy/abo0v3ODZQD/duk7Ejqw5vAm kvFmxLheNVs/RmgZtmB7CugAqibTkAE= =EdJu -----END PGP SIGNATURE----- Merge tag 'efi-fixes-for-v6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi Pull EFI fixes from Ard Biesheuvel: - Missing x86 patch for the runtime cleanup that was merged in -rc1 - Kconfig tweak for kexec on x86 so EFI support does not get disabled inadvertently - Use the right EFI memory type for the unaccepted memory table so kexec/kdump exposes it to the crash kernel as well - Work around EFI implementations which do not implement QueryVariableInfo, which is now called by statfs() on efivarfs * tag 'efi-fixes-for-v6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi: efivarfs: fix statfs() on efivarfs efi/unaccepted: Use ACPI reclaim memory for unaccepted memory table efi/x86: Ensure that EFI_RUNTIME_MAP is enabled for kexec efi/x86: Move EFI runtime call setup/teardown helpers out of line
This commit is contained in:
commit
e42bebf6db
@ -1945,6 +1945,7 @@ config EFI
|
||||
select UCS2_STRING
|
||||
select EFI_RUNTIME_WRAPPERS
|
||||
select ARCH_USE_MEMREMAP_PROT
|
||||
select EFI_RUNTIME_MAP if KEXEC_CORE
|
||||
help
|
||||
This enables the kernel to use EFI runtime services that are
|
||||
available (such as the EFI variable services).
|
||||
@ -2020,7 +2021,6 @@ config EFI_MAX_FAKE_MEM
|
||||
config EFI_RUNTIME_MAP
|
||||
bool "Export EFI runtime maps to sysfs" if EXPERT
|
||||
depends on EFI
|
||||
default KEXEC_CORE
|
||||
help
|
||||
Export EFI runtime memory regions to /sys/firmware/efi/runtime-map.
|
||||
That memory map is required by the 2nd kernel to set up EFI virtual
|
||||
|
@ -91,19 +91,6 @@ static inline void efi_fpu_end(void)
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
#define EFI_X86_KERNEL_ALLOC_LIMIT (SZ_512M - 1)
|
||||
|
||||
#define arch_efi_call_virt_setup() \
|
||||
({ \
|
||||
efi_fpu_begin(); \
|
||||
firmware_restrict_branch_speculation_start(); \
|
||||
})
|
||||
|
||||
#define arch_efi_call_virt_teardown() \
|
||||
({ \
|
||||
firmware_restrict_branch_speculation_end(); \
|
||||
efi_fpu_end(); \
|
||||
})
|
||||
|
||||
#else /* !CONFIG_X86_32 */
|
||||
#define EFI_X86_KERNEL_ALLOC_LIMIT EFI_ALLOC_LIMIT
|
||||
|
||||
@ -116,14 +103,6 @@ extern bool efi_disable_ibt_for_runtime;
|
||||
__efi_call(__VA_ARGS__); \
|
||||
})
|
||||
|
||||
#define arch_efi_call_virt_setup() \
|
||||
({ \
|
||||
efi_sync_low_kernel_mappings(); \
|
||||
efi_fpu_begin(); \
|
||||
firmware_restrict_branch_speculation_start(); \
|
||||
efi_enter_mm(); \
|
||||
})
|
||||
|
||||
#undef arch_efi_call_virt
|
||||
#define arch_efi_call_virt(p, f, args...) ({ \
|
||||
u64 ret, ibt = ibt_save(efi_disable_ibt_for_runtime); \
|
||||
@ -132,13 +111,6 @@ extern bool efi_disable_ibt_for_runtime;
|
||||
ret; \
|
||||
})
|
||||
|
||||
#define arch_efi_call_virt_teardown() \
|
||||
({ \
|
||||
efi_leave_mm(); \
|
||||
firmware_restrict_branch_speculation_end(); \
|
||||
efi_fpu_end(); \
|
||||
})
|
||||
|
||||
#ifdef CONFIG_KASAN
|
||||
/*
|
||||
* CONFIG_KASAN may redefine memset to __memset. __memset function is present
|
||||
@ -168,8 +140,8 @@ extern void efi_delete_dummy_variable(void);
|
||||
extern void efi_crash_gracefully_on_page_fault(unsigned long phys_addr);
|
||||
extern void efi_free_boot_services(void);
|
||||
|
||||
void efi_enter_mm(void);
|
||||
void efi_leave_mm(void);
|
||||
void arch_efi_call_virt_setup(void);
|
||||
void arch_efi_call_virt_teardown(void);
|
||||
|
||||
/* kexec external ABI */
|
||||
struct efi_setup_data {
|
||||
|
@ -140,3 +140,15 @@ void __init efi_runtime_update_mappings(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void arch_efi_call_virt_setup(void)
|
||||
{
|
||||
efi_fpu_begin();
|
||||
firmware_restrict_branch_speculation_start();
|
||||
}
|
||||
|
||||
void arch_efi_call_virt_teardown(void)
|
||||
{
|
||||
firmware_restrict_branch_speculation_end();
|
||||
efi_fpu_end();
|
||||
}
|
||||
|
@ -474,19 +474,34 @@ void __init efi_dump_pagetable(void)
|
||||
* can not change under us.
|
||||
* It should be ensured that there are no concurrent calls to this function.
|
||||
*/
|
||||
void efi_enter_mm(void)
|
||||
static void efi_enter_mm(void)
|
||||
{
|
||||
efi_prev_mm = current->active_mm;
|
||||
current->active_mm = &efi_mm;
|
||||
switch_mm(efi_prev_mm, &efi_mm, NULL);
|
||||
}
|
||||
|
||||
void efi_leave_mm(void)
|
||||
static void efi_leave_mm(void)
|
||||
{
|
||||
current->active_mm = efi_prev_mm;
|
||||
switch_mm(&efi_mm, efi_prev_mm, NULL);
|
||||
}
|
||||
|
||||
void arch_efi_call_virt_setup(void)
|
||||
{
|
||||
efi_sync_low_kernel_mappings();
|
||||
efi_fpu_begin();
|
||||
firmware_restrict_branch_speculation_start();
|
||||
efi_enter_mm();
|
||||
}
|
||||
|
||||
void arch_efi_call_virt_teardown(void)
|
||||
{
|
||||
efi_leave_mm();
|
||||
firmware_restrict_branch_speculation_end();
|
||||
efi_fpu_end();
|
||||
}
|
||||
|
||||
static DEFINE_SPINLOCK(efi_runtime_lock);
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@ efi_status_t allocate_unaccepted_bitmap(__u32 nr_desc,
|
||||
bitmap_size = DIV_ROUND_UP(unaccepted_end - unaccepted_start,
|
||||
EFI_UNACCEPTED_UNIT_SIZE * BITS_PER_BYTE);
|
||||
|
||||
status = efi_bs_call(allocate_pool, EFI_LOADER_DATA,
|
||||
status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
|
||||
sizeof(*unaccepted_table) + bitmap_size,
|
||||
(void **)&unaccepted_table);
|
||||
if (status != EFI_SUCCESS) {
|
||||
|
@ -32,10 +32,16 @@ static int efivarfs_statfs(struct dentry *dentry, struct kstatfs *buf)
|
||||
u64 storage_space, remaining_space, max_variable_size;
|
||||
efi_status_t status;
|
||||
|
||||
status = efivar_query_variable_info(attr, &storage_space, &remaining_space,
|
||||
&max_variable_size);
|
||||
if (status != EFI_SUCCESS)
|
||||
return efi_status_to_err(status);
|
||||
/* Some UEFI firmware does not implement QueryVariableInfo() */
|
||||
storage_space = remaining_space = 0;
|
||||
if (efi_rt_services_supported(EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)) {
|
||||
status = efivar_query_variable_info(attr, &storage_space,
|
||||
&remaining_space,
|
||||
&max_variable_size);
|
||||
if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED)
|
||||
pr_warn_ratelimited("query_variable_info() failed: 0x%lx\n",
|
||||
status);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is not a normal filesystem, so no point in pretending it has a block
|
||||
|
Loading…
Reference in New Issue
Block a user