diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-06-02 14:06:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-06-02 14:06:13 -0400 |
commit | af0424522dbb235ee7f1eb84bce074004c9d8b51 (patch) | |
tree | c1894636cdd4e954c0a89d2741998b1f5227c728 | |
parent | 4fb5741c7c5defd88046f570694fc3249479f36f (diff) | |
parent | 88447c5b93d98be847f428c39ba589779a59eb83 (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:
"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
-rw-r--r-- | arch/x86/platform/efi/efi.c | 2 | ||||
-rw-r--r-- | arch/x86/platform/efi/efi_64.c | 9 | ||||
-rw-r--r-- | arch/x86/platform/efi/quirks.c | 3 | ||||
-rw-r--r-- | drivers/firmware/efi/efi.c | 3 |
4 files changed, 14 insertions, 3 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index e1cb01a22fa8..a7189a3b4d70 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -85,6 +85,8 @@ static efi_status_t __init phys_efi_set_virtual_address_map( | |||
85 | pgd_t *save_pgd; | 85 | pgd_t *save_pgd; |
86 | 86 | ||
87 | save_pgd = efi_call_phys_prolog(); | 87 | save_pgd = efi_call_phys_prolog(); |
88 | if (!save_pgd) | ||
89 | return EFI_ABORTED; | ||
88 | 90 | ||
89 | /* Disable interrupts around EFI calls: */ | 91 | /* Disable interrupts around EFI calls: */ |
90 | local_irq_save(flags); | 92 | local_irq_save(flags); |
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index cf0347f61b21..08ce8177c3af 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -84,13 +84,15 @@ pgd_t * __init efi_call_phys_prolog(void) | |||
84 | 84 | ||
85 | if (!efi_enabled(EFI_OLD_MEMMAP)) { | 85 | if (!efi_enabled(EFI_OLD_MEMMAP)) { |
86 | efi_switch_mm(&efi_mm); | 86 | efi_switch_mm(&efi_mm); |
87 | return NULL; | 87 | return efi_mm.pgd; |
88 | } | 88 | } |
89 | 89 | ||
90 | early_code_mapping_set_exec(1); | 90 | early_code_mapping_set_exec(1); |
91 | 91 | ||
92 | n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); | 92 | n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); |
93 | save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL); | 93 | save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL); |
94 | if (!save_pgd) | ||
95 | return NULL; | ||
94 | 96 | ||
95 | /* | 97 | /* |
96 | * Build 1:1 identity mapping for efi=old_map usage. Note that | 98 | * 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 | pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX; | 140 | pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX; |
139 | } | 141 | } |
140 | 142 | ||
141 | out: | ||
142 | __flush_tlb_all(); | 143 | __flush_tlb_all(); |
143 | |||
144 | return save_pgd; | 144 | return save_pgd; |
145 | out: | ||
146 | efi_call_phys_epilog(save_pgd); | ||
147 | return NULL; | ||
145 | } | 148 | } |
146 | 149 | ||
147 | void __init efi_call_phys_epilog(pgd_t *save_pgd) | 150 | void __init efi_call_phys_epilog(pgd_t *save_pgd) |
diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c index feb77777c8b8..632b83885867 100644 --- a/arch/x86/platform/efi/quirks.c +++ b/arch/x86/platform/efi/quirks.c | |||
@@ -513,6 +513,9 @@ int __init efi_reuse_config(u64 tables, int nr_tables) | |||
513 | void *p, *tablep; | 513 | void *p, *tablep; |
514 | struct efi_setup_data *data; | 514 | struct efi_setup_data *data; |
515 | 515 | ||
516 | if (nr_tables == 0) | ||
517 | return 0; | ||
518 | |||
516 | if (!efi_setup) | 519 | if (!efi_setup) |
517 | return 0; | 520 | return 0; |
518 | 521 | ||
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 55b77c576c42..521a541d02ad 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
@@ -636,6 +636,9 @@ int __init efi_config_init(efi_config_table_type_t *arch_tables) | |||
636 | void *config_tables; | 636 | void *config_tables; |
637 | int sz, ret; | 637 | int sz, ret; |
638 | 638 | ||
639 | if (efi.systab->nr_tables == 0) | ||
640 | return 0; | ||
641 | |||
639 | if (efi_enabled(EFI_64BIT)) | 642 | if (efi_enabled(EFI_64BIT)) |
640 | sz = sizeof(efi_config_table_64_t); | 643 | sz = sizeof(efi_config_table_64_t); |
641 | else | 644 | else |