提交 af042452 编写于 作者: L Linus Torvalds

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

Pull EFI fixes from Ingo Molnar:
 "Two EFI fixes: a quirk for weird systabs, plus add more robust error
  handling in the old 1:1 mapping code"

* 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  efi: Allow the number of EFI configuration tables entries to be zero
  efi/x86/Add missing error handling to old_memmap 1:1 mapping code
...@@ -85,6 +85,8 @@ static efi_status_t __init phys_efi_set_virtual_address_map( ...@@ -85,6 +85,8 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
pgd_t *save_pgd; pgd_t *save_pgd;
save_pgd = efi_call_phys_prolog(); save_pgd = efi_call_phys_prolog();
if (!save_pgd)
return EFI_ABORTED;
/* Disable interrupts around EFI calls: */ /* Disable interrupts around EFI calls: */
local_irq_save(flags); local_irq_save(flags);
......
...@@ -84,13 +84,15 @@ pgd_t * __init efi_call_phys_prolog(void) ...@@ -84,13 +84,15 @@ pgd_t * __init efi_call_phys_prolog(void)
if (!efi_enabled(EFI_OLD_MEMMAP)) { if (!efi_enabled(EFI_OLD_MEMMAP)) {
efi_switch_mm(&efi_mm); efi_switch_mm(&efi_mm);
return NULL; return efi_mm.pgd;
} }
early_code_mapping_set_exec(1); early_code_mapping_set_exec(1);
n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL); save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
if (!save_pgd)
return NULL;
/* /*
* Build 1:1 identity mapping for efi=old_map usage. Note that * Build 1:1 identity mapping for efi=old_map usage. Note that
...@@ -138,10 +140,11 @@ pgd_t * __init efi_call_phys_prolog(void) ...@@ -138,10 +140,11 @@ pgd_t * __init efi_call_phys_prolog(void)
pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX; pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX;
} }
out:
__flush_tlb_all(); __flush_tlb_all();
return save_pgd; return save_pgd;
out:
efi_call_phys_epilog(save_pgd);
return NULL;
} }
void __init efi_call_phys_epilog(pgd_t *save_pgd) void __init efi_call_phys_epilog(pgd_t *save_pgd)
......
...@@ -513,6 +513,9 @@ int __init efi_reuse_config(u64 tables, int nr_tables) ...@@ -513,6 +513,9 @@ int __init efi_reuse_config(u64 tables, int nr_tables)
void *p, *tablep; void *p, *tablep;
struct efi_setup_data *data; struct efi_setup_data *data;
if (nr_tables == 0)
return 0;
if (!efi_setup) if (!efi_setup)
return 0; return 0;
......
...@@ -636,6 +636,9 @@ int __init efi_config_init(efi_config_table_type_t *arch_tables) ...@@ -636,6 +636,9 @@ int __init efi_config_init(efi_config_table_type_t *arch_tables)
void *config_tables; void *config_tables;
int sz, ret; int sz, ret;
if (efi.systab->nr_tables == 0)
return 0;
if (efi_enabled(EFI_64BIT)) if (efi_enabled(EFI_64BIT))
sz = sizeof(efi_config_table_64_t); sz = sizeof(efi_config_table_64_t);
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册