iommu/amd: Don't use MSI address range for DMA addresses
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / x86 / kernel / crash.c
blobebd4c51d096a525cbc6978561e11b3a4afbeb385
1 /*
2 * Architecture specific (i386/x86_64) functions for kexec based crash dumps.
4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
6 * Copyright (C) IBM Corporation, 2004. All rights reserved.
8 */
10 #include <linux/init.h>
11 #include <linux/types.h>
12 #include <linux/kernel.h>
13 #include <linux/smp.h>
14 #include <linux/reboot.h>
15 #include <linux/kexec.h>
16 #include <linux/delay.h>
17 #include <linux/elf.h>
18 #include <linux/elfcore.h>
20 #include <asm/processor.h>
21 #include <asm/hardirq.h>
22 #include <asm/nmi.h>
23 #include <asm/hw_irq.h>
24 #include <asm/apic.h>
25 #include <asm/hpet.h>
26 #include <linux/kdebug.h>
27 #include <asm/cpu.h>
28 #include <asm/reboot.h>
29 #include <asm/virtext.h>
31 #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
33 static void kdump_nmi_callback(int cpu, struct die_args *args)
35 struct pt_regs *regs;
36 #ifdef CONFIG_X86_32
37 struct pt_regs fixed_regs;
38 #endif
40 regs = args->regs;
42 #ifdef CONFIG_X86_32
43 if (!user_mode_vm(regs)) {
44 crash_fixup_ss_esp(&fixed_regs, regs);
45 regs = &fixed_regs;
47 #endif
48 crash_save_cpu(regs, cpu);
50 /* Disable VMX or SVM if needed.
52 * We need to disable virtualization on all CPUs.
53 * Having VMX or SVM enabled on any CPU may break rebooting
54 * after the kdump kernel has finished its task.
56 cpu_emergency_vmxoff();
57 cpu_emergency_svm_disable();
59 disable_local_APIC();
62 static void kdump_nmi_shootdown_cpus(void)
64 nmi_shootdown_cpus(kdump_nmi_callback);
66 disable_local_APIC();
69 #else
70 static void kdump_nmi_shootdown_cpus(void)
72 /* There are no cpus to shootdown */
74 #endif
76 void native_machine_crash_shutdown(struct pt_regs *regs)
78 /* This function is only called after the system
79 * has panicked or is otherwise in a critical state.
80 * The minimum amount of code to allow a kexec'd kernel
81 * to run successfully needs to happen here.
83 * In practice this means shooting down the other cpus in
84 * an SMP system.
86 /* The kernel is broken so disable interrupts */
87 local_irq_disable();
89 kdump_nmi_shootdown_cpus();
91 /* Booting kdump kernel with VMX or SVM enabled won't work,
92 * because (among other limitations) we can't disable paging
93 * with the virt flags.
95 cpu_emergency_vmxoff();
96 cpu_emergency_svm_disable();
98 lapic_shutdown();
99 #if defined(CONFIG_X86_IO_APIC)
100 disable_IO_APIC();
101 #endif
102 #ifdef CONFIG_HPET_TIMER
103 hpet_disable();
104 #endif
105 crash_save_cpu(regs, safe_smp_processor_id());