]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
x86: wrap kexec feature with CONFIG_KEXEC
authorJonathan Creekmore <jonathan.creekmore@gmail.com>
Wed, 9 Sep 2015 14:28:27 +0000 (16:28 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 9 Sep 2015 14:28:27 +0000 (16:28 +0200)
Add the appropriate #if checks around the kexec code in the x86 codebase
so that the feature can actually be turned off by the flag instead of
always required to be enabled on x86.

Signed-off-by: Jonathan Creekmore <jonathan.creekmore@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: David Vrabel <david.vrabel@citrix.com>
xen/Rules.mk
xen/arch/x86/Makefile
xen/arch/x86/setup.c
xen/arch/x86/x86_64/compat/entry.S
xen/arch/x86/x86_64/entry.S
xen/common/Makefile
xen/include/asm-x86/config.h
xen/include/xen/kexec.h

index feb08d689ac91c49ec7a3ae81d08f9bd8353da72..bf19d20ac7fc853bbbb487f0ffc4d67677878ae1 100644 (file)
@@ -10,6 +10,7 @@ lock_profile  ?= n
 crash_debug   ?= n
 frame_pointer ?= n
 lto           ?= n
+kexec         ?= y
 
 include $(XEN_ROOT)/Config.mk
 
@@ -72,6 +73,11 @@ ifneq ($(max_phys_irqs),)
 CFLAGS-y                += -DMAX_PHYS_IRQS=$(max_phys_irqs)
 endif
 
+CONFIG_KEXEC-$(HAS_KEXEC) := $(kexec)
+CONFIG_KEXEC              := $(CONFIG_KEXEC-y)
+
+CFLAGS-$(CONFIG_KEXEC)  += -DCONFIG_KEXEC
+
 AFLAGS-y                += -D__ASSEMBLY__ -include $(BASEDIR)/include/xen/config.h
 
 # Clang's built-in assembler can't handle .code16/.code32/.code64 yet
index 5f2495121f4fe452fd09fdc4045d398c2ed834f0..39a8059b3ebc799188f4ffa07428cc918b6a7285 100644 (file)
@@ -14,6 +14,7 @@ obj-bin-y += bzimage.init.o
 obj-bin-y += clear_page.o
 obj-bin-y += copy_page.o
 obj-y += compat.o
+obj-$(CONFIG_KEXEC) += crash.o
 obj-y += debug.o
 obj-y += delay.o
 obj-bin-y += dmi_scan.init.o
@@ -31,6 +32,7 @@ obj-y += io_apic.o
 obj-y += msi.o
 obj-y += ioport_emulate.o
 obj-y += irq.o
+obj-$(CONFIG_KEXEC) += machine_kexec.o
 obj-y += microcode_amd.o
 obj-y += microcode_intel.o
 # This must come after the vendor specific files.
@@ -56,8 +58,6 @@ obj-y += trace.o
 obj-y += traps.o
 obj-y += usercopy.o
 obj-y += x86_emulate.o
-obj-y += machine_kexec.o
-obj-y += crash.o
 obj-y += tboot.o
 obj-y += hpet.o
 obj-y += vm_event.o
index 3946e4c226cdbefd4450e1549da256ffc596e101..3f4868e1f984f0797444bd880bdcbd244e2cfb1f 100644 (file)
@@ -481,6 +481,7 @@ static void __init parse_video_info(void)
 
 static void __init kexec_reserve_area(struct e820map *e820)
 {
+#ifdef CONFIG_KEXEC
     unsigned long kdump_start = kexec_crash_area.start;
     unsigned long kdump_size  = kexec_crash_area.size;
     static bool_t __initdata is_reserved = 0;
@@ -503,6 +504,7 @@ static void __init kexec_reserve_area(struct e820map *e820)
         printk("Kdump: %luMB (%lukB) at %#lx\n",
                kdump_size >> 20, kdump_size >> 10, kdump_start);
     }
+#endif
 }
 
 static void noinline init_done(void)
