diff options
Diffstat (limited to 'trunk/2.6.22/20016_xen3-auto-arch-i386.patch1')
-rw-r--r-- | trunk/2.6.22/20016_xen3-auto-arch-i386.patch1 | 483 |
1 files changed, 483 insertions, 0 deletions
diff --git a/trunk/2.6.22/20016_xen3-auto-arch-i386.patch1 b/trunk/2.6.22/20016_xen3-auto-arch-i386.patch1 new file mode 100644 index 0000000..159d584 --- /dev/null +++ b/trunk/2.6.22/20016_xen3-auto-arch-i386.patch1 @@ -0,0 +1,483 @@ +Subject: xen3 arch-i386 +From: http://xenbits.xensource.com/xen-3.1-testing.hg (tip 15042) +Patch-mainline: obsolete +Acked-by: jbeulich@novell.com + +--- + arch/i386/Makefile | 24 ++++++++++++++++++++++ + arch/i386/kernel/Makefile | 22 ++++++++++++++++++-- + arch/i386/kernel/acpi/Makefile | 4 +++ + arch/i386/kernel/asm-offsets.c | 7 +++++- + arch/i386/kernel/cpu/Makefile | 5 ++++ + arch/i386/kernel/cpu/mtrr/Makefile | 7 ++++++ + arch/i386/kernel/crash.c | 4 +++ + arch/i386/kernel/machine_kexec.c | 40 +++++++++++++++++++++++++++++++++++++ + arch/i386/kernel/sysenter.c | 18 ++++++++++++++++ + arch/i386/kernel/vm86.c | 12 +++++++++++ + arch/i386/mm/Makefile | 8 +++++++ + arch/i386/oprofile/Makefile | 7 ++++++ + arch/i386/pci/Makefile | 9 ++++++++ + arch/i386/power/Makefile | 4 ++- + include/asm-i386/apic.h | 2 + + include/asm-i386/kexec.h | 14 ++++++++++++ + 16 files changed, 183 insertions(+), 4 deletions(-) + +--- linux-2.6.22.orig/arch/i386/kernel/acpi/Makefile ++++ linux-2.6.22/arch/i386/kernel/acpi/Makefile +@@ -5,3 +5,7 @@ ifneq ($(CONFIG_ACPI_PROCESSOR),) + obj-y += cstate.o processor.o + endif + ++ifdef CONFIG_XEN ++include $(srctree)/scripts/Makefile.xen ++obj-y := $(call cherrypickxen, $(obj-y), $(src)) ++endif +--- linux-2.6.22.orig/arch/i386/kernel/asm-offsets.c ++++ linux-2.6.22/arch/i386/kernel/asm-offsets.c +@@ -92,9 +92,14 @@ void foo(void) + OFFSET(pbe_orig_address, pbe, orig_address); + OFFSET(pbe_next, pbe, next); + ++#ifndef CONFIG_X86_NO_TSS + /* Offset from the sysenter stack to tss.esp0 */ +- DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, x86_tss.esp0) - ++ DEFINE(SYSENTER_stack_esp0, offsetof(struct tss_struct, x86_tss.esp0) - + sizeof(struct tss_struct)); ++#else ++ /* sysenter stack points directly to esp0 */ ++ DEFINE(SYSENTER_stack_esp0, 0); ++#endif + + DEFINE(PAGE_SIZE_asm, PAGE_SIZE); + DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT); +--- linux-2.6.22.orig/arch/i386/kernel/cpu/Makefile ++++ linux-2.6.22/arch/i386/kernel/cpu/Makefile +@@ -19,3 +19,8 @@ obj-$(CONFIG_MTRR) += mtrr/ + obj-$(CONFIG_CPU_FREQ) += cpufreq/ + + obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o ++ ++ifdef CONFIG_XEN ++include $(srctree)/scripts/Makefile.xen ++obj-y := $(call cherrypickxen, $(obj-y), $(src)) ++endif +--- linux-2.6.22.orig/arch/i386/kernel/cpu/mtrr/Makefile ++++ linux-2.6.22/arch/i386/kernel/cpu/mtrr/Makefile +@@ -1,3 +1,10 @@ + obj-y := main.o if.o generic.o state.o + obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o + ++ifdef CONFIG_XEN ++include $(srctree)/scripts/Makefile.xen ++n-obj-xen := generic.o state.o amd.o cyrix.o centaur.o ++ ++obj-y := $(call filterxen, $(obj-y), $(n-obj-xen)) ++obj-y := $(call cherrypickxen, $(obj-y)) ++endif +--- linux-2.6.22.orig/arch/i386/kernel/crash.c ++++ linux-2.6.22/arch/i386/kernel/crash.c +@@ -31,6 +31,7 @@ + /* This keeps a track of which one is crashing cpu. */ + static int crashing_cpu; + ++#ifndef CONFIG_XEN + #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) + static atomic_t waiting_for_crash_ipi; + +@@ -112,6 +113,7 @@ static void nmi_shootdown_cpus(void) + /* There are no cpus to shootdown */ + } + #endif ++#endif /* CONFIG_XEN */ + + void machine_crash_shutdown(struct pt_regs *regs) + { +@@ -128,10 +130,12 @@ void machine_crash_shutdown(struct pt_re + + /* Make a note of crashing cpu. Will be used in NMI callback.*/ + crashing_cpu = safe_smp_processor_id(); ++#ifndef CONFIG_XEN + nmi_shootdown_cpus(); + lapic_shutdown(); + #if defined(CONFIG_X86_IO_APIC) + disable_IO_APIC(); + #endif ++#endif /* CONFIG_XEN */ + crash_save_cpu(regs, safe_smp_processor_id()); + } +--- linux-2.6.22.orig/arch/i386/kernel/machine_kexec.c ++++ linux-2.6.22/arch/i386/kernel/machine_kexec.c +@@ -20,6 +20,10 @@ + #include <asm/desc.h> + #include <asm/system.h> + ++#ifdef CONFIG_XEN ++#include <xen/interface/kexec.h> ++#endif ++ + #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE))) + static u32 kexec_pgd[1024] PAGE_ALIGNED; + #ifdef CONFIG_X86_PAE +@@ -71,6 +75,40 @@ static void load_segments(void) + #undef __STR + } + ++#ifdef CONFIG_XEN ++ ++#define __ma(x) (pfn_to_mfn(__pa((x)) >> PAGE_SHIFT) << PAGE_SHIFT) ++ ++#if PAGES_NR > KEXEC_XEN_NO_PAGES ++#error PAGES_NR is greater than KEXEC_XEN_NO_PAGES - Xen support will break ++#endif ++ ++#if PA_CONTROL_PAGE != 0 ++#error PA_CONTROL_PAGE is non zero - Xen support will break ++#endif ++ ++void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, struct kimage *image) ++{ ++ void *control_page; ++ ++ memset(xki->page_list, 0, sizeof(xki->page_list)); ++ ++ control_page = page_address(image->control_code_page); ++ memcpy(control_page, relocate_kernel, PAGE_SIZE); ++ ++ xki->page_list[PA_CONTROL_PAGE] = __ma(control_page); ++ xki->page_list[PA_PGD] = __ma(kexec_pgd); ++#ifdef CONFIG_X86_PAE ++ xki->page_list[PA_PMD_0] = __ma(kexec_pmd0); ++ xki->page_list[PA_PMD_1] = __ma(kexec_pmd1); ++#endif ++ xki->page_list[PA_PTE_0] = __ma(kexec_pte0); ++ xki->page_list[PA_PTE_1] = __ma(kexec_pte1); ++ ++} ++ ++#endif /* CONFIG_XEN */ ++ + /* + * A architecture hook called to validate the + * proposed image and prepare the control pages +@@ -97,6 +135,7 @@ void machine_kexec_cleanup(struct kimage + { + } + ++#ifndef CONFIG_XEN + /* + * Do not allocate memory (or fail in any way) in machine_kexec(). + * We are past the point of no return, committed to rebooting now. +@@ -147,6 +186,7 @@ NORET_TYPE void machine_kexec(struct kim + relocate_kernel((unsigned long)image->head, (unsigned long)page_list, + image->start, cpu_has_pae); + } ++#endif + + /* crashkernel=size@addr specifies the location to reserve for + * a crash kernel. By reserving this memory we guarantee +--- linux-2.6.22.orig/arch/i386/kernel/Makefile ++++ linux-2.6.22/arch/i386/kernel/Makefile +@@ -47,6 +47,12 @@ obj-y += pcspeaker.o + + obj-$(CONFIG_SCx200) += scx200.o + ++ifdef CONFIG_XEN ++vsyscall_note := vsyscall-note-xen.o ++else ++vsyscall_note := vsyscall-note.o ++endif ++ + # vsyscall.o contains the vsyscall DSO images as __initdata. + # We must build both images before we can assemble it. + # Note: kbuild does not track this dependency due to usage of .incbin +@@ -68,7 +74,7 @@ SYSCFLAGS_vsyscall-int80.so = $(vsyscall + + $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \ + $(obj)/vsyscall-%.so: $(src)/vsyscall.lds \ +- $(obj)/vsyscall-%.o $(obj)/vsyscall-note.o FORCE ++ $(obj)/vsyscall-%.o $(obj)/$(vsyscall_note) FORCE + $(call if_changed,syscall) + + # We also create a special relocatable object that should mirror the symbol +@@ -80,10 +86,22 @@ $(obj)/built-in.o: ld_flags += -R $(obj) + + SYSCFLAGS_vsyscall-syms.o = -r + $(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \ +- $(obj)/vsyscall-sysenter.o $(obj)/vsyscall-note.o FORCE ++ $(obj)/vsyscall-sysenter.o $(obj)/$(vsyscall_note) FORCE + $(call if_changed,syscall) + + k8-y += ../../x86_64/kernel/k8.o + stacktrace-y += ../../x86_64/kernel/stacktrace.o + early-quirks-y += ../../x86_64/kernel/early-quirks.o + ++ifdef CONFIG_XEN ++include $(srctree)/scripts/Makefile.xen ++ ++obj-y += fixup.o ++microcode-$(subst m,y,$(CONFIG_MICROCODE)) := microcode-xen.o ++n-obj-xen := i8259.o timers/ reboot.o smpboot.o trampoline.o ++ ++obj-y := $(call filterxen, $(obj-y), $(n-obj-xen)) ++obj-y := $(call cherrypickxen, $(obj-y)) ++extra-y := $(call cherrypickxen, $(extra-y)) ++%/head-xen.o %/head-xen.s: EXTRA_AFLAGS := ++endif +--- linux-2.6.22.orig/arch/i386/kernel/sysenter.c ++++ linux-2.6.22/arch/i386/kernel/sysenter.c +@@ -37,6 +37,10 @@ enum { + #define VDSO_DEFAULT VDSO_ENABLED + #endif + ++#ifdef CONFIG_XEN ++#include <xen/interface/callback.h> ++#endif ++ + /* + * Should the kernel map a VDSO page into processes and pass its + * address down to glibc upon exec()? +@@ -175,6 +179,7 @@ static __init void relocate_vdso(Elf32_E + + void enable_sep_cpu(void) + { ++#ifndef CONFIG_X86_NO_TSS + int cpu = get_cpu(); + struct tss_struct *tss = &per_cpu(init_tss, cpu); + +@@ -189,6 +194,7 @@ void enable_sep_cpu(void) + wrmsr(MSR_IA32_SYSENTER_ESP, tss->x86_tss.esp1, 0); + wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) sysenter_entry, 0); + put_cpu(); ++#endif + } + + static struct vm_area_struct gate_vma; +@@ -242,6 +248,18 @@ int __init sysenter_setup(void) + + syscall_pages[0] = virt_to_page(syscall_page); + ++#ifdef CONFIG_XEN ++ if (boot_cpu_has(X86_FEATURE_SEP)) { ++ static struct callback_register __initdata sysenter = { ++ .type = CALLBACKTYPE_sysenter, ++ .address = { __KERNEL_CS, (unsigned long)sysenter_entry }, ++ }; ++ ++ if (HYPERVISOR_callback_op(CALLBACKOP_register, &sysenter) < 0) ++ clear_bit(X86_FEATURE_SEP, boot_cpu_data.x86_capability); ++ } ++#endif ++ + gate_vma_init(); + + printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO)); +--- linux-2.6.22.orig/arch/i386/kernel/vm86.c ++++ linux-2.6.22/arch/i386/kernel/vm86.c +@@ -125,7 +125,9 @@ static int copy_vm86_regs_from_user(stru + struct pt_regs * FASTCALL(save_v86_state(struct kernel_vm86_regs * regs)); + struct pt_regs * fastcall save_v86_state(struct kernel_vm86_regs * regs) + { ++#ifndef CONFIG_X86_NO_TSS + struct tss_struct *tss; ++#endif + struct pt_regs *ret; + unsigned long tmp; + +@@ -148,12 +150,16 @@ struct pt_regs * fastcall save_v86_state + do_exit(SIGSEGV); + } + ++#ifndef CONFIG_X86_NO_TSS + tss = &per_cpu(init_tss, get_cpu()); ++#endif + current->thread.esp0 = current->thread.saved_esp0; + current->thread.sysenter_cs = __KERNEL_CS; + load_esp0(tss, ¤t->thread); + current->thread.saved_esp0 = 0; ++#ifndef CONFIG_X86_NO_TSS + put_cpu(); ++#endif + + ret = KVM86->regs32; + +@@ -279,7 +285,9 @@ out: + + static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk) + { ++#ifndef CONFIG_X86_NO_TSS + struct tss_struct *tss; ++#endif + /* + * make sure the vm86() system call doesn't try to do anything silly + */ +@@ -324,12 +332,16 @@ static void do_sys_vm86(struct kernel_vm + tsk->thread.saved_fs = info->regs32->xfs; + savesegment(gs, tsk->thread.saved_gs); + ++#ifndef CONFIG_X86_NO_TSS + tss = &per_cpu(init_tss, get_cpu()); ++#endif + tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0; + if (cpu_has_sep) + tsk->thread.sysenter_cs = 0; + load_esp0(tss, &tsk->thread); ++#ifndef CONFIG_X86_NO_TSS + put_cpu(); ++#endif + + tsk->thread.screen_bitmap = info->screen_bitmap; + if (info->flags & VM86_SCREEN_BITMAP) +--- linux-2.6.22.orig/arch/i386/Makefile ++++ linux-2.6.22/arch/i386/Makefile +@@ -60,6 +60,11 @@ AFLAGS += $(call as-instr,.cfi_startproc + + CFLAGS += $(cflags-y) + ++cppflags-$(CONFIG_XEN) += \ ++ -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION) ++ ++CPPFLAGS += $(cppflags-y) ++ + # Default subarch .c files + mcore-y := mach-default + +@@ -83,6 +88,10 @@ mcore-$(CONFIG_X86_BIGSMP) := mach-defau + mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-i386/mach-summit + mcore-$(CONFIG_X86_SUMMIT) := mach-default + ++# Xen subarch support ++mflags-$(CONFIG_X86_XEN) := -Iinclude/asm-i386/mach-xen ++mcore-$(CONFIG_X86_XEN) := mach-xen ++ + # generic subarchitecture + mflags-$(CONFIG_X86_GENERICARCH) := -Iinclude/asm-i386/mach-generic + mcore-$(CONFIG_X86_GENERICARCH) := mach-default +@@ -118,6 +127,19 @@ boot := arch/i386/boot + PHONY += zImage bzImage compressed zlilo bzlilo \ + zdisk bzdisk fdimage fdimage144 fdimage288 isoimage install + ++ifdef CONFIG_XEN ++CPPFLAGS := -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen $(CPPFLAGS) ++head-y := arch/i386/kernel/head-xen.o arch/i386/kernel/init_task-xen.o ++boot := arch/i386/boot-xen ++.PHONY: vmlinuz ++all: vmlinuz ++ ++vmlinuz: vmlinux ++ $(Q)$(MAKE) $(build)=$(boot) $@ ++ ++install: ++ $(Q)$(MAKE) $(build)=$(boot) XENGUEST=$(XENGUEST) $@ ++else + all: bzImage + + # KBUILD_IMAGE specify target image being built +@@ -140,6 +162,7 @@ fdimage fdimage144 fdimage288 isoimage: + + install: + $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install ++endif + + archclean: + $(Q)$(MAKE) $(clean)=arch/i386/boot +@@ -158,3 +181,4 @@ endef + CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ + arch/$(ARCH)/boot/image.iso \ + arch/$(ARCH)/boot/mtools.conf ++CLEAN_FILES += vmlinuz vmlinux-stripped +--- linux-2.6.22.orig/arch/i386/mm/Makefile ++++ linux-2.6.22/arch/i386/mm/Makefile +@@ -8,3 +8,11 @@ obj-$(CONFIG_NUMA) += discontig.o + obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o + obj-$(CONFIG_HIGHMEM) += highmem.o + obj-$(CONFIG_BOOT_IOREMAP) += boot_ioremap.o ++ ++ifdef CONFIG_XEN ++include $(srctree)/scripts/Makefile.xen ++ ++obj-y += hypervisor.o ++ ++obj-y := $(call cherrypickxen, $(obj-y)) ++endif +--- linux-2.6.22.orig/arch/i386/oprofile/Makefile ++++ linux-2.6.22/arch/i386/oprofile/Makefile +@@ -6,7 +6,14 @@ DRIVER_OBJS = $(addprefix ../../../drive + oprofilefs.o oprofile_stats.o \ + timer_int.o ) + ++ifdef CONFIG_XEN ++XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \ ++ xenoprofile.o) ++oprofile-y := $(DRIVER_OBJS) \ ++ $(XENOPROF_COMMON_OBJS) xenoprof.o ++else + oprofile-y := $(DRIVER_OBJS) init.o backtrace.o + oprofile-$(CONFIG_X86_LOCAL_APIC) += nmi_int.o op_model_athlon.o \ + op_model_ppro.o op_model_p4.o + oprofile-$(CONFIG_X86_IO_APIC) += nmi_timer_int.o ++endif +--- linux-2.6.22.orig/arch/i386/pci/Makefile ++++ linux-2.6.22/arch/i386/pci/Makefile +@@ -4,6 +4,10 @@ obj-$(CONFIG_PCI_BIOS) += pcbios.o + obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o mmconfig-shared.o + obj-$(CONFIG_PCI_DIRECT) += direct.o + ++# pcifront should be after pcbios.o, mmconfig.o, and direct.o as it should only ++# take over if direct access to the PCI bus is unavailable ++obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += pcifront.o ++ + pci-y := fixup.o + pci-$(CONFIG_ACPI) += acpi.o + pci-y += legacy.o irq.o +@@ -12,3 +16,8 @@ pci-$(CONFIG_X86_VISWS) := visws.o fixu + pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o + + obj-y += $(pci-y) common.o early.o ++ ++ifdef CONFIG_XEN ++include $(srctree)/scripts/Makefile.xen ++obj-y := $(call cherrypickxen, $(obj-y)) ++endif +--- linux-2.6.22.orig/arch/i386/power/Makefile ++++ linux-2.6.22/arch/i386/power/Makefile +@@ -1,2 +1,4 @@ +-obj-$(CONFIG_PM) += cpu.o ++obj-$(CONFIG_PM_LEGACY) += cpu.o ++obj-$(CONFIG_SOFTWARE_SUSPEND) += cpu.o ++obj-$(CONFIG_ACPI_SLEEP) += cpu.o + obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o suspend.o +--- linux-2.6.22.orig/include/asm-i386/apic.h ++++ linux-2.6.22/include/asm-i386/apic.h +@@ -111,7 +111,9 @@ extern int APIC_init_uniprocessor (void) + + extern void enable_NMI_through_LVT0 (void * dummy); + ++#ifndef CONFIG_XEN + #define ARCH_APICTIMER_STOPS_ON_C3 1 ++#endif + + extern int timer_over_8254; + extern int local_apic_timer_c2_ok; +--- linux-2.6.22.orig/include/asm-i386/kexec.h ++++ linux-2.6.22/include/asm-i386/kexec.h +@@ -94,6 +94,20 @@ relocate_kernel(unsigned long indirectio + unsigned long start_address, + unsigned int has_pae) ATTRIB_NORET; + ++ ++/* Under Xen we need to work with machine addresses. These macros give the ++ * machine address of a certain page to the generic kexec code instead of ++ * the pseudo physical address which would be given by the default macros. ++ */ ++ ++#ifdef CONFIG_XEN ++#define KEXEC_ARCH_HAS_PAGE_MACROS ++#define kexec_page_to_pfn(page) pfn_to_mfn(page_to_pfn(page)) ++#define kexec_pfn_to_page(pfn) pfn_to_page(mfn_to_pfn(pfn)) ++#define kexec_virt_to_phys(addr) virt_to_machine(addr) ++#define kexec_phys_to_virt(addr) phys_to_virt(machine_to_phys(addr)) ++#endif ++ + #endif /* __ASSEMBLY__ */ + + #endif /* _I386_KEXEC_H */ |