]>
Commit | Line | Data |
---|---|---|
cc90b958 BS |
1 | Subject: xen3 arch-x86 |
2 | From: http://xenbits.xensource.com/linux-2.6.18-xen.hg (tip 728:832aac894efd) | |
3 | Patch-mainline: obsolete | |
4 | Acked-by: jbeulich@novell.com | |
5 | ||
6 | Index: head-2008-12-01/arch/x86/Makefile | |
7 | =================================================================== | |
8 | --- head-2008-12-01.orig/arch/x86/Makefile 2008-12-01 10:53:14.000000000 +0100 | |
9 | +++ head-2008-12-01/arch/x86/Makefile 2008-12-01 11:11:08.000000000 +0100 | |
10 | @@ -115,6 +115,10 @@ mcore-y := arch/x86/mach-default/ | |
11 | mflags-$(CONFIG_X86_VOYAGER) := -Iinclude/asm-x86/mach-voyager | |
12 | mcore-$(CONFIG_X86_VOYAGER) := arch/x86/mach-voyager/ | |
13 | ||
14 | +# Xen subarch support | |
15 | +mflags-$(CONFIG_X86_XEN) := -Iinclude/asm-x86/mach-xen | |
16 | +mcore-$(CONFIG_X86_XEN) := arch/x86/mach-xen/ | |
17 | + | |
18 | # generic subarchitecture | |
19 | mflags-$(CONFIG_X86_GENERICARCH):= -Iinclude/asm-x86/mach-generic | |
20 | fcore-$(CONFIG_X86_GENERICARCH) += arch/x86/mach-generic/ | |
21 | @@ -183,9 +187,26 @@ drivers-$(CONFIG_KDB) += arch/x86/kdb/ | |
22 | ||
23 | boot := arch/x86/boot | |
24 | ||
25 | -PHONY += zImage bzImage compressed zlilo bzlilo \ | |
26 | +PHONY += zImage bzImage vmlinuz compressed zlilo bzlilo \ | |
27 | zdisk bzdisk fdimage fdimage144 fdimage288 isoimage install | |
28 | ||
29 | +ifdef CONFIG_XEN | |
30 | +CPPFLAGS := -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION) \ | |
31 | + -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen $(CPPFLAGS) | |
32 | + | |
33 | +ifdef CONFIG_X86_64 | |
34 | +LDFLAGS_vmlinux := -e startup_64 | |
35 | +endif | |
36 | + | |
37 | +# Default kernel to build | |
38 | +all: vmlinuz | |
39 | + | |
40 | +# KBUILD_IMAGE specifies the target image being built | |
41 | +KBUILD_IMAGE := $(boot)/vmlinuz | |
42 | + | |
43 | +vmlinuz: vmlinux | |
44 | + $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) | |
45 | +else | |
46 | # Default kernel to build | |
47 | all: bzImage | |
48 | ||
49 | @@ -208,6 +229,7 @@ zdisk bzdisk: vmlinux | |
50 | ||
51 | fdimage fdimage144 fdimage288 isoimage: vmlinux | |
52 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ | |
53 | +endif | |
54 | ||
55 | install: | |
56 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install | |
57 | Index: head-2008-12-01/arch/x86/boot/Makefile | |
58 | =================================================================== | |
59 | --- head-2008-12-01.orig/arch/x86/boot/Makefile 2008-12-01 10:53:14.000000000 +0100 | |
60 | +++ head-2008-12-01/arch/x86/boot/Makefile 2008-12-01 11:11:08.000000000 +0100 | |
61 | @@ -25,7 +25,7 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA | |
62 | ||
63 | #RAMDISK := -DRAMDISK=512 | |
64 | ||
65 | -targets := vmlinux.bin setup.bin setup.elf zImage bzImage | |
66 | +targets := vmlinux.bin setup.bin setup.elf zImage bzImage vmlinuz vmlinux-stripped | |
67 | subdir- := compressed | |
68 | ||
69 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o | |
70 | @@ -190,5 +190,13 @@ zlilo: $(BOOTIMAGE) | |
71 | cp System.map $(INSTALL_PATH)/ | |
72 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | |
73 | ||
74 | +$(obj)/vmlinuz: $(obj)/vmlinux-stripped FORCE | |
75 | + $(call if_changed,gzip) | |
76 | + @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' | |
77 | + | |
78 | +$(obj)/vmlinux-stripped: OBJCOPYFLAGS := -g --strip-unneeded | |
79 | +$(obj)/vmlinux-stripped: vmlinux FORCE | |
80 | + $(call if_changed,objcopy) | |
81 | + | |
82 | install: | |
83 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" | |
84 | Index: head-2008-12-01/arch/x86/kernel/Makefile | |
85 | =================================================================== | |
86 | --- head-2008-12-01.orig/arch/x86/kernel/Makefile 2008-12-01 10:53:14.000000000 +0100 | |
87 | +++ head-2008-12-01/arch/x86/kernel/Makefile 2008-12-01 11:14:33.000000000 +0100 | |
88 | @@ -99,10 +99,13 @@ scx200-y += scx200_32.o | |
89 | ||
90 | obj-$(CONFIG_OLPC) += olpc.o | |
91 | ||
92 | +obj-$(CONFIG_X86_XEN) += fixup.o | |
93 | + | |
94 | ### | |
95 | # 64 bit specific files | |
96 | ifeq ($(CONFIG_X86_64),y) | |
97 | obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o | |
98 | + obj-$(CONFIG_X86_XEN_GENAPIC) += genapic_xen_64.o | |
99 | obj-y += bios_uv.o | |
100 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o | |
101 | obj-$(CONFIG_AUDIT) += audit_64.o | |
102 | @@ -116,4 +119,10 @@ ifeq ($(CONFIG_X86_64),y) | |
103 | obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o | |
104 | ||
105 | obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o | |
106 | + | |
107 | + time_64-$(CONFIG_XEN) += time_32.o | |
108 | + pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o | |
109 | endif | |
110 | + | |
111 | +disabled-obj-$(CONFIG_XEN) := i8259_$(BITS).o reboot.o smpboot_$(BITS).o | |
112 | +%/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) := | |
113 | Index: head-2008-12-01/arch/x86/kernel/acpi/Makefile | |
114 | =================================================================== | |
115 | --- head-2008-12-01.orig/arch/x86/kernel/acpi/Makefile 2008-12-01 10:53:14.000000000 +0100 | |
116 | +++ head-2008-12-01/arch/x86/kernel/acpi/Makefile 2008-12-01 11:11:08.000000000 +0100 | |
117 | @@ -5,6 +5,9 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wake | |
118 | ||
119 | ifneq ($(CONFIG_ACPI_PROCESSOR),) | |
120 | obj-y += cstate.o processor.o | |
121 | +ifneq ($(CONFIG_PROCESSOR_EXTERNAL_CONTROL),) | |
122 | +obj-$(CONFIG_XEN) += processor_extcntl_xen.o | |
123 | +endif | |
124 | endif | |
125 | ||
126 | $(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin | |
127 | @@ -12,3 +15,4 @@ $(obj)/wakeup_rm.o: $(obj)/realmode/w | |
128 | $(obj)/realmode/wakeup.bin: FORCE | |
129 | $(Q)$(MAKE) $(build)=$(obj)/realmode | |
130 | ||
131 | +disabled-obj-$(CONFIG_XEN) := cstate.o wakeup_$(BITS).o | |
132 | Index: head-2008-12-01/arch/x86/kernel/acpi/boot.c | |
133 | =================================================================== | |
134 | --- head-2008-12-01.orig/arch/x86/kernel/acpi/boot.c 2008-12-01 10:53:14.000000000 +0100 | |
135 | +++ head-2008-12-01/arch/x86/kernel/acpi/boot.c 2008-12-01 11:11:08.000000000 +0100 | |
136 | @@ -130,8 +130,10 @@ char *__init __acpi_map_table(unsigned l | |
137 | if (!phys || !size) | |
138 | return NULL; | |
139 | ||
140 | +#ifndef CONFIG_XEN | |
141 | if (phys+size <= (max_low_pfn_mapped << PAGE_SHIFT)) | |
142 | return __va(phys); | |
143 | +#endif | |
144 | ||
145 | offset = phys & (PAGE_SIZE - 1); | |
146 | mapped_size = PAGE_SIZE - offset; | |
147 | Index: head-2008-12-01/arch/x86/kernel/acpi/processor.c | |
148 | =================================================================== | |
149 | --- head-2008-12-01.orig/arch/x86/kernel/acpi/processor.c 2008-12-01 10:53:14.000000000 +0100 | |
150 | +++ head-2008-12-01/arch/x86/kernel/acpi/processor.c 2008-12-01 11:11:08.000000000 +0100 | |
151 | @@ -75,7 +75,18 @@ static void init_intel_pdc(struct acpi_p | |
152 | /* Initialize _PDC data based on the CPU vendor */ | |
153 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr) | |
154 | { | |
155 | +#ifdef CONFIG_XEN | |
156 | + /* | |
157 | + * As a work-around, just use cpu0's cpuinfo for all processors. | |
158 | + * Further work is required to expose xen hypervisor interface of | |
159 | + * getting physical cpuinfo to dom0 kernel and then | |
160 | + * arch_acpi_processor_init_pdc can set _PDC parameters according | |
161 | + * to Xen's phys information. | |
162 | + */ | |
163 | + struct cpuinfo_x86 *c = &boot_cpu_data; | |
164 | +#else | |
165 | struct cpuinfo_x86 *c = &cpu_data(pr->id); | |
166 | +#endif | |
167 | ||
168 | pr->pdc = NULL; | |
169 | if (c->x86_vendor == X86_VENDOR_INTEL) | |
170 | Index: head-2008-12-01/arch/x86/kernel/cpu/mtrr/Makefile | |
171 | =================================================================== | |
172 | --- head-2008-12-01.orig/arch/x86/kernel/cpu/mtrr/Makefile 2008-12-01 10:53:14.000000000 +0100 | |
173 | +++ head-2008-12-01/arch/x86/kernel/cpu/mtrr/Makefile 2008-12-01 11:11:08.000000000 +0100 | |
174 | @@ -1,3 +1,4 @@ | |
175 | obj-y := main.o if.o generic.o state.o | |
176 | obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o | |
177 | ||
178 | +obj-$(CONFIG_XEN) := main.o if.o | |
179 | Index: head-2008-12-01/arch/x86/kernel/crash.c | |
180 | =================================================================== | |
181 | --- head-2008-12-01.orig/arch/x86/kernel/crash.c 2008-12-01 10:53:14.000000000 +0100 | |
182 | +++ head-2008-12-01/arch/x86/kernel/crash.c 2008-12-01 11:11:08.000000000 +0100 | |
183 | @@ -32,6 +32,7 @@ | |
184 | /* This keeps a track of which one is crashing cpu. */ | |
185 | static int crashing_cpu; | |
186 | ||
187 | +#ifndef CONFIG_XEN | |
188 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) | |
189 | static atomic_t waiting_for_crash_ipi; | |
190 | ||
191 | @@ -190,6 +191,7 @@ static void halt_current_cpu(struct pt_r | |
192 | /* There are no cpus to shootdown */ | |
193 | } | |
194 | #endif | |
195 | +#endif /* CONFIG_XEN */ | |
196 | ||
197 | void native_machine_crash_shutdown(struct pt_regs *regs) | |
198 | { | |
199 | @@ -206,11 +208,13 @@ void native_machine_crash_shutdown(struc | |
200 | ||
201 | /* Make a note of crashing cpu. Will be used in NMI callback.*/ | |
202 | crashing_cpu = safe_smp_processor_id(); | |
203 | +#ifndef CONFIG_XEN | |
204 | nmi_shootdown_cpus(); | |
205 | lapic_shutdown(); | |
206 | #if defined(CONFIG_X86_IO_APIC) | |
207 | disable_IO_APIC(); | |
208 | #endif | |
209 | +#endif /* CONFIG_XEN */ | |
210 | #ifdef CONFIG_HPET_TIMER | |
211 | hpet_disable(); | |
212 | #endif | |
213 | Index: head-2008-12-01/arch/x86/lib/Makefile | |
214 | =================================================================== | |
215 | --- head-2008-12-01.orig/arch/x86/lib/Makefile 2008-12-01 10:53:14.000000000 +0100 | |
216 | +++ head-2008-12-01/arch/x86/lib/Makefile 2008-12-01 11:11:08.000000000 +0100 | |
217 | @@ -25,3 +25,5 @@ else | |
218 | lib-y += memmove_64.o memset_64.o | |
219 | lib-y += copy_user_64.o rwlock_64.o copy_user_nocache_64.o | |
220 | endif | |
221 | + | |
222 | +lib-$(CONFIG_XEN_SCRUB_PAGES) += scrub.o | |
223 | Index: head-2008-12-01/arch/x86/mm/Makefile | |
224 | =================================================================== | |
225 | --- head-2008-12-01.orig/arch/x86/mm/Makefile 2008-12-01 10:53:14.000000000 +0100 | |
226 | +++ head-2008-12-01/arch/x86/mm/Makefile 2008-12-01 11:11:08.000000000 +0100 | |
227 | @@ -21,4 +21,6 @@ obj-$(CONFIG_K8_NUMA) += k8topology_64. | |
228 | endif | |
229 | obj-$(CONFIG_ACPI_NUMA) += srat_$(BITS).o | |
230 | ||
231 | +obj-$(CONFIG_XEN) += hypervisor.o | |
232 | + | |
233 | obj-$(CONFIG_MEMTEST) += memtest.o | |
234 | Index: head-2008-12-01/arch/x86/oprofile/Makefile | |
235 | =================================================================== | |
236 | --- head-2008-12-01.orig/arch/x86/oprofile/Makefile 2008-12-01 10:53:14.000000000 +0100 | |
237 | +++ head-2008-12-01/arch/x86/oprofile/Makefile 2008-12-01 11:11:08.000000000 +0100 | |
238 | @@ -6,7 +6,14 @@ DRIVER_OBJS = $(addprefix ../../../drive | |
239 | oprofilefs.o oprofile_stats.o \ | |
240 | timer_int.o ) | |
241 | ||
242 | +ifdef CONFIG_XEN | |
243 | +XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \ | |
244 | + xenoprofile.o) | |
245 | +oprofile-y := $(DRIVER_OBJS) \ | |
246 | + $(XENOPROF_COMMON_OBJS) xenoprof.o | |
247 | +else | |
248 | oprofile-y := $(DRIVER_OBJS) init.o backtrace.o | |
249 | oprofile-$(CONFIG_X86_LOCAL_APIC) += nmi_int.o op_model_athlon.o \ | |
250 | op_model_ppro.o op_model_p4.o | |
251 | oprofile-$(CONFIG_X86_IO_APIC) += nmi_timer_int.o | |
252 | +endif | |
253 | Index: head-2008-12-01/arch/x86/pci/Makefile | |
254 | =================================================================== | |
255 | --- head-2008-12-01.orig/arch/x86/pci/Makefile 2008-12-01 10:53:14.000000000 +0100 | |
256 | +++ head-2008-12-01/arch/x86/pci/Makefile 2008-12-01 11:11:08.000000000 +0100 | |
257 | @@ -4,6 +4,9 @@ obj-$(CONFIG_PCI_BIOS) += pcbios.o | |
258 | obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_$(BITS).o direct.o mmconfig-shared.o | |
259 | obj-$(CONFIG_PCI_DIRECT) += direct.o | |
260 | obj-$(CONFIG_PCI_OLPC) += olpc.o | |
261 | +# pcifront should be after mmconfig.o and direct.o as it should only | |
262 | +# take over if direct access to the PCI bus is unavailable | |
263 | +obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += pcifront.o | |
264 | ||
265 | obj-y += fixup.o | |
266 | obj-$(CONFIG_ACPI) += acpi.o | |
267 | Index: head-2008-12-01/include/asm-x86/acpi.h | |
268 | =================================================================== | |
269 | --- head-2008-12-01.orig/include/asm-x86/acpi.h 2008-12-01 10:53:14.000000000 +0100 | |
270 | +++ head-2008-12-01/include/asm-x86/acpi.h 2008-12-01 11:11:08.000000000 +0100 | |
271 | @@ -30,6 +30,10 @@ | |
272 | #include <asm/mmu.h> | |
273 | #include <asm/mpspec.h> | |
274 | ||
275 | +#ifdef CONFIG_XEN | |
276 | +#include <xen/interface/platform.h> | |
277 | +#endif | |
278 | + | |
279 | #define COMPILER_DEPENDENT_INT64 long long | |
280 | #define COMPILER_DEPENDENT_UINT64 unsigned long long | |
281 | ||
282 | @@ -124,6 +128,27 @@ extern unsigned long acpi_wakeup_address | |
283 | /* early initialization routine */ | |
284 | extern void acpi_reserve_bootmem(void); | |
285 | ||
286 | +#ifdef CONFIG_XEN | |
287 | +static inline int acpi_notify_hypervisor_state(u8 sleep_state, | |
288 | + u32 pm1a_cnt_val, | |
289 | + u32 pm1b_cnt_val) | |
290 | +{ | |
291 | + struct xen_platform_op op = { | |
292 | + .cmd = XENPF_enter_acpi_sleep, | |
293 | + .interface_version = XENPF_INTERFACE_VERSION, | |
294 | + .u = { | |
295 | + .enter_acpi_sleep = { | |
296 | + .pm1a_cnt_val = pm1a_cnt_val, | |
297 | + .pm1b_cnt_val = pm1b_cnt_val, | |
298 | + .sleep_state = sleep_state, | |
299 | + }, | |
300 | + }, | |
301 | + }; | |
302 | + | |
303 | + return HYPERVISOR_platform_op(&op); | |
304 | +} | |
305 | +#endif /* CONFIG_XEN */ | |
306 | + | |
307 | /* | |
308 | * Check if the CPU can handle C2 and deeper | |
309 | */ | |
310 | @@ -156,7 +181,9 @@ static inline void disable_acpi(void) { | |
311 | ||
312 | #endif /* !CONFIG_ACPI */ | |
313 | ||
314 | +#ifndef CONFIG_XEN | |
315 | #define ARCH_HAS_POWER_INIT 1 | |
316 | +#endif | |
317 | ||
318 | struct bootnode; | |
319 | ||
320 | Index: head-2008-12-01/include/asm-x86/apic.h | |
321 | =================================================================== | |
322 | --- head-2008-12-01.orig/include/asm-x86/apic.h 2008-12-01 10:53:14.000000000 +0100 | |
323 | +++ head-2008-12-01/include/asm-x86/apic.h 2008-12-01 11:11:08.000000000 +0100 | |
324 | @@ -12,7 +12,9 @@ | |
325 | #include <asm/cpufeature.h> | |
326 | #include <asm/msr.h> | |
327 | ||
328 | +#ifndef CONFIG_XEN | |
329 | #define ARCH_APICTIMER_STOPS_ON_C3 1 | |
330 | +#endif | |
331 | ||
332 | /* | |
333 | * Debugging macros | |
334 | Index: head-2008-12-01/include/asm-x86/kexec.h | |
335 | =================================================================== | |
336 | --- head-2008-12-01.orig/include/asm-x86/kexec.h 2008-12-01 10:53:14.000000000 +0100 | |
337 | +++ head-2008-12-01/include/asm-x86/kexec.h 2008-12-01 11:11:08.000000000 +0100 | |
338 | @@ -170,6 +170,19 @@ relocate_kernel(unsigned long indirectio | |
339 | unsigned long start_address) ATTRIB_NORET; | |
340 | #endif | |
341 | ||
342 | +/* Under Xen we need to work with machine addresses. These macros give the | |
343 | + * machine address of a certain page to the generic kexec code instead of | |
344 | + * the pseudo physical address which would be given by the default macros. | |
345 | + */ | |
346 | + | |
347 | +#ifdef CONFIG_XEN | |
348 | +#define KEXEC_ARCH_HAS_PAGE_MACROS | |
349 | +#define kexec_page_to_pfn(page) pfn_to_mfn(page_to_pfn(page)) | |
350 | +#define kexec_pfn_to_page(pfn) pfn_to_page(mfn_to_pfn(pfn)) | |
351 | +#define kexec_virt_to_phys(addr) virt_to_machine(addr) | |
352 | +#define kexec_phys_to_virt(addr) phys_to_virt(machine_to_phys(addr)) | |
353 | +#endif | |
354 | + | |
355 | #endif /* __ASSEMBLY__ */ | |
356 | ||
357 | #endif /* _KEXEC_H */ |