From: Greg Kroah-Hartman Date: Fri, 1 Feb 2013 10:15:11 +0000 (+0100) Subject: 3.7-stable patches X-Git-Tag: v3.0.62~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e616ac5c5dc145e0f1f8af33d45157df5ceea59;p=thirdparty%2Fkernel%2Fstable-queue.git 3.7-stable patches added patches: efi-x86-pass-a-proper-identity-mapping-in-efi_call_phys_prelog.patch x86-efi-fix-32-bit-efi-handover-protocol-entry-point.patch x86-efi-fix-display-detection-in-efi-boot-stub.patch x86-efi-set-runtime_version-to-the-efi-spec-revision.patch --- diff --git a/queue-3.7/efi-x86-pass-a-proper-identity-mapping-in-efi_call_phys_prelog.patch b/queue-3.7/efi-x86-pass-a-proper-identity-mapping-in-efi_call_phys_prelog.patch new file mode 100644 index 00000000000..b7bf3db04f3 --- /dev/null +++ b/queue-3.7/efi-x86-pass-a-proper-identity-mapping-in-efi_call_phys_prelog.patch @@ -0,0 +1,115 @@ +From b8f2c21db390273c3eaf0e5308faeaeb1e233840 Mon Sep 17 00:00:00 2001 +From: Nathan Zimmer +Date: Tue, 8 Jan 2013 09:02:43 -0600 +Subject: efi, x86: Pass a proper identity mapping in efi_call_phys_prelog + +From: Nathan Zimmer + +commit b8f2c21db390273c3eaf0e5308faeaeb1e233840 upstream. + +Update efi_call_phys_prelog to install an identity mapping of all available +memory. This corrects a bug on very large systems with more then 512 GB in +which bios would not be able to access addresses above not in the mapping. + +The result is a crash that looks much like this. + +BUG: unable to handle kernel paging request at 000000effd870020 +IP: [<0000000078bce331>] 0x78bce330 +PGD 0 +Oops: 0000 [#1] SMP +Modules linked in: +CPU 0 +Pid: 0, comm: swapper/0 Tainted: G W 3.8.0-rc1-next-20121224-medusa_ntz+ #2 Intel Corp. Stoutland Platform +RIP: 0010:[<0000000078bce331>] [<0000000078bce331>] 0x78bce330 +RSP: 0000:ffffffff81601d28 EFLAGS: 00010006 +RAX: 0000000078b80e18 RBX: 0000000000000004 RCX: 0000000000000004 +RDX: 0000000078bcf958 RSI: 0000000000002400 RDI: 8000000000000000 +RBP: 0000000078bcf760 R08: 000000effd870000 R09: 0000000000000000 +R10: 0000000000000000 R11: 00000000000000c3 R12: 0000000000000030 +R13: 000000effd870000 R14: 0000000000000000 R15: ffff88effd870000 +FS: 0000000000000000(0000) GS:ffff88effe400000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 000000effd870020 CR3: 000000000160c000 CR4: 00000000000006b0 +DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 +Process swapper/0 (pid: 0, threadinfo ffffffff81600000, task ffffffff81614400) +Stack: + 0000000078b80d18 0000000000000004 0000000078bced7b ffff880078b81fff + 0000000000000000 0000000000000082 0000000078bce3a8 0000000000002400 + 0000000060000202 0000000078b80da0 0000000078bce45d ffffffff8107cb5a +Call Trace: + [] ? on_each_cpu+0x77/0x83 + [] ? change_page_attr_set_clr+0x32f/0x3ed + [] ? efi_call4+0x46/0x80 + [] ? efi_enter_virtual_mode+0x1f5/0x305 + [] ? start_kernel+0x34a/0x3d2 + [] ? repair_env_string+0x60/0x60 + [] ? x86_64_start_reservations+0xba/0xc1 + [] ? early_idt_handlers+0x120/0x120 + [] ? x86_64_start_kernel+0x154/0x163 +Code: Bad RIP value. +RIP [<0000000078bce331>] 0x78bce330 + RSP +CR2: 000000effd870020 +---[ end trace ead828934fef5eab ]--- + +Signed-off-by: Nathan Zimmer +Cc: Thomas Gleixner +Cc: Ingo Molnar +Cc: "H. Peter Anvin" +Signed-off-by: Robin Holt +Signed-off-by: Matt Fleming +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/platform/efi/efi_64.c | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +--- a/arch/x86/platform/efi/efi_64.c ++++ b/arch/x86/platform/efi/efi_64.c +@@ -38,7 +38,7 @@ + #include + #include + +-static pgd_t save_pgd __initdata; ++static pgd_t *save_pgd __initdata; + static unsigned long efi_flags __initdata; + + static void __init early_code_mapping_set_exec(int executable) +@@ -61,12 +61,20 @@ static void __init early_code_mapping_se + void __init efi_call_phys_prelog(void) + { + unsigned long vaddress; ++ int pgd; ++ int n_pgds; + + early_code_mapping_set_exec(1); + local_irq_save(efi_flags); +- vaddress = (unsigned long)__va(0x0UL); +- save_pgd = *pgd_offset_k(0x0UL); +- set_pgd(pgd_offset_k(0x0UL), *pgd_offset_k(vaddress)); ++ ++ n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); ++ save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL); ++ ++ for (pgd = 0; pgd < n_pgds; pgd++) { ++ save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE); ++ vaddress = (unsigned long)__va(pgd * PGDIR_SIZE); ++ set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress)); ++ } + __flush_tlb_all(); + } + +@@ -75,7 +83,11 @@ void __init efi_call_phys_epilog(void) + /* + * After the lock is released, the original page table is restored. + */ +- set_pgd(pgd_offset_k(0x0UL), save_pgd); ++ int pgd; ++ int n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE); ++ for (pgd = 0; pgd < n_pgds; pgd++) ++ set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), save_pgd[pgd]); ++ kfree(save_pgd); + __flush_tlb_all(); + local_irq_restore(efi_flags); + early_code_mapping_set_exec(0); diff --git a/queue-3.7/series b/queue-3.7/series index e37e6d2a8c6..3c10edb08aa 100644 --- a/queue-3.7/series +++ b/queue-3.7/series @@ -61,3 +61,7 @@ smp-fix-smp-function-call-empty-cpu-mask-race.patch x86-msr-add-capabilities-check.patch efi-make-efi_enabled-a-function-to-query-efi-facilities.patch samsung-laptop-disable-on-efi-hardware.patch +x86-efi-fix-display-detection-in-efi-boot-stub.patch +x86-efi-fix-32-bit-efi-handover-protocol-entry-point.patch +efi-x86-pass-a-proper-identity-mapping-in-efi_call_phys_prelog.patch +x86-efi-set-runtime_version-to-the-efi-spec-revision.patch diff --git a/queue-3.7/x86-efi-fix-32-bit-efi-handover-protocol-entry-point.patch b/queue-3.7/x86-efi-fix-32-bit-efi-handover-protocol-entry-point.patch new file mode 100644 index 00000000000..95741e85e02 --- /dev/null +++ b/queue-3.7/x86-efi-fix-32-bit-efi-handover-protocol-entry-point.patch @@ -0,0 +1,37 @@ +From f791620fa7517e1045742c475a7f005db9a634b8 Mon Sep 17 00:00:00 2001 +From: David Woodhouse +Date: Mon, 7 Jan 2013 22:01:50 +0000 +Subject: x86, efi: Fix 32-bit EFI handover protocol entry point + +From: David Woodhouse + +commit f791620fa7517e1045742c475a7f005db9a634b8 upstream. + +If the bootloader calls the EFI handover entry point as a standard function +call, then it'll have a return address on the stack. We need to pop that +before calling efi_main(), or the arguments will all be out of position on +the stack. + +Signed-off-by: David Woodhouse +Link: http://lkml.kernel.org/r/1358513837.2397.247.camel@shinybook.infradead.org +Signed-off-by: H. Peter Anvin +Cc: Matt Fleming +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/boot/compressed/head_32.S | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/x86/boot/compressed/head_32.S ++++ b/arch/x86/boot/compressed/head_32.S +@@ -50,8 +50,10 @@ ENTRY(startup_32) + pushl %eax + pushl %esi + pushl %ecx ++ sub $0x4, %esp + + .org 0x30,0x90 ++ add $0x4, %esp + call efi_main + cmpl $0, %eax + movl %eax, %esi diff --git a/queue-3.7/x86-efi-fix-display-detection-in-efi-boot-stub.patch b/queue-3.7/x86-efi-fix-display-detection-in-efi-boot-stub.patch new file mode 100644 index 00000000000..59ee84b64bd --- /dev/null +++ b/queue-3.7/x86-efi-fix-display-detection-in-efi-boot-stub.patch @@ -0,0 +1,46 @@ +From 70a479cbe80296d3113e65cc2f713a5101061daf Mon Sep 17 00:00:00 2001 +From: David Woodhouse +Date: Mon, 7 Jan 2013 21:52:16 +0000 +Subject: x86, efi: Fix display detection in EFI boot stub + +From: David Woodhouse + +commit 70a479cbe80296d3113e65cc2f713a5101061daf upstream. + +When booting under OVMF we have precisely one GOP device, and it +implements the ConOut protocol. + +We break out of the loop when we look at it... and then promptly abort +because 'first_gop' never gets set. We should set first_gop *before* +breaking out of the loop. Yes, it doesn't really mean "first" any more, +but that doesn't matter. It's only a flag to indicate that a suitable +GOP was found. + +In fact, we'd do just as well to initialise 'width' to zero in this +function, then just check *that* instead of first_gop. But I'll do the +minimal fix for now (and for stable@). + +Signed-off-by: David Woodhouse +Link: http://lkml.kernel.org/r/1358513837.2397.247.camel@shinybook.infradead.org +Signed-off-by: H. Peter Anvin +Cc: Matt Fleming +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/boot/compressed/eboot.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/arch/x86/boot/compressed/eboot.c ++++ b/arch/x86/boot/compressed/eboot.c +@@ -316,10 +316,9 @@ static efi_status_t setup_gop(struct scr + * Once we've found a GOP supporting ConOut, + * don't bother looking any further. + */ ++ first_gop = gop; + if (conout_found) + break; +- +- first_gop = gop; + } + } + diff --git a/queue-3.7/x86-efi-set-runtime_version-to-the-efi-spec-revision.patch b/queue-3.7/x86-efi-set-runtime_version-to-the-efi-spec-revision.patch new file mode 100644 index 00000000000..026ff5dffc2 --- /dev/null +++ b/queue-3.7/x86-efi-set-runtime_version-to-the-efi-spec-revision.patch @@ -0,0 +1,38 @@ +From 712ba9e9afc4b3d3d6fa81565ca36fe518915c01 Mon Sep 17 00:00:00 2001 +From: Matt Fleming +Date: Fri, 25 Jan 2013 10:07:25 +0000 +Subject: x86, efi: Set runtime_version to the EFI spec revision + +From: Matt Fleming + +commit 712ba9e9afc4b3d3d6fa81565ca36fe518915c01 upstream. + +efi.runtime_version is erroneously being set to the value of the +vendor's firmware revision instead of that of the implemented EFI +specification. We can't deduce which EFI functions are available based +on the revision of the vendor's firmware since the version scheme is +likely to be unique to each vendor. + +What we really need to know is the revision of the implemented EFI +specification, which is available in the EFI System Table header. + +Signed-off-by: Matt Fleming +Cc: Seiji Aguchi +Cc: Matthew Garrett +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/platform/efi/efi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/platform/efi/efi.c ++++ b/arch/x86/platform/efi/efi.c +@@ -949,7 +949,7 @@ void __init efi_enter_virtual_mode(void) + * + * Call EFI services through wrapper functions. + */ +- efi.runtime_version = efi_systab.fw_revision; ++ efi.runtime_version = efi_systab.hdr.revision; + efi.get_time = virt_efi_get_time; + efi.set_time = virt_efi_set_time; + efi.get_wakeup_time = virt_efi_get_wakeup_time;