Magellan Linux

Contents of /trunk/kernel26-xen/patches-2.6.25-r1/1013-2.6.25-xen-auto-arch-i386.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 609 - (show annotations) (download)
Fri May 23 17:35:37 2008 UTC (15 years, 11 months ago) by niro
File size: 11187 byte(s)
-using opensuse xen patchset, updated kernel configs

1 Subject: xen3 arch-i386
2 From: http://xenbits.xensource.com/linux-2.6.18-xen.hg (tip 517:d71965a78c20)
3 Patch-mainline: obsolete
4 Acked-by: jbeulich@novell.com
5
6 Index: head-2008-04-15/arch/x86/kernel/asm-offsets_32.c
7 ===================================================================
8 --- head-2008-04-15.orig/arch/x86/kernel/asm-offsets_32.c 2008-04-15 09:41:09.000000000 +0200
9 +++ head-2008-04-15/arch/x86/kernel/asm-offsets_32.c 2008-04-15 09:59:29.000000000 +0200
10 @@ -98,9 +98,14 @@ void foo(void)
11 OFFSET(pbe_orig_address, pbe, orig_address);
12 OFFSET(pbe_next, pbe, next);
13
14 +#ifndef CONFIG_X86_NO_TSS
15 /* Offset from the sysenter stack to tss.sp0 */
16 - DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
17 + DEFINE(SYSENTER_stack_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
18 sizeof(struct tss_struct));
19 +#else
20 + /* sysenter stack points directly to sp0 */
21 + DEFINE(SYSENTER_stack_sp0, 0);
22 +#endif
23
24 DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
25 DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT);
26 Index: head-2008-04-15/arch/x86/kernel/entry_32.S
27 ===================================================================
28 --- head-2008-04-15.orig/arch/x86/kernel/entry_32.S 2008-04-15 09:41:09.000000000 +0200
29 +++ head-2008-04-15/arch/x86/kernel/entry_32.S 2008-04-15 09:59:29.000000000 +0200
30 @@ -288,7 +288,7 @@ ENTRY(ia32_sysenter_target)
31 CFI_SIGNAL_FRAME
32 CFI_DEF_CFA esp, 0
33 CFI_REGISTER esp, ebp
34 - movl TSS_sysenter_sp0(%esp),%esp
35 + movl SYSENTER_stack_sp0(%esp),%esp
36 sysenter_past_esp:
37 /*
38 * No need to follow this irqs on/off section: the syscall
39 @@ -744,7 +744,7 @@ END(device_not_available)
40 * that sets up the real kernel stack. Check here, since we can't
41 * allow the wrong stack to be used.
42 *
43 - * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have
44 + * "SYSENTER_stack_sp0+12" is because the NMI/debug handler will have
45 * already pushed 3 words if it hits on the sysenter instruction:
46 * eflags, cs and eip.
47 *
48 @@ -756,7 +756,7 @@ END(device_not_available)
49 cmpw $__KERNEL_CS,4(%esp); \
50 jne ok; \
51 label: \
52 - movl TSS_sysenter_sp0+offset(%esp),%esp; \
53 + movl SYSENTER_stack_sp0+offset(%esp),%esp; \
54 CFI_DEF_CFA esp, 0; \
55 CFI_UNDEFINED eip; \
56 pushfl; \
57 Index: head-2008-04-15/arch/x86/kernel/machine_kexec_32.c
58 ===================================================================
59 --- head-2008-04-15.orig/arch/x86/kernel/machine_kexec_32.c 2008-04-15 09:41:09.000000000 +0200
60 +++ head-2008-04-15/arch/x86/kernel/machine_kexec_32.c 2008-04-15 09:59:29.000000000 +0200
61 @@ -21,6 +21,10 @@
62 #include <asm/desc.h>
63 #include <asm/system.h>
64
65 +#ifdef CONFIG_XEN
66 +#include <xen/interface/kexec.h>
67 +#endif
68 +
69 #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
70 static u32 kexec_pgd[1024] PAGE_ALIGNED;
71 #ifdef CONFIG_X86_PAE
72 @@ -30,6 +34,55 @@ static u32 kexec_pmd1[1024] PAGE_ALIGNED
73 static u32 kexec_pte0[1024] PAGE_ALIGNED;
74 static u32 kexec_pte1[1024] PAGE_ALIGNED;
75
76 +#ifdef CONFIG_XEN
77 +
78 +#define __ma(x) (pfn_to_mfn(__pa((x)) >> PAGE_SHIFT) << PAGE_SHIFT)
79 +
80 +#if PAGES_NR > KEXEC_XEN_NO_PAGES
81 +#error PAGES_NR is greater than KEXEC_XEN_NO_PAGES - Xen support will break
82 +#endif
83 +
84 +#if PA_CONTROL_PAGE != 0
85 +#error PA_CONTROL_PAGE is non zero - Xen support will break
86 +#endif
87 +
88 +void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, struct kimage *image)
89 +{
90 + void *control_page;
91 +
92 + memset(xki->page_list, 0, sizeof(xki->page_list));
93 +
94 + control_page = page_address(image->control_code_page);
95 + memcpy(control_page, relocate_kernel, PAGE_SIZE);
96 +
97 + xki->page_list[PA_CONTROL_PAGE] = __ma(control_page);
98 + xki->page_list[PA_PGD] = __ma(kexec_pgd);
99 +#ifdef CONFIG_X86_PAE
100 + xki->page_list[PA_PMD_0] = __ma(kexec_pmd0);
101 + xki->page_list[PA_PMD_1] = __ma(kexec_pmd1);
102 +#endif
103 + xki->page_list[PA_PTE_0] = __ma(kexec_pte0);
104 + xki->page_list[PA_PTE_1] = __ma(kexec_pte1);
105 +
106 +}
107 +
108 +int __init machine_kexec_setup_resources(struct resource *hypervisor,
109 + struct resource *phys_cpus,
110 + int nr_phys_cpus)
111 +{
112 + int k;
113 +
114 + /* The per-cpu crash note resources belong to the hypervisor resource */
115 + for (k = 0; k < nr_phys_cpus; k++)
116 + request_resource(hypervisor, phys_cpus + k);
117 +
118 + return 0;
119 +}
120 +
121 +void machine_kexec_register_resources(struct resource *res) { ; }
122 +
123 +#endif /* CONFIG_XEN */
124 +
125 /*
126 * A architecture hook called to validate the
127 * proposed image and prepare the control pages
128 @@ -56,6 +109,7 @@ void machine_kexec_cleanup(struct kimage
129 {
130 }
131
132 +#ifndef CONFIG_XEN
133 /*
134 * Do not allocate memory (or fail in any way) in machine_kexec().
135 * We are past the point of no return, committed to rebooting now.
136 @@ -89,6 +143,7 @@ NORET_TYPE void machine_kexec(struct kim
137 relocate_kernel((unsigned long)image->head, (unsigned long)page_list,
138 image->start, cpu_has_pae);
139 }
140 +#endif
141
142 void arch_crash_save_vmcoreinfo(void)
143 {
144 Index: head-2008-04-15/arch/x86/kernel/traps_32.c
145 ===================================================================
146 --- head-2008-04-15.orig/arch/x86/kernel/traps_32.c 2008-04-15 09:41:09.000000000 +0200
147 +++ head-2008-04-15/arch/x86/kernel/traps_32.c 2008-04-15 09:59:29.000000000 +0200
148 @@ -764,18 +764,11 @@ mem_parity_error(unsigned char reason, s
149 static __kprobes void
150 io_check_error(unsigned char reason, struct pt_regs * regs)
151 {
152 - unsigned long i;
153 -
154 printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
155 show_registers(regs);
156
157 /* Re-enable the IOCK line, wait for a few seconds */
158 - reason = (reason & 0xf) | 8;
159 - outb(reason, 0x61);
160 - i = 2000;
161 - while (--i) udelay(1000);
162 - reason &= ~8;
163 - outb(reason, 0x61);
164 + clear_io_check_error(reason);
165 }
166
167 static __kprobes void
168 Index: head-2008-04-15/arch/x86/kernel/vm86_32.c
169 ===================================================================
170 --- head-2008-04-15.orig/arch/x86/kernel/vm86_32.c 2008-04-15 09:41:09.000000000 +0200
171 +++ head-2008-04-15/arch/x86/kernel/vm86_32.c 2008-04-15 09:59:29.000000000 +0200
172 @@ -122,7 +122,9 @@ static int copy_vm86_regs_from_user(stru
173
174 struct pt_regs * save_v86_state(struct kernel_vm86_regs * regs)
175 {
176 +#ifndef CONFIG_X86_NO_TSS
177 struct tss_struct *tss;
178 +#endif
179 struct pt_regs *ret;
180 unsigned long tmp;
181
182 @@ -145,12 +147,16 @@ struct pt_regs * save_v86_state(struct k
183 do_exit(SIGSEGV);
184 }
185
186 +#ifndef CONFIG_X86_NO_TSS
187 tss = &per_cpu(init_tss, get_cpu());
188 +#endif
189 current->thread.sp0 = current->thread.saved_sp0;
190 current->thread.sysenter_cs = __KERNEL_CS;
191 load_sp0(tss, &current->thread);
192 current->thread.saved_sp0 = 0;
193 +#ifndef CONFIG_X86_NO_TSS
194 put_cpu();
195 +#endif
196
197 ret = KVM86->regs32;
198
199 @@ -276,7 +282,9 @@ out:
200
201 static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk)
202 {
203 +#ifndef CONFIG_X86_NO_TSS
204 struct tss_struct *tss;
205 +#endif
206 /*
207 * make sure the vm86() system call doesn't try to do anything silly
208 */
209 @@ -321,12 +329,16 @@ static void do_sys_vm86(struct kernel_vm
210 tsk->thread.saved_fs = info->regs32->fs;
211 savesegment(gs, tsk->thread.saved_gs);
212
213 +#ifndef CONFIG_X86_NO_TSS
214 tss = &per_cpu(init_tss, get_cpu());
215 +#endif
216 tsk->thread.sp0 = (unsigned long) &info->VM86_TSS_ESP0;
217 if (cpu_has_sep)
218 tsk->thread.sysenter_cs = 0;
219 load_sp0(tss, &tsk->thread);
220 +#ifndef CONFIG_X86_NO_TSS
221 put_cpu();
222 +#endif
223
224 tsk->thread.screen_bitmap = info->screen_bitmap;
225 if (info->flags & VM86_SCREEN_BITMAP)
226 Index: head-2008-04-15/arch/x86/pci/Makefile_32
227 ===================================================================
228 --- head-2008-04-15.orig/arch/x86/pci/Makefile_32 2008-04-15 09:41:09.000000000 +0200
229 +++ head-2008-04-15/arch/x86/pci/Makefile_32 2008-04-15 09:59:29.000000000 +0200
230 @@ -4,6 +4,10 @@ obj-$(CONFIG_PCI_BIOS) += pcbios.o
231 obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_32.o direct.o mmconfig-shared.o
232 obj-$(CONFIG_PCI_DIRECT) += direct.o
233
234 +# pcifront should be after pcbios.o, mmconfig.o, and direct.o as it should only
235 +# take over if direct access to the PCI bus is unavailable
236 +obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += pcifront.o
237 +
238 pci-y := fixup.o
239 pci-$(CONFIG_ACPI) += acpi.o
240 pci-y += legacy.o irq.o
241 Index: head-2008-04-15/arch/x86/power/cpu_32.c
242 ===================================================================
243 --- head-2008-04-15.orig/arch/x86/power/cpu_32.c 2008-04-15 09:41:09.000000000 +0200
244 +++ head-2008-04-15/arch/x86/power/cpu_32.c 2008-04-15 09:59:29.000000000 +0200
245 @@ -63,11 +63,12 @@ static void do_fpu_end(void)
246
247 static void fix_processor_context(void)
248 {
249 +#ifndef CONFIG_X86_NO_TSS
250 int cpu = smp_processor_id();
251 struct tss_struct * t = &per_cpu(init_tss, cpu);
252
253 set_tss_desc(cpu,t); /* This just modifies memory; should not be necessary. But... This is necessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
254 -
255 +#endif
256 load_TR_desc(); /* This does ltr */
257 load_LDT(&current->active_mm->context); /* This does lldt */
258
259 Index: head-2008-04-15/arch/x86/vdso/vdso32-setup.c
260 ===================================================================
261 --- head-2008-04-15.orig/arch/x86/vdso/vdso32-setup.c 2008-04-15 09:41:09.000000000 +0200
262 +++ head-2008-04-15/arch/x86/vdso/vdso32-setup.c 2008-04-15 09:59:29.000000000 +0200
263 @@ -26,6 +26,10 @@
264 #include <asm/vdso.h>
265 #include <asm/proto.h>
266
267 +#ifdef CONFIG_XEN
268 +#include <xen/interface/callback.h>
269 +#endif
270 +
271 enum {
272 VDSO_DISABLED = 0,
273 VDSO_ENABLED = 1,
274 @@ -234,6 +238,7 @@ static inline void map_compat_vdso(int m
275
276 void enable_sep_cpu(void)
277 {
278 +#ifndef CONFIG_XEN
279 int cpu = get_cpu();
280 struct tss_struct *tss = &per_cpu(init_tss, cpu);
281
282 @@ -248,6 +253,35 @@ void enable_sep_cpu(void)
283 wrmsr(MSR_IA32_SYSENTER_ESP, tss->x86_tss.sp1, 0);
284 wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) ia32_sysenter_target, 0);
285 put_cpu();
286 +#else
287 + extern asmlinkage void ia32pv_sysenter_target(void);
288 + static struct callback_register sysenter = {
289 + .type = CALLBACKTYPE_sysenter,
290 + .address = { __KERNEL_CS, (unsigned long)ia32pv_sysenter_target },
291 + };
292 +
293 + if (!boot_cpu_has(X86_FEATURE_SEP))
294 + return;
295 +
296 + get_cpu();
297 +
298 + if (xen_feature(XENFEAT_supervisor_mode_kernel))
299 + sysenter.address.eip = (unsigned long)ia32_sysenter_target;
300 +
301 + switch (HYPERVISOR_callback_op(CALLBACKOP_register, &sysenter)) {
302 + case 0:
303 + break;
304 +#if CONFIG_XEN_COMPAT < 0x030200
305 + case -ENOSYS:
306 + sysenter.type = CALLBACKTYPE_sysenter_deprecated;
307 + if (HYPERVISOR_callback_op(CALLBACKOP_register, &sysenter) == 0)
308 + break;
309 +#endif
310 + default:
311 + clear_bit(X86_FEATURE_SEP, boot_cpu_data.x86_capability);
312 + break;
313 + }
314 +#endif
315 }
316
317 static struct vm_area_struct gate_vma;
318 Index: head-2008-04-15/include/asm-x86/mach-default/mach_traps.h
319 ===================================================================
320 --- head-2008-04-15.orig/include/asm-x86/mach-default/mach_traps.h 2008-04-15 09:41:09.000000000 +0200
321 +++ head-2008-04-15/include/asm-x86/mach-default/mach_traps.h 2008-04-15 09:59:29.000000000 +0200
322 @@ -13,6 +13,18 @@ static inline void clear_mem_error(unsig
323 outb(reason, 0x61);
324 }
325
326 +static inline void clear_io_check_error(unsigned char reason)
327 +{
328 + unsigned long i;
329 +
330 + reason = (reason & 0xf) | 8;
331 + outb(reason, 0x61);
332 + i = 2000;
333 + while (--i) udelay(1000);
334 + reason &= ~8;
335 + outb(reason, 0x61);
336 +}
337 +
338 static inline unsigned char get_nmi_reason(void)
339 {
340 return inb(0x61);