aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/aperture_64.c46
-rw-r--r--arch/x86/xen/mmu_hvm.c2
2 files changed, 46 insertions, 2 deletions
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index f5d92bc3b884..2c4d5ece7456 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -30,6 +30,7 @@
30#include <asm/dma.h> 30#include <asm/dma.h>
31#include <asm/amd_nb.h> 31#include <asm/amd_nb.h>
32#include <asm/x86_init.h> 32#include <asm/x86_init.h>
33#include <linux/crash_dump.h>
33 34
34/* 35/*
35 * Using 512M as goal, in case kexec will load kernel_big 36 * Using 512M as goal, in case kexec will load kernel_big
@@ -56,6 +57,33 @@ int fallback_aper_force __initdata;
56 57
57int fix_aperture __initdata = 1; 58int fix_aperture __initdata = 1;
58 59
60#ifdef CONFIG_PROC_VMCORE
61/*
62 * If the first kernel maps the aperture over e820 RAM, the kdump kernel will
63 * use the same range because it will remain configured in the northbridge.
64 * Trying to dump this area via /proc/vmcore may crash the machine, so exclude
65 * it from vmcore.
66 */
67static unsigned long aperture_pfn_start, aperture_page_count;
68
69static int gart_oldmem_pfn_is_ram(unsigned long pfn)
70{
71 return likely((pfn < aperture_pfn_start) ||
72 (pfn >= aperture_pfn_start + aperture_page_count));
73}
74
75static void exclude_from_vmcore(u64 aper_base, u32 aper_order)
76{
77 aperture_pfn_start = aper_base >> PAGE_SHIFT;
78 aperture_page_count = (32 * 1024 * 1024) << aper_order >> PAGE_SHIFT;
79 WARN_ON(register_oldmem_pfn_is_ram(&gart_oldmem_pfn_is_ram));
80}
81#else
82static void exclude_from_vmcore(u64 aper_base, u32 aper_order)
83{
84}
85#endif
86
59/* This code runs before the PCI subsystem is initialized, so just 87/* This code runs before the PCI subsystem is initialized, so just
60 access the northbridge directly. */ 88 access the northbridge directly. */
61 89
@@ -435,8 +463,16 @@ int __init gart_iommu_hole_init(void)
435 463
436out: 464out:
437 if (!fix && !fallback_aper_force) { 465 if (!fix && !fallback_aper_force) {
438 if (last_aper_base) 466 if (last_aper_base) {
467 /*
468 * If this is the kdump kernel, the first kernel
469 * may have allocated the range over its e820 RAM
470 * and fixed up the northbridge
471 */
472 exclude_from_vmcore(last_aper_base, last_aper_order);
473
439 return 1; 474 return 1;
475 }
440 return 0; 476 return 0;
441 } 477 }
442 478
@@ -473,6 +509,14 @@ out:
473 return 0; 509 return 0;
474 } 510 }
475 511
512 /*
513 * If this is the kdump kernel _and_ the first kernel did not
514 * configure the aperture in the northbridge, this range may
515 * overlap with the first kernel's memory. We can't access the
516 * range through vmcore even though it should be part of the dump.
517 */
518 exclude_from_vmcore(aper_alloc, aper_order);
519
476 /* Fix up the north bridges */ 520 /* Fix up the north bridges */
477 for (i = 0; i < amd_nb_bus_dev_ranges[i].dev_limit; i++) { 521 for (i = 0; i < amd_nb_bus_dev_ranges[i].dev_limit; i++) {
478 int bus, dev_base, dev_limit; 522 int bus, dev_base, dev_limit;
diff --git a/arch/x86/xen/mmu_hvm.c b/arch/x86/xen/mmu_hvm.c
index 2cfcfe4f6b2a..dd2ad82eee80 100644
--- a/arch/x86/xen/mmu_hvm.c
+++ b/arch/x86/xen/mmu_hvm.c
@@ -75,6 +75,6 @@ void __init xen_hvm_init_mmu_ops(void)
75 if (is_pagetable_dying_supported()) 75 if (is_pagetable_dying_supported())
76 pv_mmu_ops.exit_mmap = xen_hvm_exit_mmap; 76 pv_mmu_ops.exit_mmap = xen_hvm_exit_mmap;
77#ifdef CONFIG_PROC_VMCORE 77#ifdef CONFIG_PROC_VMCORE
78 register_oldmem_pfn_is_ram(&xen_oldmem_pfn_is_ram); 78 WARN_ON(register_oldmem_pfn_is_ram(&xen_oldmem_pfn_is_ram));
79#endif 79#endif
80} 80}