Commit 8819ba39 authored by Ard Biesheuvel's avatar Ard Biesheuvel

efi/arm: Drop unnecessary references to efi.systab

Instead of populating efi.systab very early during efi_init() with
a mapping that is released again before the function exits, use a
local variable here. Now that we use efi.runtime to access the runtime
services table, this removes the only reference efi.systab, so there is
no need to populate it anymore, or discover its virtually remapped
address. So drop the references entirely.

Tested-by: Tony Luck <tony.luck@intel.com> # arch/ia64
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent 59f2a619
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <asm/efi.h> #include <asm/efi.h>
u64 efi_system_table;
static int __init is_memory(efi_memory_desc_t *md) static int __init is_memory(efi_memory_desc_t *md)
{ {
if (md->attribute & (EFI_MEMORY_WB|EFI_MEMORY_WT|EFI_MEMORY_WC)) if (md->attribute & (EFI_MEMORY_WB|EFI_MEMORY_WT|EFI_MEMORY_WC))
...@@ -36,7 +34,7 @@ static int __init is_memory(efi_memory_desc_t *md) ...@@ -36,7 +34,7 @@ static int __init is_memory(efi_memory_desc_t *md)
* as some data members of the EFI system table are virtually remapped after * as some data members of the EFI system table are virtually remapped after
* SetVirtualAddressMap() has been called. * SetVirtualAddressMap() has been called.
*/ */
static phys_addr_t efi_to_phys(unsigned long addr) static phys_addr_t __init efi_to_phys(unsigned long addr)
{ {
efi_memory_desc_t *md; efi_memory_desc_t *md;
...@@ -83,15 +81,15 @@ static void __init init_screen_info(void) ...@@ -83,15 +81,15 @@ static void __init init_screen_info(void)
memblock_mark_nomap(screen_info.lfb_base, screen_info.lfb_size); memblock_mark_nomap(screen_info.lfb_base, screen_info.lfb_size);
} }
static int __init uefi_init(void) static int __init uefi_init(u64 efi_system_table)
{ {
efi_config_table_t *config_tables; efi_config_table_t *config_tables;
efi_system_table_t *systab;
size_t table_size; size_t table_size;
int retval; int retval;
efi.systab = early_memremap_ro(efi_system_table, systab = early_memremap_ro(efi_system_table, sizeof(efi_system_table_t));
sizeof(efi_system_table_t)); if (systab == NULL) {
if (efi.systab == NULL) {
pr_warn("Unable to map EFI system table.\n"); pr_warn("Unable to map EFI system table.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -100,30 +98,29 @@ static int __init uefi_init(void) ...@@ -100,30 +98,29 @@ static int __init uefi_init(void)
if (IS_ENABLED(CONFIG_64BIT)) if (IS_ENABLED(CONFIG_64BIT))
set_bit(EFI_64BIT, &efi.flags); set_bit(EFI_64BIT, &efi.flags);
retval = efi_systab_check_header(&efi.systab->hdr, 2); retval = efi_systab_check_header(&systab->hdr, 2);
if (retval) if (retval)
goto out; goto out;
efi.runtime = efi.systab->runtime; efi.runtime = systab->runtime;
efi.runtime_version = efi.systab->hdr.revision; efi.runtime_version = systab->hdr.revision;
efi_systab_report_header(&efi.systab->hdr, efi_systab_report_header(&systab->hdr, efi_to_phys(systab->fw_vendor));
efi_to_phys(efi.systab->fw_vendor));
table_size = sizeof(efi_config_table_64_t) * efi.systab->nr_tables; table_size = sizeof(efi_config_table_t) * systab->nr_tables;
config_tables = early_memremap_ro(efi_to_phys(efi.systab->tables), config_tables = early_memremap_ro(efi_to_phys(systab->tables),
table_size); table_size);
if (config_tables == NULL) { if (config_tables == NULL) {
pr_warn("Unable to map EFI config table array.\n"); pr_warn("Unable to map EFI config table array.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
} }
retval = efi_config_parse_tables(config_tables, efi.systab->nr_tables, retval = efi_config_parse_tables(config_tables, systab->nr_tables,
arch_tables); arch_tables);
early_memunmap(config_tables, table_size); early_memunmap(config_tables, table_size);
out: out:
early_memunmap(efi.systab, sizeof(efi_system_table_t)); early_memunmap(systab, sizeof(efi_system_table_t));
return retval; return retval;
} }
...@@ -214,8 +211,6 @@ void __init efi_init(void) ...@@ -214,8 +211,6 @@ void __init efi_init(void)
if (!efi_get_fdt_params(&params)) if (!efi_get_fdt_params(&params))
return; return;
efi_system_table = params.system_table;
data.desc_version = params.desc_ver; data.desc_version = params.desc_ver;
data.desc_size = params.desc_size; data.desc_size = params.desc_size;
data.size = params.mmap_size; data.size = params.mmap_size;
...@@ -234,7 +229,7 @@ void __init efi_init(void) ...@@ -234,7 +229,7 @@ void __init efi_init(void)
"Unexpected EFI_MEMORY_DESCRIPTOR version %ld", "Unexpected EFI_MEMORY_DESCRIPTOR version %ld",
efi.memmap.desc_version); efi.memmap.desc_version);
if (uefi_init() < 0) { if (uefi_init(params.system_table) < 0) {
efi_memmap_unmap(); efi_memmap_unmap();
return; return;
} }
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
extern u64 efi_system_table;
#if defined(CONFIG_PTDUMP_DEBUGFS) && defined(CONFIG_ARM64) #if defined(CONFIG_PTDUMP_DEBUGFS) && defined(CONFIG_ARM64)
#include <asm/ptdump.h> #include <asm/ptdump.h>
...@@ -54,13 +52,11 @@ device_initcall(ptdump_init); ...@@ -54,13 +52,11 @@ device_initcall(ptdump_init);
static bool __init efi_virtmap_init(void) static bool __init efi_virtmap_init(void)
{ {
efi_memory_desc_t *md; efi_memory_desc_t *md;
bool systab_found;
efi_mm.pgd = pgd_alloc(&efi_mm); efi_mm.pgd = pgd_alloc(&efi_mm);
mm_init_cpumask(&efi_mm); mm_init_cpumask(&efi_mm);
init_new_context(NULL, &efi_mm); init_new_context(NULL, &efi_mm);
systab_found = false;
for_each_efi_memory_desc(md) { for_each_efi_memory_desc(md) {
phys_addr_t phys = md->phys_addr; phys_addr_t phys = md->phys_addr;
int ret; int ret;
...@@ -76,20 +72,6 @@ static bool __init efi_virtmap_init(void) ...@@ -76,20 +72,6 @@ static bool __init efi_virtmap_init(void)
&phys, ret); &phys, ret);
return false; return false;
} }
/*
* If this entry covers the address of the UEFI system table,
* calculate and record its virtual address.
*/
if (efi_system_table >= phys &&
efi_system_table < phys + (md->num_pages * EFI_PAGE_SIZE)) {
efi.systab = (void *)(unsigned long)(efi_system_table -
phys + md->virt_addr);
systab_found = true;
}
}
if (!systab_found) {
pr_err("No virtual mapping found for the UEFI System Table\n");
return false;
} }
if (efi_memattr_apply_permissions(&efi_mm, efi_set_mapping_permissions)) if (efi_memattr_apply_permissions(&efi_mm, efi_set_mapping_permissions))
......
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