From: Raymund Will <rw@suse.de>
Subject: x86, efi: skip EFI_RESERVED_TYPE areas in efi_enter_virtual_mode()
Patch-mainline: ?
References: bnc#655434, bnc#681242

Using set_memory_uc() on areas marked with EFI_RESERVED_TYPE may crash
the machine on recent CPUs.
 
Signed-off-by: Raymund Will <rw@suse.de>

---
 arch/x86/platform/efi/efi.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -613,11 +613,15 @@ void __init efi_enter_virtual_mode(void)
 			continue;
 		}
 
-		if (!(md->attribute & EFI_MEMORY_WB)) {
+		if (!(md->attribute & EFI_MEMORY_WB) &&
+		    md->type != EFI_RESERVED_TYPE) {
 			addr = md->virt_addr;
 			npages = md->num_pages;
 			memrange_efi_to_native(&addr, &npages);
 			set_memory_uc(addr, npages);
+		} else if (md->type == EFI_RESERVED_TYPE) {
+			printk(KERN_INFO PFX "skip EFI_RESERVED_TYPE: 0x%llX "
+				"attr=0x%llx!\n", md->phys_addr, md->attribute);
 		}
 
 		systab = (u64) (unsigned long) efi_phys.systab;
