Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+43 -38
+1 -1
arch/x86/Kconfig
··· 1945 1945 select UCS2_STRING 1946 1946 select EFI_RUNTIME_WRAPPERS 1947 1947 select ARCH_USE_MEMREMAP_PROT 1948 + select EFI_RUNTIME_MAP if KEXEC_CORE 1948 1949 help 1949 1950 This enables the kernel to use EFI runtime services that are 1950 1951 available (such as the EFI variable services). ··· 2021 2020 config EFI_RUNTIME_MAP 2022 2021 bool "Export EFI runtime maps to sysfs" if EXPERT 2023 2022 depends on EFI 2024 - default KEXEC_CORE 2025 2023 help 2026 2024 Export EFI runtime memory regions to /sys/firmware/efi/runtime-map. 2027 2025 That memory map is required by the 2nd kernel to set up EFI virtual
+2 -30
arch/x86/include/asm/efi.h
··· 91 91 92 92 #ifdef CONFIG_X86_32 93 93 #define EFI_X86_KERNEL_ALLOC_LIMIT (SZ_512M - 1) 94 - 95 - #define arch_efi_call_virt_setup() \ 96 - ({ \ 97 - efi_fpu_begin(); \ 98 - firmware_restrict_branch_speculation_start(); \ 99 - }) 100 - 101 - #define arch_efi_call_virt_teardown() \ 102 - ({ \ 103 - firmware_restrict_branch_speculation_end(); \ 104 - efi_fpu_end(); \ 105 - }) 106 - 107 94 #else /* !CONFIG_X86_32 */ 108 95 #define EFI_X86_KERNEL_ALLOC_LIMIT EFI_ALLOC_LIMIT 109 96 ··· 103 116 __efi_call(__VA_ARGS__); \ 104 117 }) 105 118 106 - #define arch_efi_call_virt_setup() \ 107 - ({ \ 108 - efi_sync_low_kernel_mappings(); \ 109 - efi_fpu_begin(); \ 110 - firmware_restrict_branch_speculation_start(); \ 111 - efi_enter_mm(); \ 112 - }) 113 - 114 119 #undef arch_efi_call_virt 115 120 #define arch_efi_call_virt(p, f, args...) ({ \ 116 121 u64 ret, ibt = ibt_save(efi_disable_ibt_for_runtime); \ 117 122 ret = efi_call((void *)p->f, args); \ 118 123 ibt_restore(ibt); \ 119 124 ret; \ 120 - }) 121 - 122 - #define arch_efi_call_virt_teardown() \ 123 - ({ \ 124 - efi_leave_mm(); \ 125 - firmware_restrict_branch_speculation_end(); \ 126 - efi_fpu_end(); \ 127 125 }) 128 126 129 127 #ifdef CONFIG_KASAN ··· 140 168 extern void efi_crash_gracefully_on_page_fault(unsigned long phys_addr); 141 169 extern void efi_free_boot_services(void); 142 170 143 - void efi_enter_mm(void); 144 - void efi_leave_mm(void); 171 + void arch_efi_call_virt_setup(void); 172 + void arch_efi_call_virt_teardown(void); 145 173 146 174 /* kexec external ABI */ 147 175 struct efi_setup_data {
+12
arch/x86/platform/efi/efi_32.c
··· 140 140 } 141 141 } 142 142 } 143 + 144 + void arch_efi_call_virt_setup(void) 145 + { 146 + efi_fpu_begin(); 147 + firmware_restrict_branch_speculation_start(); 148 + } 149 + 150 + void arch_efi_call_virt_teardown(void) 151 + { 152 + firmware_restrict_branch_speculation_end(); 153 + efi_fpu_end(); 154 + }
+17 -2
arch/x86/platform/efi/efi_64.c
··· 474 474 * can not change under us. 475 475 * It should be ensured that there are no concurrent calls to this function. 476 476 */ 477 - void efi_enter_mm(void) 477 + static void efi_enter_mm(void) 478 478 { 479 479 efi_prev_mm = current->active_mm; 480 480 current->active_mm = &efi_mm; 481 481 switch_mm(efi_prev_mm, &efi_mm, NULL); 482 482 } 483 483 484 - void efi_leave_mm(void) 484 + static void efi_leave_mm(void) 485 485 { 486 486 current->active_mm = efi_prev_mm; 487 487 switch_mm(&efi_mm, efi_prev_mm, NULL); 488 + } 489 + 490 + void arch_efi_call_virt_setup(void) 491 + { 492 + efi_sync_low_kernel_mappings(); 493 + efi_fpu_begin(); 494 + firmware_restrict_branch_speculation_start(); 495 + efi_enter_mm(); 496 + } 497 + 498 + void arch_efi_call_virt_teardown(void) 499 + { 500 + efi_leave_mm(); 501 + firmware_restrict_branch_speculation_end(); 502 + efi_fpu_end(); 488 503 } 489 504 490 505 static DEFINE_SPINLOCK(efi_runtime_lock);
+1 -1
drivers/firmware/efi/libstub/unaccepted_memory.c
··· 62 62 bitmap_size = DIV_ROUND_UP(unaccepted_end - unaccepted_start, 63 63 EFI_UNACCEPTED_UNIT_SIZE * BITS_PER_BYTE); 64 64 65 - status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, 65 + status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY, 66 66 sizeof(*unaccepted_table) + bitmap_size, 67 67 (void **)&unaccepted_table); 68 68 if (status != EFI_SUCCESS) {
+10 -4
fs/efivarfs/super.c
··· 32 32 u64 storage_space, remaining_space, max_variable_size; 33 33 efi_status_t status; 34 34 35 - status = efivar_query_variable_info(attr, &storage_space, &remaining_space, 36 - &max_variable_size); 37 - if (status != EFI_SUCCESS) 38 - return efi_status_to_err(status); 35 + /* Some UEFI firmware does not implement QueryVariableInfo() */ 36 + storage_space = remaining_space = 0; 37 + if (efi_rt_services_supported(EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)) { 38 + status = efivar_query_variable_info(attr, &storage_space, 39 + &remaining_space, 40 + &max_variable_size); 41 + if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED) 42 + pr_warn_ratelimited("query_variable_info() failed: 0x%lx\n", 43 + status); 44 + } 39 45 40 46 /* 41 47 * This is not a normal filesystem, so no point in pretending it has a block