summaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-06-29 07:32:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-06-29 07:32:09 -0400
commita7211bc9f3d50d77efe77c332b269458a94fcfd2 (patch)
tree7706737cdba1e29534a31c3055942e71ea74bce1 /drivers/firmware
parent2407e486066b8ce00dabd7e2b3a2cbcc59ea6186 (diff)
parent48c7d73b2362ce61503551ad70052617b3e8857d (diff)
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
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/efi/efi-bgrt.c5
-rw-r--r--drivers/firmware/efi/efi.c12
-rw-r--r--drivers/firmware/efi/efibc.c12
3 files changed, 17 insertions, 12 deletions
diff --git a/drivers/firmware/efi/efi-bgrt.c b/drivers/firmware/efi/efi-bgrt.c
index a2384184a7de..b07c17643210 100644
--- a/drivers/firmware/efi/efi-bgrt.c
+++ b/drivers/firmware/efi/efi-bgrt.c
@@ -47,11 +47,6 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
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);
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 16b2137d117c..4b7cf7bc0ded 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -1009,14 +1009,16 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
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)
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;
diff --git a/drivers/firmware/efi/efibc.c b/drivers/firmware/efi/efibc.c
index 61e099826cbb..35dccc88ac0a 100644
--- a/drivers/firmware/efi/efibc.c
+++ b/drivers/firmware/efi/efibc.c
@@ -43,11 +43,13 @@ static int efibc_set_variable(const char *name, const char *value)
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_VOLATILE 47 entry->var.VendorGuid,
48 | EFI_VARIABLE_BOOTSERVICE_ACCESS 48 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);