Commit 8d9f412d authored by Linus Torvalds's avatar Linus Torvalds

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

Pull EFI fix from Ingo Molnar:
 "An arm64 warning fix"

* 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  efi: Prevent GICv3 WARN() by mapping the memreserve table before first use
parents 575d7d0d 976b4891
...@@ -969,13 +969,33 @@ bool efi_is_table_address(unsigned long phys_addr) ...@@ -969,13 +969,33 @@ bool efi_is_table_address(unsigned long phys_addr)
static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock); static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock);
static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init; static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init;
int efi_mem_reserve_persistent(phys_addr_t addr, u64 size) static int __init efi_memreserve_map_root(void)
{
if (efi.mem_reserve == EFI_INVALID_TABLE_ADDR)
return -ENODEV;
efi_memreserve_root = memremap(efi.mem_reserve,
sizeof(*efi_memreserve_root),
MEMREMAP_WB);
if (WARN_ON_ONCE(!efi_memreserve_root))
return -ENOMEM;
return 0;
}
int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
{ {
struct linux_efi_memreserve *rsv; struct linux_efi_memreserve *rsv;
int rc;
if (!efi_memreserve_root) if (efi_memreserve_root == (void *)ULONG_MAX)
return -ENODEV; return -ENODEV;
if (!efi_memreserve_root) {
rc = efi_memreserve_map_root();
if (rc)
return rc;
}
rsv = kmalloc(sizeof(*rsv), GFP_ATOMIC); rsv = kmalloc(sizeof(*rsv), GFP_ATOMIC);
if (!rsv) if (!rsv)
return -ENOMEM; return -ENOMEM;
...@@ -993,14 +1013,10 @@ int efi_mem_reserve_persistent(phys_addr_t addr, u64 size) ...@@ -993,14 +1013,10 @@ int efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
static int __init efi_memreserve_root_init(void) static int __init efi_memreserve_root_init(void)
{ {
if (efi.mem_reserve == EFI_INVALID_TABLE_ADDR) if (efi_memreserve_root)
return -ENODEV; return 0;
if (efi_memreserve_map_root())
efi_memreserve_root = memremap(efi.mem_reserve, efi_memreserve_root = (void *)ULONG_MAX;
sizeof(*efi_memreserve_root),
MEMREMAP_WB);
if (!efi_memreserve_root)
return -ENOMEM;
return 0; return 0;
} }
early_initcall(efi_memreserve_root_init); early_initcall(efi_memreserve_root_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment