History

Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull EFI fixes from Ingo Molnar: "Four fixes: - fix a kexec crash on arm64 - fix a reboot crash on some Android platforms - future-proof the code for upcoming ACPI 6.2 changes - fix a build warning on x86" * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: efibc: Replace variable set function in notifier call x86/efi: fix a -Wtype-limits compilation warning efi/bgrt: Drop BGRT status field reserved bits check efi/memreserve: deal with memreserve entries in unmapped memory

Linus Torvalds committed 7 years ago

Commit a7211bc2 parents 2407e48 48c7d734 files · +18 −13Browse files

Unified · Split

4 files
  1. arch/x86/platform/efi/quirks.c +1 −1
  2. drivers/firmware/efi/efi-bgrt.c +0 −5
  3. drivers/firmware/efi/efi.c +10 −2
  4. drivers/firmware/efi/efibc.c +7 −5
arch/x86/platform/efi/quirks.c+1−1
@@ -728,7 +728,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr) · 727 unmodified lines
728 * Address range 0x0000 - 0x0fff is always mapped in the efi_pgd, so728 * Address range 0x0000 - 0x0fff is always mapped in the efi_pgd, so
729 * page faulting on these addresses isn't expected.729 * page faulting on these addresses isn't expected.
730 */730 */
731 if (phys_addr >= 0x0000 && phys_addr <= 0x0fff)731 if (phys_addr <= 0x0fff)
732 return;732 return;
733 733
734 /*734 /*
drivers/firmware/efi/efi-bgrt.c+0−5
@@ -47,11 +47,6 @@ void __init efi_bgrt_init(struct acpi_table_header *table) · 46 unmodified lines
47 bgrt->version);47 bgrt->version);
48 goto out;48 goto out;
49 }49 }
50 if (bgrt->status & 0xfe) {
51 pr_notice("Ignoring BGRT: reserved status bits are non-zero %u\n",
52 bgrt->status);
53 goto out;
54 }
55 if (bgrt->image_type != 0) {50 if (bgrt->image_type != 0) {
56 pr_notice("Ignoring BGRT: invalid image type %u (expected 0)\n",51 pr_notice("Ignoring BGRT: invalid image type %u (expected 0)\n",
57 bgrt->image_type);52 bgrt->image_type);
drivers/firmware/efi/efi.c+10−2
@@ -1009,14 +1009,16 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 1008 unmodified lines
1009 1009
1010 /* first try to find a slot in an existing linked list entry */1010 /* first try to find a slot in an existing linked list entry */
1011 for (prsv = efi_memreserve_root->next; prsv; prsv = rsv->next) {1011 for (prsv = efi_memreserve_root->next; prsv; prsv = rsv->next) {
1012 rsv = __va(prsv);1012 rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB);
1013 index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);1013 index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
1014 if (index < rsv->size) {1014 if (index < rsv->size) {
1015 rsv->entry[index].base = addr;1015 rsv->entry[index].base = addr;
1016 rsv->entry[index].size = size;1016 rsv->entry[index].size = size;
1017 1017
1018 memunmap(rsv);
1018 return 0;1019 return 0;
1019 }1020 }
1021 memunmap(rsv);
1020 }1022 }
1021 1023
1022 /* no slot found - allocate a new linked list entry */1024 /* no slot found - allocate a new linked list entry */
@@ -1024,7 +1026,13 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 1 unmodified line
1024 if (!rsv)1026 if (!rsv)
1025 return -ENOMEM;1027 return -ENOMEM;
1026 1028
1027 rsv->size = EFI_MEMRESERVE_COUNT(PAGE_SIZE);1029 /*
1030 * The memremap() call above assumes that a linux_efi_memreserve entry
1031 * never crosses a page boundary, so let's ensure that this remains true
1032 * even when kexec'ing a 4k pages kernel from a >4k pages kernel, by
1033 * using SZ_4K explicitly in the size calculation below.
1034 */
1035 rsv->size = EFI_MEMRESERVE_COUNT(SZ_4K);
1028 atomic_set(&rsv->count, 1);1036 atomic_set(&rsv->count, 1);
1029 rsv->entry[0].base = addr;1037 rsv->entry[0].base = addr;
1030 rsv->entry[0].size = size;1038 rsv->entry[0].size = size;
drivers/firmware/efi/efibc.c+7−5
@@ -43,11 +43,13 @@ static int efibc_set_variable(const char *name, const char *value) · 42 unmodified lines
43 efibc_str_to_str16(value, (efi_char16_t *)entry->var.Data);43 efibc_str_to_str16(value, (efi_char16_t *)entry->var.Data);
44 memcpy(&entry->var.VendorGuid, &guid, sizeof(guid));44 memcpy(&entry->var.VendorGuid, &guid, sizeof(guid));
45 45
46 ret = efivar_entry_set(entry,46 ret = efivar_entry_set_safe(entry->var.VariableName,
47 EFI_VARIABLE_NON_VOLATILE47 entry->var.VendorGuid,
48 | EFI_VARIABLE_BOOTSERVICE_ACCESS48 EFI_VARIABLE_NON_VOLATILE
49 | EFI_VARIABLE_RUNTIME_ACCESS,49 | EFI_VARIABLE_BOOTSERVICE_ACCESS
50 size, entry->var.Data, NULL);50 | EFI_VARIABLE_RUNTIME_ACCESS,
51 false, size, entry->var.Data);
52
51 if (ret)53 if (ret)
52 pr_err("failed to set %s EFI variable: 0x%x\n",54 pr_err("failed to set %s EFI variable: 0x%x\n",
53 name, ret);55 name, ret);