@@ -973,6 +975,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
             }
         }
 
+#ifdef CONFIG_KEXEC
         /* Don't overlap with modules. */
         e = consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size),
                              mod, mbi->mods_count, -1);
@@ -981,6 +984,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
             e = (e - kexec_crash_area.size) & PAGE_MASK;
             kexec_crash_area.start = e;
         }
+#endif
     }
 
     if ( modules_headroom && !mod->reserved )
@@ -1125,6 +1129,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
                          PFN_UP(mod[i].mod_end), PAGE_HYPERVISOR);
     }
 
+#ifdef CONFIG_KEXEC
     if ( kexec_crash_area.size )
     {
         unsigned long s = PFN_DOWN(kexec_crash_area.start);
@@ -1135,6 +1140,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
             map_pages_to_xen((unsigned long)__va(kexec_crash_area.start),
                              s, e - s, PAGE_HYPERVISOR);
     }
+#endif
 
     xen_virt_end = ((unsigned long)_end + (1UL << L2_PAGETABLE_SHIFT) - 1) &
                    ~((1UL << L2_PAGETABLE_SHIFT) - 1);
index 152177967f1ba9898e5129e50c118160f859045c..3088aa7651155fe90213921b5d656d8a4d84e84f 100644 (file)
@@ -390,6 +390,10 @@ compat_crash_page_fault:
 
 .section .rodata, "a", @progbits
 
+#ifndef CONFIG_KEXEC
+#define compat_kexec_op do_ni_hypercall
+#endif
+
 ENTRY(compat_hypercall_table)
         .quad compat_set_trap_table     /*  0 */
         .quad do_mmu_update
index 74677a2fe12ebd39a745601ac4619fb370bdde41..28c32143f7980d0649e19bb7245eb811f3b2824c 100644 (file)
@@ -723,6 +723,10 @@ ENTRY(exception_table)
         .endr
         .size exception_table, . - exception_table
 
+#ifndef CONFIG_KEXEC
+#define do_kexec_op do_ni_hypercall
+#endif
+
 ENTRY(hypercall_table)
         .quad do_set_trap_table     /*  0 */
         .quad do_mmu_update
index 3fdf931135a3beecd17ff6a140ce64e1e50e4959..1726fac3249bcde874b485f632d66d87d6d51ec0 100644 (file)
@@ -13,8 +13,8 @@ obj-y += guestcopy.o
 obj-y += irq.o
 obj-y += kernel.o
 obj-y += keyhandler.o
-obj-$(HAS_KEXEC) += kexec.o
-obj-$(HAS_KEXEC) += kimage.o
+obj-$(CONFIG_KEXEC) += kexec.o
+obj-$(CONFIG_KEXEC) += kimage.o
 obj-y += lib.o
 obj-y += lzo.o
 obj-$(HAS_MEM_ACCESS) += mem_access.o
index 3e9be834d960bfccce3d8fd3c3bb881aa4a2a623..52f7ca80c0f9e08d1f1398d3bc07dccd9cd5e9af 100644 (file)
@@ -48,7 +48,6 @@
 #define CONFIG_HOTPLUG_CPU 1
 
 #define CONFIG_XENOPROF 1
-#define CONFIG_KEXEC 1
 #define CONFIG_WATCHDOG 1
 
 #define CONFIG_MULTIBOOT 1
index b7d121d06423142684ba585e7d14887d75fbfdad..baaeb88ac0db270515f2c5f6c371d98e80874143 100644 (file)
@@ -79,6 +79,12 @@ void vmcoreinfo_append_str(const char *fmt, ...)
 #else /* !CONFIG_KEXEC */
 
 #define crashinfo_maxaddr_bits 0
+#define kexecing 0
+
+static inline void kexec_early_calculations(void) {}
+static inline void kexec_crash(void) {}
+static inline void kexec_crash_save_cpu(void) {}
+static inline void set_kexec_crash_area_size(u64 system_ram) {}
 
 #endif