aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Young <dyoung@redhat.com>2014-08-14 05:15:31 -0400
committerMatt Fleming <matt.fleming@intel.com>2014-10-03 13:40:59 -0400
commita5a750a98fe2812263546cc20badd32bab21ec52 (patch)
tree61c283161af2dc26c8cb1b3443b01bcb4c4826f2
parent6632210f50530ea53dd21f786f2854609d928689 (diff)
x86/efi: Clear EFI_RUNTIME_SERVICES if failing to enter virtual mode
If enter virtual mode failed due to some reason other than the efi call the EFI_RUNTIME_SERVICES bit in efi.flags should be cleared thus users of efi runtime services can check the bit and handle the case instead of assume efi runtime is ok. Per Matt, if efi call SetVirtualAddressMap fails we will be not sure it's safe to make any assumptions about the state of the system. So kernel panics instead of clears EFI_RUNTIME_SERVICES bit. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--arch/x86/platform/efi/efi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 00f4cc566adb..d3096c0aa941 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -724,6 +724,7 @@ static void __init kexec_enter_virtual_mode(void)
724 */ 724 */
725 if (!efi_is_native()) { 725 if (!efi_is_native()) {
726 efi_unmap_memmap(); 726 efi_unmap_memmap();
727 clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
727 return; 728 return;
728 } 729 }
729 730
@@ -797,6 +798,7 @@ static void __init __efi_enter_virtual_mode(void)
797 new_memmap = efi_map_regions(&count, &pg_shift); 798 new_memmap = efi_map_regions(&count, &pg_shift);
798 if (!new_memmap) { 799 if (!new_memmap) {
799 pr_err("Error reallocating memory, EFI runtime non-functional!\n"); 800 pr_err("Error reallocating memory, EFI runtime non-functional!\n");
801 clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
800 return; 802 return;
801 } 803 }
802 804
@@ -804,8 +806,10 @@ static void __init __efi_enter_virtual_mode(void)
804 806
805 BUG_ON(!efi.systab); 807 BUG_ON(!efi.systab);
806 808
807 if (efi_setup_page_tables(__pa(new_memmap), 1 << pg_shift)) 809 if (efi_setup_page_tables(__pa(new_memmap), 1 << pg_shift)) {
810 clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
808 return; 811 return;
812 }
809 813
810 efi_sync_low_kernel_mappings(); 814 efi_sync_low_kernel_mappings();
811 efi_dump_pagetable(); 815 efi_dump_pagetable();