]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: www.kernel.org |
2 | Subject: Update to 2.6.24 | |
3 | Patch-mainline: 2.6.24 | |
4 | ||
5 | Automatically created from "patches.kernel.org/patch-2.6.24" by xen-port-patches.py | |
6 | ||
7 | Acked-by: jbeulich@novell.com | |
8 | ||
9 | --- sle11-2009-06-29.orig/arch/x86/Kconfig 2009-02-05 10:22:38.000000000 +0100 | |
10 | +++ sle11-2009-06-29/arch/x86/Kconfig 2009-02-16 16:18:36.000000000 +0100 | |
11 | @@ -50,15 +50,16 @@ config GENERIC_CMOS_UPDATE | |
12 | ||
13 | config CLOCKSOURCE_WATCHDOG | |
14 | def_bool y | |
15 | - depends on !X86_XEN | |
16 | + depends on !XEN | |
17 | ||
18 | config GENERIC_CLOCKEVENTS | |
19 | def_bool y | |
20 | - depends on !X86_XEN | |
21 | + depends on !XEN | |
22 | ||
23 | config GENERIC_CLOCKEVENTS_BROADCAST | |
24 | def_bool y | |
25 | - depends on X86_64 || (X86_32 && X86_LOCAL_APIC && !X86_XEN) | |
26 | + depends on X86_64 || (X86_32 && X86_LOCAL_APIC) | |
27 | + depends on !XEN | |
28 | ||
29 | config LOCKDEP_SUPPORT | |
30 | def_bool y | |
31 | @@ -211,12 +212,12 @@ config X86_TRAMPOLINE | |
32 | ||
33 | config X86_NO_TSS | |
34 | bool | |
35 | - depends on X86_XEN || X86_64_XEN | |
36 | + depends on XEN | |
37 | default y | |
38 | ||
39 | config X86_NO_IDT | |
40 | bool | |
41 | - depends on X86_XEN || X86_64_XEN | |
42 | + depends on XEN | |
43 | default y | |
44 | ||
45 | config KTIME_SCALAR | |
46 | @@ -287,6 +288,7 @@ config X86_PC | |
47 | ||
48 | config X86_XEN | |
49 | bool "Xen-compatible" | |
50 | + depends on X86_32 | |
51 | select XEN | |
52 | select X86_PAE | |
53 | select X86_UP_APIC if !SMP && XEN_PRIVILEGED_GUEST | |
54 | @@ -365,6 +367,7 @@ endif | |
55 | ||
56 | config X86_64_XEN | |
57 | bool "Enable Xen compatible kernel" | |
58 | + depends on X86_64 | |
59 | select XEN | |
60 | select SWIOTLB | |
61 | help | |
62 | @@ -417,7 +420,7 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER | |
63 | ||
64 | menuconfig PARAVIRT_GUEST | |
65 | bool "Paravirtualized guest support" | |
66 | - depends on !X86_XEN && !X86_64_XEN | |
67 | + depends on !XEN | |
68 | help | |
69 | Say Y here to get to see options related to running Linux under | |
70 | various hypervisors. This option alone does not add any kernel code. | |
71 | @@ -511,7 +514,7 @@ source "arch/x86/Kconfig.cpu" | |
72 | config HPET_TIMER | |
73 | def_bool X86_64 | |
74 | prompt "HPET Timer Support" if X86_32 | |
75 | - depends on !X86_XEN && !X86_64_XEN | |
76 | + depends on !XEN | |
77 | help | |
78 | Use the IA-PC HPET (High Precision Event Timer) to manage | |
79 | time in preference to the PIT and RTC, if a HPET is | |
80 | @@ -831,7 +834,7 @@ config I8K | |
81 | config X86_REBOOTFIXUPS | |
82 | def_bool n | |
83 | prompt "Enable X86 board specific fixups for reboot" | |
84 | - depends on X86_32 && !X86_XEN | |
85 | + depends on X86_32 && !XEN | |
86 | ---help--- | |
87 | This enables chipset and/or board specific fixups to be done | |
88 | in order to get reboot to work correctly. This is only needed on | |
89 | @@ -1164,7 +1167,7 @@ config X86_RESERVE_LOW_64K | |
90 | config MATH_EMULATION | |
91 | bool | |
92 | prompt "Math emulation" if X86_32 | |
93 | - depends on !X86_XEN | |
94 | + depends on !XEN | |
95 | ---help--- | |
96 | Linux can emulate a math coprocessor (used for floating point | |
97 | operations) if you don't have one. 486DX and Pentium processors have | |
98 | @@ -1272,7 +1275,7 @@ config X86_PAT | |
99 | config EFI | |
100 | def_bool n | |
101 | prompt "EFI runtime service support" | |
102 | - depends on ACPI && !X86_XEN && !X86_64_XEN | |
103 | + depends on ACPI && !XEN | |
104 | ---help--- | |
105 | This enables the kernel to use EFI runtime services that are | |
106 | available (such as the EFI variable services). | |
107 | @@ -1287,7 +1290,7 @@ config EFI | |
108 | config IRQBALANCE | |
109 | def_bool y | |
110 | prompt "Enable kernel irq balancing" | |
111 | - depends on X86_32 && SMP && X86_IO_APIC && !X86_XEN | |
112 | + depends on X86_32 && SMP && X86_IO_APIC && !XEN | |
113 | help | |
114 | The default yes will allow the kernel to do irq load balancing. | |
115 | Saying no will keep the kernel from doing irq load balancing. | |
116 | @@ -1433,7 +1436,7 @@ config PHYSICAL_START | |
117 | ||
118 | config RELOCATABLE | |
119 | bool "Build a relocatable kernel (EXPERIMENTAL)" | |
120 | - depends on EXPERIMENTAL && !X86_XEN && !X86_64_XEN | |
121 | + depends on EXPERIMENTAL && !XEN | |
122 | help | |
123 | This builds a kernel image that retains relocation information | |
124 | so it can be loaded someplace besides the default 1MB. | |
125 | @@ -1503,6 +1506,7 @@ endmenu | |
126 | config ARCH_ENABLE_MEMORY_HOTPLUG | |
127 | def_bool y | |
128 | depends on X86_64 || (X86_32 && HIGHMEM) | |
129 | + depends on !XEN | |
130 | ||
131 | config HAVE_ARCH_EARLY_PFN_TO_NID | |
132 | def_bool X86_64 | |
133 | @@ -1693,7 +1697,7 @@ choice | |
134 | ||
135 | config PCI_GOBIOS | |
136 | bool "BIOS" | |
137 | - depends on !X86_XEN | |
138 | + depends on !XEN | |
139 | ||
140 | config PCI_GOMMCONFIG | |
141 | bool "MMConfig" | |
142 | @@ -1744,7 +1748,7 @@ config PCI_MMCONFIG | |
143 | ||
144 | config XEN_PCIDEV_FRONTEND | |
145 | bool "Xen PCI Frontend" if X86_64 | |
146 | - depends on PCI && ((X86_XEN && (PCI_GOXEN_FE || PCI_GOANY)) || X86_64_XEN) | |
147 | + depends on PCI && XEN && (PCI_GOXEN_FE || PCI_GOANY || X86_64) | |
148 | select HOTPLUG | |
149 | default y | |
150 | help | |
151 | @@ -1761,6 +1765,7 @@ config XEN_PCIDEV_FE_DEBUG | |
152 | config DMAR | |
153 | bool "Support for DMA Remapping Devices (EXPERIMENTAL)" | |
154 | depends on X86_64 && PCI_MSI && ACPI && EXPERIMENTAL | |
155 | + depends on !XEN | |
156 | help | |
157 | DMA remapping (DMAR) devices support enables independent address | |
158 | translations for Direct Memory Access (DMA) from devices. | |
159 | --- sle11-2009-06-29.orig/arch/x86/Makefile 2009-02-16 16:17:21.000000000 +0100 | |
160 | +++ sle11-2009-06-29/arch/x86/Makefile 2009-02-16 16:18:36.000000000 +0100 | |
161 | @@ -191,8 +191,8 @@ PHONY += zImage bzImage vmlinuz compress | |
162 | zdisk bzdisk fdimage fdimage144 fdimage288 isoimage install | |
163 | ||
164 | ifdef CONFIG_XEN | |
165 | -CPPFLAGS := -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION) \ | |
166 | - -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen $(CPPFLAGS) | |
167 | +KBUILD_CPPFLAGS := -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION) \ | |
168 | + -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen $(KBUILD_CPPFLAGS) | |
169 | ||
170 | ifdef CONFIG_X86_64 | |
171 | LDFLAGS_vmlinux := -e startup_64 | |
172 | @@ -206,6 +206,8 @@ KBUILD_IMAGE := $(boot)/vmlinuz | |
173 | ||
174 | vmlinuz: vmlinux | |
175 | $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) | |
176 | + $(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot | |
177 | + $(Q)ln -fsn ../../x86/boot/$@ $(objtree)/arch/$(UTS_MACHINE)/boot/$@ | |
178 | else | |
179 | # Default kernel to build | |
180 | all: bzImage | |
181 | --- sle11-2009-06-29.orig/arch/x86/ia32/ia32entry-xen.S 2009-02-16 16:17:21.000000000 +0100 | |
182 | +++ sle11-2009-06-29/arch/x86/ia32/ia32entry-xen.S 2009-02-16 16:18:36.000000000 +0100 | |
183 | @@ -125,20 +125,16 @@ sysenter_do_call: | |
184 | jmp int_ret_from_sys_call | |
185 | ||
186 | sysenter_tracesys: | |
187 | + xchgl %r9d,%ebp | |
188 | SAVE_REST | |
189 | CLEAR_RREGS | |
190 | + movq %r9,R9(%rsp) | |
191 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ | |
192 | movq %rsp,%rdi /* &pt_regs -> arg1 */ | |
193 | call syscall_trace_enter | |
194 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ | |
195 | RESTORE_REST | |
196 | - movl %ebp, %ebp | |
197 | - /* no need to do an access_ok check here because rbp has been | |
198 | - 32bit zero extended */ | |
199 | -1: movl (%rbp),%r9d | |
200 | - .section __ex_table,"a" | |
201 | - .quad 1b,ia32_badarg | |
202 | - .previous | |
203 | + xchgl %ebp,%r9d | |
204 | jmp sysenter_do_call | |
205 | CFI_ENDPROC | |
206 | ENDPROC(ia32_sysenter_target) | |
207 | @@ -200,20 +196,17 @@ cstar_do_call: | |
208 | jmp int_ret_from_sys_call | |
209 | ||
210 | cstar_tracesys: | |
211 | + xchgl %r9d,%ebp | |
212 | SAVE_REST | |
213 | CLEAR_RREGS | |
214 | + movq %r9,R9(%rsp) | |
215 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ | |
216 | movq %rsp,%rdi /* &pt_regs -> arg1 */ | |
217 | call syscall_trace_enter | |
218 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ | |
219 | RESTORE_REST | |
220 | + xchgl %ebp,%r9d | |
221 | movl RSP-ARGOFFSET(%rsp), %r8d | |
222 | - /* no need to do an access_ok check here because r8 has been | |
223 | - 32bit zero extended */ | |
224 | -1: movl (%r8),%r9d | |
225 | - .section __ex_table,"a" | |
226 | - .quad 1b,ia32_badarg | |
227 | - .previous | |
228 | jmp cstar_do_call | |
229 | END(ia32_cstar_target) | |
230 | ||
231 | --- sle11-2009-06-29.orig/arch/x86/kernel/Makefile 2008-12-15 11:27:22.000000000 +0100 | |
232 | +++ sle11-2009-06-29/arch/x86/kernel/Makefile 2009-02-16 16:18:36.000000000 +0100 | |
233 | @@ -127,4 +127,4 @@ endif | |
234 | disabled-obj-$(CONFIG_XEN) := early-quirks.o hpet.o i8253.o i8259_$(BITS).o reboot.o \ | |
235 | smpboot_$(BITS).o tsc_$(BITS).o tsc_sync.o | |
236 | disabled-obj-$(CONFIG_XEN_UNPRIVILEGED_GUEST) += mpparse_64.o | |
237 | -%/head_64.o %/head_64.s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) := | |
238 | +%/head_64.o %/head_64.s: asflags-$(CONFIG_XEN) := | |
239 | --- sle11-2009-06-29.orig/arch/x86/kernel/acpi/sleep_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
240 | +++ sle11-2009-06-29/arch/x86/kernel/acpi/sleep_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
241 | @@ -90,7 +90,7 @@ __setup("acpi_sleep=", acpi_sleep_setup) | |
242 | ||
243 | /* Ouch, we want to delete this. We already have better version in userspace, in | |
244 | s2ram from suspend.sf.net project */ | |
245 | -static __init int reset_videomode_after_s3(struct dmi_system_id *d) | |
246 | +static __init int reset_videomode_after_s3(const struct dmi_system_id *d) | |
247 | { | |
248 | acpi_realmode_flags |= 2; | |
249 | return 0; | |
250 | --- sle11-2009-06-29.orig/arch/x86/kernel/acpi/sleep_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
251 | +++ sle11-2009-06-29/arch/x86/kernel/acpi/sleep_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
252 | @@ -123,6 +123,3 @@ static int __init acpi_sleep_setup(char | |
253 | __setup("acpi_sleep=", acpi_sleep_setup); | |
254 | #endif /* CONFIG_ACPI_PV_SLEEP */ | |
255 | ||
256 | -void acpi_pci_link_exit(void) | |
257 | -{ | |
258 | -} | |
259 | --- sle11-2009-06-29.orig/arch/x86/kernel/apic_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
260 | +++ sle11-2009-06-29/arch/x86/kernel/apic_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
261 | @@ -63,22 +63,38 @@ int setup_profiling_timer(unsigned int m | |
262 | ||
263 | void smp_local_timer_interrupt(void) | |
264 | { | |
265 | - profile_tick(CPU_PROFILING); | |
266 | #ifndef CONFIG_XEN | |
267 | -#ifdef CONFIG_SMP | |
268 | - update_process_times(user_mode(get_irq_regs())); | |
269 | -#endif | |
270 | -#endif | |
271 | + int cpu = smp_processor_id(); | |
272 | + struct clock_event_device *evt = &per_cpu(lapic_events, cpu); | |
273 | + | |
274 | /* | |
275 | - * We take the 'long' return path, and there every subsystem | |
276 | - * grabs the appropriate locks (kernel lock/ irq lock). | |
277 | + * Normally we should not be here till LAPIC has been initialized but | |
278 | + * in some cases like kdump, its possible that there is a pending LAPIC | |
279 | + * timer interrupt from previous kernel's context and is delivered in | |
280 | + * new kernel the moment interrupts are enabled. | |
281 | * | |
282 | - * We might want to decouple profiling from the 'long path', | |
283 | - * and do the profiling totally in assembly. | |
284 | - * | |
285 | - * Currently this isn't too much of an issue (performance wise), | |
286 | - * we can take more than 100K local irqs per second on a 100 MHz P5. | |
287 | + * Interrupts are enabled early and LAPIC is setup much later, hence | |
288 | + * its possible that when we get here evt->event_handler is NULL. | |
289 | + * Check for event_handler being NULL and discard the interrupt as | |
290 | + * spurious. | |
291 | + */ | |
292 | + if (!evt->event_handler) { | |
293 | + printk(KERN_WARNING | |
294 | + "Spurious LAPIC timer interrupt on cpu %d\n", cpu); | |
295 | + /* Switch it off */ | |
296 | + lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, evt); | |
297 | + return; | |
298 | + } | |
299 | +#endif | |
300 | + | |
301 | + /* | |
302 | + * the NMI deadlock-detector uses this. | |
303 | */ | |
304 | + add_pda(apic_timer_irqs, 1); | |
305 | + | |
306 | +#ifndef CONFIG_XEN | |
307 | + evt->event_handler(evt); | |
308 | +#endif | |
309 | } | |
310 | ||
311 | /* | |
312 | @@ -94,11 +110,6 @@ void smp_apic_timer_interrupt(struct pt_ | |
313 | struct pt_regs *old_regs = set_irq_regs(regs); | |
314 | ||
315 | /* | |
316 | - * the NMI deadlock-detector uses this. | |
317 | - */ | |
318 | - add_pda(apic_timer_irqs, 1); | |
319 | - | |
320 | - /* | |
321 | * NOTE! We'd better ACK the irq immediately, | |
322 | * because timer handling can be slow. | |
323 | */ | |
324 | @@ -132,6 +143,7 @@ asmlinkage void smp_spurious_interrupt(v | |
325 | if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f))) | |
326 | ack_APIC_irq(); | |
327 | ||
328 | + add_pda(irq_spurious_count, 1); | |
329 | irq_exit(); | |
330 | } | |
331 | ||
332 | --- sle11-2009-06-29.orig/arch/x86/kernel/cpu/common-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
333 | +++ sle11-2009-06-29/arch/x86/kernel/cpu/common-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
334 | @@ -214,7 +214,7 @@ static void __cpuinit get_cpu_vendor(str | |
335 | ||
336 | static int __init x86_fxsr_setup(char * s) | |
337 | { | |
338 | - /* Tell all the other CPU's to not use it... */ | |
339 | + /* Tell all the other CPUs to not use it... */ | |
340 | disable_x86_fxsr = 1; | |
341 | ||
342 | /* | |
343 | --- sle11-2009-06-29.orig/arch/x86/kernel/e820_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
344 | +++ sle11-2009-06-29/arch/x86/kernel/e820_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
345 | @@ -52,6 +52,13 @@ struct resource code_resource = { | |
346 | .flags = IORESOURCE_BUSY | IORESOURCE_MEM | |
347 | }; | |
348 | ||
349 | +struct resource bss_resource = { | |
350 | + .name = "Kernel bss", | |
351 | + .start = 0, | |
352 | + .end = 0, | |
353 | + .flags = IORESOURCE_BUSY | IORESOURCE_MEM | |
354 | +}; | |
355 | + | |
356 | static struct resource system_rom_resource = { | |
357 | .name = "System ROM", | |
358 | .start = 0xf0000, | |
359 | @@ -266,7 +273,9 @@ static struct e820map machine_e820; | |
360 | * and also for regions reported as reserved by the e820. | |
361 | */ | |
362 | static void __init | |
363 | -legacy_init_iomem_resources(struct resource *code_resource, struct resource *data_resource) | |
364 | +legacy_init_iomem_resources(struct resource *code_resource, | |
365 | + struct resource *data_resource, | |
366 | + struct resource *bss_resource) | |
367 | { | |
368 | int i; | |
369 | ||
370 | @@ -300,9 +309,11 @@ legacy_init_iomem_resources(struct resou | |
371 | #ifndef CONFIG_XEN | |
372 | request_resource(res, code_resource); | |
373 | request_resource(res, data_resource); | |
374 | + request_resource(res, bss_resource); | |
375 | #endif | |
376 | #ifdef CONFIG_KEXEC | |
377 | - request_resource(res, &crashk_res); | |
378 | + if (crashk_res.start != crashk_res.end) | |
379 | + request_resource(res, &crashk_res); | |
380 | #ifdef CONFIG_XEN | |
381 | xen_machine_kexec_register_resources(res); | |
382 | #endif | |
383 | @@ -329,9 +340,11 @@ static int __init request_standard_resou | |
384 | ||
385 | printk("Setting up standard PCI resources\n"); | |
386 | if (efi_enabled) | |
387 | - efi_initialize_iomem_resources(&code_resource, &data_resource); | |
388 | + efi_initialize_iomem_resources(&code_resource, | |
389 | + &data_resource, &bss_resource); | |
390 | else | |
391 | - legacy_init_iomem_resources(&code_resource, &data_resource); | |
392 | + legacy_init_iomem_resources(&code_resource, | |
393 | + &data_resource, &bss_resource); | |
394 | ||
395 | /* EFI systems may still have VGA */ | |
396 | request_resource(&iomem_resource, &video_ram_resource); | |
397 | @@ -774,7 +787,7 @@ void __init e820_register_memory(void) | |
398 | #endif | |
399 | ||
400 | /* | |
401 | - * Search for the bigest gap in the low 32 bits of the e820 | |
402 | + * Search for the biggest gap in the low 32 bits of the e820 | |
403 | * memory space. | |
404 | */ | |
405 | last = 0x100000000ull; | |
406 | --- sle11-2009-06-29.orig/arch/x86/kernel/e820_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
407 | +++ sle11-2009-06-29/arch/x86/kernel/e820_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
408 | @@ -24,7 +24,7 @@ | |
409 | #include <asm/page.h> | |
410 | #include <asm/e820.h> | |
411 | #include <asm/proto.h> | |
412 | -#include <asm/bootsetup.h> | |
413 | +#include <asm/setup.h> | |
414 | #include <asm/sections.h> | |
415 | #include <xen/interface/memory.h> | |
416 | ||
417 | @@ -51,7 +51,7 @@ unsigned long end_pfn_map; | |
418 | */ | |
419 | static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT; | |
420 | ||
421 | -extern struct resource code_resource, data_resource; | |
422 | +extern struct resource code_resource, data_resource, bss_resource; | |
423 | ||
424 | /* Check for some hardcoded bad areas that early boot is not allowed to touch */ | |
425 | static inline int bad_addr(unsigned long *addrp, unsigned long size) | |
426 | @@ -73,10 +73,15 @@ static inline int bad_addr(unsigned long | |
427 | ||
428 | /* initrd */ | |
429 | #ifdef CONFIG_BLK_DEV_INITRD | |
430 | - if (LOADER_TYPE && INITRD_START && last >= INITRD_START && | |
431 | - addr < INITRD_START+INITRD_SIZE) { | |
432 | - *addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE); | |
433 | - return 1; | |
434 | + if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { | |
435 | + unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; | |
436 | + unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; | |
437 | + unsigned long ramdisk_end = ramdisk_image+ramdisk_size; | |
438 | + | |
439 | + if (last >= ramdisk_image && addr < ramdisk_end) { | |
440 | + *addrp = PAGE_ALIGN(ramdisk_end); | |
441 | + return 1; | |
442 | + } | |
443 | } | |
444 | #endif | |
445 | /* kernel code */ | |
446 | @@ -249,6 +254,7 @@ void __init e820_reserve_resources(struc | |
447 | #ifndef CONFIG_XEN | |
448 | request_resource(res, &code_resource); | |
449 | request_resource(res, &data_resource); | |
450 | + request_resource(res, &bss_resource); | |
451 | #endif | |
452 | #ifdef CONFIG_KEXEC | |
453 | if (crashk_res.start != crashk_res.end) | |
454 | @@ -650,8 +656,8 @@ void __init setup_memory_region(void) | |
455 | * Otherwise fake a memory map; one section from 0k->640k, | |
456 | * the next section from 1mb->appropriate_mem_k | |
457 | */ | |
458 | - sanitize_e820_map(E820_MAP, &E820_MAP_NR); | |
459 | - if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) | |
460 | + sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries); | |
461 | + if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) | |
462 | early_panic("Cannot find a valid memory map"); | |
463 | printk(KERN_INFO "BIOS-provided physical RAM map:\n"); | |
464 | e820_print_map("BIOS-e820"); | |
465 | @@ -836,3 +842,22 @@ __init void e820_setup_gap(struct e820en | |
466 | printk(KERN_INFO "Allocating PCI resources starting at %lx (gap: %lx:%lx)\n", | |
467 | pci_mem_start, gapstart, gapsize); | |
468 | } | |
469 | + | |
470 | +int __init arch_get_ram_range(int slot, u64 *addr, u64 *size) | |
471 | +{ | |
472 | + int i; | |
473 | + | |
474 | + if (slot < 0 || slot >= e820.nr_map) | |
475 | + return -1; | |
476 | + for (i = slot; i < e820.nr_map; i++) { | |
477 | + if (e820.map[i].type != E820_RAM) | |
478 | + continue; | |
479 | + break; | |
480 | + } | |
481 | + if (i == e820.nr_map || e820.map[i].addr > (max_pfn << PAGE_SHIFT)) | |
482 | + return -1; | |
483 | + *addr = e820.map[i].addr; | |
484 | + *size = min_t(u64, e820.map[i].size + e820.map[i].addr, | |
485 | + max_pfn << PAGE_SHIFT) - *addr; | |
486 | + return i + 1; | |
487 | +} | |
488 | --- sle11-2009-06-29.orig/arch/x86/kernel/early_printk-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
489 | +++ sle11-2009-06-29/arch/x86/kernel/early_printk-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
490 | @@ -6,14 +6,9 @@ | |
491 | #include <asm/io.h> | |
492 | #include <asm/processor.h> | |
493 | #include <asm/fcntl.h> | |
494 | +#include <asm/setup.h> | |
495 | ||
496 | /* Simple VGA output */ | |
497 | - | |
498 | -#ifdef __i386__ | |
499 | -#include <asm/setup.h> | |
500 | -#else | |
501 | -#include <asm/bootsetup.h> | |
502 | -#endif | |
503 | #define VGABASE (__ISA_IO_base + 0xb8000) | |
504 | ||
505 | #ifndef CONFIG_XEN | |
506 | @@ -264,10 +259,10 @@ static int __init setup_early_printk(cha | |
507 | early_console = &early_serial_console; | |
508 | } else if (!strncmp(buf, "vga", 3)) { | |
509 | #ifndef CONFIG_XEN | |
510 | - && SCREEN_INFO.orig_video_isVGA == 1) { | |
511 | - max_xpos = SCREEN_INFO.orig_video_cols; | |
512 | - max_ypos = SCREEN_INFO.orig_video_lines; | |
513 | - current_ypos = SCREEN_INFO.orig_y; | |
514 | + && boot_params.screen_info.orig_video_isVGA == 1) { | |
515 | + max_xpos = boot_params.screen_info.orig_video_cols; | |
516 | + max_ypos = boot_params.screen_info.orig_video_lines; | |
517 | + current_ypos = boot_params.screen_info.orig_y; | |
518 | #endif | |
519 | early_console = &early_vga_console; | |
520 | } else if (!strncmp(buf, "simnow", 6)) { | |
521 | --- sle11-2009-06-29.orig/arch/x86/kernel/entry_32-xen.S 2009-02-16 16:17:21.000000000 +0100 | |
522 | +++ sle11-2009-06-29/arch/x86/kernel/entry_32-xen.S 2009-05-14 11:18:18.000000000 +0200 | |
523 | @@ -254,6 +254,7 @@ check_userspace: | |
524 | jb resume_kernel # not returning to v8086 or userspace | |
525 | ||
526 | ENTRY(resume_userspace) | |
527 | + LOCKDEP_SYS_EXIT | |
528 | DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt | |
529 | # setting need_resched or sigpending | |
530 | # between sampling and the iret | |
531 | @@ -341,6 +342,7 @@ sysenter_past_esp: | |
532 | jae syscall_badsys | |
533 | call *sys_call_table(,%eax,4) | |
534 | movl %eax,PT_EAX(%esp) | |
535 | + LOCKDEP_SYS_EXIT | |
536 | DISABLE_INTERRUPTS(CLBR_ANY) | |
537 | TRACE_IRQS_OFF | |
538 | movl TI_flags(%ebp), %ecx | |
539 | @@ -406,6 +408,7 @@ syscall_call: | |
540 | call *sys_call_table(,%eax,4) | |
541 | movl %eax,PT_EAX(%esp) # store the return value | |
542 | syscall_exit: | |
543 | + LOCKDEP_SYS_EXIT | |
544 | DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt | |
545 | # setting need_resched or sigpending | |
546 | # between sampling and the iret | |
547 | @@ -478,7 +481,7 @@ ldt_ss: | |
548 | * is still available to implement the setting of the high | |
549 | * 16-bits in the INTERRUPT_RETURN paravirt-op. | |
550 | */ | |
551 | - cmpl $0, paravirt_ops+PARAVIRT_enabled | |
552 | + cmpl $0, pv_info+PARAVIRT_enabled | |
553 | jne restore_nocheck | |
554 | #endif | |
555 | ||
556 | @@ -540,6 +543,7 @@ work_pending: | |
557 | jz work_notifysig | |
558 | work_resched: | |
559 | call schedule | |
560 | + LOCKDEP_SYS_EXIT | |
561 | DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt | |
562 | # setting need_resched or sigpending | |
563 | # between sampling and the iret | |
564 | @@ -1268,6 +1272,6 @@ ENTRY(kernel_thread_helper) | |
565 | ENDPROC(kernel_thread_helper) | |
566 | ||
567 | .section .rodata,"a" | |
568 | -#include "syscall_table.S" | |
569 | +#include "syscall_table_32.S" | |
570 | ||
571 | syscall_table_size=(.-sys_call_table) | |
572 | --- sle11-2009-06-29.orig/arch/x86/kernel/entry_64-xen.S 2009-02-16 16:17:21.000000000 +0100 | |
573 | +++ sle11-2009-06-29/arch/x86/kernel/entry_64-xen.S 2009-02-16 16:18:36.000000000 +0100 | |
574 | @@ -57,7 +57,7 @@ | |
575 | #include <xen/interface/arch-x86_64.h> | |
576 | #include <xen/interface/features.h> | |
577 | ||
578 | -#include "xen_entry.S" | |
579 | +#include "xen_entry_64.S" | |
580 | ||
581 | .code64 | |
582 | ||
583 | @@ -275,6 +275,7 @@ ret_from_sys_call: | |
584 | movl $_TIF_ALLWORK_MASK,%edi | |
585 | /* edi: flagmask */ | |
586 | sysret_check: | |
587 | + LOCKDEP_SYS_EXIT | |
588 | GET_THREAD_INFO(%rcx) | |
589 | XEN_BLOCK_EVENTS(%rsi) | |
590 | TRACE_IRQS_OFF | |
591 | @@ -365,6 +366,7 @@ int_ret_from_sys_call: | |
592 | movl $_TIF_ALLWORK_MASK,%edi | |
593 | /* edi: mask to check */ | |
594 | int_with_check: | |
595 | + LOCKDEP_SYS_EXIT_IRQ | |
596 | GET_THREAD_INFO(%rcx) | |
597 | movl threadinfo_flags(%rcx),%edx | |
598 | andl %edi,%edx | |
599 | @@ -516,11 +518,12 @@ END(stub_rt_sigreturn) | |
600 | ||
601 | retint_check: | |
602 | CFI_DEFAULT_STACK adj=1 | |
603 | + LOCKDEP_SYS_EXIT_IRQ | |
604 | movl threadinfo_flags(%rcx),%edx | |
605 | andl %edi,%edx | |
606 | CFI_REMEMBER_STATE | |
607 | jnz retint_careful | |
608 | -retint_restore_args: | |
609 | +retint_restore_args: /* return to kernel space */ | |
610 | movl EFLAGS-REST_SKIP(%rsp), %eax | |
611 | shr $9, %eax # EAX[0] == IRET_EFLAGS.IF | |
612 | XEN_GET_VCPU_INFO(%rsi) | |
613 | @@ -841,7 +844,7 @@ error_call_handler: | |
614 | movq ORIG_RAX(%rsp),%rsi # get error code | |
615 | movq $-1,ORIG_RAX(%rsp) | |
616 | call *%rax | |
617 | -error_exit: | |
618 | +error_exit: | |
619 | RESTORE_REST | |
620 | /* cli */ | |
621 | XEN_BLOCK_EVENTS(%rsi) | |
622 | @@ -849,14 +852,11 @@ error_exit: | |
623 | GET_THREAD_INFO(%rcx) | |
624 | testb $3,CS-ARGOFFSET(%rsp) | |
625 | jz retint_kernel | |
626 | + LOCKDEP_SYS_EXIT_IRQ | |
627 | movl threadinfo_flags(%rcx),%edx | |
628 | movl $_TIF_WORK_MASK,%edi | |
629 | andl %edi,%edx | |
630 | jnz retint_careful | |
631 | - /* | |
632 | - * The iret might restore flags: | |
633 | - */ | |
634 | - TRACE_IRQS_IRETQ | |
635 | jmp retint_restore_args | |
636 | ||
637 | #if 0 | |
638 | @@ -1071,7 +1071,7 @@ child_rip: | |
639 | movq %rsi, %rdi | |
640 | call *%rax | |
641 | # exit | |
642 | - xorl %edi, %edi | |
643 | + mov %eax, %edi | |
644 | call do_exit | |
645 | CFI_ENDPROC | |
646 | ENDPROC(child_rip) | |
647 | --- sle11-2009-06-29.orig/arch/x86/kernel/genapic_64-xen.c 2008-12-15 11:27:22.000000000 +0100 | |
648 | +++ sle11-2009-06-29/arch/x86/kernel/genapic_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
649 | @@ -24,12 +24,21 @@ | |
650 | #include <acpi/acpi_bus.h> | |
651 | #endif | |
652 | ||
653 | -/* which logical CPU number maps to which CPU (physical APIC ID) */ | |
654 | -u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly | |
655 | +/* | |
656 | + * which logical CPU number maps to which CPU (physical APIC ID) | |
657 | + * | |
658 | + * The following static array is used during kernel startup | |
659 | + * and the x86_cpu_to_apicid_ptr contains the address of the | |
660 | + * array during this time. Is it zeroed when the per_cpu | |
661 | + * data area is removed. | |
662 | + */ | |
663 | +#ifndef CONFIG_XEN | |
664 | +u8 x86_cpu_to_apicid_init[NR_CPUS] __initdata | |
665 | = { [0 ... NR_CPUS-1] = BAD_APICID }; | |
666 | -EXPORT_SYMBOL(x86_cpu_to_apicid); | |
667 | - | |
668 | -u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; | |
669 | +void *x86_cpu_to_apicid_ptr; | |
670 | +#endif | |
671 | +DEFINE_PER_CPU(u8, x86_cpu_to_apicid) = BAD_APICID; | |
672 | +EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid); | |
673 | ||
674 | #ifndef CONFIG_XEN | |
675 | struct genapic __read_mostly *genapic = &apic_flat; | |
676 | --- sle11-2009-06-29.orig/arch/x86/kernel/head64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
677 | +++ sle11-2009-06-29/arch/x86/kernel/head64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
678 | @@ -1,5 +1,5 @@ | |
679 | /* | |
680 | - * linux/arch/x86_64/kernel/head64.c -- prepare to run common code | |
681 | + * prepare to run common code | |
682 | * | |
683 | * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE | |
684 | * | |
685 | @@ -21,7 +21,6 @@ | |
686 | #include <asm/processor.h> | |
687 | #include <asm/proto.h> | |
688 | #include <asm/smp.h> | |
689 | -#include <asm/bootsetup.h> | |
690 | #include <asm/setup.h> | |
691 | #include <asm/desc.h> | |
692 | #include <asm/pgtable.h> | |
693 | @@ -47,27 +46,16 @@ static void __init clear_bss(void) | |
694 | } | |
695 | #endif | |
696 | ||
697 | -#define NEW_CL_POINTER 0x228 /* Relative to real mode data */ | |
698 | -#define OLD_CL_MAGIC_ADDR 0x20 | |
699 | -#define OLD_CL_MAGIC 0xA33F | |
700 | -#define OLD_CL_OFFSET 0x22 | |
701 | - | |
702 | static void __init copy_bootdata(char *real_mode_data) | |
703 | { | |
704 | #ifndef CONFIG_XEN | |
705 | - unsigned long new_data; | |
706 | char * command_line; | |
707 | ||
708 | - memcpy(x86_boot_params, real_mode_data, BOOT_PARAM_SIZE); | |
709 | - new_data = *(u32 *) (x86_boot_params + NEW_CL_POINTER); | |
710 | - if (!new_data) { | |
711 | - if (OLD_CL_MAGIC != *(u16 *)(real_mode_data + OLD_CL_MAGIC_ADDR)) { | |
712 | - return; | |
713 | - } | |
714 | - new_data = __pa(real_mode_data) + *(u16 *)(real_mode_data + OLD_CL_OFFSET); | |
715 | + memcpy(&boot_params, real_mode_data, sizeof boot_params); | |
716 | + if (boot_params.hdr.cmd_line_ptr) { | |
717 | + command_line = __va(boot_params.hdr.cmd_line_ptr); | |
718 | + memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); | |
719 | } | |
720 | - command_line = __va(new_data); | |
721 | - memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); | |
722 | #else | |
723 | int max_cmdline; | |
724 | ||
725 | @@ -117,7 +105,7 @@ void __init x86_64_start_kernel(char * r | |
726 | ||
727 | for (i = 0; i < IDT_ENTRIES; i++) | |
728 | set_intr_gate(i, early_idt_handler); | |
729 | - asm volatile("lidt %0" :: "m" (idt_descr)); | |
730 | + load_idt((const struct desc_ptr *)&idt_descr); | |
731 | #endif | |
732 | ||
733 | early_printk("Kernel alive\n"); | |
734 | --- sle11-2009-06-29.orig/arch/x86/kernel/init_task-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
735 | +++ sle11-2009-06-29/arch/x86/kernel/init_task-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
736 | @@ -14,11 +14,11 @@ static struct fs_struct init_fs = INIT_F | |
737 | static struct files_struct init_files = INIT_FILES; | |
738 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | |
739 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | |
740 | - | |
741 | +#ifdef CONFIG_X86_XEN | |
742 | #define swapper_pg_dir ((pgd_t *)NULL) | |
743 | +#endif | |
744 | struct mm_struct init_mm = INIT_MM(init_mm); | |
745 | #undef swapper_pg_dir | |
746 | - | |
747 | EXPORT_SYMBOL(init_mm); | |
748 | ||
749 | /* | |
750 | @@ -28,7 +28,7 @@ EXPORT_SYMBOL(init_mm); | |
751 | * way process stacks are handled. This is done by having a special | |
752 | * "init_task" linker map entry.. | |
753 | */ | |
754 | -union thread_union init_thread_union | |
755 | +union thread_union init_thread_union | |
756 | __attribute__((__section__(".data.init_task"))) = | |
757 | { INIT_THREAD_INFO(init_task) }; | |
758 | ||
759 | @@ -38,14 +38,15 @@ union thread_union init_thread_union | |
760 | * All other task structs will be allocated on slabs in fork.c | |
761 | */ | |
762 | struct task_struct init_task = INIT_TASK(init_task); | |
763 | - | |
764 | EXPORT_SYMBOL(init_task); | |
765 | ||
766 | #ifndef CONFIG_X86_NO_TSS | |
767 | /* | |
768 | - * per-CPU TSS segments. Threads are completely 'soft' on Linux, | |
769 | - * no more per-task TSS's. | |
770 | - */ | |
771 | + * no more per-task TSS's. The TSS size is kept cacheline-aligned | |
772 | + * so they are allowed to end up in the .data.cacheline_aligned | |
773 | + * section. Since TSS's are completely CPU-local, we want them | |
774 | + * on exact cacheline boundaries, to eliminate cacheline ping-pong. | |
775 | + */ | |
776 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS; | |
777 | #endif | |
778 | ||
779 | --- sle11-2009-06-29.orig/arch/x86/kernel/io_apic_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
780 | +++ sle11-2009-06-29/arch/x86/kernel/io_apic_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
781 | @@ -427,7 +427,7 @@ static struct irq_cpu_info { | |
782 | ||
783 | #define IRQ_ALLOWED(cpu, allowed_mask) cpu_isset(cpu, allowed_mask) | |
784 | ||
785 | -#define CPU_TO_PACKAGEINDEX(i) (first_cpu(cpu_sibling_map[i])) | |
786 | +#define CPU_TO_PACKAGEINDEX(i) (first_cpu(per_cpu(cpu_sibling_map, i))) | |
787 | ||
788 | static cpumask_t balance_irq_affinity[NR_IRQS] = { | |
789 | [0 ... NR_IRQS-1] = CPU_MASK_ALL | |
790 | @@ -633,7 +633,7 @@ tryanotherirq: | |
791 | ||
792 | imbalance = move_this_load; | |
793 | ||
794 | - /* For physical_balance case, we accumlated both load | |
795 | + /* For physical_balance case, we accumulated both load | |
796 | * values in the one of the siblings cpu_irq[], | |
797 | * to use the same code for physical and logical processors | |
798 | * as much as possible. | |
799 | @@ -647,7 +647,7 @@ tryanotherirq: | |
800 | * (A+B)/2 vs B | |
801 | */ | |
802 | load = CPU_IRQ(min_loaded) >> 1; | |
803 | - for_each_cpu_mask(j, cpu_sibling_map[min_loaded]) { | |
804 | + for_each_cpu_mask(j, per_cpu(cpu_sibling_map, min_loaded)) { | |
805 | if (load > CPU_IRQ(j)) { | |
806 | /* This won't change cpu_sibling_map[min_loaded] */ | |
807 | load = CPU_IRQ(j); | |
808 | @@ -1018,7 +1018,7 @@ static int EISA_ELCR(unsigned int irq) | |
809 | #define default_MCA_trigger(idx) (1) | |
810 | #define default_MCA_polarity(idx) (0) | |
811 | ||
812 | -static int __init MPBIOS_polarity(int idx) | |
813 | +static int MPBIOS_polarity(int idx) | |
814 | { | |
815 | int bus = mp_irqs[idx].mpc_srcbus; | |
816 | int polarity; | |
817 | @@ -1347,6 +1347,11 @@ static void __init setup_IO_APIC_irqs(vo | |
818 | continue; | |
819 | } | |
820 | ||
821 | + if (!first_notcon) { | |
822 | + apic_printk(APIC_VERBOSE, " not connected.\n"); | |
823 | + first_notcon = 1; | |
824 | + } | |
825 | + | |
826 | entry.trigger = irq_trigger(idx); | |
827 | entry.polarity = irq_polarity(idx); | |
828 | ||
829 | @@ -1936,13 +1941,16 @@ __setup("no_timer_check", notimercheck); | |
830 | static int __init timer_irq_works(void) | |
831 | { | |
832 | unsigned long t1 = jiffies; | |
833 | + unsigned long flags; | |
834 | ||
835 | if (no_timer_check) | |
836 | return 1; | |
837 | ||
838 | + local_save_flags(flags); | |
839 | local_irq_enable(); | |
840 | /* Let ten ticks pass... */ | |
841 | mdelay((10 * 1000) / HZ); | |
842 | + local_irq_restore(flags); | |
843 | ||
844 | /* | |
845 | * Expect a few ticks at least, to be sure some possible | |
846 | @@ -2223,6 +2231,9 @@ static inline void __init check_timer(vo | |
847 | { | |
848 | int apic1, pin1, apic2, pin2; | |
849 | int vector; | |
850 | + unsigned long flags; | |
851 | + | |
852 | + local_irq_save(flags); | |
853 | ||
854 | /* | |
855 | * get/set the timer IRQ vector: | |
856 | @@ -2268,7 +2279,7 @@ static inline void __init check_timer(vo | |
857 | } | |
858 | if (disable_timer_pin_1 > 0) | |
859 | clear_IO_APIC_pin(0, pin1); | |
860 | - return; | |
861 | + goto out; | |
862 | } | |
863 | clear_IO_APIC_pin(apic1, pin1); | |
864 | printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to " | |
865 | @@ -2291,7 +2302,7 @@ static inline void __init check_timer(vo | |
866 | if (nmi_watchdog == NMI_IO_APIC) { | |
867 | setup_nmi(); | |
868 | } | |
869 | - return; | |
870 | + goto out; | |
871 | } | |
872 | /* | |
873 | * Cleanup, just in case ... | |
874 | @@ -2315,7 +2326,7 @@ static inline void __init check_timer(vo | |
875 | ||
876 | if (timer_irq_works()) { | |
877 | printk(" works.\n"); | |
878 | - return; | |
879 | + goto out; | |
880 | } | |
881 | apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); | |
882 | printk(" failed.\n"); | |
883 | @@ -2331,11 +2342,13 @@ static inline void __init check_timer(vo | |
884 | ||
885 | if (timer_irq_works()) { | |
886 | printk(" works.\n"); | |
887 | - return; | |
888 | + goto out; | |
889 | } | |
890 | printk(" failed :(.\n"); | |
891 | panic("IO-APIC + timer doesn't work! Boot with apic=debug and send a " | |
892 | "report. Then try booting with the 'noapic' option"); | |
893 | +out: | |
894 | + local_irq_restore(flags); | |
895 | } | |
896 | #else | |
897 | int timer_uses_ioapic_pin_0 = 0; | |
898 | @@ -2353,6 +2366,14 @@ int timer_uses_ioapic_pin_0 = 0; | |
899 | ||
900 | void __init setup_IO_APIC(void) | |
901 | { | |
902 | +#ifndef CONFIG_XEN | |
903 | + int i; | |
904 | + | |
905 | + /* Reserve all the system vectors. */ | |
906 | + for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++) | |
907 | + set_bit(i, used_vectors); | |
908 | +#endif | |
909 | + | |
910 | enable_IO_APIC(); | |
911 | ||
912 | if (acpi_ioapic) | |
913 | @@ -2542,7 +2563,7 @@ void destroy_irq(unsigned int irq) | |
914 | #endif /* CONFIG_XEN */ | |
915 | ||
916 | /* | |
917 | - * MSI mesage composition | |
918 | + * MSI message composition | |
919 | */ | |
920 | #if defined(CONFIG_PCI_MSI) && !defined(CONFIG_XEN) | |
921 | static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg) | |
922 | @@ -2899,6 +2920,25 @@ int io_apic_set_pci_routing (int ioapic, | |
923 | return 0; | |
924 | } | |
925 | ||
926 | +int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) | |
927 | +{ | |
928 | + int i; | |
929 | + | |
930 | + if (skip_ioapic_setup) | |
931 | + return -1; | |
932 | + | |
933 | + for (i = 0; i < mp_irq_entries; i++) | |
934 | + if (mp_irqs[i].mpc_irqtype == mp_INT && | |
935 | + mp_irqs[i].mpc_srcbusirq == bus_irq) | |
936 | + break; | |
937 | + if (i >= mp_irq_entries) | |
938 | + return -1; | |
939 | + | |
940 | + *trigger = irq_trigger(i); | |
941 | + *polarity = irq_polarity(i); | |
942 | + return 0; | |
943 | +} | |
944 | + | |
945 | #endif /* CONFIG_ACPI */ | |
946 | ||
947 | static int __init parse_disable_timer_pin_1(char *arg) | |
948 | --- sle11-2009-06-29.orig/arch/x86/kernel/io_apic_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
949 | +++ sle11-2009-06-29/arch/x86/kernel/io_apic_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
950 | @@ -31,6 +31,7 @@ | |
951 | #include <linux/sysdev.h> | |
952 | #include <linux/msi.h> | |
953 | #include <linux/htirq.h> | |
954 | +#include <linux/dmar.h> | |
955 | #ifdef CONFIG_ACPI | |
956 | #include <acpi/acpi_bus.h> | |
957 | #endif | |
958 | @@ -584,7 +585,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, | |
959 | #define default_PCI_trigger(idx) (1) | |
960 | #define default_PCI_polarity(idx) (1) | |
961 | ||
962 | -static int __init MPBIOS_polarity(int idx) | |
963 | +static int MPBIOS_polarity(int idx) | |
964 | { | |
965 | int bus = mp_irqs[idx].mpc_srcbus; | |
966 | int polarity; | |
967 | @@ -871,6 +872,10 @@ static void __init setup_IO_APIC_irqs(vo | |
968 | apic_printk(APIC_VERBOSE, ", %d-%d", mp_ioapics[apic].mpc_apicid, pin); | |
969 | continue; | |
970 | } | |
971 | + if (!first_notcon) { | |
972 | + apic_printk(APIC_VERBOSE, " not connected.\n"); | |
973 | + first_notcon = 1; | |
974 | + } | |
975 | ||
976 | irq = pin_2_irq(idx, apic, pin); | |
977 | add_pin_to_irq(irq, apic, pin); | |
978 | @@ -881,7 +886,7 @@ static void __init setup_IO_APIC_irqs(vo | |
979 | } | |
980 | ||
981 | if (!first_notcon) | |
982 | - apic_printk(APIC_VERBOSE," not connected.\n"); | |
983 | + apic_printk(APIC_VERBOSE, " not connected.\n"); | |
984 | } | |
985 | ||
986 | #ifndef CONFIG_XEN | |
987 | @@ -1277,10 +1282,13 @@ void disable_IO_APIC(void) | |
988 | static int __init timer_irq_works(void) | |
989 | { | |
990 | unsigned long t1 = jiffies; | |
991 | + unsigned long flags; | |
992 | ||
993 | + local_save_flags(flags); | |
994 | local_irq_enable(); | |
995 | /* Let ten ticks pass... */ | |
996 | mdelay((10 * 1000) / HZ); | |
997 | + local_irq_restore(flags); | |
998 | ||
999 | /* | |
1000 | * Expect a few ticks at least, to be sure some possible | |
1001 | @@ -1655,6 +1663,9 @@ static inline void check_timer(void) | |
1002 | { | |
1003 | struct irq_cfg *cfg = irq_cfg + 0; | |
1004 | int apic1, pin1, apic2, pin2; | |
1005 | + unsigned long flags; | |
1006 | + | |
1007 | + local_irq_save(flags); | |
1008 | ||
1009 | /* | |
1010 | * get/set the timer IRQ vector: | |
1011 | @@ -1696,7 +1707,7 @@ static inline void check_timer(void) | |
1012 | } | |
1013 | if (disable_timer_pin_1 > 0) | |
1014 | clear_IO_APIC_pin(0, pin1); | |
1015 | - return; | |
1016 | + goto out; | |
1017 | } | |
1018 | clear_IO_APIC_pin(apic1, pin1); | |
1019 | apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not " | |
1020 | @@ -1718,7 +1729,7 @@ static inline void check_timer(void) | |
1021 | if (nmi_watchdog == NMI_IO_APIC) { | |
1022 | setup_nmi(); | |
1023 | } | |
1024 | - return; | |
1025 | + goto out; | |
1026 | } | |
1027 | /* | |
1028 | * Cleanup, just in case ... | |
1029 | @@ -1741,7 +1752,7 @@ static inline void check_timer(void) | |
1030 | ||
1031 | if (timer_irq_works()) { | |
1032 | apic_printk(APIC_VERBOSE," works.\n"); | |
1033 | - return; | |
1034 | + goto out; | |
1035 | } | |
1036 | apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector); | |
1037 | apic_printk(APIC_VERBOSE," failed.\n"); | |
1038 | @@ -1756,10 +1767,12 @@ static inline void check_timer(void) | |
1039 | ||
1040 | if (timer_irq_works()) { | |
1041 | apic_printk(APIC_VERBOSE," works.\n"); | |
1042 | - return; | |
1043 | + goto out; | |
1044 | } | |
1045 | apic_printk(APIC_VERBOSE," failed :(.\n"); | |
1046 | panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n"); | |
1047 | +out: | |
1048 | + local_irq_restore(flags); | |
1049 | } | |
1050 | #else | |
1051 | #define check_timer() ((void)0) | |
1052 | @@ -1775,7 +1788,7 @@ __setup("no_timer_check", notimercheck); | |
1053 | ||
1054 | /* | |
1055 | * | |
1056 | - * IRQ's that are handled by the PIC in the MPS IOAPIC case. | |
1057 | + * IRQs that are handled by the PIC in the MPS IOAPIC case. | |
1058 | * - IRQ2 is the cascade IRQ, and cannot be a io-apic IRQ. | |
1059 | * Linux doesn't really care, as it's not actually used | |
1060 | * for any interrupt handling anyway. | |
1061 | @@ -1858,7 +1871,7 @@ static struct sysdev_class ioapic_sysdev | |
1062 | static int __init ioapic_init_sysfs(void) | |
1063 | { | |
1064 | struct sys_device * dev; | |
1065 | - int i, size, error = 0; | |
1066 | + int i, size, error; | |
1067 | ||
1068 | error = sysdev_class_register(&ioapic_sysdev_class); | |
1069 | if (error) | |
1070 | @@ -1867,12 +1880,11 @@ static int __init ioapic_init_sysfs(void | |
1071 | for (i = 0; i < nr_ioapics; i++ ) { | |
1072 | size = sizeof(struct sys_device) + nr_ioapic_registers[i] | |
1073 | * sizeof(struct IO_APIC_route_entry); | |
1074 | - mp_ioapic_data[i] = kmalloc(size, GFP_KERNEL); | |
1075 | + mp_ioapic_data[i] = kzalloc(size, GFP_KERNEL); | |
1076 | if (!mp_ioapic_data[i]) { | |
1077 | printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i); | |
1078 | continue; | |
1079 | } | |
1080 | - memset(mp_ioapic_data[i], 0, size); | |
1081 | dev = &mp_ioapic_data[i]->dev; | |
1082 | dev->id = i; | |
1083 | dev->cls = &ioapic_sysdev_class; | |
1084 | @@ -1933,7 +1945,7 @@ void destroy_irq(unsigned int irq) | |
1085 | #endif /* CONFIG_XEN */ | |
1086 | ||
1087 | /* | |
1088 | - * MSI mesage composition | |
1089 | + * MSI message composition | |
1090 | */ | |
1091 | #if defined(CONFIG_PCI_MSI) && !defined(CONFIG_XEN) | |
1092 | static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg) | |
1093 | @@ -2043,8 +2055,64 @@ void arch_teardown_msi_irq(unsigned int | |
1094 | destroy_irq(irq); | |
1095 | } | |
1096 | ||
1097 | -#endif /* CONFIG_PCI_MSI */ | |
1098 | +#ifdef CONFIG_DMAR | |
1099 | +#ifdef CONFIG_SMP | |
1100 | +static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask) | |
1101 | +{ | |
1102 | + struct irq_cfg *cfg = irq_cfg + irq; | |
1103 | + struct msi_msg msg; | |
1104 | + unsigned int dest; | |
1105 | + cpumask_t tmp; | |
1106 | + | |
1107 | + cpus_and(tmp, mask, cpu_online_map); | |
1108 | + if (cpus_empty(tmp)) | |
1109 | + return; | |
1110 | + | |
1111 | + if (assign_irq_vector(irq, mask)) | |
1112 | + return; | |
1113 | + | |
1114 | + cpus_and(tmp, cfg->domain, mask); | |
1115 | + dest = cpu_mask_to_apicid(tmp); | |
1116 | + | |
1117 | + dmar_msi_read(irq, &msg); | |
1118 | + | |
1119 | + msg.data &= ~MSI_DATA_VECTOR_MASK; | |
1120 | + msg.data |= MSI_DATA_VECTOR(cfg->vector); | |
1121 | + msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; | |
1122 | + msg.address_lo |= MSI_ADDR_DEST_ID(dest); | |
1123 | + | |
1124 | + dmar_msi_write(irq, &msg); | |
1125 | + irq_desc[irq].affinity = mask; | |
1126 | +} | |
1127 | +#endif /* CONFIG_SMP */ | |
1128 | + | |
1129 | +struct irq_chip dmar_msi_type = { | |
1130 | + .name = "DMAR_MSI", | |
1131 | + .unmask = dmar_msi_unmask, | |
1132 | + .mask = dmar_msi_mask, | |
1133 | + .ack = ack_apic_edge, | |
1134 | +#ifdef CONFIG_SMP | |
1135 | + .set_affinity = dmar_msi_set_affinity, | |
1136 | +#endif | |
1137 | + .retrigger = ioapic_retrigger_irq, | |
1138 | +}; | |
1139 | + | |
1140 | +int arch_setup_dmar_msi(unsigned int irq) | |
1141 | +{ | |
1142 | + int ret; | |
1143 | + struct msi_msg msg; | |
1144 | + | |
1145 | + ret = msi_compose_msg(NULL, irq, &msg); | |
1146 | + if (ret < 0) | |
1147 | + return ret; | |
1148 | + dmar_msi_write(irq, &msg); | |
1149 | + set_irq_chip_and_handler_name(irq, &dmar_msi_type, handle_edge_irq, | |
1150 | + "edge"); | |
1151 | + return 0; | |
1152 | +} | |
1153 | +#endif | |
1154 | ||
1155 | +#endif /* CONFIG_PCI_MSI */ | |
1156 | /* | |
1157 | * Hypertransport interrupt support | |
1158 | */ | |
1159 | @@ -2177,8 +2245,27 @@ int io_apic_set_pci_routing (int ioapic, | |
1160 | return 0; | |
1161 | } | |
1162 | ||
1163 | -#endif /* CONFIG_ACPI */ | |
1164 | ||
1165 | +int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) | |
1166 | +{ | |
1167 | + int i; | |
1168 | + | |
1169 | + if (skip_ioapic_setup) | |
1170 | + return -1; | |
1171 | + | |
1172 | + for (i = 0; i < mp_irq_entries; i++) | |
1173 | + if (mp_irqs[i].mpc_irqtype == mp_INT && | |
1174 | + mp_irqs[i].mpc_srcbusirq == bus_irq) | |
1175 | + break; | |
1176 | + if (i >= mp_irq_entries) | |
1177 | + return -1; | |
1178 | + | |
1179 | + *trigger = irq_trigger(i); | |
1180 | + *polarity = irq_polarity(i); | |
1181 | + return 0; | |
1182 | +} | |
1183 | + | |
1184 | +#endif /* CONFIG_ACPI */ | |
1185 | ||
1186 | #ifndef CONFIG_XEN | |
1187 | /* | |
1188 | @@ -2217,3 +2304,4 @@ void __init setup_ioapic_dest(void) | |
1189 | } | |
1190 | #endif | |
1191 | #endif /* !CONFIG_XEN */ | |
1192 | + | |
1193 | --- sle11-2009-06-29.orig/arch/x86/kernel/ioport_32-xen.c 2008-12-15 11:27:22.000000000 +0100 | |
1194 | +++ sle11-2009-06-29/arch/x86/kernel/ioport_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1195 | @@ -1,6 +1,4 @@ | |
1196 | /* | |
1197 | - * linux/arch/i386/kernel/ioport.c | |
1198 | - * | |
1199 | * This contains the io-permission bitmap code - written by obz, with changes | |
1200 | * by Linus. | |
1201 | */ | |
1202 | --- sle11-2009-06-29.orig/arch/x86/kernel/ioport_64-xen.c 2008-12-15 11:27:22.000000000 +0100 | |
1203 | +++ sle11-2009-06-29/arch/x86/kernel/ioport_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1204 | @@ -1,6 +1,4 @@ | |
1205 | /* | |
1206 | - * linux/arch/x86_64/kernel/ioport.c | |
1207 | - * | |
1208 | * This contains the io-permission bitmap code - written by obz, with changes | |
1209 | * by Linus. | |
1210 | */ | |
1211 | --- sle11-2009-06-29.orig/arch/x86/kernel/irq_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
1212 | +++ sle11-2009-06-29/arch/x86/kernel/irq_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1213 | @@ -1,6 +1,4 @@ | |
1214 | /* | |
1215 | - * linux/arch/i386/kernel/irq.c | |
1216 | - * | |
1217 | * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar | |
1218 | * | |
1219 | * This file contains the lowest level x86-specific interrupt | |
1220 | @@ -231,8 +229,6 @@ asmlinkage void do_softirq(void) | |
1221 | ||
1222 | local_irq_restore(flags); | |
1223 | } | |
1224 | - | |
1225 | -EXPORT_SYMBOL(do_softirq); | |
1226 | #endif | |
1227 | ||
1228 | /* | |
1229 | @@ -259,9 +255,17 @@ int show_interrupts(struct seq_file *p, | |
1230 | } | |
1231 | ||
1232 | if (i < NR_IRQS) { | |
1233 | + unsigned any_count = 0; | |
1234 | + | |
1235 | spin_lock_irqsave(&irq_desc[i].lock, flags); | |
1236 | +#ifndef CONFIG_SMP | |
1237 | + any_count = kstat_irqs(i); | |
1238 | +#else | |
1239 | + for_each_online_cpu(j) | |
1240 | + any_count |= kstat_cpu(j).irqs[i]; | |
1241 | +#endif | |
1242 | action = irq_desc[i].action; | |
1243 | - if (!action) | |
1244 | + if (!action && !any_count) | |
1245 | goto skip; | |
1246 | seq_printf(p, "%3d: ",i); | |
1247 | #ifndef CONFIG_SMP | |
1248 | @@ -272,10 +276,12 @@ int show_interrupts(struct seq_file *p, | |
1249 | #endif | |
1250 | seq_printf(p, " %8s", irq_desc[i].chip->name); | |
1251 | seq_printf(p, "-%-8s", irq_desc[i].name); | |
1252 | - seq_printf(p, " %s", action->name); | |
1253 | ||
1254 | - for (action=action->next; action; action = action->next) | |
1255 | - seq_printf(p, ", %s", action->name); | |
1256 | + if (action) { | |
1257 | + seq_printf(p, " %s", action->name); | |
1258 | + while ((action = action->next) != NULL) | |
1259 | + seq_printf(p, ", %s", action->name); | |
1260 | + } | |
1261 | ||
1262 | seq_putc(p, '\n'); | |
1263 | skip: | |
1264 | @@ -284,13 +290,46 @@ skip: | |
1265 | seq_printf(p, "NMI: "); | |
1266 | for_each_online_cpu(j) | |
1267 | seq_printf(p, "%10u ", nmi_count(j)); | |
1268 | - seq_putc(p, '\n'); | |
1269 | + seq_printf(p, " Non-maskable interrupts\n"); | |
1270 | #ifdef CONFIG_X86_LOCAL_APIC | |
1271 | seq_printf(p, "LOC: "); | |
1272 | for_each_online_cpu(j) | |
1273 | seq_printf(p, "%10u ", | |
1274 | per_cpu(irq_stat,j).apic_timer_irqs); | |
1275 | - seq_putc(p, '\n'); | |
1276 | + seq_printf(p, " Local timer interrupts\n"); | |
1277 | +#endif | |
1278 | +#ifdef CONFIG_SMP | |
1279 | + seq_printf(p, "RES: "); | |
1280 | + for_each_online_cpu(j) | |
1281 | + seq_printf(p, "%10u ", | |
1282 | + per_cpu(irq_stat,j).irq_resched_count); | |
1283 | + seq_printf(p, " Rescheduling interrupts\n"); | |
1284 | + seq_printf(p, "CAL: "); | |
1285 | + for_each_online_cpu(j) | |
1286 | + seq_printf(p, "%10u ", | |
1287 | + per_cpu(irq_stat,j).irq_call_count); | |
1288 | + seq_printf(p, " function call interrupts\n"); | |
1289 | +#ifndef CONFIG_XEN | |
1290 | + seq_printf(p, "TLB: "); | |
1291 | + for_each_online_cpu(j) | |
1292 | + seq_printf(p, "%10u ", | |
1293 | + per_cpu(irq_stat,j).irq_tlb_count); | |
1294 | + seq_printf(p, " TLB shootdowns\n"); | |
1295 | +#endif | |
1296 | +#endif | |
1297 | +#ifdef CONFIG_X86_MCE | |
1298 | + seq_printf(p, "TRM: "); | |
1299 | + for_each_online_cpu(j) | |
1300 | + seq_printf(p, "%10u ", | |
1301 | + per_cpu(irq_stat,j).irq_thermal_count); | |
1302 | + seq_printf(p, " Thermal event interrupts\n"); | |
1303 | +#endif | |
1304 | +#ifdef CONFIG_X86_LOCAL_APIC | |
1305 | + seq_printf(p, "SPU: "); | |
1306 | + for_each_online_cpu(j) | |
1307 | + seq_printf(p, "%10u ", | |
1308 | + per_cpu(irq_stat,j).irq_spurious_count); | |
1309 | + seq_printf(p, " Spurious interrupts\n"); | |
1310 | #endif | |
1311 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | |
1312 | #if defined(CONFIG_X86_IO_APIC) | |
1313 | --- sle11-2009-06-29.orig/arch/x86/kernel/irq_64-xen.c 2008-12-15 11:27:22.000000000 +0100 | |
1314 | +++ sle11-2009-06-29/arch/x86/kernel/irq_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1315 | @@ -1,6 +1,4 @@ | |
1316 | /* | |
1317 | - * linux/arch/x86_64/kernel/irq.c | |
1318 | - * | |
1319 | * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar | |
1320 | * | |
1321 | * This file contains the lowest level x86_64-specific interrupt | |
1322 | @@ -64,9 +62,17 @@ int show_interrupts(struct seq_file *p, | |
1323 | } | |
1324 | ||
1325 | if (i < NR_IRQS) { | |
1326 | + unsigned any_count = 0; | |
1327 | + | |
1328 | spin_lock_irqsave(&irq_desc[i].lock, flags); | |
1329 | +#ifndef CONFIG_SMP | |
1330 | + any_count = kstat_irqs(i); | |
1331 | +#else | |
1332 | + for_each_online_cpu(j) | |
1333 | + any_count |= kstat_cpu(j).irqs[i]; | |
1334 | +#endif | |
1335 | action = irq_desc[i].action; | |
1336 | - if (!action) | |
1337 | + if (!action && !any_count) | |
1338 | goto skip; | |
1339 | seq_printf(p, "%3d: ",i); | |
1340 | #ifndef CONFIG_SMP | |
1341 | @@ -78,9 +84,11 @@ int show_interrupts(struct seq_file *p, | |
1342 | seq_printf(p, " %8s", irq_desc[i].chip->name); | |
1343 | seq_printf(p, "-%-8s", irq_desc[i].name); | |
1344 | ||
1345 | - seq_printf(p, " %s", action->name); | |
1346 | - for (action=action->next; action; action = action->next) | |
1347 | - seq_printf(p, ", %s", action->name); | |
1348 | + if (action) { | |
1349 | + seq_printf(p, " %s", action->name); | |
1350 | + while ((action = action->next) != NULL) | |
1351 | + seq_printf(p, ", %s", action->name); | |
1352 | + } | |
1353 | seq_putc(p, '\n'); | |
1354 | skip: | |
1355 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | |
1356 | @@ -88,12 +96,44 @@ skip: | |
1357 | seq_printf(p, "NMI: "); | |
1358 | for_each_online_cpu(j) | |
1359 | seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count); | |
1360 | - seq_putc(p, '\n'); | |
1361 | + seq_printf(p, " Non-maskable interrupts\n"); | |
1362 | #ifdef CONFIG_X86_LOCAL_APIC | |
1363 | seq_printf(p, "LOC: "); | |
1364 | for_each_online_cpu(j) | |
1365 | seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs); | |
1366 | - seq_putc(p, '\n'); | |
1367 | + seq_printf(p, " Local timer interrupts\n"); | |
1368 | +#endif | |
1369 | +#ifdef CONFIG_SMP | |
1370 | + seq_printf(p, "RES: "); | |
1371 | + for_each_online_cpu(j) | |
1372 | + seq_printf(p, "%10u ", cpu_pda(j)->irq_resched_count); | |
1373 | + seq_printf(p, " Rescheduling interrupts\n"); | |
1374 | + seq_printf(p, "CAL: "); | |
1375 | + for_each_online_cpu(j) | |
1376 | + seq_printf(p, "%10u ", cpu_pda(j)->irq_call_count); | |
1377 | + seq_printf(p, " function call interrupts\n"); | |
1378 | +#ifndef CONFIG_XEN | |
1379 | + seq_printf(p, "TLB: "); | |
1380 | + for_each_online_cpu(j) | |
1381 | + seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count); | |
1382 | + seq_printf(p, " TLB shootdowns\n"); | |
1383 | +#endif | |
1384 | +#endif | |
1385 | +#ifdef CONFIG_X86_MCE | |
1386 | + seq_printf(p, "TRM: "); | |
1387 | + for_each_online_cpu(j) | |
1388 | + seq_printf(p, "%10u ", cpu_pda(j)->irq_thermal_count); | |
1389 | + seq_printf(p, " Thermal event interrupts\n"); | |
1390 | + seq_printf(p, "THR: "); | |
1391 | + for_each_online_cpu(j) | |
1392 | + seq_printf(p, "%10u ", cpu_pda(j)->irq_threshold_count); | |
1393 | + seq_printf(p, " Threshold APIC interrupts\n"); | |
1394 | +#endif | |
1395 | +#ifdef CONFIG_X86_LOCAL_APIC | |
1396 | + seq_printf(p, "SPU: "); | |
1397 | + for_each_online_cpu(j) | |
1398 | + seq_printf(p, "%10u ", cpu_pda(j)->irq_spurious_count); | |
1399 | + seq_printf(p, " Spurious interrupts\n"); | |
1400 | #endif | |
1401 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | |
1402 | } | |
1403 | @@ -211,7 +251,6 @@ asmlinkage void do_softirq(void) | |
1404 | } | |
1405 | local_irq_restore(flags); | |
1406 | } | |
1407 | -EXPORT_SYMBOL(do_softirq); | |
1408 | ||
1409 | #ifndef CONFIG_X86_LOCAL_APIC | |
1410 | /* | |
1411 | --- sle11-2009-06-29.orig/arch/x86/kernel/ldt_32-xen.c 2008-12-15 11:27:22.000000000 +0100 | |
1412 | +++ sle11-2009-06-29/arch/x86/kernel/ldt_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1413 | @@ -1,6 +1,4 @@ | |
1414 | /* | |
1415 | - * linux/arch/i386/kernel/ldt.c | |
1416 | - * | |
1417 | * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds | |
1418 | * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> | |
1419 | */ | |
1420 | @@ -106,14 +104,14 @@ int init_new_context(struct task_struct | |
1421 | struct mm_struct * old_mm; | |
1422 | int retval = 0; | |
1423 | ||
1424 | - init_MUTEX(&mm->context.sem); | |
1425 | + mutex_init(&mm->context.lock); | |
1426 | mm->context.size = 0; | |
1427 | mm->context.has_foreign_mappings = 0; | |
1428 | old_mm = current->mm; | |
1429 | if (old_mm && old_mm->context.size > 0) { | |
1430 | - down(&old_mm->context.sem); | |
1431 | + mutex_lock(&old_mm->context.lock); | |
1432 | retval = copy_ldt(&mm->context, &old_mm->context); | |
1433 | - up(&old_mm->context.sem); | |
1434 | + mutex_unlock(&old_mm->context.lock); | |
1435 | } | |
1436 | return retval; | |
1437 | } | |
1438 | @@ -149,7 +147,7 @@ static int read_ldt(void __user * ptr, u | |
1439 | if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) | |
1440 | bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; | |
1441 | ||
1442 | - down(&mm->context.sem); | |
1443 | + mutex_lock(&mm->context.lock); | |
1444 | size = mm->context.size*LDT_ENTRY_SIZE; | |
1445 | if (size > bytecount) | |
1446 | size = bytecount; | |
1447 | @@ -157,7 +155,7 @@ static int read_ldt(void __user * ptr, u | |
1448 | err = 0; | |
1449 | if (copy_to_user(ptr, mm->context.ldt, size)) | |
1450 | err = -EFAULT; | |
1451 | - up(&mm->context.sem); | |
1452 | + mutex_unlock(&mm->context.lock); | |
1453 | if (err < 0) | |
1454 | goto error_return; | |
1455 | if (size != bytecount) { | |
1456 | @@ -213,7 +211,7 @@ static int write_ldt(void __user * ptr, | |
1457 | goto out; | |
1458 | } | |
1459 | ||
1460 | - down(&mm->context.sem); | |
1461 | + mutex_lock(&mm->context.lock); | |
1462 | if (ldt_info.entry_number >= mm->context.size) { | |
1463 | error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); | |
1464 | if (error < 0) | |
1465 | @@ -240,7 +238,7 @@ install: | |
1466 | entry_1, entry_2); | |
1467 | ||
1468 | out_unlock: | |
1469 | - up(&mm->context.sem); | |
1470 | + mutex_unlock(&mm->context.lock); | |
1471 | out: | |
1472 | return error; | |
1473 | } | |
1474 | --- sle11-2009-06-29.orig/arch/x86/kernel/ldt_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
1475 | +++ sle11-2009-06-29/arch/x86/kernel/ldt_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1476 | @@ -1,6 +1,4 @@ | |
1477 | /* | |
1478 | - * linux/arch/x86_64/kernel/ldt.c | |
1479 | - * | |
1480 | * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds | |
1481 | * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> | |
1482 | * Copyright (C) 2002 Andi Kleen | |
1483 | @@ -112,19 +110,14 @@ int init_new_context(struct task_struct | |
1484 | int retval = 0; | |
1485 | ||
1486 | memset(&mm->context, 0, sizeof(mm->context)); | |
1487 | - init_MUTEX(&mm->context.sem); | |
1488 | + mutex_init(&mm->context.lock); | |
1489 | old_mm = current->mm; | |
1490 | if (old_mm) | |
1491 | mm->context.vdso = old_mm->context.vdso; | |
1492 | if (old_mm && old_mm->context.size > 0) { | |
1493 | - down(&old_mm->context.sem); | |
1494 | + mutex_lock(&old_mm->context.lock); | |
1495 | retval = copy_ldt(&mm->context, &old_mm->context); | |
1496 | - up(&old_mm->context.sem); | |
1497 | - } | |
1498 | - if (retval == 0) { | |
1499 | - spin_lock(&mm_unpinned_lock); | |
1500 | - list_add(&mm->context.unpinned, &mm_unpinned); | |
1501 | - spin_unlock(&mm_unpinned_lock); | |
1502 | + mutex_unlock(&old_mm->context.lock); | |
1503 | } | |
1504 | return retval; | |
1505 | } | |
1506 | @@ -148,11 +141,6 @@ void destroy_context(struct mm_struct *m | |
1507 | kfree(mm->context.ldt); | |
1508 | mm->context.size = 0; | |
1509 | } | |
1510 | - if (!PagePinned(virt_to_page(mm->pgd))) { | |
1511 | - spin_lock(&mm_unpinned_lock); | |
1512 | - list_del(&mm->context.unpinned); | |
1513 | - spin_unlock(&mm_unpinned_lock); | |
1514 | - } | |
1515 | } | |
1516 | ||
1517 | static int read_ldt(void __user * ptr, unsigned long bytecount) | |
1518 | @@ -166,7 +154,7 @@ static int read_ldt(void __user * ptr, u | |
1519 | if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) | |
1520 | bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; | |
1521 | ||
1522 | - down(&mm->context.sem); | |
1523 | + mutex_lock(&mm->context.lock); | |
1524 | size = mm->context.size*LDT_ENTRY_SIZE; | |
1525 | if (size > bytecount) | |
1526 | size = bytecount; | |
1527 | @@ -174,7 +162,7 @@ static int read_ldt(void __user * ptr, u | |
1528 | err = 0; | |
1529 | if (copy_to_user(ptr, mm->context.ldt, size)) | |
1530 | err = -EFAULT; | |
1531 | - up(&mm->context.sem); | |
1532 | + mutex_unlock(&mm->context.lock); | |
1533 | if (err < 0) | |
1534 | goto error_return; | |
1535 | if (size != bytecount) { | |
1536 | @@ -227,7 +215,7 @@ static int write_ldt(void __user * ptr, | |
1537 | goto out; | |
1538 | } | |
1539 | ||
1540 | - down(&mm->context.sem); | |
1541 | + mutex_lock(&mm->context.lock); | |
1542 | if (ldt_info.entry_number >= (unsigned)mm->context.size) { | |
1543 | error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); | |
1544 | if (error < 0) | |
1545 | @@ -256,7 +244,7 @@ install: | |
1546 | error = HYPERVISOR_update_descriptor(mach_lp, (unsigned long)((entry_1 | (unsigned long) entry_2 << 32))); | |
1547 | ||
1548 | out_unlock: | |
1549 | - up(&mm->context.sem); | |
1550 | + mutex_unlock(&mm->context.lock); | |
1551 | out: | |
1552 | return error; | |
1553 | } | |
1554 | --- sle11-2009-06-29.orig/arch/x86/kernel/mpparse_32-xen.c 2008-12-15 11:27:22.000000000 +0100 | |
1555 | +++ sle11-2009-06-29/arch/x86/kernel/mpparse_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1556 | @@ -1023,7 +1023,7 @@ void __init mp_config_acpi_legacy_irqs ( | |
1557 | ||
1558 | /* | |
1559 | * Use the default configuration for the IRQs 0-15. Unless | |
1560 | - * overriden by (MADT) interrupt source override entries. | |
1561 | + * overridden by (MADT) interrupt source override entries. | |
1562 | */ | |
1563 | for (i = 0; i < 16; i++) { | |
1564 | int idx; | |
1565 | --- sle11-2009-06-29.orig/arch/x86/kernel/mpparse_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
1566 | +++ sle11-2009-06-29/arch/x86/kernel/mpparse_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1567 | @@ -57,6 +57,8 @@ unsigned long mp_lapic_addr = 0; | |
1568 | ||
1569 | /* Processor that is doing the boot up */ | |
1570 | unsigned int boot_cpu_id = -1U; | |
1571 | +EXPORT_SYMBOL(boot_cpu_id); | |
1572 | + | |
1573 | /* Internal processor count */ | |
1574 | unsigned int num_processors __cpuinitdata = 0; | |
1575 | ||
1576 | @@ -87,7 +89,7 @@ static int __init mpf_checksum(unsigned | |
1577 | } | |
1578 | ||
1579 | #ifndef CONFIG_XEN | |
1580 | -static void __cpuinit MP_processor_info (struct mpc_config_processor *m) | |
1581 | +static void __cpuinit MP_processor_info(struct mpc_config_processor *m) | |
1582 | { | |
1583 | int cpu; | |
1584 | cpumask_t tmp_map; | |
1585 | @@ -124,13 +126,24 @@ static void __cpuinit MP_processor_info | |
1586 | cpu = 0; | |
1587 | } | |
1588 | bios_cpu_apicid[cpu] = m->mpc_apicid; | |
1589 | - x86_cpu_to_apicid[cpu] = m->mpc_apicid; | |
1590 | + /* | |
1591 | + * We get called early in the the start_kernel initialization | |
1592 | + * process when the per_cpu data area is not yet setup, so we | |
1593 | + * use a static array that is removed after the per_cpu data | |
1594 | + * area is created. | |
1595 | + */ | |
1596 | + if (x86_cpu_to_apicid_ptr) { | |
1597 | + u8 *x86_cpu_to_apicid = (u8 *)x86_cpu_to_apicid_ptr; | |
1598 | + x86_cpu_to_apicid[cpu] = m->mpc_apicid; | |
1599 | + } else { | |
1600 | + per_cpu(x86_cpu_to_apicid, cpu) = m->mpc_apicid; | |
1601 | + } | |
1602 | ||
1603 | cpu_set(cpu, cpu_possible_map); | |
1604 | cpu_set(cpu, cpu_present_map); | |
1605 | } | |
1606 | #else | |
1607 | -static void __cpuinit MP_processor_info (struct mpc_config_processor *m) | |
1608 | +static void __cpuinit MP_processor_info(struct mpc_config_processor *m) | |
1609 | { | |
1610 | num_processors++; | |
1611 | } | |
1612 | --- sle11-2009-06-29.orig/arch/x86/kernel/pci-dma-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
1613 | +++ sle11-2009-06-29/arch/x86/kernel/pci-dma-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1614 | @@ -13,14 +13,13 @@ | |
1615 | #include <linux/pci.h> | |
1616 | #include <linux/module.h> | |
1617 | #include <linux/version.h> | |
1618 | -#include <linux/pci.h> | |
1619 | #include <asm/io.h> | |
1620 | #include <xen/balloon.h> | |
1621 | #include <xen/gnttab.h> | |
1622 | #include <asm/swiotlb.h> | |
1623 | #include <asm/tlbflush.h> | |
1624 | -#include <asm-i386/mach-xen/asm/swiotlb.h> | |
1625 | -#include <asm-i386/mach-xen/asm/gnttab_dma.h> | |
1626 | +#include <asm/swiotlb_32.h> | |
1627 | +#include <asm/gnttab_dma.h> | |
1628 | #include <asm/bug.h> | |
1629 | ||
1630 | #ifdef __x86_64__ | |
1631 | @@ -106,27 +105,29 @@ int range_straddles_page_boundary(paddr_ | |
1632 | } | |
1633 | ||
1634 | int | |
1635 | -dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, | |
1636 | +dma_map_sg(struct device *hwdev, struct scatterlist *sgl, int nents, | |
1637 | enum dma_data_direction direction) | |
1638 | { | |
1639 | int i, rc; | |
1640 | ||
1641 | BUG_ON(!valid_dma_direction(direction)); | |
1642 | - WARN_ON(nents == 0 || sg[0].length == 0); | |
1643 | + WARN_ON(nents == 0 || sgl->length == 0); | |
1644 | ||
1645 | if (swiotlb) { | |
1646 | - rc = swiotlb_map_sg(hwdev, sg, nents, direction); | |
1647 | + rc = swiotlb_map_sg(hwdev, sgl, nents, direction); | |
1648 | } else { | |
1649 | - for (i = 0; i < nents; i++ ) { | |
1650 | - BUG_ON(!sg[i].page); | |
1651 | - sg[i].dma_address = | |
1652 | - gnttab_dma_map_page(sg[i].page) + sg[i].offset; | |
1653 | - sg[i].dma_length = sg[i].length; | |
1654 | + struct scatterlist *sg; | |
1655 | + | |
1656 | + for_each_sg(sgl, sg, nents, i) { | |
1657 | + BUG_ON(!sg_page(sg)); | |
1658 | + sg->dma_address = | |
1659 | + gnttab_dma_map_page(sg_page(sg)) + sg->offset; | |
1660 | + sg->dma_length = sg->length; | |
1661 | IOMMU_BUG_ON(address_needs_mapping( | |
1662 | - hwdev, sg[i].dma_address)); | |
1663 | + hwdev, sg->dma_address)); | |
1664 | IOMMU_BUG_ON(range_straddles_page_boundary( | |
1665 | - page_to_pseudophys(sg[i].page) + sg[i].offset, | |
1666 | - sg[i].length)); | |
1667 | + page_to_pseudophys(sg_page(sg)) + sg->offset, | |
1668 | + sg->length)); | |
1669 | } | |
1670 | rc = nents; | |
1671 | } | |
1672 | @@ -137,17 +138,19 @@ dma_map_sg(struct device *hwdev, struct | |
1673 | EXPORT_SYMBOL(dma_map_sg); | |
1674 | ||
1675 | void | |
1676 | -dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, | |
1677 | +dma_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nents, | |
1678 | enum dma_data_direction direction) | |
1679 | { | |
1680 | int i; | |
1681 | ||
1682 | BUG_ON(!valid_dma_direction(direction)); | |
1683 | if (swiotlb) | |
1684 | - swiotlb_unmap_sg(hwdev, sg, nents, direction); | |
1685 | + swiotlb_unmap_sg(hwdev, sgl, nents, direction); | |
1686 | else { | |
1687 | - for (i = 0; i < nents; i++ ) | |
1688 | - gnttab_dma_unmap_page(sg[i].dma_address); | |
1689 | + struct scatterlist *sg; | |
1690 | + | |
1691 | + for_each_sg(sgl, sg, nents, i) | |
1692 | + gnttab_dma_unmap_page(sg->dma_address); | |
1693 | } | |
1694 | } | |
1695 | EXPORT_SYMBOL(dma_unmap_sg); | |
1696 | @@ -261,7 +264,8 @@ void dma_free_coherent(struct device *de | |
1697 | { | |
1698 | struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; | |
1699 | int order = get_order(size); | |
1700 | - | |
1701 | + | |
1702 | + WARN_ON(irqs_disabled()); /* for portability */ | |
1703 | if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) { | |
1704 | int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; | |
1705 | ||
1706 | --- sle11-2009-06-29.orig/arch/x86/kernel/process_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
1707 | +++ sle11-2009-06-29/arch/x86/kernel/process_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1708 | @@ -1,6 +1,4 @@ | |
1709 | /* | |
1710 | - * linux/arch/i386/kernel/process.c | |
1711 | - * | |
1712 | * Copyright (C) 1995 Linus Torvalds | |
1713 | * | |
1714 | * Pentium III FXSR, SSE support | |
1715 | @@ -190,6 +188,10 @@ void cpu_idle(void) | |
1716 | } | |
1717 | } | |
1718 | ||
1719 | +static void do_nothing(void *unused) | |
1720 | +{ | |
1721 | +} | |
1722 | + | |
1723 | void cpu_idle_wait(void) | |
1724 | { | |
1725 | unsigned int cpu, this_cpu = get_cpu(); | |
1726 | @@ -214,13 +216,20 @@ void cpu_idle_wait(void) | |
1727 | cpu_clear(cpu, map); | |
1728 | } | |
1729 | cpus_and(map, map, cpu_online_map); | |
1730 | + /* | |
1731 | + * We waited 1 sec, if a CPU still did not call idle | |
1732 | + * it may be because it is in idle and not waking up | |
1733 | + * because it has nothing to do. | |
1734 | + * Give all the remaining CPUS a kick. | |
1735 | + */ | |
1736 | + smp_call_function_mask(map, do_nothing, 0, 0); | |
1737 | } while (!cpus_empty(map)); | |
1738 | ||
1739 | set_cpus_allowed(current, tmp); | |
1740 | } | |
1741 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | |
1742 | ||
1743 | -void __devinit select_idle_routine(const struct cpuinfo_x86 *c) | |
1744 | +void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) | |
1745 | { | |
1746 | } | |
1747 | ||
1748 | @@ -238,34 +247,52 @@ static int __init idle_setup(char *str) | |
1749 | } | |
1750 | early_param("idle", idle_setup); | |
1751 | ||
1752 | -void show_regs(struct pt_regs * regs) | |
1753 | +void __show_registers(struct pt_regs *regs, int all) | |
1754 | { | |
1755 | unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; | |
1756 | unsigned long d0, d1, d2, d3, d6, d7; | |
1757 | + unsigned long esp; | |
1758 | + unsigned short ss, gs; | |
1759 | + | |
1760 | + if (user_mode_vm(regs)) { | |
1761 | + esp = regs->esp; | |
1762 | + ss = regs->xss & 0xffff; | |
1763 | + savesegment(gs, gs); | |
1764 | + } else { | |
1765 | + esp = (unsigned long) (®s->esp); | |
1766 | + savesegment(ss, ss); | |
1767 | + savesegment(gs, gs); | |
1768 | + } | |
1769 | ||
1770 | printk("\n"); | |
1771 | - printk("Pid: %d, comm: %20s\n", current->pid, current->comm); | |
1772 | - printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); | |
1773 | + printk("Pid: %d, comm: %s %s (%s %.*s)\n", | |
1774 | + task_pid_nr(current), current->comm, | |
1775 | + print_tainted(), init_utsname()->release, | |
1776 | + (int)strcspn(init_utsname()->version, " "), | |
1777 | + init_utsname()->version); | |
1778 | + | |
1779 | + printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", | |
1780 | + 0xffff & regs->xcs, regs->eip, regs->eflags, | |
1781 | + smp_processor_id()); | |
1782 | print_symbol("EIP is at %s\n", regs->eip); | |
1783 | ||
1784 | - if (user_mode_vm(regs)) | |
1785 | - printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); | |
1786 | - printk(" EFLAGS: %08lx %s (%s %.*s)\n", | |
1787 | - regs->eflags, print_tainted(), init_utsname()->release, | |
1788 | - (int)strcspn(init_utsname()->version, " "), | |
1789 | - init_utsname()->version); | |
1790 | printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", | |
1791 | - regs->eax,regs->ebx,regs->ecx,regs->edx); | |
1792 | - printk("ESI: %08lx EDI: %08lx EBP: %08lx", | |
1793 | - regs->esi, regs->edi, regs->ebp); | |
1794 | - printk(" DS: %04x ES: %04x FS: %04x\n", | |
1795 | - 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs); | |
1796 | + regs->eax, regs->ebx, regs->ecx, regs->edx); | |
1797 | + printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", | |
1798 | + regs->esi, regs->edi, regs->ebp, esp); | |
1799 | + printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", | |
1800 | + regs->xds & 0xffff, regs->xes & 0xffff, | |
1801 | + regs->xfs & 0xffff, gs, ss); | |
1802 | + | |
1803 | + if (!all) | |
1804 | + return; | |
1805 | ||
1806 | cr0 = read_cr0(); | |
1807 | cr2 = read_cr2(); | |
1808 | cr3 = read_cr3(); | |
1809 | cr4 = read_cr4_safe(); | |
1810 | - printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); | |
1811 | + printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", | |
1812 | + cr0, cr2, cr3, cr4); | |
1813 | ||
1814 | get_debugreg(d0, 0); | |
1815 | get_debugreg(d1, 1); | |
1816 | @@ -273,10 +300,16 @@ void show_regs(struct pt_regs * regs) | |
1817 | get_debugreg(d3, 3); | |
1818 | printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", | |
1819 | d0, d1, d2, d3); | |
1820 | + | |
1821 | get_debugreg(d6, 6); | |
1822 | get_debugreg(d7, 7); | |
1823 | - printk("DR6: %08lx DR7: %08lx\n", d6, d7); | |
1824 | + printk("DR6: %08lx DR7: %08lx\n", | |
1825 | + d6, d7); | |
1826 | +} | |
1827 | ||
1828 | +void show_regs(struct pt_regs *regs) | |
1829 | +{ | |
1830 | + __show_registers(regs, 1); | |
1831 | show_trace(NULL, regs, ®s->esp); | |
1832 | } | |
1833 | ||
1834 | --- sle11-2009-06-29.orig/arch/x86/kernel/process_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
1835 | +++ sle11-2009-06-29/arch/x86/kernel/process_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1836 | @@ -1,6 +1,4 @@ | |
1837 | /* | |
1838 | - * linux/arch/x86-64/kernel/process.c | |
1839 | - * | |
1840 | * Copyright (C) 1995 Linus Torvalds | |
1841 | * | |
1842 | * Pentium III FXSR, SSE support | |
1843 | @@ -41,6 +39,7 @@ | |
1844 | #include <linux/notifier.h> | |
1845 | #include <linux/kprobes.h> | |
1846 | #include <linux/kdebug.h> | |
1847 | +#include <linux/tick.h> | |
1848 | ||
1849 | #include <asm/uaccess.h> | |
1850 | #include <asm/pgtable.h> | |
1851 | @@ -172,6 +171,9 @@ void cpu_idle (void) | |
1852 | ||
1853 | if (__get_cpu_var(cpu_idle_state)) | |
1854 | __get_cpu_var(cpu_idle_state) = 0; | |
1855 | + | |
1856 | + tick_nohz_stop_sched_tick(); | |
1857 | + | |
1858 | rmb(); | |
1859 | idle = xen_idle; /* no alternatives */ | |
1860 | if (cpu_is_offline(smp_processor_id())) | |
1861 | @@ -190,12 +192,17 @@ void cpu_idle (void) | |
1862 | __exit_idle(); | |
1863 | } | |
1864 | ||
1865 | + tick_nohz_restart_sched_tick(); | |
1866 | preempt_enable_no_resched(); | |
1867 | schedule(); | |
1868 | preempt_disable(); | |
1869 | } | |
1870 | } | |
1871 | ||
1872 | +static void do_nothing(void *unused) | |
1873 | +{ | |
1874 | +} | |
1875 | + | |
1876 | void cpu_idle_wait(void) | |
1877 | { | |
1878 | unsigned int cpu, this_cpu = get_cpu(); | |
1879 | @@ -221,6 +228,13 @@ void cpu_idle_wait(void) | |
1880 | cpu_clear(cpu, map); | |
1881 | } | |
1882 | cpus_and(map, map, cpu_online_map); | |
1883 | + /* | |
1884 | + * We waited 1 sec, if a CPU still did not call idle | |
1885 | + * it may be because it is in idle and not waking up | |
1886 | + * because it has nothing to do. | |
1887 | + * Give all the remaining CPUS a kick. | |
1888 | + */ | |
1889 | + smp_call_function_mask(map, do_nothing, 0, 0); | |
1890 | } while (!cpus_empty(map)); | |
1891 | ||
1892 | set_cpus_allowed(current, tmp); | |
1893 | @@ -528,7 +542,7 @@ static inline void __switch_to_xtra(stru | |
1894 | * | |
1895 | * Kprobes not supported here. Set the probe on schedule instead. | |
1896 | */ | |
1897 | -__kprobes struct task_struct * | |
1898 | +struct task_struct * | |
1899 | __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |
1900 | { | |
1901 | struct thread_struct *prev = &prev_p->thread, | |
1902 | --- sle11-2009-06-29.orig/arch/x86/kernel/quirks-xen.c 2008-12-15 11:27:22.000000000 +0100 | |
1903 | +++ sle11-2009-06-29/arch/x86/kernel/quirks-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
1904 | @@ -41,7 +41,353 @@ static void __devinit quirk_intel_irqbal | |
1905 | if (!(config & 0x2)) | |
1906 | pci_write_config_byte(dev, 0xf4, config); | |
1907 | } | |
1908 | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance); | |
1909 | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance); | |
1910 | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_intel_irqbalance); | |
1911 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, | |
1912 | + quirk_intel_irqbalance); | |
1913 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, | |
1914 | + quirk_intel_irqbalance); | |
1915 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, | |
1916 | + quirk_intel_irqbalance); | |
1917 | +#endif | |
1918 | + | |
1919 | +#if defined(CONFIG_HPET_TIMER) | |
1920 | +#include <asm/hpet.h> | |
1921 | + | |
1922 | +unsigned long force_hpet_address; | |
1923 | + | |
1924 | +static enum { | |
1925 | + NONE_FORCE_HPET_RESUME, | |
1926 | + OLD_ICH_FORCE_HPET_RESUME, | |
1927 | + ICH_FORCE_HPET_RESUME, | |
1928 | + VT8237_FORCE_HPET_RESUME, | |
1929 | + NVIDIA_FORCE_HPET_RESUME, | |
1930 | +} force_hpet_resume_type; | |
1931 | + | |
1932 | +static void __iomem *rcba_base; | |
1933 | + | |
1934 | +static void ich_force_hpet_resume(void) | |
1935 | +{ | |
1936 | + u32 val; | |
1937 | + | |
1938 | + if (!force_hpet_address) | |
1939 | + return; | |
1940 | + | |
1941 | + if (rcba_base == NULL) | |
1942 | + BUG(); | |
1943 | + | |
1944 | + /* read the Function Disable register, dword mode only */ | |
1945 | + val = readl(rcba_base + 0x3404); | |
1946 | + if (!(val & 0x80)) { | |
1947 | + /* HPET disabled in HPTC. Trying to enable */ | |
1948 | + writel(val | 0x80, rcba_base + 0x3404); | |
1949 | + } | |
1950 | + | |
1951 | + val = readl(rcba_base + 0x3404); | |
1952 | + if (!(val & 0x80)) | |
1953 | + BUG(); | |
1954 | + else | |
1955 | + printk(KERN_DEBUG "Force enabled HPET at resume\n"); | |
1956 | + | |
1957 | + return; | |
1958 | +} | |
1959 | + | |
1960 | +static void ich_force_enable_hpet(struct pci_dev *dev) | |
1961 | +{ | |
1962 | + u32 val; | |
1963 | + u32 uninitialized_var(rcba); | |
1964 | + int err = 0; | |
1965 | + | |
1966 | + if (hpet_address || force_hpet_address) | |
1967 | + return; | |
1968 | + | |
1969 | + pci_read_config_dword(dev, 0xF0, &rcba); | |
1970 | + rcba &= 0xFFFFC000; | |
1971 | + if (rcba == 0) { | |
1972 | + printk(KERN_DEBUG "RCBA disabled. Cannot force enable HPET\n"); | |
1973 | + return; | |
1974 | + } | |
1975 | + | |
1976 | + /* use bits 31:14, 16 kB aligned */ | |
1977 | + rcba_base = ioremap_nocache(rcba, 0x4000); | |
1978 | + if (rcba_base == NULL) { | |
1979 | + printk(KERN_DEBUG "ioremap failed. Cannot force enable HPET\n"); | |
1980 | + return; | |
1981 | + } | |
1982 | + | |
1983 | + /* read the Function Disable register, dword mode only */ | |
1984 | + val = readl(rcba_base + 0x3404); | |
1985 | + | |
1986 | + if (val & 0x80) { | |
1987 | + /* HPET is enabled in HPTC. Just not reported by BIOS */ | |
1988 | + val = val & 0x3; | |
1989 | + force_hpet_address = 0xFED00000 | (val << 12); | |
1990 | + printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n", | |
1991 | + force_hpet_address); | |
1992 | + iounmap(rcba_base); | |
1993 | + return; | |
1994 | + } | |
1995 | + | |
1996 | + /* HPET disabled in HPTC. Trying to enable */ | |
1997 | + writel(val | 0x80, rcba_base + 0x3404); | |
1998 | + | |
1999 | + val = readl(rcba_base + 0x3404); | |
2000 | + if (!(val & 0x80)) { | |
2001 | + err = 1; | |
2002 | + } else { | |
2003 | + val = val & 0x3; | |
2004 | + force_hpet_address = 0xFED00000 | (val << 12); | |
2005 | + } | |
2006 | + | |
2007 | + if (err) { | |
2008 | + force_hpet_address = 0; | |
2009 | + iounmap(rcba_base); | |
2010 | + printk(KERN_DEBUG "Failed to force enable HPET\n"); | |
2011 | + } else { | |
2012 | + force_hpet_resume_type = ICH_FORCE_HPET_RESUME; | |
2013 | + printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n", | |
2014 | + force_hpet_address); | |
2015 | + } | |
2016 | +} | |
2017 | + | |
2018 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, | |
2019 | + ich_force_enable_hpet); | |
2020 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, | |
2021 | + ich_force_enable_hpet); | |
2022 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, | |
2023 | + ich_force_enable_hpet); | |
2024 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, | |
2025 | + ich_force_enable_hpet); | |
2026 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, | |
2027 | + ich_force_enable_hpet); | |
2028 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, | |
2029 | + ich_force_enable_hpet); | |
2030 | + | |
2031 | + | |
2032 | +static struct pci_dev *cached_dev; | |
2033 | + | |
2034 | +static void old_ich_force_hpet_resume(void) | |
2035 | +{ | |
2036 | + u32 val; | |
2037 | + u32 uninitialized_var(gen_cntl); | |
2038 | + | |
2039 | + if (!force_hpet_address || !cached_dev) | |
2040 | + return; | |
2041 | + | |
2042 | + pci_read_config_dword(cached_dev, 0xD0, &gen_cntl); | |
2043 | + gen_cntl &= (~(0x7 << 15)); | |
2044 | + gen_cntl |= (0x4 << 15); | |
2045 | + | |
2046 | + pci_write_config_dword(cached_dev, 0xD0, gen_cntl); | |
2047 | + pci_read_config_dword(cached_dev, 0xD0, &gen_cntl); | |
2048 | + val = gen_cntl >> 15; | |
2049 | + val &= 0x7; | |
2050 | + if (val == 0x4) | |
2051 | + printk(KERN_DEBUG "Force enabled HPET at resume\n"); | |
2052 | + else | |
2053 | + BUG(); | |
2054 | +} | |
2055 | + | |
2056 | +static void old_ich_force_enable_hpet(struct pci_dev *dev) | |
2057 | +{ | |
2058 | + u32 val; | |
2059 | + u32 uninitialized_var(gen_cntl); | |
2060 | + | |
2061 | + if (hpet_address || force_hpet_address) | |
2062 | + return; | |
2063 | + | |
2064 | + pci_read_config_dword(dev, 0xD0, &gen_cntl); | |
2065 | + /* | |
2066 | + * Bit 17 is HPET enable bit. | |
2067 | + * Bit 16:15 control the HPET base address. | |
2068 | + */ | |
2069 | + val = gen_cntl >> 15; | |
2070 | + val &= 0x7; | |
2071 | + if (val & 0x4) { | |
2072 | + val &= 0x3; | |
2073 | + force_hpet_address = 0xFED00000 | (val << 12); | |
2074 | + printk(KERN_DEBUG "HPET at base address 0x%lx\n", | |
2075 | + force_hpet_address); | |
2076 | + return; | |
2077 | + } | |
2078 | + | |
2079 | + /* | |
2080 | + * HPET is disabled. Trying enabling at FED00000 and check | |
2081 | + * whether it sticks | |
2082 | + */ | |
2083 | + gen_cntl &= (~(0x7 << 15)); | |
2084 | + gen_cntl |= (0x4 << 15); | |
2085 | + pci_write_config_dword(dev, 0xD0, gen_cntl); | |
2086 | + | |
2087 | + pci_read_config_dword(dev, 0xD0, &gen_cntl); | |
2088 | + | |
2089 | + val = gen_cntl >> 15; | |
2090 | + val &= 0x7; | |
2091 | + if (val & 0x4) { | |
2092 | + /* HPET is enabled in HPTC. Just not reported by BIOS */ | |
2093 | + val &= 0x3; | |
2094 | + force_hpet_address = 0xFED00000 | (val << 12); | |
2095 | + printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n", | |
2096 | + force_hpet_address); | |
2097 | + cached_dev = dev; | |
2098 | + force_hpet_resume_type = OLD_ICH_FORCE_HPET_RESUME; | |
2099 | + return; | |
2100 | + } | |
2101 | + | |
2102 | + printk(KERN_DEBUG "Failed to force enable HPET\n"); | |
2103 | +} | |
2104 | + | |
2105 | +/* | |
2106 | + * Undocumented chipset features. Make sure that the user enforced | |
2107 | + * this. | |
2108 | + */ | |
2109 | +static void old_ich_force_enable_hpet_user(struct pci_dev *dev) | |
2110 | +{ | |
2111 | + if (hpet_force_user) | |
2112 | + old_ich_force_enable_hpet(dev); | |
2113 | +} | |
2114 | + | |
2115 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, | |
2116 | + old_ich_force_enable_hpet_user); | |
2117 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, | |
2118 | + old_ich_force_enable_hpet_user); | |
2119 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, | |
2120 | + old_ich_force_enable_hpet_user); | |
2121 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, | |
2122 | + old_ich_force_enable_hpet_user); | |
2123 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, | |
2124 | + old_ich_force_enable_hpet); | |
2125 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_12, | |
2126 | + old_ich_force_enable_hpet); | |
2127 | + | |
2128 | + | |
2129 | +static void vt8237_force_hpet_resume(void) | |
2130 | +{ | |
2131 | + u32 val; | |
2132 | + | |
2133 | + if (!force_hpet_address || !cached_dev) | |
2134 | + return; | |
2135 | + | |
2136 | + val = 0xfed00000 | 0x80; | |
2137 | + pci_write_config_dword(cached_dev, 0x68, val); | |
2138 | + | |
2139 | + pci_read_config_dword(cached_dev, 0x68, &val); | |
2140 | + if (val & 0x80) | |
2141 | + printk(KERN_DEBUG "Force enabled HPET at resume\n"); | |
2142 | + else | |
2143 | + BUG(); | |
2144 | +} | |
2145 | + | |
2146 | +static void vt8237_force_enable_hpet(struct pci_dev *dev) | |
2147 | +{ | |
2148 | + u32 uninitialized_var(val); | |
2149 | + | |
2150 | + if (!hpet_force_user || hpet_address || force_hpet_address) | |
2151 | + return; | |
2152 | + | |
2153 | + pci_read_config_dword(dev, 0x68, &val); | |
2154 | + /* | |
2155 | + * Bit 7 is HPET enable bit. | |
2156 | + * Bit 31:10 is HPET base address (contrary to what datasheet claims) | |
2157 | + */ | |
2158 | + if (val & 0x80) { | |
2159 | + force_hpet_address = (val & ~0x3ff); | |
2160 | + printk(KERN_DEBUG "HPET at base address 0x%lx\n", | |
2161 | + force_hpet_address); | |
2162 | + return; | |
2163 | + } | |
2164 | + | |
2165 | + /* | |
2166 | + * HPET is disabled. Trying enabling at FED00000 and check | |
2167 | + * whether it sticks | |
2168 | + */ | |
2169 | + val = 0xfed00000 | 0x80; | |
2170 | + pci_write_config_dword(dev, 0x68, val); | |
2171 | + | |
2172 | + pci_read_config_dword(dev, 0x68, &val); | |
2173 | + if (val & 0x80) { | |
2174 | + force_hpet_address = (val & ~0x3ff); | |
2175 | + printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n", | |
2176 | + force_hpet_address); | |
2177 | + cached_dev = dev; | |
2178 | + force_hpet_resume_type = VT8237_FORCE_HPET_RESUME; | |
2179 | + return; | |
2180 | + } | |
2181 | + | |
2182 | + printk(KERN_DEBUG "Failed to force enable HPET\n"); | |
2183 | +} | |
2184 | + | |
2185 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, | |
2186 | + vt8237_force_enable_hpet); | |
2187 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, | |
2188 | + vt8237_force_enable_hpet); | |
2189 | + | |
2190 | +/* | |
2191 | + * Undocumented chipset feature taken from LinuxBIOS. | |
2192 | + */ | |
2193 | +static void nvidia_force_hpet_resume(void) | |
2194 | +{ | |
2195 | + pci_write_config_dword(cached_dev, 0x44, 0xfed00001); | |
2196 | + printk(KERN_DEBUG "Force enabled HPET at resume\n"); | |
2197 | +} | |
2198 | + | |
2199 | +static void nvidia_force_enable_hpet(struct pci_dev *dev) | |
2200 | +{ | |
2201 | + u32 uninitialized_var(val); | |
2202 | + | |
2203 | + if (!hpet_force_user || hpet_address || force_hpet_address) | |
2204 | + return; | |
2205 | + | |
2206 | + pci_write_config_dword(dev, 0x44, 0xfed00001); | |
2207 | + pci_read_config_dword(dev, 0x44, &val); | |
2208 | + force_hpet_address = val & 0xfffffffe; | |
2209 | + force_hpet_resume_type = NVIDIA_FORCE_HPET_RESUME; | |
2210 | + printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n", | |
2211 | + force_hpet_address); | |
2212 | + cached_dev = dev; | |
2213 | + return; | |
2214 | +} | |
2215 | + | |
2216 | +/* ISA Bridges */ | |
2217 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0050, | |
2218 | + nvidia_force_enable_hpet); | |
2219 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0051, | |
2220 | + nvidia_force_enable_hpet); | |
2221 | + | |
2222 | +/* LPC bridges */ | |
2223 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0360, | |
2224 | + nvidia_force_enable_hpet); | |
2225 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0361, | |
2226 | + nvidia_force_enable_hpet); | |
2227 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0362, | |
2228 | + nvidia_force_enable_hpet); | |
2229 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0363, | |
2230 | + nvidia_force_enable_hpet); | |
2231 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0364, | |
2232 | + nvidia_force_enable_hpet); | |
2233 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0365, | |
2234 | + nvidia_force_enable_hpet); | |
2235 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0366, | |
2236 | + nvidia_force_enable_hpet); | |
2237 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0367, | |
2238 | + nvidia_force_enable_hpet); | |
2239 | + | |
2240 | +void force_hpet_resume(void) | |
2241 | +{ | |
2242 | + switch (force_hpet_resume_type) { | |
2243 | + case ICH_FORCE_HPET_RESUME: | |
2244 | + return ich_force_hpet_resume(); | |
2245 | + | |
2246 | + case OLD_ICH_FORCE_HPET_RESUME: | |
2247 | + return old_ich_force_hpet_resume(); | |
2248 | + | |
2249 | + case VT8237_FORCE_HPET_RESUME: | |
2250 | + return vt8237_force_hpet_resume(); | |
2251 | + | |
2252 | + case NVIDIA_FORCE_HPET_RESUME: | |
2253 | + return nvidia_force_hpet_resume(); | |
2254 | + | |
2255 | + default: | |
2256 | + break; | |
2257 | + } | |
2258 | +} | |
2259 | + | |
2260 | #endif | |
2261 | --- sle11-2009-06-29.orig/arch/x86/kernel/setup64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
2262 | +++ sle11-2009-06-29/arch/x86/kernel/setup64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
2263 | @@ -15,7 +15,6 @@ | |
2264 | #include <linux/bootmem.h> | |
2265 | #include <linux/bitops.h> | |
2266 | #include <linux/module.h> | |
2267 | -#include <asm/bootsetup.h> | |
2268 | #include <asm/pda.h> | |
2269 | #include <asm/pgtable.h> | |
2270 | #include <asm/processor.h> | |
2271 | @@ -27,11 +26,12 @@ | |
2272 | #include <asm/percpu.h> | |
2273 | #include <asm/proto.h> | |
2274 | #include <asm/sections.h> | |
2275 | +#include <asm/setup.h> | |
2276 | #ifdef CONFIG_XEN | |
2277 | #include <asm/hypervisor.h> | |
2278 | #endif | |
2279 | ||
2280 | -char x86_boot_params[BOOT_PARAM_SIZE] __initdata; | |
2281 | +struct boot_params __initdata boot_params; | |
2282 | ||
2283 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; | |
2284 | ||
2285 | @@ -159,8 +159,8 @@ static void switch_pt(void) | |
2286 | ||
2287 | static void __cpuinit cpu_gdt_init(const struct desc_ptr *gdt_descr) | |
2288 | { | |
2289 | - asm volatile("lgdt %0" :: "m" (*gdt_descr)); | |
2290 | - asm volatile("lidt %0" :: "m" (idt_descr)); | |
2291 | + load_gdt(gdt_descr); | |
2292 | + load_idt(idt_descr); | |
2293 | } | |
2294 | #endif | |
2295 | ||
2296 | @@ -252,6 +252,14 @@ void __cpuinit check_efer(void) | |
2297 | ||
2298 | unsigned long kernel_eflags; | |
2299 | ||
2300 | +#ifndef CONFIG_X86_NO_TSS | |
2301 | +/* | |
2302 | + * Copies of the original ist values from the tss are only accessed during | |
2303 | + * debugging, no special alignment required. | |
2304 | + */ | |
2305 | +DEFINE_PER_CPU(struct orig_ist, orig_ist); | |
2306 | +#endif | |
2307 | + | |
2308 | /* | |
2309 | * cpu_init() initializes state that is per-CPU. Some data is already | |
2310 | * initialized (naturally) in the bootstrap process, such as the GDT | |
2311 | --- sle11-2009-06-29.orig/arch/x86/kernel/setup_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
2312 | +++ sle11-2009-06-29/arch/x86/kernel/setup_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
2313 | @@ -1,6 +1,4 @@ | |
2314 | /* | |
2315 | - * linux/arch/i386/kernel/setup.c | |
2316 | - * | |
2317 | * Copyright (C) 1995 Linus Torvalds | |
2318 | * | |
2319 | * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 | |
2320 | @@ -70,6 +68,7 @@ | |
2321 | #include <xen/xencons.h> | |
2322 | #include <setup_arch.h> | |
2323 | #include <bios_ebda.h> | |
2324 | +#include <asm/cacheflush.h> | |
2325 | ||
2326 | #ifdef CONFIG_XEN | |
2327 | #include <xen/interface/kexec.h> | |
2328 | @@ -80,13 +79,14 @@ static struct notifier_block xen_panic_b | |
2329 | xen_panic_event, NULL, 0 /* try to go last */ | |
2330 | }; | |
2331 | ||
2332 | -int disable_pse __devinitdata = 0; | |
2333 | +int disable_pse __cpuinitdata = 0; | |
2334 | ||
2335 | /* | |
2336 | * Machine setup.. | |
2337 | */ | |
2338 | extern struct resource code_resource; | |
2339 | extern struct resource data_resource; | |
2340 | +extern struct resource bss_resource; | |
2341 | ||
2342 | /* cpu data as detected by the assembly code in head.S */ | |
2343 | struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; | |
2344 | @@ -98,9 +98,6 @@ unsigned long mmu_cr4_features; | |
2345 | ||
2346 | /* for MCA, but anyone else can use it if they want */ | |
2347 | unsigned int machine_id; | |
2348 | -#ifdef CONFIG_MCA | |
2349 | -EXPORT_SYMBOL(machine_id); | |
2350 | -#endif | |
2351 | unsigned int machine_submodel_id; | |
2352 | unsigned int BIOS_revision; | |
2353 | unsigned int mca_pentium_flag; | |
2354 | @@ -121,7 +118,7 @@ EXPORT_SYMBOL(apm_info); | |
2355 | struct edid_info edid_info; | |
2356 | EXPORT_SYMBOL_GPL(edid_info); | |
2357 | #ifndef CONFIG_XEN | |
2358 | -#define copy_edid() (edid_info = EDID_INFO) | |
2359 | +#define copy_edid() (edid_info = boot_params.edid_info) | |
2360 | #endif | |
2361 | struct ist_info ist_info; | |
2362 | #if defined(CONFIG_X86_SPEEDSTEP_SMI) || \ | |
2363 | @@ -170,10 +167,11 @@ EXPORT_SYMBOL(edd); | |
2364 | */ | |
2365 | static inline void copy_edd(void) | |
2366 | { | |
2367 | - memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); | |
2368 | - memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); | |
2369 | - edd.mbr_signature_nr = EDD_MBR_SIG_NR; | |
2370 | - edd.edd_info_nr = EDD_NR; | |
2371 | + memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer, | |
2372 | + sizeof(edd.mbr_signature)); | |
2373 | + memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info)); | |
2374 | + edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries; | |
2375 | + edd.edd_info_nr = boot_params.eddbuf_entries; | |
2376 | } | |
2377 | #endif | |
2378 | #else | |
2379 | @@ -416,6 +414,53 @@ extern unsigned long __init setup_memory | |
2380 | extern void zone_sizes_init(void); | |
2381 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | |
2382 | ||
2383 | +static inline unsigned long long get_total_mem(void) | |
2384 | +{ | |
2385 | + unsigned long long total; | |
2386 | + | |
2387 | + total = max_low_pfn - min_low_pfn; | |
2388 | +#ifdef CONFIG_HIGHMEM | |
2389 | + total += highend_pfn - highstart_pfn; | |
2390 | +#endif | |
2391 | + | |
2392 | + return total << PAGE_SHIFT; | |
2393 | +} | |
2394 | + | |
2395 | +#ifdef CONFIG_KEXEC | |
2396 | +#ifndef CONFIG_XEN | |
2397 | +static void __init reserve_crashkernel(void) | |
2398 | +{ | |
2399 | + unsigned long long total_mem; | |
2400 | + unsigned long long crash_size, crash_base; | |
2401 | + int ret; | |
2402 | + | |
2403 | + total_mem = get_total_mem(); | |
2404 | + | |
2405 | + ret = parse_crashkernel(boot_command_line, total_mem, | |
2406 | + &crash_size, &crash_base); | |
2407 | + if (ret == 0 && crash_size > 0) { | |
2408 | + if (crash_base > 0) { | |
2409 | + printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " | |
2410 | + "for crashkernel (System RAM: %ldMB)\n", | |
2411 | + (unsigned long)(crash_size >> 20), | |
2412 | + (unsigned long)(crash_base >> 20), | |
2413 | + (unsigned long)(total_mem >> 20)); | |
2414 | + crashk_res.start = crash_base; | |
2415 | + crashk_res.end = crash_base + crash_size - 1; | |
2416 | + reserve_bootmem(crash_base, crash_size); | |
2417 | + } else | |
2418 | + printk(KERN_INFO "crashkernel reservation failed - " | |
2419 | + "you have to specify a base address\n"); | |
2420 | + } | |
2421 | +} | |
2422 | +#else | |
2423 | +#define reserve_crashkernel xen_machine_kexec_setup_resources | |
2424 | +#endif | |
2425 | +#else | |
2426 | +static inline void __init reserve_crashkernel(void) | |
2427 | +{} | |
2428 | +#endif | |
2429 | + | |
2430 | void __init setup_bootmem_allocator(void) | |
2431 | { | |
2432 | unsigned long bootmap_size; | |
2433 | @@ -471,30 +516,25 @@ void __init setup_bootmem_allocator(void | |
2434 | ||
2435 | #ifdef CONFIG_BLK_DEV_INITRD | |
2436 | if (xen_start_info->mod_start) { | |
2437 | - if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { | |
2438 | - /*reserve_bootmem(INITRD_START, INITRD_SIZE);*/ | |
2439 | - initrd_start = INITRD_START + PAGE_OFFSET; | |
2440 | - initrd_end = initrd_start+INITRD_SIZE; | |
2441 | + unsigned long ramdisk_image = __pa(xen_start_info->mod_start); | |
2442 | + unsigned long ramdisk_size = xen_start_info->mod_len; | |
2443 | + unsigned long ramdisk_end = ramdisk_image + ramdisk_size; | |
2444 | + unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT; | |
2445 | + | |
2446 | + if (ramdisk_end <= end_of_lowmem) { | |
2447 | + /*reserve_bootmem(ramdisk_image, ramdisk_size);*/ | |
2448 | + initrd_start = ramdisk_image + PAGE_OFFSET; | |
2449 | + initrd_end = initrd_start+ramdisk_size; | |
2450 | initrd_below_start_ok = 1; | |
2451 | - } | |
2452 | - else { | |
2453 | + } else { | |
2454 | printk(KERN_ERR "initrd extends beyond end of memory " | |
2455 | - "(0x%08lx > 0x%08lx)\ndisabling initrd\n", | |
2456 | - INITRD_START + INITRD_SIZE, | |
2457 | - max_low_pfn << PAGE_SHIFT); | |
2458 | + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", | |
2459 | + ramdisk_end, end_of_lowmem); | |
2460 | initrd_start = 0; | |
2461 | } | |
2462 | } | |
2463 | #endif | |
2464 | -#ifdef CONFIG_KEXEC | |
2465 | -#ifdef CONFIG_XEN | |
2466 | - xen_machine_kexec_setup_resources(); | |
2467 | -#else | |
2468 | - if (crashk_res.start != crashk_res.end) | |
2469 | - reserve_bootmem(crashk_res.start, | |
2470 | - crashk_res.end - crashk_res.start + 1); | |
2471 | -#endif | |
2472 | -#endif | |
2473 | + reserve_crashkernel(); | |
2474 | } | |
2475 | ||
2476 | /* | |
2477 | @@ -572,7 +612,8 @@ void __init setup_arch(char **cmdline_p) | |
2478 | * the system table is valid. If not, then initialize normally. | |
2479 | */ | |
2480 | #ifdef CONFIG_EFI | |
2481 | - if ((LOADER_TYPE == 0x50) && EFI_SYSTAB) | |
2482 | + if ((boot_params.hdr.type_of_loader == 0x50) && | |
2483 | + boot_params.efi_info.efi_systab) | |
2484 | efi_enabled = 1; | |
2485 | #endif | |
2486 | ||
2487 | @@ -580,18 +621,18 @@ void __init setup_arch(char **cmdline_p) | |
2488 | properly. Setting ROOT_DEV to default to /dev/ram0 breaks initrd. | |
2489 | */ | |
2490 | ROOT_DEV = MKDEV(UNNAMED_MAJOR,0); | |
2491 | - screen_info = SCREEN_INFO; | |
2492 | + screen_info = boot_params.screen_info; | |
2493 | copy_edid(); | |
2494 | - apm_info.bios = APM_BIOS_INFO; | |
2495 | - ist_info = IST_INFO; | |
2496 | - saved_videomode = VIDEO_MODE; | |
2497 | - if( SYS_DESC_TABLE.length != 0 ) { | |
2498 | - set_mca_bus(SYS_DESC_TABLE.table[3] & 0x2); | |
2499 | - machine_id = SYS_DESC_TABLE.table[0]; | |
2500 | - machine_submodel_id = SYS_DESC_TABLE.table[1]; | |
2501 | - BIOS_revision = SYS_DESC_TABLE.table[2]; | |
2502 | + apm_info.bios = boot_params.apm_bios_info; | |
2503 | + ist_info = boot_params.ist_info; | |
2504 | + saved_videomode = boot_params.hdr.vid_mode; | |
2505 | + if( boot_params.sys_desc_table.length != 0 ) { | |
2506 | + set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2); | |
2507 | + machine_id = boot_params.sys_desc_table.table[0]; | |
2508 | + machine_submodel_id = boot_params.sys_desc_table.table[1]; | |
2509 | + BIOS_revision = boot_params.sys_desc_table.table[2]; | |
2510 | } | |
2511 | - bootloader_type = LOADER_TYPE; | |
2512 | + bootloader_type = boot_params.hdr.type_of_loader; | |
2513 | ||
2514 | if (is_initial_xendomain()) { | |
2515 | const struct dom0_vga_console_info *info = | |
2516 | @@ -606,9 +647,9 @@ void __init setup_arch(char **cmdline_p) | |
2517 | screen_info.orig_video_isVGA = 0; | |
2518 | ||
2519 | #ifdef CONFIG_BLK_DEV_RAM | |
2520 | - rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; | |
2521 | - rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); | |
2522 | - rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); | |
2523 | + rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; | |
2524 | + rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0); | |
2525 | + rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0); | |
2526 | #endif | |
2527 | ||
2528 | ARCH_SETUP | |
2529 | @@ -621,7 +662,7 @@ void __init setup_arch(char **cmdline_p) | |
2530 | ||
2531 | copy_edd(); | |
2532 | ||
2533 | - if (!MOUNT_ROOT_RDONLY) | |
2534 | + if (!boot_params.hdr.root_flags) | |
2535 | root_mountflags &= ~MS_RDONLY; | |
2536 | init_mm.start_code = (unsigned long) _text; | |
2537 | init_mm.end_code = (unsigned long) _etext; | |
2538 | @@ -633,6 +674,8 @@ void __init setup_arch(char **cmdline_p) | |
2539 | code_resource.end = virt_to_phys(_etext)-1; | |
2540 | data_resource.start = virt_to_phys(_etext); | |
2541 | data_resource.end = virt_to_phys(_edata)-1; | |
2542 | + bss_resource.start = virt_to_phys(&__bss_start); | |
2543 | + bss_resource.end = virt_to_phys(&__bss_stop)-1; | |
2544 | ||
2545 | if ((i = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE) | |
2546 | i = COMMAND_LINE_SIZE; | |
2547 | @@ -661,7 +704,7 @@ void __init setup_arch(char **cmdline_p) | |
2548 | /* | |
2549 | * NOTE: before this point _nobody_ is allowed to allocate | |
2550 | * any memory using the bootmem allocator. Although the | |
2551 | - * alloctor is now initialised only the first 8Mb of the kernel | |
2552 | + * allocator is now initialised only the first 8Mb of the kernel | |
2553 | * virtual address space has been mapped. All allocations before | |
2554 | * paging_init() has completed must use the alloc_bootmem_low_pages() | |
2555 | * variant (which allocates DMA'able memory) and care must be taken | |
2556 | @@ -784,10 +827,8 @@ void __init setup_arch(char **cmdline_p) | |
2557 | acpi_boot_table_init(); | |
2558 | #endif | |
2559 | ||
2560 | -#ifdef CONFIG_PCI | |
2561 | -#ifdef CONFIG_X86_IO_APIC | |
2562 | - check_acpi_pci(); /* Checks more than just ACPI actually */ | |
2563 | -#endif | |
2564 | +#if defined(CONFIG_PCI) && !defined(CONFIG_XEN) | |
2565 | + early_quirks(); | |
2566 | #endif | |
2567 | ||
2568 | #ifdef CONFIG_ACPI | |
2569 | --- sle11-2009-06-29.orig/arch/x86/kernel/setup_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
2570 | +++ sle11-2009-06-29/arch/x86/kernel/setup_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
2571 | @@ -1,10 +1,5 @@ | |
2572 | /* | |
2573 | - * linux/arch/x86-64/kernel/setup.c | |
2574 | - * | |
2575 | * Copyright (C) 1995 Linus Torvalds | |
2576 | - * | |
2577 | - * Nov 2001 Dave Jones <davej@suse.de> | |
2578 | - * Forked from i386 setup code. | |
2579 | */ | |
2580 | ||
2581 | /* | |
2582 | @@ -57,13 +52,13 @@ | |
2583 | #include <asm/dma.h> | |
2584 | #include <asm/mpspec.h> | |
2585 | #include <asm/mmu_context.h> | |
2586 | -#include <asm/bootsetup.h> | |
2587 | #include <asm/proto.h> | |
2588 | #include <asm/setup.h> | |
2589 | #include <asm/mach_apic.h> | |
2590 | #include <asm/numa.h> | |
2591 | #include <asm/sections.h> | |
2592 | #include <asm/dmi.h> | |
2593 | +#include <asm/cacheflush.h> | |
2594 | #ifdef CONFIG_XEN | |
2595 | #include <linux/percpu.h> | |
2596 | #include <xen/interface/physdev.h> | |
2597 | @@ -180,6 +175,12 @@ struct resource code_resource = { | |
2598 | .end = 0, | |
2599 | .flags = IORESOURCE_RAM, | |
2600 | }; | |
2601 | +struct resource bss_resource = { | |
2602 | + .name = "Kernel bss", | |
2603 | + .start = 0, | |
2604 | + .end = 0, | |
2605 | + .flags = IORESOURCE_RAM, | |
2606 | +}; | |
2607 | ||
2608 | #ifdef CONFIG_PROC_VMCORE | |
2609 | /* elfcorehdr= specifies the location of elf core header | |
2610 | @@ -231,10 +232,11 @@ EXPORT_SYMBOL(edd); | |
2611 | */ | |
2612 | static inline void copy_edd(void) | |
2613 | { | |
2614 | - memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); | |
2615 | - memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); | |
2616 | - edd.mbr_signature_nr = EDD_MBR_SIG_NR; | |
2617 | - edd.edd_info_nr = EDD_NR; | |
2618 | + memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer, | |
2619 | + sizeof(edd.mbr_signature)); | |
2620 | + memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info)); | |
2621 | + edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries; | |
2622 | + edd.edd_info_nr = boot_params.eddbuf_entries; | |
2623 | } | |
2624 | #endif | |
2625 | #else | |
2626 | @@ -243,6 +245,41 @@ static inline void copy_edd(void) | |
2627 | } | |
2628 | #endif | |
2629 | ||
2630 | +#ifdef CONFIG_KEXEC | |
2631 | +#ifndef CONFIG_XEN | |
2632 | +static void __init reserve_crashkernel(void) | |
2633 | +{ | |
2634 | + unsigned long long free_mem; | |
2635 | + unsigned long long crash_size, crash_base; | |
2636 | + int ret; | |
2637 | + | |
2638 | + free_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT; | |
2639 | + | |
2640 | + ret = parse_crashkernel(boot_command_line, free_mem, | |
2641 | + &crash_size, &crash_base); | |
2642 | + if (ret == 0 && crash_size) { | |
2643 | + if (crash_base > 0) { | |
2644 | + printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " | |
2645 | + "for crashkernel (System RAM: %ldMB)\n", | |
2646 | + (unsigned long)(crash_size >> 20), | |
2647 | + (unsigned long)(crash_base >> 20), | |
2648 | + (unsigned long)(free_mem >> 20)); | |
2649 | + crashk_res.start = crash_base; | |
2650 | + crashk_res.end = crash_base + crash_size - 1; | |
2651 | + reserve_bootmem(crash_base, crash_size); | |
2652 | + } else | |
2653 | + printk(KERN_INFO "crashkernel reservation failed - " | |
2654 | + "you have to specify a base address\n"); | |
2655 | + } | |
2656 | +} | |
2657 | +#else | |
2658 | +#define reserve_crashkernel xen_machine_kexec_setup_resources | |
2659 | +#endif | |
2660 | +#else | |
2661 | +static inline void __init reserve_crashkernel(void) | |
2662 | +{} | |
2663 | +#endif | |
2664 | + | |
2665 | #ifndef CONFIG_XEN | |
2666 | #define EBDA_ADDR_POINTER 0x40E | |
2667 | ||
2668 | @@ -283,7 +320,7 @@ void __init setup_arch(char **cmdline_p) | |
2669 | atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block); | |
2670 | ||
2671 | ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); | |
2672 | - screen_info = SCREEN_INFO; | |
2673 | + screen_info = boot_params.screen_info; | |
2674 | ||
2675 | if (is_initial_xendomain()) { | |
2676 | const struct dom0_vga_console_info *info = | |
2677 | @@ -306,22 +343,22 @@ void __init setup_arch(char **cmdline_p) | |
2678 | #else | |
2679 | printk(KERN_INFO "Command line: %s\n", boot_command_line); | |
2680 | ||
2681 | - ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); | |
2682 | - screen_info = SCREEN_INFO; | |
2683 | - edid_info = EDID_INFO; | |
2684 | + ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); | |
2685 | + screen_info = boot_params.screen_info; | |
2686 | + edid_info = boot_params.edid_info; | |
2687 | #endif /* !CONFIG_XEN */ | |
2688 | - saved_video_mode = SAVED_VIDEO_MODE; | |
2689 | - bootloader_type = LOADER_TYPE; | |
2690 | + saved_video_mode = boot_params.hdr.vid_mode; | |
2691 | + bootloader_type = boot_params.hdr.type_of_loader; | |
2692 | ||
2693 | #ifdef CONFIG_BLK_DEV_RAM | |
2694 | - rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; | |
2695 | - rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); | |
2696 | - rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); | |
2697 | + rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; | |
2698 | + rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0); | |
2699 | + rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0); | |
2700 | #endif | |
2701 | setup_memory_region(); | |
2702 | copy_edd(); | |
2703 | ||
2704 | - if (!MOUNT_ROOT_RDONLY) | |
2705 | + if (!boot_params.hdr.root_flags) | |
2706 | root_mountflags &= ~MS_RDONLY; | |
2707 | init_mm.start_code = (unsigned long) &_text; | |
2708 | init_mm.end_code = (unsigned long) &_etext; | |
2709 | @@ -332,6 +369,8 @@ void __init setup_arch(char **cmdline_p) | |
2710 | code_resource.end = virt_to_phys(&_etext)-1; | |
2711 | data_resource.start = virt_to_phys(&_etext); | |
2712 | data_resource.end = virt_to_phys(&_edata)-1; | |
2713 | + bss_resource.start = virt_to_phys(&__bss_start); | |
2714 | + bss_resource.end = virt_to_phys(&__bss_stop)-1; | |
2715 | ||
2716 | early_identify_cpu(&boot_cpu_data); | |
2717 | ||
2718 | @@ -359,6 +398,11 @@ void __init setup_arch(char **cmdline_p) | |
2719 | if (is_initial_xendomain()) | |
2720 | dmi_scan_machine(); | |
2721 | ||
2722 | +#if defined(CONFIG_SMP) && !defined(CONFIG_XEN) | |
2723 | + /* setup to use the static apicid table during kernel startup */ | |
2724 | + x86_cpu_to_apicid_ptr = (void *)&x86_cpu_to_apicid_init; | |
2725 | +#endif | |
2726 | + | |
2727 | /* How many end-of-memory variables you have, grandma! */ | |
2728 | max_low_pfn = end_pfn; | |
2729 | max_pfn = end_pfn; | |
2730 | @@ -423,52 +467,37 @@ void __init setup_arch(char **cmdline_p) | |
2731 | */ | |
2732 | acpi_reserve_bootmem(); | |
2733 | #endif | |
2734 | -#ifdef CONFIG_XEN | |
2735 | #ifdef CONFIG_BLK_DEV_INITRD | |
2736 | +#ifdef CONFIG_XEN | |
2737 | if (xen_start_info->mod_start) { | |
2738 | - if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { | |
2739 | - /*reserve_bootmem_generic(INITRD_START, INITRD_SIZE);*/ | |
2740 | - initrd_start = INITRD_START + PAGE_OFFSET; | |
2741 | - initrd_end = initrd_start+INITRD_SIZE; | |
2742 | + unsigned long ramdisk_image = __pa(xen_start_info->mod_start); | |
2743 | + unsigned long ramdisk_size = xen_start_info->mod_len; | |
2744 | +#else | |
2745 | + if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { | |
2746 | + unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; | |
2747 | + unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; | |
2748 | +#endif | |
2749 | + unsigned long ramdisk_end = ramdisk_image + ramdisk_size; | |
2750 | + unsigned long end_of_mem = end_pfn << PAGE_SHIFT; | |
2751 | + | |
2752 | + if (ramdisk_end <= end_of_mem) { | |
2753 | +#ifndef CONFIG_XEN | |
2754 | + reserve_bootmem_generic(ramdisk_image, ramdisk_size); | |
2755 | +#endif | |
2756 | + initrd_start = ramdisk_image + PAGE_OFFSET; | |
2757 | + initrd_end = initrd_start+ramdisk_size; | |
2758 | +#ifdef CONFIG_XEN | |
2759 | initrd_below_start_ok = 1; | |
2760 | - } else { | |
2761 | - printk(KERN_ERR "initrd extends beyond end of memory " | |
2762 | - "(0x%08lx > 0x%08lx)\ndisabling initrd\n", | |
2763 | - (unsigned long)(INITRD_START + INITRD_SIZE), | |
2764 | - (unsigned long)(end_pfn << PAGE_SHIFT)); | |
2765 | - initrd_start = 0; | |
2766 | - } | |
2767 | - } | |
2768 | #endif | |
2769 | -#else /* CONFIG_XEN */ | |
2770 | -#ifdef CONFIG_BLK_DEV_INITRD | |
2771 | - if (LOADER_TYPE && INITRD_START) { | |
2772 | - if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { | |
2773 | - reserve_bootmem_generic(INITRD_START, INITRD_SIZE); | |
2774 | - initrd_start = INITRD_START + PAGE_OFFSET; | |
2775 | - initrd_end = initrd_start+INITRD_SIZE; | |
2776 | - } | |
2777 | - else { | |
2778 | + } else { | |
2779 | printk(KERN_ERR "initrd extends beyond end of memory " | |
2780 | - "(0x%08lx > 0x%08lx)\ndisabling initrd\n", | |
2781 | - (unsigned long)(INITRD_START + INITRD_SIZE), | |
2782 | - (unsigned long)(end_pfn << PAGE_SHIFT)); | |
2783 | + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", | |
2784 | + ramdisk_end, end_of_mem); | |
2785 | initrd_start = 0; | |
2786 | } | |
2787 | } | |
2788 | #endif | |
2789 | -#endif /* !CONFIG_XEN */ | |
2790 | -#ifdef CONFIG_KEXEC | |
2791 | -#ifdef CONFIG_XEN | |
2792 | - xen_machine_kexec_setup_resources(); | |
2793 | -#else | |
2794 | - if (crashk_res.start != crashk_res.end) { | |
2795 | - reserve_bootmem_generic(crashk_res.start, | |
2796 | - crashk_res.end - crashk_res.start + 1); | |
2797 | - } | |
2798 | -#endif | |
2799 | -#endif | |
2800 | - | |
2801 | + reserve_crashkernel(); | |
2802 | paging_init(); | |
2803 | #ifdef CONFIG_X86_LOCAL_APIC | |
2804 | /* | |
2805 | @@ -783,7 +812,7 @@ static void __init amd_detect_cmp(struct | |
2806 | but in the same order as the HT nodeids. | |
2807 | If that doesn't result in a usable node fall back to the | |
2808 | path for the previous case. */ | |
2809 | - int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits); | |
2810 | + int ht_nodeid = apicid - (cpu_data(0).phys_proc_id << bits); | |
2811 | if (ht_nodeid >= 0 && | |
2812 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) | |
2813 | node = apicid_to_node[ht_nodeid]; | |
2814 | @@ -798,6 +827,39 @@ static void __init amd_detect_cmp(struct | |
2815 | #endif | |
2816 | } | |
2817 | ||
2818 | +#define ENABLE_C1E_MASK 0x18000000 | |
2819 | +#define CPUID_PROCESSOR_SIGNATURE 1 | |
2820 | +#define CPUID_XFAM 0x0ff00000 | |
2821 | +#define CPUID_XFAM_K8 0x00000000 | |
2822 | +#define CPUID_XFAM_10H 0x00100000 | |
2823 | +#define CPUID_XFAM_11H 0x00200000 | |
2824 | +#define CPUID_XMOD 0x000f0000 | |
2825 | +#define CPUID_XMOD_REV_F 0x00040000 | |
2826 | + | |
2827 | +#ifndef CONFIG_XEN | |
2828 | +/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */ | |
2829 | +static __cpuinit int amd_apic_timer_broken(void) | |
2830 | +{ | |
2831 | + u32 lo, hi; | |
2832 | + u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); | |
2833 | + switch (eax & CPUID_XFAM) { | |
2834 | + case CPUID_XFAM_K8: | |
2835 | + if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F) | |
2836 | + break; | |
2837 | + case CPUID_XFAM_10H: | |
2838 | + case CPUID_XFAM_11H: | |
2839 | + rdmsr(MSR_K8_ENABLE_C1E, lo, hi); | |
2840 | + if (lo & ENABLE_C1E_MASK) | |
2841 | + return 1; | |
2842 | + break; | |
2843 | + default: | |
2844 | + /* err on the side of caution */ | |
2845 | + return 1; | |
2846 | + } | |
2847 | + return 0; | |
2848 | +} | |
2849 | +#endif | |
2850 | + | |
2851 | static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |
2852 | { | |
2853 | unsigned level; | |
2854 | @@ -827,7 +889,7 @@ static void __cpuinit init_amd(struct cp | |
2855 | level = cpuid_eax(1); | |
2856 | if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)) | |
2857 | set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); | |
2858 | - if (c->x86 == 0x10) | |
2859 | + if (c->x86 == 0x10 || c->x86 == 0x11) | |
2860 | set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); | |
2861 | ||
2862 | /* Enable workaround for FXSAVE leak */ | |
2863 | @@ -869,6 +931,11 @@ static void __cpuinit init_amd(struct cp | |
2864 | /* Family 10 doesn't support C states in MWAIT so don't use it */ | |
2865 | if (c->x86 == 0x10 && !force_mwait) | |
2866 | clear_bit(X86_FEATURE_MWAIT, &c->x86_capability); | |
2867 | + | |
2868 | +#ifndef CONFIG_XEN | |
2869 | + if (amd_apic_timer_broken()) | |
2870 | + disable_apic_timer = 1; | |
2871 | +#endif | |
2872 | } | |
2873 | ||
2874 | static void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |
2875 | @@ -1179,6 +1246,7 @@ void __cpuinit print_cpu_info(struct cpu | |
2876 | static int show_cpuinfo(struct seq_file *m, void *v) | |
2877 | { | |
2878 | struct cpuinfo_x86 *c = v; | |
2879 | + int cpu = 0; | |
2880 | ||
2881 | /* | |
2882 | * These flag bits must match the definitions in <asm/cpufeature.h>. | |
2883 | @@ -1188,7 +1256,7 @@ static int show_cpuinfo(struct seq_file | |
2884 | * applications want to get the raw CPUID data, they should access | |
2885 | * /dev/cpu/<cpu_nr>/cpuid instead. | |
2886 | */ | |
2887 | - static char *x86_cap_flags[] = { | |
2888 | + static const char *const x86_cap_flags[] = { | |
2889 | /* Intel-defined */ | |
2890 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", | |
2891 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", | |
2892 | @@ -1219,7 +1287,7 @@ static int show_cpuinfo(struct seq_file | |
2893 | /* Intel-defined (#2) */ | |
2894 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", | |
2895 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, | |
2896 | - NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt", | |
2897 | + NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", | |
2898 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
2899 | ||
2900 | /* VIA/Cyrix/Centaur-defined */ | |
2901 | @@ -1229,10 +1297,10 @@ static int show_cpuinfo(struct seq_file | |
2902 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
2903 | ||
2904 | /* AMD-defined (#2) */ | |
2905 | - "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy", | |
2906 | - "altmovcr8", "abm", "sse4a", | |
2907 | - "misalignsse", "3dnowprefetch", | |
2908 | - "osvw", "ibs", NULL, NULL, NULL, NULL, | |
2909 | + "lahf_lm", "cmp_legacy", "svm", "extapic", | |
2910 | + "cr8_legacy", "abm", "sse4a", "misalignsse", | |
2911 | + "3dnowprefetch", "osvw", "ibs", "sse5", | |
2912 | + "skinit", "wdt", NULL, NULL, | |
2913 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
2914 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
2915 | ||
2916 | @@ -1242,7 +1310,7 @@ static int show_cpuinfo(struct seq_file | |
2917 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
2918 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
2919 | }; | |
2920 | - static char *x86_power_flags[] = { | |
2921 | + static const char *const x86_power_flags[] = { | |
2922 | "ts", /* temperature sensor */ | |
2923 | "fid", /* frequency id control */ | |
2924 | "vid", /* voltage id control */ | |
2925 | @@ -1257,8 +1325,7 @@ static int show_cpuinfo(struct seq_file | |
2926 | ||
2927 | ||
2928 | #ifdef CONFIG_SMP | |
2929 | - if (!cpu_online(c-cpu_data)) | |
2930 | - return 0; | |
2931 | + cpu = c->cpu_index; | |
2932 | #endif | |
2933 | ||
2934 | seq_printf(m,"processor\t: %u\n" | |
2935 | @@ -1266,7 +1333,7 @@ static int show_cpuinfo(struct seq_file | |
2936 | "cpu family\t: %d\n" | |
2937 | "model\t\t: %d\n" | |
2938 | "model name\t: %s\n", | |
2939 | - (unsigned)(c-cpu_data), | |
2940 | + (unsigned)cpu, | |
2941 | c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", | |
2942 | c->x86, | |
2943 | (int)c->x86_model, | |
2944 | @@ -1278,7 +1345,7 @@ static int show_cpuinfo(struct seq_file | |
2945 | seq_printf(m, "stepping\t: unknown\n"); | |
2946 | ||
2947 | if (cpu_has(c,X86_FEATURE_TSC)) { | |
2948 | - unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data)); | |
2949 | + unsigned int freq = cpufreq_quick_get((unsigned)cpu); | |
2950 | if (!freq) | |
2951 | freq = cpu_khz; | |
2952 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", | |
2953 | @@ -1291,9 +1358,9 @@ static int show_cpuinfo(struct seq_file | |
2954 | ||
2955 | #ifdef CONFIG_SMP | |
2956 | if (smp_num_siblings * c->x86_max_cores > 1) { | |
2957 | - int cpu = c - cpu_data; | |
2958 | seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); | |
2959 | - seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu])); | |
2960 | + seq_printf(m, "siblings\t: %d\n", | |
2961 | + cpus_weight(per_cpu(cpu_core_map, cpu))); | |
2962 | seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); | |
2963 | seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); | |
2964 | } | |
2965 | @@ -1348,12 +1415,16 @@ static int show_cpuinfo(struct seq_file | |
2966 | ||
2967 | static void *c_start(struct seq_file *m, loff_t *pos) | |
2968 | { | |
2969 | - return *pos < NR_CPUS ? cpu_data + *pos : NULL; | |
2970 | + if (*pos == 0) /* just in case, cpu 0 is not the first */ | |
2971 | + *pos = first_cpu(cpu_online_map); | |
2972 | + if ((*pos) < NR_CPUS && cpu_online(*pos)) | |
2973 | + return &cpu_data(*pos); | |
2974 | + return NULL; | |
2975 | } | |
2976 | ||
2977 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | |
2978 | { | |
2979 | - ++*pos; | |
2980 | + *pos = next_cpu(*pos, cpu_online_map); | |
2981 | return c_start(m, pos); | |
2982 | } | |
2983 | ||
2984 | --- sle11-2009-06-29.orig/arch/x86/kernel/smp_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
2985 | +++ sle11-2009-06-29/arch/x86/kernel/smp_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
2986 | @@ -72,7 +72,7 @@ | |
2987 | * | |
2988 | * B stepping CPUs may hang. There are hardware work arounds | |
2989 | * for this. We warn about it in case your board doesn't have the work | |
2990 | - * arounds. Basically thats so I can tell anyone with a B stepping | |
2991 | + * arounds. Basically that's so I can tell anyone with a B stepping | |
2992 | * CPU and SMP problems "tough". | |
2993 | * | |
2994 | * Specific items [From Pentium Processor Specification Update] | |
2995 | @@ -241,7 +241,7 @@ void leave_mm(unsigned long cpu) | |
2996 | * 1a1) cpu_clear(cpu, old_mm->cpu_vm_mask); | |
2997 | * Stop ipi delivery for the old mm. This is not synchronized with | |
2998 | * the other cpus, but smp_invalidate_interrupt ignore flush ipis | |
2999 | - * for the wrong mm, and in the worst case we perform a superflous | |
3000 | + * for the wrong mm, and in the worst case we perform a superfluous | |
3001 | * tlb flush. | |
3002 | * 1a2) set cpu_tlbstate to TLBSTATE_OK | |
3003 | * Now the smp_invalidate_interrupt won't call leave_mm if cpu0 | |
3004 | @@ -309,6 +309,7 @@ irqreturn_t smp_invalidate_interrupt(int | |
3005 | smp_mb__after_clear_bit(); | |
3006 | out: | |
3007 | put_cpu_no_resched(); | |
3008 | + __get_cpu_var(irq_stat).irq_tlb_count++; | |
3009 | ||
3010 | return IRQ_HANDLED; | |
3011 | } | |
3012 | @@ -580,7 +581,7 @@ static void stop_this_cpu (void * dummy) | |
3013 | */ | |
3014 | cpu_clear(smp_processor_id(), cpu_online_map); | |
3015 | disable_all_local_evtchn(); | |
3016 | - if (cpu_data[smp_processor_id()].hlt_works_ok) | |
3017 | + if (cpu_data(smp_processor_id()).hlt_works_ok) | |
3018 | for(;;) halt(); | |
3019 | for (;;); | |
3020 | } | |
3021 | @@ -610,6 +611,7 @@ void xen_smp_send_stop(void) | |
3022 | */ | |
3023 | irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id) | |
3024 | { | |
3025 | + __get_cpu_var(irq_stat).irq_resched_count++; | |
3026 | ||
3027 | return IRQ_HANDLED; | |
3028 | } | |
3029 | @@ -632,6 +634,7 @@ irqreturn_t smp_call_function_interrupt( | |
3030 | */ | |
3031 | irq_enter(); | |
3032 | (*func)(info); | |
3033 | + __get_cpu_var(irq_stat).irq_call_count++; | |
3034 | irq_exit(); | |
3035 | ||
3036 | if (wait) { | |
3037 | --- sle11-2009-06-29.orig/arch/x86/kernel/smp_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
3038 | +++ sle11-2009-06-29/arch/x86/kernel/smp_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
3039 | @@ -167,6 +167,7 @@ asmlinkage void smp_invalidate_interrupt | |
3040 | out: | |
3041 | ack_APIC_irq(); | |
3042 | cpu_clear(cpu, f->flush_cpumask); | |
3043 | + add_pda(irq_tlb_count, 1); | |
3044 | } | |
3045 | ||
3046 | static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, | |
3047 | @@ -326,17 +327,27 @@ void unlock_ipi_call_lock(void) | |
3048 | } | |
3049 | ||
3050 | /* | |
3051 | - * this function sends a 'generic call function' IPI to one other CPU | |
3052 | - * in the system. | |
3053 | - * | |
3054 | - * cpu is a standard Linux logical CPU number. | |
3055 | + * this function sends a 'generic call function' IPI to all other CPU | |
3056 | + * of the system defined in the mask. | |
3057 | */ | |
3058 | -static void | |
3059 | -__smp_call_function_single(int cpu, void (*func) (void *info), void *info, | |
3060 | - int nonatomic, int wait) | |
3061 | + | |
3062 | +static int | |
3063 | +__smp_call_function_mask(cpumask_t mask, | |
3064 | + void (*func)(void *), void *info, | |
3065 | + int wait) | |
3066 | { | |
3067 | struct call_data_struct data; | |
3068 | - int cpus = 1; | |
3069 | + cpumask_t allbutself; | |
3070 | + int cpus; | |
3071 | + | |
3072 | + allbutself = cpu_online_map; | |
3073 | + cpu_clear(smp_processor_id(), allbutself); | |
3074 | + | |
3075 | + cpus_and(mask, mask, allbutself); | |
3076 | + cpus = cpus_weight(mask); | |
3077 | + | |
3078 | + if (!cpus) | |
3079 | + return 0; | |
3080 | ||
3081 | data.func = func; | |
3082 | data.info = info; | |
3083 | @@ -347,19 +358,55 @@ __smp_call_function_single(int cpu, void | |
3084 | ||
3085 | call_data = &data; | |
3086 | wmb(); | |
3087 | - /* Send a message to all other CPUs and wait for them to respond */ | |
3088 | - send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); | |
3089 | + | |
3090 | + /* Send a message to other CPUs */ | |
3091 | + if (cpus_equal(mask, allbutself)) | |
3092 | + send_IPI_allbutself(CALL_FUNCTION_VECTOR); | |
3093 | + else | |
3094 | + send_IPI_mask(mask, CALL_FUNCTION_VECTOR); | |
3095 | ||
3096 | /* Wait for response */ | |
3097 | while (atomic_read(&data.started) != cpus) | |
3098 | cpu_relax(); | |
3099 | ||
3100 | if (!wait) | |
3101 | - return; | |
3102 | + return 0; | |
3103 | ||
3104 | while (atomic_read(&data.finished) != cpus) | |
3105 | cpu_relax(); | |
3106 | + | |
3107 | + return 0; | |
3108 | +} | |
3109 | +/** | |
3110 | + * smp_call_function_mask(): Run a function on a set of other CPUs. | |
3111 | + * @mask: The set of cpus to run on. Must not include the current cpu. | |
3112 | + * @func: The function to run. This must be fast and non-blocking. | |
3113 | + * @info: An arbitrary pointer to pass to the function. | |
3114 | + * @wait: If true, wait (atomically) until function has completed on other CPUs. | |
3115 | + * | |
3116 | + * Returns 0 on success, else a negative status code. | |
3117 | + * | |
3118 | + * If @wait is true, then returns once @func has returned; otherwise | |
3119 | + * it returns just before the target cpu calls @func. | |
3120 | + * | |
3121 | + * You must not call this function with disabled interrupts or from a | |
3122 | + * hardware interrupt handler or from a bottom half handler. | |
3123 | + */ | |
3124 | +int smp_call_function_mask(cpumask_t mask, | |
3125 | + void (*func)(void *), void *info, | |
3126 | + int wait) | |
3127 | +{ | |
3128 | + int ret; | |
3129 | + | |
3130 | + /* Can deadlock when called with interrupts disabled */ | |
3131 | + WARN_ON(irqs_disabled()); | |
3132 | + | |
3133 | + spin_lock(&call_lock); | |
3134 | + ret = __smp_call_function_mask(mask, func, info, wait); | |
3135 | + spin_unlock(&call_lock); | |
3136 | + return ret; | |
3137 | } | |
3138 | +EXPORT_SYMBOL(smp_call_function_mask); | |
3139 | ||
3140 | /* | |
3141 | * smp_call_function_single - Run a function on a specific CPU | |
3142 | @@ -378,6 +425,7 @@ int smp_call_function_single (int cpu, v | |
3143 | int nonatomic, int wait) | |
3144 | { | |
3145 | /* prevent preemption and reschedule on another processor */ | |
3146 | + int ret; | |
3147 | int me = get_cpu(); | |
3148 | ||
3149 | /* Can deadlock when called with interrupts disabled */ | |
3150 | @@ -391,51 +439,14 @@ int smp_call_function_single (int cpu, v | |
3151 | return 0; | |
3152 | } | |
3153 | ||
3154 | - spin_lock(&call_lock); | |
3155 | - __smp_call_function_single(cpu, func, info, nonatomic, wait); | |
3156 | - spin_unlock(&call_lock); | |
3157 | + ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, wait); | |
3158 | + | |
3159 | put_cpu(); | |
3160 | - return 0; | |
3161 | + return ret; | |
3162 | } | |
3163 | EXPORT_SYMBOL(smp_call_function_single); | |
3164 | ||
3165 | /* | |
3166 | - * this function sends a 'generic call function' IPI to all other CPUs | |
3167 | - * in the system. | |
3168 | - */ | |
3169 | -static void __smp_call_function (void (*func) (void *info), void *info, | |
3170 | - int nonatomic, int wait) | |
3171 | -{ | |
3172 | - struct call_data_struct data; | |
3173 | - int cpus = num_online_cpus()-1; | |
3174 | - | |
3175 | - if (!cpus) | |
3176 | - return; | |
3177 | - | |
3178 | - data.func = func; | |
3179 | - data.info = info; | |
3180 | - atomic_set(&data.started, 0); | |
3181 | - data.wait = wait; | |
3182 | - if (wait) | |
3183 | - atomic_set(&data.finished, 0); | |
3184 | - | |
3185 | - call_data = &data; | |
3186 | - wmb(); | |
3187 | - /* Send a message to all other CPUs and wait for them to respond */ | |
3188 | - send_IPI_allbutself(CALL_FUNCTION_VECTOR); | |
3189 | - | |
3190 | - /* Wait for response */ | |
3191 | - while (atomic_read(&data.started) != cpus) | |
3192 | - cpu_relax(); | |
3193 | - | |
3194 | - if (!wait) | |
3195 | - return; | |
3196 | - | |
3197 | - while (atomic_read(&data.finished) != cpus) | |
3198 | - cpu_relax(); | |
3199 | -} | |
3200 | - | |
3201 | -/* | |
3202 | * smp_call_function - run a function on all other CPUs. | |
3203 | * @func: The function to run. This must be fast and non-blocking. | |
3204 | * @info: An arbitrary pointer to pass to the function. | |
3205 | @@ -453,10 +464,7 @@ static void __smp_call_function (void (* | |
3206 | int smp_call_function (void (*func) (void *info), void *info, int nonatomic, | |
3207 | int wait) | |
3208 | { | |
3209 | - spin_lock(&call_lock); | |
3210 | - __smp_call_function(func,info,nonatomic,wait); | |
3211 | - spin_unlock(&call_lock); | |
3212 | - return 0; | |
3213 | + return smp_call_function_mask(cpu_online_map, func, info, wait); | |
3214 | } | |
3215 | EXPORT_SYMBOL(smp_call_function); | |
3216 | ||
3217 | @@ -485,7 +493,7 @@ void smp_send_stop(void) | |
3218 | /* Don't deadlock on the call lock in panic */ | |
3219 | nolock = !spin_trylock(&call_lock); | |
3220 | local_irq_save(flags); | |
3221 | - __smp_call_function(stop_this_cpu, NULL, 0, 0); | |
3222 | + __smp_call_function_mask(cpu_online_map, stop_this_cpu, NULL, 0); | |
3223 | if (!nolock) | |
3224 | spin_unlock(&call_lock); | |
3225 | disable_all_local_evtchn(); | |
3226 | @@ -505,7 +513,9 @@ asmlinkage irqreturn_t smp_reschedule_in | |
3227 | { | |
3228 | #ifndef CONFIG_XEN | |
3229 | ack_APIC_irq(); | |
3230 | -#else | |
3231 | +#endif | |
3232 | + add_pda(irq_resched_count, 1); | |
3233 | +#ifdef CONFIG_XEN | |
3234 | return IRQ_HANDLED; | |
3235 | #endif | |
3236 | } | |
3237 | @@ -535,6 +545,7 @@ asmlinkage irqreturn_t smp_call_function | |
3238 | exit_idle(); | |
3239 | irq_enter(); | |
3240 | (*func)(info); | |
3241 | + add_pda(irq_call_count, 1); | |
3242 | irq_exit(); | |
3243 | if (wait) { | |
3244 | mb(); | |
3245 | --- sle11-2009-06-29.orig/arch/x86/kernel/time_32-xen.c 2009-03-24 10:12:09.000000000 +0100 | |
3246 | +++ sle11-2009-06-29/arch/x86/kernel/time_32-xen.c 2009-03-24 10:12:35.000000000 +0100 | |
3247 | @@ -1,6 +1,4 @@ | |
3248 | /* | |
3249 | - * linux/arch/i386/kernel/time.c | |
3250 | - * | |
3251 | * Copyright (C) 1991, 1992, 1995 Linus Torvalds | |
3252 | * | |
3253 | * This file contains the PC-specific time handling details: | |
3254 | @@ -74,6 +72,7 @@ | |
3255 | #include <asm/arch_hooks.h> | |
3256 | ||
3257 | #include <xen/evtchn.h> | |
3258 | +#include <xen/sysctl.h> | |
3259 | #include <xen/interface/vcpu.h> | |
3260 | ||
3261 | #include <asm/i8253.h> | |
3262 | @@ -544,6 +543,13 @@ irqreturn_t timer_interrupt(int irq, voi | |
3263 | struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu); | |
3264 | struct vcpu_runstate_info runstate; | |
3265 | ||
3266 | + /* Keep nmi watchdog up to date */ | |
3267 | +#ifdef __i386__ | |
3268 | + per_cpu(irq_stat, smp_processor_id()).irq0_irqs++; | |
3269 | +#else | |
3270 | + add_pda(irq0_irqs, 1); | |
3271 | +#endif | |
3272 | + | |
3273 | /* | |
3274 | * Here we are in the timer irq handler. We just have irqs locally | |
3275 | * disabled but we don't know if the timer_bh is running on the other | |
3276 | @@ -994,7 +1000,7 @@ static int time_cpufreq_notifier(struct | |
3277 | struct cpufreq_freqs *freq = data; | |
3278 | struct xen_platform_op op; | |
3279 | ||
3280 | - if (cpu_has(&cpu_data[freq->cpu], X86_FEATURE_CONSTANT_TSC)) | |
3281 | + if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC)) | |
3282 | return 0; | |
3283 | ||
3284 | if (val == CPUFREQ_PRECHANGE) | |
3285 | @@ -1032,30 +1038,33 @@ core_initcall(cpufreq_time_setup); | |
3286 | */ | |
3287 | static ctl_table xen_subtable[] = { | |
3288 | { | |
3289 | - .ctl_name = 1, | |
3290 | + .ctl_name = CTL_XEN_INDEPENDENT_WALLCLOCK, | |
3291 | .procname = "independent_wallclock", | |
3292 | .data = &independent_wallclock, | |
3293 | .maxlen = sizeof(independent_wallclock), | |
3294 | .mode = 0644, | |
3295 | + .strategy = sysctl_data, | |
3296 | .proc_handler = proc_dointvec | |
3297 | }, | |
3298 | { | |
3299 | - .ctl_name = 2, | |
3300 | + .ctl_name = CTL_XEN_PERMITTED_CLOCK_JITTER, | |
3301 | .procname = "permitted_clock_jitter", | |
3302 | .data = &permitted_clock_jitter, | |
3303 | .maxlen = sizeof(permitted_clock_jitter), | |
3304 | .mode = 0644, | |
3305 | + .strategy = sysctl_data, | |
3306 | .proc_handler = proc_doulongvec_minmax | |
3307 | }, | |
3308 | - { 0 } | |
3309 | + { } | |
3310 | }; | |
3311 | static ctl_table xen_table[] = { | |
3312 | { | |
3313 | - .ctl_name = 123, | |
3314 | + .ctl_name = CTL_XEN, | |
3315 | .procname = "xen", | |
3316 | .mode = 0555, | |
3317 | - .child = xen_subtable}, | |
3318 | - { 0 } | |
3319 | + .child = xen_subtable | |
3320 | + }, | |
3321 | + { } | |
3322 | }; | |
3323 | static int __init xen_sysctl_init(void) | |
3324 | { | |
3325 | --- sle11-2009-06-29.orig/arch/x86/kernel/traps_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
3326 | +++ sle11-2009-06-29/arch/x86/kernel/traps_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
3327 | @@ -1,6 +1,4 @@ | |
3328 | /* | |
3329 | - * linux/arch/i386/traps.c | |
3330 | - * | |
3331 | * Copyright (C) 1991, 1992 Linus Torvalds | |
3332 | * | |
3333 | * Pentium III FXSR, SSE support | |
3334 | @@ -65,6 +63,11 @@ | |
3335 | ||
3336 | int panic_on_unrecovered_nmi; | |
3337 | ||
3338 | +#ifndef CONFIG_XEN | |
3339 | +DECLARE_BITMAP(used_vectors, NR_VECTORS); | |
3340 | +EXPORT_SYMBOL_GPL(used_vectors); | |
3341 | +#endif | |
3342 | + | |
3343 | asmlinkage int system_call(void); | |
3344 | ||
3345 | /* Do we ignore FPU interrupts ? */ | |
3346 | @@ -120,7 +123,7 @@ struct stack_frame { | |
3347 | ||
3348 | static inline unsigned long print_context_stack(struct thread_info *tinfo, | |
3349 | unsigned long *stack, unsigned long ebp, | |
3350 | - struct stacktrace_ops *ops, void *data) | |
3351 | + const struct stacktrace_ops *ops, void *data) | |
3352 | { | |
3353 | #ifdef CONFIG_FRAME_POINTER | |
3354 | struct stack_frame *frame = (struct stack_frame *)ebp; | |
3355 | @@ -157,7 +160,7 @@ static inline unsigned long print_contex | |
3356 | ||
3357 | void dump_trace(struct task_struct *task, struct pt_regs *regs, | |
3358 | unsigned long *stack, | |
3359 | - struct stacktrace_ops *ops, void *data) | |
3360 | + const struct stacktrace_ops *ops, void *data) | |
3361 | { | |
3362 | unsigned long ebp = 0; | |
3363 | ||
3364 | @@ -229,7 +232,7 @@ static void print_trace_address(void *da | |
3365 | touch_nmi_watchdog(); | |
3366 | } | |
3367 | ||
3368 | -static struct stacktrace_ops print_trace_ops = { | |
3369 | +static const struct stacktrace_ops print_trace_ops = { | |
3370 | .warning = print_trace_warning, | |
3371 | .warning_symbol = print_trace_warning_symbol, | |
3372 | .stack = print_trace_stack, | |
3373 | @@ -288,6 +291,11 @@ void dump_stack(void) | |
3374 | { | |
3375 | unsigned long stack; | |
3376 | ||
3377 | + printk("Pid: %d, comm: %.20s %s %s %.*s\n", | |
3378 | + current->pid, current->comm, print_tainted(), | |
3379 | + init_utsname()->release, | |
3380 | + (int)strcspn(init_utsname()->version, " "), | |
3381 | + init_utsname()->version); | |
3382 | show_trace(current, NULL, &stack); | |
3383 | } | |
3384 | ||
3385 | @@ -296,48 +304,24 @@ EXPORT_SYMBOL(dump_stack); | |
3386 | void show_registers(struct pt_regs *regs) | |
3387 | { | |
3388 | int i; | |
3389 | - int in_kernel = 1; | |
3390 | - unsigned long esp; | |
3391 | - unsigned short ss, gs; | |
3392 | - | |
3393 | - esp = (unsigned long) (®s->esp); | |
3394 | - savesegment(ss, ss); | |
3395 | - savesegment(gs, gs); | |
3396 | - if (user_mode_vm(regs)) { | |
3397 | - in_kernel = 0; | |
3398 | - esp = regs->esp; | |
3399 | - ss = regs->xss & 0xffff; | |
3400 | - } | |
3401 | + | |
3402 | print_modules(); | |
3403 | - printk(KERN_EMERG "CPU: %d\n" | |
3404 | - KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" | |
3405 | - KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", | |
3406 | - smp_processor_id(), 0xffff & regs->xcs, regs->eip, | |
3407 | - print_tainted(), regs->eflags, init_utsname()->release, | |
3408 | - (int)strcspn(init_utsname()->version, " "), | |
3409 | - init_utsname()->version); | |
3410 | - print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); | |
3411 | - printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", | |
3412 | - regs->eax, regs->ebx, regs->ecx, regs->edx); | |
3413 | - printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", | |
3414 | - regs->esi, regs->edi, regs->ebp, esp); | |
3415 | - printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", | |
3416 | - regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss); | |
3417 | + __show_registers(regs, 0); | |
3418 | printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", | |
3419 | - TASK_COMM_LEN, current->comm, current->pid, | |
3420 | + TASK_COMM_LEN, current->comm, task_pid_nr(current), | |
3421 | current_thread_info(), current, task_thread_info(current)); | |
3422 | /* | |
3423 | * When in-kernel, we also print out the stack and code at the | |
3424 | * time of the fault.. | |
3425 | */ | |
3426 | - if (in_kernel) { | |
3427 | + if (!user_mode_vm(regs)) { | |
3428 | u8 *eip; | |
3429 | unsigned int code_prologue = code_bytes * 43 / 64; | |
3430 | unsigned int code_len = code_bytes; | |
3431 | unsigned char c; | |
3432 | ||
3433 | printk("\n" KERN_EMERG "Stack: "); | |
3434 | - show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG); | |
3435 | + show_stack_log_lvl(NULL, regs, ®s->esp, KERN_EMERG); | |
3436 | ||
3437 | printk(KERN_EMERG "Code: "); | |
3438 | ||
3439 | @@ -382,11 +366,11 @@ int is_valid_bugaddr(unsigned long eip) | |
3440 | void die(const char * str, struct pt_regs * regs, long err) | |
3441 | { | |
3442 | static struct { | |
3443 | - spinlock_t lock; | |
3444 | + raw_spinlock_t lock; | |
3445 | u32 lock_owner; | |
3446 | int lock_owner_depth; | |
3447 | } die = { | |
3448 | - .lock = __SPIN_LOCK_UNLOCKED(die.lock), | |
3449 | + .lock = __RAW_SPIN_LOCK_UNLOCKED, | |
3450 | .lock_owner = -1, | |
3451 | .lock_owner_depth = 0 | |
3452 | }; | |
3453 | @@ -397,40 +381,33 @@ void die(const char * str, struct pt_reg | |
3454 | ||
3455 | if (die.lock_owner != raw_smp_processor_id()) { | |
3456 | console_verbose(); | |
3457 | - spin_lock_irqsave(&die.lock, flags); | |
3458 | + raw_local_irq_save(flags); | |
3459 | + __raw_spin_lock(&die.lock); | |
3460 | die.lock_owner = smp_processor_id(); | |
3461 | die.lock_owner_depth = 0; | |
3462 | bust_spinlocks(1); | |
3463 | - } | |
3464 | - else | |
3465 | - local_save_flags(flags); | |
3466 | + } else | |
3467 | + raw_local_irq_save(flags); | |
3468 | ||
3469 | if (++die.lock_owner_depth < 3) { | |
3470 | - int nl = 0; | |
3471 | unsigned long esp; | |
3472 | unsigned short ss; | |
3473 | ||
3474 | report_bug(regs->eip, regs); | |
3475 | ||
3476 | - printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); | |
3477 | + printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, | |
3478 | + ++die_counter); | |
3479 | #ifdef CONFIG_PREEMPT | |
3480 | - printk(KERN_EMERG "PREEMPT "); | |
3481 | - nl = 1; | |
3482 | + printk("PREEMPT "); | |
3483 | #endif | |
3484 | #ifdef CONFIG_SMP | |
3485 | - if (!nl) | |
3486 | - printk(KERN_EMERG); | |
3487 | printk("SMP "); | |
3488 | - nl = 1; | |
3489 | #endif | |
3490 | #ifdef CONFIG_DEBUG_PAGEALLOC | |
3491 | - if (!nl) | |
3492 | - printk(KERN_EMERG); | |
3493 | printk("DEBUG_PAGEALLOC"); | |
3494 | - nl = 1; | |
3495 | #endif | |
3496 | - if (nl) | |
3497 | - printk("\n"); | |
3498 | + printk("\n"); | |
3499 | + | |
3500 | if (notify_die(DIE_OOPS, str, regs, err, | |
3501 | current->thread.trap_no, SIGSEGV) != | |
3502 | NOTIFY_STOP) { | |
3503 | @@ -454,7 +431,8 @@ void die(const char * str, struct pt_reg | |
3504 | bust_spinlocks(0); | |
3505 | die.lock_owner = -1; | |
3506 | add_taint(TAINT_DIE); | |
3507 | - spin_unlock_irqrestore(&die.lock, flags); | |
3508 | + __raw_spin_unlock(&die.lock); | |
3509 | + raw_local_irq_restore(flags); | |
3510 | ||
3511 | if (!regs) | |
3512 | return; | |
3513 | @@ -571,6 +549,7 @@ fastcall void do_##name(struct pt_regs * | |
3514 | info.si_errno = 0; \ | |
3515 | info.si_code = sicode; \ | |
3516 | info.si_addr = (void __user *)siaddr; \ | |
3517 | + trace_hardirqs_fixup(); \ | |
3518 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ | |
3519 | == NOTIFY_STOP) \ | |
3520 | return; \ | |
3521 | @@ -606,7 +585,7 @@ fastcall void __kprobes do_general_prote | |
3522 | printk_ratelimit()) | |
3523 | printk(KERN_INFO | |
3524 | "%s[%d] general protection eip:%lx esp:%lx error:%lx\n", | |
3525 | - current->comm, current->pid, | |
3526 | + current->comm, task_pid_nr(current), | |
3527 | regs->eip, regs->esp, error_code); | |
3528 | ||
3529 | force_sig(SIGSEGV, current); | |
3530 | @@ -785,6 +764,8 @@ void restart_nmi(void) | |
3531 | #ifdef CONFIG_KPROBES | |
3532 | fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) | |
3533 | { | |
3534 | + trace_hardirqs_fixup(); | |
3535 | + | |
3536 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) | |
3537 | == NOTIFY_STOP) | |
3538 | return; | |
3539 | @@ -822,6 +803,8 @@ fastcall void __kprobes do_debug(struct | |
3540 | unsigned int condition; | |
3541 | struct task_struct *tsk = current; | |
3542 | ||
3543 | + trace_hardirqs_fixup(); | |
3544 | + | |
3545 | get_debugreg(condition, 6); | |
3546 | ||
3547 | if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, | |
3548 | @@ -1084,20 +1067,6 @@ asmlinkage void math_emulate(long arg) | |
3549 | ||
3550 | #endif /* CONFIG_MATH_EMULATION */ | |
3551 | ||
3552 | -#ifdef CONFIG_X86_F00F_BUG | |
3553 | -void __init trap_init_f00f_bug(void) | |
3554 | -{ | |
3555 | - __set_fixmap(FIX_F00F_IDT, __pa(&idt_table), PAGE_KERNEL_RO); | |
3556 | - | |
3557 | - /* | |
3558 | - * Update the IDT descriptor and reload the IDT so that | |
3559 | - * it uses the read-only mapped virtual address. | |
3560 | - */ | |
3561 | - idt_descr.address = fix_to_virt(FIX_F00F_IDT); | |
3562 | - load_idt(&idt_descr); | |
3563 | -} | |
3564 | -#endif | |
3565 | - | |
3566 | ||
3567 | /* | |
3568 | * NB. All these are "trap gates" (i.e. events_mask isn't set) except | |
3569 | --- sle11-2009-06-29.orig/arch/x86/kernel/traps_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
3570 | +++ sle11-2009-06-29/arch/x86/kernel/traps_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
3571 | @@ -1,6 +1,4 @@ | |
3572 | /* | |
3573 | - * linux/arch/x86-64/traps.c | |
3574 | - * | |
3575 | * Copyright (C) 1991, 1992 Linus Torvalds | |
3576 | * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs | |
3577 | * | |
3578 | @@ -33,6 +31,7 @@ | |
3579 | #include <linux/uaccess.h> | |
3580 | #include <linux/bug.h> | |
3581 | #include <linux/kdebug.h> | |
3582 | +#include <linux/utsname.h> | |
3583 | ||
3584 | #if defined(CONFIG_EDAC) | |
3585 | #include <linux/edac.h> | |
3586 | @@ -205,7 +204,7 @@ static unsigned long *in_exception_stack | |
3587 | #define MSG(txt) ops->warning(data, txt) | |
3588 | ||
3589 | /* | |
3590 | - * x86-64 can have upto three kernel stacks: | |
3591 | + * x86-64 can have up to three kernel stacks: | |
3592 | * process stack | |
3593 | * interrupt stack | |
3594 | * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack | |
3595 | @@ -219,7 +218,7 @@ static inline int valid_stack_ptr(struct | |
3596 | ||
3597 | void dump_trace(struct task_struct *tsk, struct pt_regs *regs, | |
3598 | unsigned long *stack, | |
3599 | - struct stacktrace_ops *ops, void *data) | |
3600 | + const struct stacktrace_ops *ops, void *data) | |
3601 | { | |
3602 | const unsigned cpu = get_cpu(); | |
3603 | unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; | |
3604 | @@ -340,7 +339,7 @@ static void print_trace_address(void *da | |
3605 | printk_address(addr); | |
3606 | } | |
3607 | ||
3608 | -static struct stacktrace_ops print_trace_ops = { | |
3609 | +static const struct stacktrace_ops print_trace_ops = { | |
3610 | .warning = print_trace_warning, | |
3611 | .warning_symbol = print_trace_warning_symbol, | |
3612 | .stack = print_trace_stack, | |
3613 | @@ -404,6 +403,12 @@ void show_stack(struct task_struct *tsk, | |
3614 | void dump_stack(void) | |
3615 | { | |
3616 | unsigned long dummy; | |
3617 | + | |
3618 | + printk("Pid: %d, comm: %.20s %s %s %.*s\n", | |
3619 | + current->pid, current->comm, print_tainted(), | |
3620 | + init_utsname()->release, | |
3621 | + (int)strcspn(init_utsname()->version, " "), | |
3622 | + init_utsname()->version); | |
3623 | show_trace(NULL, NULL, &dummy); | |
3624 | } | |
3625 | ||
3626 | @@ -466,7 +471,7 @@ void out_of_line_bug(void) | |
3627 | EXPORT_SYMBOL(out_of_line_bug); | |
3628 | #endif | |
3629 | ||
3630 | -static DEFINE_SPINLOCK(die_lock); | |
3631 | +static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED; | |
3632 | static int die_owner = -1; | |
3633 | static unsigned int die_nest_count; | |
3634 | ||
3635 | @@ -478,13 +483,13 @@ unsigned __kprobes long oops_begin(void) | |
3636 | oops_enter(); | |
3637 | ||
3638 | /* racy, but better than risking deadlock. */ | |
3639 | - local_irq_save(flags); | |
3640 | + raw_local_irq_save(flags); | |
3641 | cpu = smp_processor_id(); | |
3642 | - if (!spin_trylock(&die_lock)) { | |
3643 | + if (!__raw_spin_trylock(&die_lock)) { | |
3644 | if (cpu == die_owner) | |
3645 | /* nested oops. should stop eventually */; | |
3646 | else | |
3647 | - spin_lock(&die_lock); | |
3648 | + __raw_spin_lock(&die_lock); | |
3649 | } | |
3650 | die_nest_count++; | |
3651 | die_owner = cpu; | |
3652 | @@ -498,12 +503,10 @@ void __kprobes oops_end(unsigned long fl | |
3653 | die_owner = -1; | |
3654 | bust_spinlocks(0); | |
3655 | die_nest_count--; | |
3656 | - if (die_nest_count) | |
3657 | - /* We still own the lock */ | |
3658 | - local_irq_restore(flags); | |
3659 | - else | |
3660 | + if (!die_nest_count) | |
3661 | /* Nest count reaches zero, release the lock. */ | |
3662 | - spin_unlock_irqrestore(&die_lock, flags); | |
3663 | + __raw_spin_unlock(&die_lock); | |
3664 | + raw_local_irq_restore(flags); | |
3665 | if (panic_on_oops) | |
3666 | panic("Fatal exception"); | |
3667 | oops_exit(); | |
3668 | @@ -636,6 +639,7 @@ asmlinkage void do_##name(struct pt_regs | |
3669 | info.si_errno = 0; \ | |
3670 | info.si_code = sicode; \ | |
3671 | info.si_addr = (void __user *)siaddr; \ | |
3672 | + trace_hardirqs_fixup(); \ | |
3673 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ | |
3674 | == NOTIFY_STOP) \ | |
3675 | return; \ | |
3676 | @@ -741,11 +745,8 @@ mem_parity_error(unsigned char reason, s | |
3677 | ||
3678 | printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); | |
3679 | ||
3680 | -#if 0 /* XEN */ | |
3681 | /* Clear and disable the memory parity error line. */ | |
3682 | - reason = (reason & 0xf) | 4; | |
3683 | - outb(reason, 0x61); | |
3684 | -#endif /* XEN */ | |
3685 | + clear_mem_error(reason); | |
3686 | } | |
3687 | ||
3688 | static __kprobes void | |
3689 | @@ -754,14 +755,8 @@ io_check_error(unsigned char reason, str | |
3690 | printk("NMI: IOCK error (debug interrupt?)\n"); | |
3691 | show_registers(regs); | |
3692 | ||
3693 | -#if 0 /* XEN */ | |
3694 | /* Re-enable the IOCK line, wait for a few seconds */ | |
3695 | - reason = (reason & 0xf) | 8; | |
3696 | - outb(reason, 0x61); | |
3697 | - mdelay(2000); | |
3698 | - reason &= ~8; | |
3699 | - outb(reason, 0x61); | |
3700 | -#endif /* XEN */ | |
3701 | + clear_io_check_error(reason); | |
3702 | } | |
3703 | ||
3704 | static __kprobes void | |
3705 | @@ -821,6 +816,8 @@ asmlinkage __kprobes void default_do_nmi | |
3706 | /* runs on IST stack. */ | |
3707 | asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code) | |
3708 | { | |
3709 | + trace_hardirqs_fixup(); | |
3710 | + | |
3711 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { | |
3712 | return; | |
3713 | } | |
3714 | @@ -858,6 +855,8 @@ asmlinkage void __kprobes do_debug(struc | |
3715 | struct task_struct *tsk = current; | |
3716 | siginfo_t info; | |
3717 | ||
3718 | + trace_hardirqs_fixup(); | |
3719 | + | |
3720 | get_debugreg(condition, 6); | |
3721 | ||
3722 | if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, | |
3723 | --- sle11-2009-06-29.orig/arch/x86/kernel/vsyscall_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
3724 | +++ sle11-2009-06-29/arch/x86/kernel/vsyscall_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
3725 | @@ -1,6 +1,4 @@ | |
3726 | /* | |
3727 | - * linux/arch/x86_64/kernel/vsyscall.c | |
3728 | - * | |
3729 | * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE | |
3730 | * Copyright 2003 Andi Kleen, SuSE Labs. | |
3731 | * | |
3732 | @@ -50,12 +48,12 @@ | |
3733 | ({unsigned long v; \ | |
3734 | extern char __vsyscall_0; \ | |
3735 | asm("" : "=r" (v) : "0" (x)); \ | |
3736 | - ((v - VSYSCALL_FIRST_PAGE) + __pa_symbol(&__vsyscall_0)); }) | |
3737 | + ((v - VSYSCALL_START) + __pa_symbol(&__vsyscall_0)); }) | |
3738 | ||
3739 | /* | |
3740 | * vsyscall_gtod_data contains data that is : | |
3741 | * - readonly from vsyscalls | |
3742 | - * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) | |
3743 | + * - written by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) | |
3744 | * Try to keep this structure as small as possible to avoid cache line ping pongs | |
3745 | */ | |
3746 | int __vgetcpu_mode __section_vgetcpu_mode; | |
3747 | @@ -66,6 +64,16 @@ struct vsyscall_gtod_data __vsyscall_gto | |
3748 | .sysctl_enabled = 1, | |
3749 | }; | |
3750 | ||
3751 | +void update_vsyscall_tz(void) | |
3752 | +{ | |
3753 | + unsigned long flags; | |
3754 | + | |
3755 | + write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags); | |
3756 | + /* sys_tz has changed */ | |
3757 | + vsyscall_gtod_data.sys_tz = sys_tz; | |
3758 | + write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); | |
3759 | +} | |
3760 | + | |
3761 | void update_vsyscall(struct timespec *wall_time, struct clocksource *clock) | |
3762 | { | |
3763 | unsigned long flags; | |
3764 | @@ -79,8 +87,6 @@ void update_vsyscall(struct timespec *wa | |
3765 | vsyscall_gtod_data.clock.shift = clock->shift; | |
3766 | vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; | |
3767 | vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; | |
3768 | - vsyscall_gtod_data.sys_tz = sys_tz; | |
3769 | - vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; | |
3770 | vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; | |
3771 | write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); | |
3772 | } | |
3773 | @@ -166,7 +172,7 @@ time_t __vsyscall(1) vtime(time_t *t) | |
3774 | if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) | |
3775 | return time_syscall(t); | |
3776 | ||
3777 | - vgettimeofday(&tv, 0); | |
3778 | + vgettimeofday(&tv, NULL); | |
3779 | result = tv.tv_sec; | |
3780 | if (t) | |
3781 | *t = result; | |
3782 | @@ -260,18 +266,10 @@ out: | |
3783 | return ret; | |
3784 | } | |
3785 | ||
3786 | -static int vsyscall_sysctl_nostrat(ctl_table *t, int __user *name, int nlen, | |
3787 | - void __user *oldval, size_t __user *oldlenp, | |
3788 | - void __user *newval, size_t newlen) | |
3789 | -{ | |
3790 | - return -ENOSYS; | |
3791 | -} | |
3792 | - | |
3793 | static ctl_table kernel_table2[] = { | |
3794 | - { .ctl_name = 99, .procname = "vsyscall64", | |
3795 | + { .procname = "vsyscall64", | |
3796 | .data = &vsyscall_gtod_data.sysctl_enabled, .maxlen = sizeof(int), | |
3797 | .mode = 0644, | |
3798 | - .strategy = vsyscall_sysctl_nostrat, | |
3799 | .proc_handler = vsyscall_sysctl_change }, | |
3800 | {} | |
3801 | }; | |
3802 | @@ -291,9 +289,9 @@ static void __cpuinit vsyscall_set_cpu(i | |
3803 | unsigned long d; | |
3804 | unsigned long node = 0; | |
3805 | #ifdef CONFIG_NUMA | |
3806 | - node = cpu_to_node[cpu]; | |
3807 | + node = cpu_to_node(cpu); | |
3808 | #endif | |
3809 | - if (cpu_has(&cpu_data[cpu], X86_FEATURE_RDTSCP)) | |
3810 | + if (cpu_has(&cpu_data(cpu), X86_FEATURE_RDTSCP)) | |
3811 | write_rdtscp_aux((node << 12) | cpu); | |
3812 | ||
3813 | /* Store cpu number in limit so that it can be loaded quickly | |
3814 | --- sle11-2009-06-29.orig/arch/x86/mm/fault_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
3815 | +++ sle11-2009-06-29/arch/x86/mm/fault_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
3816 | @@ -25,6 +25,7 @@ | |
3817 | #include <linux/kprobes.h> | |
3818 | #include <linux/uaccess.h> | |
3819 | #include <linux/kdebug.h> | |
3820 | +#include <linux/kprobes.h> | |
3821 | ||
3822 | #include <asm/system.h> | |
3823 | #include <asm/desc.h> | |
3824 | @@ -32,33 +33,27 @@ | |
3825 | ||
3826 | extern void die(const char *,struct pt_regs *,long); | |
3827 | ||
3828 | -static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); | |
3829 | - | |
3830 | -int register_page_fault_notifier(struct notifier_block *nb) | |
3831 | +#ifdef CONFIG_KPROBES | |
3832 | +static inline int notify_page_fault(struct pt_regs *regs) | |
3833 | { | |
3834 | - vmalloc_sync_all(); | |
3835 | - return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); | |
3836 | -} | |
3837 | -EXPORT_SYMBOL_GPL(register_page_fault_notifier); | |
3838 | + int ret = 0; | |
3839 | ||
3840 | -int unregister_page_fault_notifier(struct notifier_block *nb) | |
3841 | -{ | |
3842 | - return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); | |
3843 | -} | |
3844 | -EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); | |
3845 | + /* kprobe_running() needs smp_processor_id() */ | |
3846 | + if (!user_mode_vm(regs)) { | |
3847 | + preempt_disable(); | |
3848 | + if (kprobe_running() && kprobe_fault_handler(regs, 14)) | |
3849 | + ret = 1; | |
3850 | + preempt_enable(); | |
3851 | + } | |
3852 | ||
3853 | -static inline int notify_page_fault(struct pt_regs *regs, long err) | |
3854 | + return ret; | |
3855 | +} | |
3856 | +#else | |
3857 | +static inline int notify_page_fault(struct pt_regs *regs) | |
3858 | { | |
3859 | - struct die_args args = { | |
3860 | - .regs = regs, | |
3861 | - .str = "page fault", | |
3862 | - .err = err, | |
3863 | - .trapnr = 14, | |
3864 | - .signr = SIGSEGV | |
3865 | - }; | |
3866 | - return atomic_notifier_call_chain(¬ify_page_fault_chain, | |
3867 | - DIE_PAGE_FAULT, &args); | |
3868 | + return 0; | |
3869 | } | |
3870 | +#endif | |
3871 | ||
3872 | /* | |
3873 | * Return EIP plus the CS segment base. The segment limit is also | |
3874 | @@ -110,7 +105,7 @@ static inline unsigned long get_segment_ | |
3875 | LDT and other horrors are only used in user space. */ | |
3876 | if (seg & (1<<2)) { | |
3877 | /* Must lock the LDT while reading it. */ | |
3878 | - down(¤t->mm->context.sem); | |
3879 | + mutex_lock(¤t->mm->context.lock); | |
3880 | desc = current->mm->context.ldt; | |
3881 | desc = (void *)desc + (seg & ~7); | |
3882 | } else { | |
3883 | @@ -123,7 +118,7 @@ static inline unsigned long get_segment_ | |
3884 | base = get_desc_base((unsigned long *)desc); | |
3885 | ||
3886 | if (seg & (1<<2)) { | |
3887 | - up(¤t->mm->context.sem); | |
3888 | + mutex_unlock(¤t->mm->context.lock); | |
3889 | } else | |
3890 | put_cpu(); | |
3891 | ||
3892 | @@ -244,7 +239,7 @@ static void dump_fault_path(unsigned lon | |
3893 | if (mfn_to_pfn(mfn) >= highstart_pfn) | |
3894 | return; | |
3895 | #endif | |
3896 | - if (p[0] & _PAGE_PRESENT) { | |
3897 | + if ((p[0] & _PAGE_PRESENT) && !(p[0] & _PAGE_PSE)) { | |
3898 | page = mfn_to_pfn(mfn) << PAGE_SHIFT; | |
3899 | p = (unsigned long *) __va(page); | |
3900 | address &= 0x001fffff; | |
3901 | @@ -270,7 +265,8 @@ static void dump_fault_path(unsigned lon | |
3902 | * it's allocated already. | |
3903 | */ | |
3904 | if ((machine_to_phys(page) >> PAGE_SHIFT) < max_low_pfn | |
3905 | - && (page & _PAGE_PRESENT)) { | |
3906 | + && (page & _PAGE_PRESENT) | |
3907 | + && !(page & _PAGE_PSE)) { | |
3908 | page = machine_to_phys(page & PAGE_MASK); | |
3909 | page = ((unsigned long *) __va(page))[(address >> PAGE_SHIFT) | |
3910 | & (PTRS_PER_PTE - 1)]; | |
3911 | @@ -416,6 +412,11 @@ fastcall void __kprobes do_page_fault(st | |
3912 | int write, si_code; | |
3913 | int fault; | |
3914 | ||
3915 | + /* | |
3916 | + * We can fault from pretty much anywhere, with unknown IRQ state. | |
3917 | + */ | |
3918 | + trace_hardirqs_fixup(); | |
3919 | + | |
3920 | /* get the address */ | |
3921 | address = read_cr2(); | |
3922 | ||
3923 | @@ -453,7 +454,7 @@ fastcall void __kprobes do_page_fault(st | |
3924 | /* Can take a spurious fault if mapping changes R/O -> R/W. */ | |
3925 | if (spurious_fault(regs, address, error_code)) | |
3926 | return; | |
3927 | - if (notify_page_fault(regs, error_code) == NOTIFY_STOP) | |
3928 | + if (notify_page_fault(regs)) | |
3929 | return; | |
3930 | /* | |
3931 | * Don't take the mm semaphore here. If we fixup a prefetch | |
3932 | @@ -462,7 +463,7 @@ fastcall void __kprobes do_page_fault(st | |
3933 | goto bad_area_nosemaphore; | |
3934 | } | |
3935 | ||
3936 | - if (notify_page_fault(regs, error_code) == NOTIFY_STOP) | |
3937 | + if (notify_page_fault(regs)) | |
3938 | return; | |
3939 | ||
3940 | /* It's safe to allow irq's after cr2 has been saved and the vmalloc | |
3941 | @@ -481,7 +482,7 @@ fastcall void __kprobes do_page_fault(st | |
3942 | ||
3943 | /* When running in the kernel we expect faults to occur only to | |
3944 | * addresses in user space. All other faults represent errors in the | |
3945 | - * kernel and should generate an OOPS. Unfortunatly, in the case of an | |
3946 | + * kernel and should generate an OOPS. Unfortunately, in the case of an | |
3947 | * erroneous fault occurring in a code path which already holds mmap_sem | |
3948 | * we will deadlock attempting to validate the fault against the | |
3949 | * address space. Luckily the kernel only validly references user | |
3950 | @@ -489,7 +490,7 @@ fastcall void __kprobes do_page_fault(st | |
3951 | * exceptions table. | |
3952 | * | |
3953 | * As the vast majority of faults will be valid we will only perform | |
3954 | - * the source reference check when there is a possibilty of a deadlock. | |
3955 | + * the source reference check when there is a possibility of a deadlock. | |
3956 | * Attempt to lock the address space, if we cannot we then validate the | |
3957 | * source. If this is invalid we can skip the address space check, | |
3958 | * thus avoiding the deadlock. | |
3959 | @@ -598,8 +599,8 @@ bad_area_nosemaphore: | |
3960 | printk_ratelimit()) { | |
3961 | printk("%s%s[%d]: segfault at %08lx eip %08lx " | |
3962 | "esp %08lx error %lx\n", | |
3963 | - tsk->pid > 1 ? KERN_INFO : KERN_EMERG, | |
3964 | - tsk->comm, tsk->pid, address, regs->eip, | |
3965 | + task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, | |
3966 | + tsk->comm, task_pid_nr(tsk), address, regs->eip, | |
3967 | regs->esp, error_code); | |
3968 | } | |
3969 | tsk->thread.cr2 = address; | |
3970 | @@ -664,8 +665,7 @@ no_context: | |
3971 | printk(KERN_ALERT "BUG: unable to handle kernel paging" | |
3972 | " request"); | |
3973 | printk(" at virtual address %08lx\n",address); | |
3974 | - printk(KERN_ALERT " printing eip:\n"); | |
3975 | - printk("%08lx\n", regs->eip); | |
3976 | + printk(KERN_ALERT "printing eip: %08lx\n", regs->eip); | |
3977 | dump_fault_path(address); | |
3978 | } | |
3979 | tsk->thread.cr2 = address; | |
3980 | @@ -681,14 +681,14 @@ no_context: | |
3981 | */ | |
3982 | out_of_memory: | |
3983 | up_read(&mm->mmap_sem); | |
3984 | - if (is_init(tsk)) { | |
3985 | + if (is_global_init(tsk)) { | |
3986 | yield(); | |
3987 | down_read(&mm->mmap_sem); | |
3988 | goto survive; | |
3989 | } | |
3990 | printk("VM: killing process %s\n", tsk->comm); | |
3991 | if (error_code & 4) | |
3992 | - do_exit(SIGKILL); | |
3993 | + do_group_exit(SIGKILL); | |
3994 | goto no_context; | |
3995 | ||
3996 | do_sigbus: | |
3997 | --- sle11-2009-06-29.orig/arch/x86/mm/fault_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
3998 | +++ sle11-2009-06-29/arch/x86/mm/fault_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
3999 | @@ -25,6 +25,7 @@ | |
4000 | #include <linux/kprobes.h> | |
4001 | #include <linux/uaccess.h> | |
4002 | #include <linux/kdebug.h> | |
4003 | +#include <linux/kprobes.h> | |
4004 | ||
4005 | #include <asm/system.h> | |
4006 | #include <asm/pgalloc.h> | |
4007 | @@ -40,34 +41,27 @@ | |
4008 | #define PF_RSVD (1<<3) | |
4009 | #define PF_INSTR (1<<4) | |
4010 | ||
4011 | -static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); | |
4012 | - | |
4013 | -/* Hook to register for page fault notifications */ | |
4014 | -int register_page_fault_notifier(struct notifier_block *nb) | |
4015 | +#ifdef CONFIG_KPROBES | |
4016 | +static inline int notify_page_fault(struct pt_regs *regs) | |
4017 | { | |
4018 | - vmalloc_sync_all(); | |
4019 | - return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); | |
4020 | -} | |
4021 | -EXPORT_SYMBOL_GPL(register_page_fault_notifier); | |
4022 | + int ret = 0; | |
4023 | ||
4024 | -int unregister_page_fault_notifier(struct notifier_block *nb) | |
4025 | -{ | |
4026 | - return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); | |
4027 | -} | |
4028 | -EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); | |
4029 | + /* kprobe_running() needs smp_processor_id() */ | |
4030 | + if (!user_mode(regs)) { | |
4031 | + preempt_disable(); | |
4032 | + if (kprobe_running() && kprobe_fault_handler(regs, 14)) | |
4033 | + ret = 1; | |
4034 | + preempt_enable(); | |
4035 | + } | |
4036 | ||
4037 | -static inline int notify_page_fault(struct pt_regs *regs, long err) | |
4038 | + return ret; | |
4039 | +} | |
4040 | +#else | |
4041 | +static inline int notify_page_fault(struct pt_regs *regs) | |
4042 | { | |
4043 | - struct die_args args = { | |
4044 | - .regs = regs, | |
4045 | - .str = "page fault", | |
4046 | - .err = err, | |
4047 | - .trapnr = 14, | |
4048 | - .signr = SIGSEGV | |
4049 | - }; | |
4050 | - return atomic_notifier_call_chain(¬ify_page_fault_chain, | |
4051 | - DIE_PAGE_FAULT, &args); | |
4052 | + return 0; | |
4053 | } | |
4054 | +#endif | |
4055 | ||
4056 | /* Sometimes the CPU reports invalid exceptions on prefetch. | |
4057 | Check that here and ignore. | |
4058 | @@ -175,7 +169,7 @@ void dump_pagetable(unsigned long addres | |
4059 | pmd = pmd_offset(pud, address); | |
4060 | if (bad_address(pmd)) goto bad; | |
4061 | printk("PMD %lx ", pmd_val(*pmd)); | |
4062 | - if (!pmd_present(*pmd)) goto ret; | |
4063 | + if (!pmd_present(*pmd) || pmd_large(*pmd)) goto ret; | |
4064 | ||
4065 | pte = pte_offset_kernel(pmd, address); | |
4066 | if (bad_address(pte)) goto bad; | |
4067 | @@ -294,7 +288,6 @@ static int vmalloc_fault(unsigned long a | |
4068 | return 0; | |
4069 | } | |
4070 | ||
4071 | -static int page_fault_trace; | |
4072 | int show_unhandled_signals = 1; | |
4073 | ||
4074 | ||
4075 | @@ -371,6 +364,11 @@ asmlinkage void __kprobes do_page_fault( | |
4076 | if (!user_mode(regs)) | |
4077 | error_code &= ~PF_USER; /* means kernel */ | |
4078 | ||
4079 | + /* | |
4080 | + * We can fault from pretty much anywhere, with unknown IRQ state. | |
4081 | + */ | |
4082 | + trace_hardirqs_fixup(); | |
4083 | + | |
4084 | tsk = current; | |
4085 | mm = tsk->mm; | |
4086 | prefetchw(&mm->mmap_sem); | |
4087 | @@ -408,7 +406,7 @@ asmlinkage void __kprobes do_page_fault( | |
4088 | /* Can take a spurious fault if mapping changes R/O -> R/W. */ | |
4089 | if (spurious_fault(regs, address, error_code)) | |
4090 | return; | |
4091 | - if (notify_page_fault(regs, error_code) == NOTIFY_STOP) | |
4092 | + if (notify_page_fault(regs)) | |
4093 | return; | |
4094 | /* | |
4095 | * Don't take the mm semaphore here. If we fixup a prefetch | |
4096 | @@ -417,16 +415,12 @@ asmlinkage void __kprobes do_page_fault( | |
4097 | goto bad_area_nosemaphore; | |
4098 | } | |
4099 | ||
4100 | - if (notify_page_fault(regs, error_code) == NOTIFY_STOP) | |
4101 | + if (notify_page_fault(regs)) | |
4102 | return; | |
4103 | ||
4104 | if (likely(regs->eflags & X86_EFLAGS_IF)) | |
4105 | local_irq_enable(); | |
4106 | ||
4107 | - if (unlikely(page_fault_trace)) | |
4108 | - printk("pagefault rip:%lx rsp:%lx cs:%lu ss:%lu address %lx error %lx\n", | |
4109 | - regs->rip,regs->rsp,regs->cs,regs->ss,address,error_code); | |
4110 | - | |
4111 | if (unlikely(error_code & PF_RSVD)) | |
4112 | pgtable_bad(address, regs, error_code); | |
4113 | ||
4114 | @@ -447,7 +441,7 @@ asmlinkage void __kprobes do_page_fault( | |
4115 | again: | |
4116 | /* When running in the kernel we expect faults to occur only to | |
4117 | * addresses in user space. All other faults represent errors in the | |
4118 | - * kernel and should generate an OOPS. Unfortunatly, in the case of an | |
4119 | + * kernel and should generate an OOPS. Unfortunately, in the case of an | |
4120 | * erroneous fault occurring in a code path which already holds mmap_sem | |
4121 | * we will deadlock attempting to validate the fault against the | |
4122 | * address space. Luckily the kernel only validly references user | |
4123 | @@ -455,7 +449,7 @@ asmlinkage void __kprobes do_page_fault( | |
4124 | * exceptions table. | |
4125 | * | |
4126 | * As the vast majority of faults will be valid we will only perform | |
4127 | - * the source reference check when there is a possibilty of a deadlock. | |
4128 | + * the source reference check when there is a possibility of a deadlock. | |
4129 | * Attempt to lock the address space, if we cannot we then validate the | |
4130 | * source. If this is invalid we can skip the address space check, | |
4131 | * thus avoiding the deadlock. | |
4132 | @@ -557,7 +551,7 @@ bad_area_nosemaphore: | |
4133 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | |
4134 | printk_ratelimit()) { | |
4135 | printk( | |
4136 | - "%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n", | |
4137 | + "%s%s[%d]: segfault at %lx rip %lx rsp %lx error %lx\n", | |
4138 | tsk->pid > 1 ? KERN_INFO : KERN_EMERG, | |
4139 | tsk->comm, tsk->pid, address, regs->rip, | |
4140 | regs->rsp, error_code); | |
4141 | @@ -623,7 +617,7 @@ no_context: | |
4142 | */ | |
4143 | out_of_memory: | |
4144 | up_read(&mm->mmap_sem); | |
4145 | - if (is_init(current)) { | |
4146 | + if (is_global_init(current)) { | |
4147 | yield(); | |
4148 | goto again; | |
4149 | } | |
4150 | @@ -690,10 +684,3 @@ void vmalloc_sync_all(void) | |
4151 | BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == | |
4152 | (__START_KERNEL & PGDIR_MASK))); | |
4153 | } | |
4154 | - | |
4155 | -static int __init enable_pagefaulttrace(char *str) | |
4156 | -{ | |
4157 | - page_fault_trace = 1; | |
4158 | - return 1; | |
4159 | -} | |
4160 | -__setup("pagefaulttrace", enable_pagefaulttrace); | |
4161 | --- sle11-2009-06-29.orig/arch/x86/mm/hypervisor.c 2009-03-04 11:28:34.000000000 +0100 | |
4162 | +++ sle11-2009-06-29/arch/x86/mm/hypervisor.c 2009-05-06 10:23:43.000000000 +0200 | |
4163 | @@ -496,6 +496,9 @@ int xen_create_contiguous_region( | |
4164 | unsigned long frame, flags; | |
4165 | unsigned int i; | |
4166 | int rc, success; | |
4167 | +#ifdef CONFIG_64BIT | |
4168 | + pte_t *ptep = NULL; | |
4169 | +#endif | |
4170 | struct xen_memory_exchange exchange = { | |
4171 | .in = { | |
4172 | .nr_extents = 1UL << order, | |
4173 | @@ -521,6 +524,27 @@ int xen_create_contiguous_region( | |
4174 | if (unlikely(order > MAX_CONTIG_ORDER)) | |
4175 | return -ENOMEM; | |
4176 | ||
4177 | +#ifdef CONFIG_64BIT | |
4178 | + if (unlikely(vstart > PAGE_OFFSET + MAXMEM)) { | |
4179 | + unsigned int level; | |
4180 | + | |
4181 | + if (vstart < __START_KERNEL_map | |
4182 | + || vstart + (PAGE_SIZE << order) > (unsigned long)_end) | |
4183 | + return -EINVAL; | |
4184 | + ptep = lookup_address((unsigned long)__va(__pa(vstart)), | |
4185 | + &level); | |
4186 | + if (ptep && pte_none(*ptep)) | |
4187 | + ptep = NULL; | |
4188 | + if (vstart < __START_KERNEL && ptep) | |
4189 | + return -EINVAL; | |
4190 | + if (order > MAX_CONTIG_ORDER - 1) | |
4191 | + return -ENOMEM; | |
4192 | + } | |
4193 | +#else | |
4194 | + if (unlikely(vstart + (PAGE_SIZE << order) > (unsigned long)high_memory)) | |
4195 | + return -EINVAL; | |
4196 | +#endif | |
4197 | + | |
4198 | set_xen_guest_handle(exchange.in.extent_start, in_frames); | |
4199 | set_xen_guest_handle(exchange.out.extent_start, &out_frame); | |
4200 | ||
4201 | @@ -533,9 +557,19 @@ int xen_create_contiguous_region( | |
4202 | in_frames[i] = pfn_to_mfn((__pa(vstart) >> PAGE_SHIFT) + i); | |
4203 | MULTI_update_va_mapping(cr_mcl + i, vstart + (i*PAGE_SIZE), | |
4204 | __pte_ma(0), 0); | |
4205 | +#ifdef CONFIG_64BIT | |
4206 | + if (ptep) | |
4207 | + MULTI_update_va_mapping(cr_mcl + i + (1U << order), | |
4208 | + (unsigned long)__va(__pa(vstart)) + (i*PAGE_SIZE), | |
4209 | + __pte_ma(0), 0); | |
4210 | +#endif | |
4211 | set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, | |
4212 | INVALID_P2M_ENTRY); | |
4213 | } | |
4214 | +#ifdef CONFIG_64BIT | |
4215 | + if (ptep) | |
4216 | + i += i; | |
4217 | +#endif | |
4218 | if (HYPERVISOR_multicall_check(cr_mcl, i, NULL)) | |
4219 | BUG(); | |
4220 | ||
4221 | @@ -569,9 +603,18 @@ int xen_create_contiguous_region( | |
4222 | frame = success ? (out_frame + i) : in_frames[i]; | |
4223 | MULTI_update_va_mapping(cr_mcl + i, vstart + (i*PAGE_SIZE), | |
4224 | pfn_pte_ma(frame, PAGE_KERNEL), 0); | |
4225 | +#ifdef CONFIG_64BIT | |
4226 | + if (ptep) | |
4227 | + MULTI_update_va_mapping(cr_mcl + i + (1U << order), | |
4228 | + (unsigned long)__va(__pa(vstart)) + (i*PAGE_SIZE), | |
4229 | + pfn_pte_ma(frame, PAGE_KERNEL_RO), 0); | |
4230 | +#endif | |
4231 | set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, frame); | |
4232 | } | |
4233 | - | |
4234 | +#ifdef CONFIG_64BIT | |
4235 | + if (ptep) | |
4236 | + i += i; | |
4237 | +#endif | |
4238 | cr_mcl[i - 1].args[MULTI_UVMFLAGS_INDEX] = order | |
4239 | ? UVMF_TLB_FLUSH|UVMF_ALL | |
4240 | : UVMF_INVLPG|UVMF_ALL; | |
4241 | --- sle11-2009-06-29.orig/arch/x86/mm/init_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
4242 | +++ sle11-2009-06-29/arch/x86/mm/init_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
4243 | @@ -94,7 +94,14 @@ static pte_t * __init one_page_table_ini | |
4244 | #else | |
4245 | if (!(__pmd_val(*pmd) & _PAGE_PRESENT)) { | |
4246 | #endif | |
4247 | - pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); | |
4248 | + pte_t *page_table = NULL; | |
4249 | + | |
4250 | +#ifdef CONFIG_DEBUG_PAGEALLOC | |
4251 | + page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); | |
4252 | +#endif | |
4253 | + if (!page_table) | |
4254 | + page_table = | |
4255 | + (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); | |
4256 | ||
4257 | paravirt_alloc_pt(&init_mm, __pa(page_table) >> PAGE_SHIFT); | |
4258 | make_lowmem_page_readonly(page_table, | |
4259 | @@ -102,7 +109,7 @@ static pte_t * __init one_page_table_ini | |
4260 | set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); | |
4261 | BUG_ON(page_table != pte_offset_kernel(pmd, 0)); | |
4262 | } | |
4263 | - | |
4264 | + | |
4265 | return pte_offset_kernel(pmd, 0); | |
4266 | } | |
4267 | ||
4268 | @@ -360,8 +367,13 @@ extern void set_highmem_pages_init(int); | |
4269 | static void __init set_highmem_pages_init(int bad_ppro) | |
4270 | { | |
4271 | int pfn; | |
4272 | - for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) | |
4273 | - add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); | |
4274 | + for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) { | |
4275 | + /* | |
4276 | + * Holes under sparsemem might not have no mem_map[]: | |
4277 | + */ | |
4278 | + if (pfn_valid(pfn)) | |
4279 | + add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); | |
4280 | + } | |
4281 | totalram_pages += totalhigh_pages; | |
4282 | } | |
4283 | #endif /* CONFIG_FLATMEM */ | |
4284 | @@ -779,35 +791,18 @@ int arch_add_memory(int nid, u64 start, | |
4285 | return __add_pages(zone, start_pfn, nr_pages); | |
4286 | } | |
4287 | ||
4288 | -int remove_memory(u64 start, u64 size) | |
4289 | -{ | |
4290 | - return -EINVAL; | |
4291 | -} | |
4292 | -EXPORT_SYMBOL_GPL(remove_memory); | |
4293 | #endif | |
4294 | ||
4295 | struct kmem_cache *pmd_cache; | |
4296 | ||
4297 | void __init pgtable_cache_init(void) | |
4298 | { | |
4299 | - size_t pgd_size = PTRS_PER_PGD*sizeof(pgd_t); | |
4300 | - | |
4301 | - if (PTRS_PER_PMD > 1) { | |
4302 | + if (PTRS_PER_PMD > 1) | |
4303 | pmd_cache = kmem_cache_create("pmd", | |
4304 | - PTRS_PER_PMD*sizeof(pmd_t), | |
4305 | - PTRS_PER_PMD*sizeof(pmd_t), | |
4306 | - SLAB_PANIC, | |
4307 | - pmd_ctor); | |
4308 | - if (!SHARED_KERNEL_PMD) { | |
4309 | - /* If we're in PAE mode and have a non-shared | |
4310 | - kernel pmd, then the pgd size must be a | |
4311 | - page size. This is because the pgd_list | |
4312 | - links through the page structure, so there | |
4313 | - can only be one pgd per page for this to | |
4314 | - work. */ | |
4315 | - pgd_size = PAGE_SIZE; | |
4316 | - } | |
4317 | - } | |
4318 | + PTRS_PER_PMD*sizeof(pmd_t), | |
4319 | + PTRS_PER_PMD*sizeof(pmd_t), | |
4320 | + SLAB_PANIC, | |
4321 | + pmd_ctor); | |
4322 | } | |
4323 | ||
4324 | /* | |
4325 | --- sle11-2009-06-29.orig/arch/x86/mm/init_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
4326 | +++ sle11-2009-06-29/arch/x86/mm/init_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
4327 | @@ -767,7 +767,7 @@ static void xen_finish_init_mapping(void | |
4328 | /* Setup the direct mapping of the physical memory at PAGE_OFFSET. | |
4329 | This runs before bootmem is initialized and gets pages directly from the | |
4330 | physical memory. To access them they are temporarily mapped. */ | |
4331 | -void __meminit init_memory_mapping(unsigned long start, unsigned long end) | |
4332 | +void __init_refok init_memory_mapping(unsigned long start, unsigned long end) | |
4333 | { | |
4334 | unsigned long next; | |
4335 | ||
4336 | @@ -901,12 +901,6 @@ error: | |
4337 | } | |
4338 | EXPORT_SYMBOL_GPL(arch_add_memory); | |
4339 | ||
4340 | -int remove_memory(u64 start, u64 size) | |
4341 | -{ | |
4342 | - return -EINVAL; | |
4343 | -} | |
4344 | -EXPORT_SYMBOL_GPL(remove_memory); | |
4345 | - | |
4346 | #if !defined(CONFIG_ACPI_NUMA) && defined(CONFIG_NUMA) | |
4347 | int memory_add_physaddr_to_nid(u64 start) | |
4348 | { | |
4349 | @@ -1173,14 +1167,6 @@ int in_gate_area_no_task(unsigned long a | |
4350 | return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END); | |
4351 | } | |
4352 | ||
4353 | -#ifndef CONFIG_XEN | |
4354 | -void * __init alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size) | |
4355 | -{ | |
4356 | - return __alloc_bootmem_core(pgdat->bdata, size, | |
4357 | - SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0); | |
4358 | -} | |
4359 | -#endif | |
4360 | - | |
4361 | const char *arch_vma_name(struct vm_area_struct *vma) | |
4362 | { | |
4363 | if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso) | |
4364 | @@ -1189,3 +1175,48 @@ const char *arch_vma_name(struct vm_area | |
4365 | return "[vsyscall]"; | |
4366 | return NULL; | |
4367 | } | |
4368 | + | |
4369 | +#ifdef CONFIG_SPARSEMEM_VMEMMAP | |
4370 | +/* | |
4371 | + * Initialise the sparsemem vmemmap using huge-pages at the PMD level. | |
4372 | + */ | |
4373 | +int __meminit vmemmap_populate(struct page *start_page, | |
4374 | + unsigned long size, int node) | |
4375 | +{ | |
4376 | + unsigned long addr = (unsigned long)start_page; | |
4377 | + unsigned long end = (unsigned long)(start_page + size); | |
4378 | + unsigned long next; | |
4379 | + pgd_t *pgd; | |
4380 | + pud_t *pud; | |
4381 | + pmd_t *pmd; | |
4382 | + | |
4383 | + for (; addr < end; addr = next) { | |
4384 | + next = pmd_addr_end(addr, end); | |
4385 | + | |
4386 | + pgd = vmemmap_pgd_populate(addr, node); | |
4387 | + if (!pgd) | |
4388 | + return -ENOMEM; | |
4389 | + pud = vmemmap_pud_populate(pgd, addr, node); | |
4390 | + if (!pud) | |
4391 | + return -ENOMEM; | |
4392 | + | |
4393 | + pmd = pmd_offset(pud, addr); | |
4394 | + if (pmd_none(*pmd)) { | |
4395 | + pte_t entry; | |
4396 | + void *p = vmemmap_alloc_block(PMD_SIZE, node); | |
4397 | + if (!p) | |
4398 | + return -ENOMEM; | |
4399 | + | |
4400 | + entry = pfn_pte(__pa(p) >> PAGE_SHIFT, PAGE_KERNEL); | |
4401 | + mk_pte_huge(entry); | |
4402 | + set_pmd(pmd, __pmd(pte_val(entry))); | |
4403 | + | |
4404 | + printk(KERN_DEBUG " [%lx-%lx] PMD ->%p on node %d\n", | |
4405 | + addr, addr + PMD_SIZE - 1, p, node); | |
4406 | + } else | |
4407 | + vmemmap_verify((pte_t *)pmd, node, addr, next); | |
4408 | + } | |
4409 | + | |
4410 | + return 0; | |
4411 | +} | |
4412 | +#endif | |
4413 | --- sle11-2009-06-29.orig/arch/x86/mm/pageattr_64-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
4414 | +++ sle11-2009-06-29/arch/x86/mm/pageattr_64-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
4415 | @@ -17,9 +17,6 @@ | |
4416 | #include <asm/pgalloc.h> | |
4417 | #include <asm/mmu_context.h> | |
4418 | ||
4419 | -LIST_HEAD(mm_unpinned); | |
4420 | -DEFINE_SPINLOCK(mm_unpinned_lock); | |
4421 | - | |
4422 | static void _pin_lock(struct mm_struct *mm, int lock) { | |
4423 | if (lock) | |
4424 | spin_lock(&mm->page_table_lock); | |
4425 | @@ -81,8 +78,8 @@ static void _pin_lock(struct mm_struct * | |
4426 | #define PIN_BATCH 8 | |
4427 | static DEFINE_PER_CPU(multicall_entry_t[PIN_BATCH], pb_mcl); | |
4428 | ||
4429 | -static inline unsigned int mm_walk_set_prot(void *pt, pgprot_t flags, | |
4430 | - unsigned int cpu, unsigned int seq) | |
4431 | +static inline unsigned int pgd_walk_set_prot(void *pt, pgprot_t flags, | |
4432 | + unsigned int cpu, unsigned int seq) | |
4433 | { | |
4434 | struct page *page = virt_to_page(pt); | |
4435 | unsigned long pfn = page_to_pfn(page); | |
4436 | @@ -100,9 +97,9 @@ static inline unsigned int mm_walk_set_p | |
4437 | return seq; | |
4438 | } | |
4439 | ||
4440 | -static void mm_walk(struct mm_struct *mm, pgprot_t flags) | |
4441 | +static void pgd_walk(pgd_t *pgd_base, pgprot_t flags) | |
4442 | { | |
4443 | - pgd_t *pgd; | |
4444 | + pgd_t *pgd = pgd_base; | |
4445 | pud_t *pud; | |
4446 | pmd_t *pmd; | |
4447 | pte_t *pte; | |
4448 | @@ -110,7 +107,6 @@ static void mm_walk(struct mm_struct *mm | |
4449 | unsigned int cpu, seq; | |
4450 | multicall_entry_t *mcl; | |
4451 | ||
4452 | - pgd = mm->pgd; | |
4453 | cpu = get_cpu(); | |
4454 | ||
4455 | /* | |
4456 | @@ -125,18 +121,18 @@ static void mm_walk(struct mm_struct *mm | |
4457 | continue; | |
4458 | pud = pud_offset(pgd, 0); | |
4459 | if (PTRS_PER_PUD > 1) /* not folded */ | |
4460 | - seq = mm_walk_set_prot(pud,flags,cpu,seq); | |
4461 | + seq = pgd_walk_set_prot(pud,flags,cpu,seq); | |
4462 | for (u = 0; u < PTRS_PER_PUD; u++, pud++) { | |
4463 | if (pud_none(*pud)) | |
4464 | continue; | |
4465 | pmd = pmd_offset(pud, 0); | |
4466 | if (PTRS_PER_PMD > 1) /* not folded */ | |
4467 | - seq = mm_walk_set_prot(pmd,flags,cpu,seq); | |
4468 | + seq = pgd_walk_set_prot(pmd,flags,cpu,seq); | |
4469 | for (m = 0; m < PTRS_PER_PMD; m++, pmd++) { | |
4470 | if (pmd_none(*pmd)) | |
4471 | continue; | |
4472 | pte = pte_offset_kernel(pmd,0); | |
4473 | - seq = mm_walk_set_prot(pte,flags,cpu,seq); | |
4474 | + seq = pgd_walk_set_prot(pte,flags,cpu,seq); | |
4475 | } | |
4476 | } | |
4477 | } | |
4478 | @@ -148,12 +144,12 @@ static void mm_walk(struct mm_struct *mm | |
4479 | seq = 0; | |
4480 | } | |
4481 | MULTI_update_va_mapping(mcl + seq, | |
4482 | - (unsigned long)__user_pgd(mm->pgd), | |
4483 | - pfn_pte(virt_to_phys(__user_pgd(mm->pgd))>>PAGE_SHIFT, flags), | |
4484 | + (unsigned long)__user_pgd(pgd_base), | |
4485 | + pfn_pte(virt_to_phys(__user_pgd(pgd_base))>>PAGE_SHIFT, flags), | |
4486 | 0); | |
4487 | MULTI_update_va_mapping(mcl + seq + 1, | |
4488 | - (unsigned long)mm->pgd, | |
4489 | - pfn_pte(virt_to_phys(mm->pgd)>>PAGE_SHIFT, flags), | |
4490 | + (unsigned long)pgd_base, | |
4491 | + pfn_pte(virt_to_phys(pgd_base)>>PAGE_SHIFT, flags), | |
4492 | UVMF_TLB_FLUSH); | |
4493 | if (unlikely(HYPERVISOR_multicall_check(mcl, seq + 2, NULL))) | |
4494 | BUG(); | |
4495 | @@ -161,21 +157,35 @@ static void mm_walk(struct mm_struct *mm | |
4496 | put_cpu(); | |
4497 | } | |
4498 | ||
4499 | +static void __pgd_pin(pgd_t *pgd) | |
4500 | +{ | |
4501 | + pgd_walk(pgd, PAGE_KERNEL_RO); | |
4502 | + xen_pgd_pin(__pa(pgd)); /* kernel */ | |
4503 | + xen_pgd_pin(__pa(__user_pgd(pgd))); /* user */ | |
4504 | + SetPagePinned(virt_to_page(pgd)); | |
4505 | +} | |
4506 | + | |
4507 | +static void __pgd_unpin(pgd_t *pgd) | |
4508 | +{ | |
4509 | + xen_pgd_unpin(__pa(pgd)); | |
4510 | + xen_pgd_unpin(__pa(__user_pgd(pgd))); | |
4511 | + pgd_walk(pgd, PAGE_KERNEL); | |
4512 | + ClearPagePinned(virt_to_page(pgd)); | |
4513 | +} | |
4514 | + | |
4515 | +void pgd_test_and_unpin(pgd_t *pgd) | |
4516 | +{ | |
4517 | + if (PagePinned(virt_to_page(pgd))) | |
4518 | + __pgd_unpin(pgd); | |
4519 | +} | |
4520 | + | |
4521 | void mm_pin(struct mm_struct *mm) | |
4522 | { | |
4523 | if (xen_feature(XENFEAT_writable_page_tables)) | |
4524 | return; | |
4525 | ||
4526 | pin_lock(mm); | |
4527 | - | |
4528 | - mm_walk(mm, PAGE_KERNEL_RO); | |
4529 | - xen_pgd_pin(__pa(mm->pgd)); /* kernel */ | |
4530 | - xen_pgd_pin(__pa(__user_pgd(mm->pgd))); /* user */ | |
4531 | - SetPagePinned(virt_to_page(mm->pgd)); | |
4532 | - spin_lock(&mm_unpinned_lock); | |
4533 | - list_del(&mm->context.unpinned); | |
4534 | - spin_unlock(&mm_unpinned_lock); | |
4535 | - | |
4536 | + __pgd_pin(mm->pgd); | |
4537 | pin_unlock(mm); | |
4538 | } | |
4539 | ||
4540 | @@ -185,34 +195,30 @@ void mm_unpin(struct mm_struct *mm) | |
4541 | return; | |
4542 | ||
4543 | pin_lock(mm); | |
4544 | - | |
4545 | - xen_pgd_unpin(__pa(mm->pgd)); | |
4546 | - xen_pgd_unpin(__pa(__user_pgd(mm->pgd))); | |
4547 | - mm_walk(mm, PAGE_KERNEL); | |
4548 | - ClearPagePinned(virt_to_page(mm->pgd)); | |
4549 | - spin_lock(&mm_unpinned_lock); | |
4550 | - list_add(&mm->context.unpinned, &mm_unpinned); | |
4551 | - spin_unlock(&mm_unpinned_lock); | |
4552 | - | |
4553 | + __pgd_unpin(mm->pgd); | |
4554 | pin_unlock(mm); | |
4555 | } | |
4556 | ||
4557 | void mm_pin_all(void) | |
4558 | { | |
4559 | + struct page *page; | |
4560 | + unsigned long flags; | |
4561 | + | |
4562 | if (xen_feature(XENFEAT_writable_page_tables)) | |
4563 | return; | |
4564 | ||
4565 | /* | |
4566 | - * Allow uninterrupted access to the mm_unpinned list. We don't | |
4567 | - * actually take the mm_unpinned_lock as it is taken inside mm_pin(). | |
4568 | + * Allow uninterrupted access to the pgd_list. Also protects | |
4569 | + * __pgd_pin() by disabling preemption. | |
4570 | * All other CPUs must be at a safe point (e.g., in stop_machine | |
4571 | * or offlined entirely). | |
4572 | */ | |
4573 | - preempt_disable(); | |
4574 | - while (!list_empty(&mm_unpinned)) | |
4575 | - mm_pin(list_entry(mm_unpinned.next, struct mm_struct, | |
4576 | - context.unpinned)); | |
4577 | - preempt_enable(); | |
4578 | + spin_lock_irqsave(&pgd_lock, flags); | |
4579 | + list_for_each_entry(page, &pgd_list, lru) { | |
4580 | + if (!PagePinned(page)) | |
4581 | + __pgd_pin((pgd_t *)page_address(page)); | |
4582 | + } | |
4583 | + spin_unlock_irqrestore(&pgd_lock, flags); | |
4584 | } | |
4585 | ||
4586 | void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) | |
4587 | @@ -331,11 +337,11 @@ static struct page *split_large_page(uns | |
4588 | return base; | |
4589 | } | |
4590 | ||
4591 | -static void cache_flush_page(void *adr) | |
4592 | +void clflush_cache_range(void *adr, int size) | |
4593 | { | |
4594 | int i; | |
4595 | - for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) | |
4596 | - asm volatile("clflush (%0)" :: "r" (adr + i)); | |
4597 | + for (i = 0; i < size; i += boot_cpu_data.x86_clflush_size) | |
4598 | + clflush(adr+i); | |
4599 | } | |
4600 | ||
4601 | static void flush_kernel_map(void *arg) | |
4602 | @@ -350,7 +356,7 @@ static void flush_kernel_map(void *arg) | |
4603 | asm volatile("wbinvd" ::: "memory"); | |
4604 | else list_for_each_entry(pg, l, lru) { | |
4605 | void *adr = page_address(pg); | |
4606 | - cache_flush_page(adr); | |
4607 | + clflush_cache_range(adr, PAGE_SIZE); | |
4608 | } | |
4609 | __flush_tlb_all(); | |
4610 | } | |
4611 | @@ -418,6 +424,7 @@ __change_page_attr(unsigned long address | |
4612 | split = split_large_page(address, prot, ref_prot2); | |
4613 | if (!split) | |
4614 | return -ENOMEM; | |
4615 | + pgprot_val(ref_prot2) &= ~_PAGE_NX; | |
4616 | set_pte(kpte, mk_pte(split, ref_prot2)); | |
4617 | kpte_page = split; | |
4618 | } | |
4619 | @@ -510,9 +517,14 @@ void global_flush_tlb(void) | |
4620 | struct page *pg, *next; | |
4621 | struct list_head l; | |
4622 | ||
4623 | - down_read(&init_mm.mmap_sem); | |
4624 | + /* | |
4625 | + * Write-protect the semaphore, to exclude two contexts | |
4626 | + * doing a list_replace_init() call in parallel and to | |
4627 | + * exclude new additions to the deferred_pages list: | |
4628 | + */ | |
4629 | + down_write(&init_mm.mmap_sem); | |
4630 | list_replace_init(&deferred_pages, &l); | |
4631 | - up_read(&init_mm.mmap_sem); | |
4632 | + up_write(&init_mm.mmap_sem); | |
4633 | ||
4634 | flush_map(&l); | |
4635 | ||
4636 | --- sle11-2009-06-29.orig/arch/x86/mm/pgtable_32-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
4637 | +++ sle11-2009-06-29/arch/x86/mm/pgtable_32-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
4638 | @@ -6,6 +6,7 @@ | |
4639 | #include <linux/kernel.h> | |
4640 | #include <linux/errno.h> | |
4641 | #include <linux/mm.h> | |
4642 | +#include <linux/nmi.h> | |
4643 | #include <linux/swap.h> | |
4644 | #include <linux/smp.h> | |
4645 | #include <linux/highmem.h> | |
4646 | @@ -46,6 +47,8 @@ void show_mem(void) | |
4647 | for_each_online_pgdat(pgdat) { | |
4648 | pgdat_resize_lock(pgdat, &flags); | |
4649 | for (i = 0; i < pgdat->node_spanned_pages; ++i) { | |
4650 | + if (unlikely(i % MAX_ORDER_NR_PAGES == 0)) | |
4651 | + touch_nmi_watchdog(); | |
4652 | page = pgdat_page_nr(pgdat, i); | |
4653 | total++; | |
4654 | if (PageHighMem(page)) | |
4655 | @@ -206,7 +209,7 @@ void pte_free(struct page *pte) | |
4656 | __free_page(pte); | |
4657 | } | |
4658 | ||
4659 | -void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags) | |
4660 | +void pmd_ctor(struct kmem_cache *cache, void *pmd) | |
4661 | { | |
4662 | memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t)); | |
4663 | } | |
4664 | --- sle11-2009-06-29.orig/arch/x86/pci/irq-xen.c 2009-02-16 16:17:21.000000000 +0100 | |
4665 | +++ sle11-2009-06-29/arch/x86/pci/irq-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
4666 | @@ -173,7 +173,7 @@ void eisa_set_level_irq(unsigned int irq | |
4667 | } | |
4668 | ||
4669 | /* | |
4670 | - * Common IRQ routing practice: nybbles in config space, | |
4671 | + * Common IRQ routing practice: nibbles in config space, | |
4672 | * offset by some magic constant. | |
4673 | */ | |
4674 | static unsigned int read_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr) | |
4675 | @@ -496,6 +496,26 @@ static int pirq_amd756_set(struct pci_de | |
4676 | return 1; | |
4677 | } | |
4678 | ||
4679 | +/* | |
4680 | + * PicoPower PT86C523 | |
4681 | + */ | |
4682 | +static int pirq_pico_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |
4683 | +{ | |
4684 | + outb(0x10 + ((pirq - 1) >> 1), 0x24); | |
4685 | + return ((pirq - 1) & 1) ? (inb(0x26) >> 4) : (inb(0x26) & 0xf); | |
4686 | +} | |
4687 | + | |
4688 | +static int pirq_pico_set(struct pci_dev *router, struct pci_dev *dev, int pirq, | |
4689 | + int irq) | |
4690 | +{ | |
4691 | + unsigned int x; | |
4692 | + outb(0x10 + ((pirq - 1) >> 1), 0x24); | |
4693 | + x = inb(0x26); | |
4694 | + x = ((pirq - 1) & 1) ? ((x & 0x0f) | (irq << 4)) : ((x & 0xf0) | (irq)); | |
4695 | + outb(x, 0x26); | |
4696 | + return 1; | |
4697 | +} | |
4698 | + | |
4699 | #ifdef CONFIG_PCI_BIOS | |
4700 | ||
4701 | static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | |
4702 | @@ -569,7 +589,7 @@ static __init int via_router_probe(struc | |
4703 | /* FIXME: We should move some of the quirk fixup stuff here */ | |
4704 | ||
4705 | /* | |
4706 | - * work arounds for some buggy BIOSes | |
4707 | + * workarounds for some buggy BIOSes | |
4708 | */ | |
4709 | if (device == PCI_DEVICE_ID_VIA_82C586_0) { | |
4710 | switch(router->device) { | |
4711 | @@ -725,6 +745,24 @@ static __init int amd_router_probe(struc | |
4712 | return 1; | |
4713 | } | |
4714 | ||
4715 | +static __init int pico_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | |
4716 | +{ | |
4717 | + switch (device) { | |
4718 | + case PCI_DEVICE_ID_PICOPOWER_PT86C523: | |
4719 | + r->name = "PicoPower PT86C523"; | |
4720 | + r->get = pirq_pico_get; | |
4721 | + r->set = pirq_pico_set; | |
4722 | + return 1; | |
4723 | + | |
4724 | + case PCI_DEVICE_ID_PICOPOWER_PT86C523BBP: | |
4725 | + r->name = "PicoPower PT86C523 rev. BB+"; | |
4726 | + r->get = pirq_pico_get; | |
4727 | + r->set = pirq_pico_set; | |
4728 | + return 1; | |
4729 | + } | |
4730 | + return 0; | |
4731 | +} | |
4732 | + | |
4733 | static __initdata struct irq_router_handler pirq_routers[] = { | |
4734 | { PCI_VENDOR_ID_INTEL, intel_router_probe }, | |
4735 | { PCI_VENDOR_ID_AL, ali_router_probe }, | |
4736 | @@ -736,6 +774,7 @@ static __initdata struct irq_router_hand | |
4737 | { PCI_VENDOR_ID_VLSI, vlsi_router_probe }, | |
4738 | { PCI_VENDOR_ID_SERVERWORKS, serverworks_router_probe }, | |
4739 | { PCI_VENDOR_ID_AMD, amd_router_probe }, | |
4740 | + { PCI_VENDOR_ID_PICOPOWER, pico_router_probe }, | |
4741 | /* Someone with docs needs to add the ATI Radeon IGP */ | |
4742 | { 0, NULL } | |
4743 | }; | |
4744 | @@ -1014,7 +1053,7 @@ static void __init pcibios_fixup_irqs(vo | |
4745 | * Work around broken HP Pavilion Notebooks which assign USB to | |
4746 | * IRQ 9 even though it is actually wired to IRQ 11 | |
4747 | */ | |
4748 | -static int __init fix_broken_hp_bios_irq9(struct dmi_system_id *d) | |
4749 | +static int __init fix_broken_hp_bios_irq9(const struct dmi_system_id *d) | |
4750 | { | |
4751 | if (!broken_hp_bios_irq9) { | |
4752 | broken_hp_bios_irq9 = 1; | |
4753 | @@ -1027,7 +1066,7 @@ static int __init fix_broken_hp_bios_irq | |
4754 | * Work around broken Acer TravelMate 360 Notebooks which assign | |
4755 | * Cardbus to IRQ 11 even though it is actually wired to IRQ 10 | |
4756 | */ | |
4757 | -static int __init fix_acer_tm360_irqrouting(struct dmi_system_id *d) | |
4758 | +static int __init fix_acer_tm360_irqrouting(const struct dmi_system_id *d) | |
4759 | { | |
4760 | if (!acer_tm360_irqrouting) { | |
4761 | acer_tm360_irqrouting = 1; | |
4762 | --- sle11-2009-06-29.orig/drivers/acpi/processor_idle.c 2009-06-29 15:17:44.000000000 +0200 | |
4763 | +++ sle11-2009-06-29/drivers/acpi/processor_idle.c 2009-06-29 15:29:06.000000000 +0200 | |
4764 | @@ -1749,6 +1749,13 @@ int acpi_processor_cst_has_changed(struc | |
4765 | if (!pr->flags.power_setup_done) | |
4766 | return -ENODEV; | |
4767 | ||
4768 | + if (processor_pm_external()) { | |
4769 | + acpi_processor_get_power_info(pr); | |
4770 | + processor_notify_external(pr, | |
4771 | + PROCESSOR_PM_CHANGE, PM_TYPE_IDLE); | |
4772 | + return ret; | |
4773 | + } | |
4774 | + | |
4775 | cpuidle_pause_and_lock(); | |
4776 | cpuidle_disable_device(&pr->power.dev); | |
4777 | acpi_processor_get_power_info(pr); | |
4778 | --- sle11-2009-06-29.orig/drivers/cpuidle/Kconfig 2009-06-29 15:14:52.000000000 +0200 | |
4779 | +++ sle11-2009-06-29/drivers/cpuidle/Kconfig 2009-02-16 16:18:36.000000000 +0100 | |
4780 | @@ -1,6 +1,7 @@ | |
4781 | ||
4782 | config CPU_IDLE | |
4783 | bool "CPU idle PM support" | |
4784 | + depends on !PROCESSOR_EXTERNAL_CONTROL | |
4785 | default ACPI | |
4786 | help | |
4787 | CPU idle is a generic framework for supporting software-controlled | |
4788 | --- sle11-2009-06-29.orig/drivers/oprofile/cpu_buffer.c 2009-02-16 16:01:39.000000000 +0100 | |
4789 | +++ sle11-2009-06-29/drivers/oprofile/cpu_buffer.c 2009-03-12 16:15:32.000000000 +0100 | |
4790 | @@ -308,6 +308,37 @@ void oprofile_add_trace(unsigned long pc | |
4791 | } | |
4792 | ||
4793 | #ifdef CONFIG_XEN | |
4794 | +/* | |
4795 | + * This is basically log_sample(b, ESCAPE_CODE, cpu_mode, CPU_TRACE_BEGIN), | |
4796 | + * as was previously accessible through oprofile_add_pc(). | |
4797 | + */ | |
4798 | +void oprofile_add_mode(int cpu_mode) | |
4799 | +{ | |
4800 | + struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); | |
4801 | + struct task_struct *task; | |
4802 | + | |
4803 | + if (nr_available_slots(cpu_buf) < 3) { | |
4804 | + cpu_buf->sample_lost_overflow++; | |
4805 | + return; | |
4806 | + } | |
4807 | + | |
4808 | + task = current; | |
4809 | + | |
4810 | + /* notice a switch from user->kernel or vice versa */ | |
4811 | + if (cpu_buf->last_cpu_mode != cpu_mode) { | |
4812 | + cpu_buf->last_cpu_mode = cpu_mode; | |
4813 | + add_code(cpu_buf, cpu_mode); | |
4814 | + } | |
4815 | + | |
4816 | + /* notice a task switch */ | |
4817 | + if (cpu_buf->last_task != task) { | |
4818 | + cpu_buf->last_task = task; | |
4819 | + add_code(cpu_buf, (unsigned long)task); | |
4820 | + } | |
4821 | + | |
4822 | + add_code(cpu_buf, CPU_TRACE_BEGIN); | |
4823 | +} | |
4824 | + | |
4825 | int oprofile_add_domain_switch(int32_t domain_id) | |
4826 | { | |
4827 | struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; | |
4828 | --- sle11-2009-06-29.orig/drivers/pci/msi-xen.c 2008-12-15 11:27:22.000000000 +0100 | |
4829 | +++ sle11-2009-06-29/drivers/pci/msi-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
4830 | @@ -264,6 +264,12 @@ static int msi_map_vector(struct pci_dev | |
4831 | return msi_map_pirq_to_vector(dev, -1, entry_nr, table_base); | |
4832 | } | |
4833 | ||
4834 | +static void pci_intx_for_msi(struct pci_dev *dev, int enable) | |
4835 | +{ | |
4836 | + if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG)) | |
4837 | + pci_intx(dev, enable); | |
4838 | +} | |
4839 | + | |
4840 | #ifdef CONFIG_PM | |
4841 | static void __pci_restore_msi_state(struct pci_dev *dev) | |
4842 | { | |
4843 | @@ -272,7 +278,7 @@ static void __pci_restore_msi_state(stru | |
4844 | if (!dev->msi_enabled) | |
4845 | return; | |
4846 | ||
4847 | - pci_intx(dev, 0); /* disable intx */ | |
4848 | + pci_intx_for_msi(dev, 0); | |
4849 | msi_set_enable(dev, 0); | |
4850 | ||
4851 | pirq = msi_map_pirq_to_vector(dev, dev->irq, 0, 0); | |
4852 | @@ -295,7 +301,7 @@ static void __pci_restore_msix_state(str | |
4853 | if (!dev->msix_enabled) | |
4854 | return; | |
4855 | ||
4856 | - pci_intx(dev, 0); /* disable intx */ | |
4857 | + pci_intx_for_msi(dev, 0); | |
4858 | msix_set_enable(dev, 0); | |
4859 | ||
4860 | msi_dev_entry = get_msi_dev_pirq_list(dev); | |
4861 | @@ -348,7 +354,7 @@ static int msi_capability_init(struct pc | |
4862 | return -EBUSY; | |
4863 | ||
4864 | /* Set MSI enabled bits */ | |
4865 | - pci_intx(dev, 0); /* disable intx */ | |
4866 | + pci_intx_for_msi(dev, 0); | |
4867 | msi_set_enable(dev, 1); | |
4868 | dev->msi_enabled = 1; | |
4869 | ||
4870 | @@ -422,7 +428,7 @@ static int msix_capability_init(struct p | |
4871 | return avail; | |
4872 | } | |
4873 | ||
4874 | - pci_intx(dev, 0); /* disable intx */ | |
4875 | + pci_intx_for_msi(dev, 0); | |
4876 | msix_set_enable(dev, 1); | |
4877 | dev->msix_enabled = 1; | |
4878 | ||
4879 | @@ -557,7 +563,7 @@ void pci_disable_msi(struct pci_dev* dev | |
4880 | ||
4881 | /* Disable MSI mode */ | |
4882 | msi_set_enable(dev, 0); | |
4883 | - pci_intx(dev, 1); /* enable intx */ | |
4884 | + pci_intx_for_msi(dev, 1); | |
4885 | dev->msi_enabled = 0; | |
4886 | } | |
4887 | EXPORT_SYMBOL(pci_disable_msi); | |
4888 | @@ -696,7 +702,7 @@ void pci_disable_msix(struct pci_dev* de | |
4889 | ||
4890 | /* Disable MSI mode */ | |
4891 | msix_set_enable(dev, 0); | |
4892 | - pci_intx(dev, 1); /* enable intx */ | |
4893 | + pci_intx_for_msi(dev, 1); | |
4894 | dev->msix_enabled = 0; | |
4895 | } | |
4896 | EXPORT_SYMBOL(pci_disable_msix); | |
4897 | --- sle11-2009-06-29.orig/drivers/xen/blkback/blkback.c 2009-02-16 16:17:21.000000000 +0100 | |
4898 | +++ sle11-2009-06-29/drivers/xen/blkback/blkback.c 2009-02-16 16:18:36.000000000 +0100 | |
4899 | @@ -269,13 +269,10 @@ static void __end_block_io_op(pending_re | |
4900 | } | |
4901 | } | |
4902 | ||
4903 | -static int end_block_io_op(struct bio *bio, unsigned int done, int error) | |
4904 | +static void end_block_io_op(struct bio *bio, int error) | |
4905 | { | |
4906 | - if (bio->bi_size != 0) | |
4907 | - return 1; | |
4908 | __end_block_io_op(bio->bi_private, error); | |
4909 | bio_put(bio); | |
4910 | - return error; | |
4911 | } | |
4912 | ||
4913 | ||
4914 | --- sle11-2009-06-29.orig/drivers/xen/blkfront/blkfront.c 2009-03-24 10:12:03.000000000 +0100 | |
4915 | +++ sle11-2009-06-29/drivers/xen/blkfront/blkfront.c 2009-02-16 16:18:36.000000000 +0100 | |
4916 | @@ -233,7 +233,7 @@ static int setup_blkring(struct xenbus_d | |
4917 | SHARED_RING_INIT(sring); | |
4918 | FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE); | |
4919 | ||
4920 | - memset(info->sg, 0, sizeof(info->sg)); | |
4921 | + sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST); | |
4922 | ||
4923 | err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring)); | |
4924 | if (err < 0) { | |
4925 | @@ -625,9 +625,8 @@ static int blkif_queue_request(struct re | |
4926 | ||
4927 | ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg); | |
4928 | BUG_ON(ring_req->nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST); | |
4929 | - for (i = 0; i < ring_req->nr_segments; ++i) { | |
4930 | - sg = info->sg + i; | |
4931 | - buffer_mfn = page_to_phys(sg->page) >> PAGE_SHIFT; | |
4932 | + for_each_sg(info->sg, sg, ring_req->nr_segments, i) { | |
4933 | + buffer_mfn = page_to_phys(sg_page(sg)) >> PAGE_SHIFT; | |
4934 | fsect = sg->offset >> 9; | |
4935 | lsect = fsect + (sg->length >> 9) - 1; | |
4936 | /* install a grant reference. */ | |
4937 | --- sle11-2009-06-29.orig/drivers/xen/core/firmware.c 2009-06-29 15:14:52.000000000 +0200 | |
4938 | +++ sle11-2009-06-29/drivers/xen/core/firmware.c 2009-03-25 18:10:23.000000000 +0100 | |
4939 | @@ -1,4 +1,5 @@ | |
4940 | #include <linux/kernel.h> | |
4941 | +#include <linux/string.h> | |
4942 | #include <linux/errno.h> | |
4943 | #include <linux/init.h> | |
4944 | #include <linux/edd.h> | |
4945 | --- sle11-2009-06-29.orig/drivers/xen/core/machine_kexec.c 2009-06-29 15:14:52.000000000 +0200 | |
4946 | +++ sle11-2009-06-29/drivers/xen/core/machine_kexec.c 2009-02-17 11:46:41.000000000 +0100 | |
4947 | @@ -29,6 +29,10 @@ void __init xen_machine_kexec_setup_reso | |
4948 | int k = 0; | |
4949 | int rc; | |
4950 | ||
4951 | + if (strstr(boot_command_line, "crashkernel=")) | |
4952 | + printk(KERN_WARNING "Ignoring crashkernel command line, " | |
4953 | + "parameter will be supplied by xen\n"); | |
4954 | + | |
4955 | if (!is_initial_xendomain()) | |
4956 | return; | |
4957 | ||
4958 | @@ -130,6 +134,13 @@ void __init xen_machine_kexec_setup_reso | |
4959 | xen_max_nr_phys_cpus)) | |
4960 | goto err; | |
4961 | ||
4962 | +#ifdef CONFIG_X86 | |
4963 | + if (xen_create_contiguous_region((unsigned long)&vmcoreinfo_note, | |
4964 | + get_order(sizeof(vmcoreinfo_note)), | |
4965 | + BITS_PER_LONG)) | |
4966 | + goto err; | |
4967 | +#endif | |
4968 | + | |
4969 | return; | |
4970 | ||
4971 | err: | |
4972 | @@ -205,6 +216,13 @@ NORET_TYPE void machine_kexec(struct kim | |
4973 | panic("KEXEC_CMD_kexec hypercall should not return\n"); | |
4974 | } | |
4975 | ||
4976 | +#ifdef CONFIG_X86 | |
4977 | +unsigned long paddr_vmcoreinfo_note(void) | |
4978 | +{ | |
4979 | + return virt_to_machine(&vmcoreinfo_note); | |
4980 | +} | |
4981 | +#endif | |
4982 | + | |
4983 | void machine_shutdown(void) | |
4984 | { | |
4985 | /* do nothing */ | |
4986 | --- sle11-2009-06-29.orig/drivers/xen/core/smpboot.c 2008-12-15 11:27:22.000000000 +0100 | |
4987 | +++ sle11-2009-06-29/drivers/xen/core/smpboot.c 2009-02-16 16:18:36.000000000 +0100 | |
4988 | @@ -45,8 +45,8 @@ cpumask_t cpu_possible_map; | |
4989 | EXPORT_SYMBOL(cpu_possible_map); | |
4990 | cpumask_t cpu_initialized_map; | |
4991 | ||
4992 | -struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; | |
4993 | -EXPORT_SYMBOL(cpu_data); | |
4994 | +DEFINE_PER_CPU(struct cpuinfo_x86, cpu_info); | |
4995 | +EXPORT_PER_CPU_SYMBOL(cpu_info); | |
4996 | ||
4997 | static DEFINE_PER_CPU(int, resched_irq); | |
4998 | static DEFINE_PER_CPU(int, callfunc_irq); | |
4999 | @@ -55,13 +55,13 @@ static char callfunc_name[NR_CPUS][15]; | |
5000 | ||
5001 | u8 cpu_2_logical_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; | |
5002 | ||
5003 | -cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; | |
5004 | -cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; | |
5005 | -EXPORT_SYMBOL(cpu_core_map); | |
5006 | +DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); | |
5007 | +DEFINE_PER_CPU(cpumask_t, cpu_core_map); | |
5008 | +EXPORT_PER_CPU_SYMBOL(cpu_core_map); | |
5009 | ||
5010 | #if defined(__i386__) | |
5011 | -u8 x86_cpu_to_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = 0xff }; | |
5012 | -EXPORT_SYMBOL(x86_cpu_to_apicid); | |
5013 | +DEFINE_PER_CPU(u8, x86_cpu_to_apicid) = BAD_APICID; | |
5014 | +EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid); | |
5015 | #endif | |
5016 | ||
5017 | void __init prefill_possible_map(void) | |
5018 | @@ -86,25 +86,25 @@ void __init smp_alloc_memory(void) | |
5019 | static inline void | |
5020 | set_cpu_sibling_map(unsigned int cpu) | |
5021 | { | |
5022 | - cpu_data[cpu].phys_proc_id = cpu; | |
5023 | - cpu_data[cpu].cpu_core_id = 0; | |
5024 | + cpu_data(cpu).phys_proc_id = cpu; | |
5025 | + cpu_data(cpu).cpu_core_id = 0; | |
5026 | ||
5027 | - cpu_sibling_map[cpu] = cpumask_of_cpu(cpu); | |
5028 | - cpu_core_map[cpu] = cpumask_of_cpu(cpu); | |
5029 | + per_cpu(cpu_sibling_map, cpu) = cpumask_of_cpu(cpu); | |
5030 | + per_cpu(cpu_core_map, cpu) = cpumask_of_cpu(cpu); | |
5031 | ||
5032 | - cpu_data[cpu].booted_cores = 1; | |
5033 | + cpu_data(cpu).booted_cores = 1; | |
5034 | } | |
5035 | ||
5036 | static void | |
5037 | remove_siblinginfo(unsigned int cpu) | |
5038 | { | |
5039 | - cpu_data[cpu].phys_proc_id = BAD_APICID; | |
5040 | - cpu_data[cpu].cpu_core_id = BAD_APICID; | |
5041 | + cpu_data(cpu).phys_proc_id = BAD_APICID; | |
5042 | + cpu_data(cpu).cpu_core_id = BAD_APICID; | |
5043 | ||
5044 | - cpus_clear(cpu_sibling_map[cpu]); | |
5045 | - cpus_clear(cpu_core_map[cpu]); | |
5046 | + cpus_clear(per_cpu(cpu_sibling_map, cpu)); | |
5047 | + cpus_clear(per_cpu(cpu_core_map, cpu)); | |
5048 | ||
5049 | - cpu_data[cpu].booted_cores = 0; | |
5050 | + cpu_data(cpu).booted_cores = 0; | |
5051 | } | |
5052 | ||
5053 | static int __cpuinit xen_smp_intr_init(unsigned int cpu) | |
5054 | @@ -163,9 +163,9 @@ void __cpuinit cpu_bringup(void) | |
5055 | { | |
5056 | cpu_init(); | |
5057 | #ifdef __i386__ | |
5058 | - identify_secondary_cpu(cpu_data + smp_processor_id()); | |
5059 | + identify_secondary_cpu(¤t_cpu_data); | |
5060 | #else | |
5061 | - identify_cpu(cpu_data + smp_processor_id()); | |
5062 | + identify_cpu(¤t_cpu_data); | |
5063 | #endif | |
5064 | touch_softlockup_watchdog(); | |
5065 | preempt_disable(); | |
5066 | @@ -266,16 +266,16 @@ void __init smp_prepare_cpus(unsigned in | |
5067 | if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, 0, &cpu_id) == 0) | |
5068 | apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id); | |
5069 | boot_cpu_data.apicid = apicid; | |
5070 | - cpu_data[0] = boot_cpu_data; | |
5071 | + cpu_data(0) = boot_cpu_data; | |
5072 | ||
5073 | cpu_2_logical_apicid[0] = apicid; | |
5074 | - x86_cpu_to_apicid[0] = apicid; | |
5075 | + per_cpu(x86_cpu_to_apicid, 0) = apicid; | |
5076 | ||
5077 | current_thread_info()->cpu = 0; | |
5078 | ||
5079 | for (cpu = 0; cpu < NR_CPUS; cpu++) { | |
5080 | - cpus_clear(cpu_sibling_map[cpu]); | |
5081 | - cpus_clear(cpu_core_map[cpu]); | |
5082 | + cpus_clear(per_cpu(cpu_sibling_map, cpu)); | |
5083 | + cpus_clear(per_cpu(cpu_core_map, cpu)); | |
5084 | } | |
5085 | ||
5086 | set_cpu_sibling_map(0); | |
5087 | @@ -320,11 +320,12 @@ void __init smp_prepare_cpus(unsigned in | |
5088 | apicid = cpu; | |
5089 | if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, cpu, &cpu_id) == 0) | |
5090 | apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id); | |
5091 | - cpu_data[cpu] = boot_cpu_data; | |
5092 | - cpu_data[cpu].apicid = apicid; | |
5093 | + cpu_data(cpu) = boot_cpu_data; | |
5094 | + cpu_data(cpu).cpu_index = cpu; | |
5095 | + cpu_data(cpu).apicid = apicid; | |
5096 | ||
5097 | cpu_2_logical_apicid[cpu] = apicid; | |
5098 | - x86_cpu_to_apicid[cpu] = apicid; | |
5099 | + per_cpu(x86_cpu_to_apicid, cpu) = apicid; | |
5100 | ||
5101 | #ifdef __x86_64__ | |
5102 | cpu_pda(cpu)->pcurrent = idle; | |
5103 | --- sle11-2009-06-29.orig/drivers/xen/netback/loopback.c 2008-12-15 11:26:44.000000000 +0100 | |
5104 | +++ sle11-2009-06-29/drivers/xen/netback/loopback.c 2009-02-16 16:18:36.000000000 +0100 | |
5105 | @@ -285,9 +285,9 @@ static void __exit clean_loopback(int i) | |
5106 | char dev_name[IFNAMSIZ]; | |
5107 | ||
5108 | sprintf(dev_name, "vif0.%d", i); | |
5109 | - dev1 = dev_get_by_name(dev_name); | |
5110 | + dev1 = dev_get_by_name(&init_net, dev_name); | |
5111 | sprintf(dev_name, "veth%d", i); | |
5112 | - dev2 = dev_get_by_name(dev_name); | |
5113 | + dev2 = dev_get_by_name(&init_net, dev_name); | |
5114 | if (dev1 && dev2) { | |
5115 | unregister_netdev(dev2); | |
5116 | unregister_netdev(dev1); | |
5117 | --- sle11-2009-06-29.orig/drivers/xen/netback/netback.c 2008-12-23 09:33:22.000000000 +0100 | |
5118 | +++ sle11-2009-06-29/drivers/xen/netback/netback.c 2009-02-16 16:18:36.000000000 +0100 | |
5119 | @@ -350,8 +350,8 @@ static void xen_network_done_notify(void | |
5120 | { | |
5121 | static struct net_device *eth0_dev = NULL; | |
5122 | if (unlikely(eth0_dev == NULL)) | |
5123 | - eth0_dev = __dev_get_by_name("eth0"); | |
5124 | - netif_rx_schedule(eth0_dev); | |
5125 | + eth0_dev = __dev_get_by_name(&init_net, "eth0"); | |
5126 | + netif_rx_schedule(eth0_dev, ???); | |
5127 | } | |
5128 | /* | |
5129 | * Add following to poll() function in NAPI driver (Tigon3 is example): | |
5130 | --- sle11-2009-06-29.orig/drivers/xen/netback/xenbus.c 2009-03-04 11:25:55.000000000 +0100 | |
5131 | +++ sle11-2009-06-29/drivers/xen/netback/xenbus.c 2009-02-16 16:18:36.000000000 +0100 | |
5132 | @@ -149,12 +149,10 @@ fail: | |
5133 | * and vif variables to the environment, for the benefit of the vif-* hotplug | |
5134 | * scripts. | |
5135 | */ | |
5136 | -static int netback_uevent(struct xenbus_device *xdev, char **envp, | |
5137 | - int num_envp, char *buffer, int buffer_size) | |
5138 | +static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *env) | |
5139 | { | |
5140 | struct backend_info *be = xdev->dev.driver_data; | |
5141 | netif_t *netif = be->netif; | |
5142 | - int i = 0, length = 0; | |
5143 | char *val; | |
5144 | ||
5145 | DPRINTK("netback_uevent"); | |
5146 | @@ -166,15 +164,11 @@ static int netback_uevent(struct xenbus_ | |
5147 | return err; | |
5148 | } | |
5149 | else { | |
5150 | - add_uevent_var(envp, num_envp, &i, buffer, buffer_size, | |
5151 | - &length, "script=%s", val); | |
5152 | + add_uevent_var(env, "script=%s", val); | |
5153 | kfree(val); | |
5154 | } | |
5155 | ||
5156 | - add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, | |
5157 | - "vif=%s", netif->dev->name); | |
5158 | - | |
5159 | - envp[i] = NULL; | |
5160 | + add_uevent_var(env, "vif=%s", netif->dev->name); | |
5161 | ||
5162 | return 0; | |
5163 | } | |
5164 | --- sle11-2009-06-29.orig/drivers/xen/netfront/accel.c 2009-04-09 14:43:45.000000000 +0200 | |
5165 | +++ sle11-2009-06-29/drivers/xen/netfront/accel.c 2009-03-30 16:39:19.000000000 +0200 | |
5166 | @@ -313,7 +313,7 @@ accelerator_set_vif_state_hooks(struct n | |
5167 | DPRINTK("%p\n",vif_state); | |
5168 | ||
5169 | /* Make sure there are no data path operations going on */ | |
5170 | - netif_poll_disable(vif_state->np->netdev); | |
5171 | + napi_disable(&vif_state->np->napi); | |
5172 | netif_tx_lock_bh(vif_state->np->netdev); | |
5173 | ||
5174 | accelerator = vif_state->np->accelerator; | |
5175 | @@ -322,7 +322,7 @@ accelerator_set_vif_state_hooks(struct n | |
5176 | spin_unlock_irqrestore(&accelerator->vif_states_lock, flags); | |
5177 | ||
5178 | netif_tx_unlock_bh(vif_state->np->netdev); | |
5179 | - netif_poll_enable(vif_state->np->netdev); | |
5180 | + napi_enable(&vif_state->np->napi); | |
5181 | } | |
5182 | ||
5183 | ||
5184 | @@ -496,7 +496,7 @@ accelerator_remove_single_hook(struct ne | |
5185 | unsigned long flags; | |
5186 | ||
5187 | /* Make sure there are no data path operations going on */ | |
5188 | - netif_poll_disable(vif_state->np->netdev); | |
5189 | + napi_disable(&vif_state->np->napi); | |
5190 | netif_tx_lock_bh(vif_state->np->netdev); | |
5191 | ||
5192 | spin_lock_irqsave(&accelerator->vif_states_lock, flags); | |
5193 | @@ -512,7 +512,7 @@ accelerator_remove_single_hook(struct ne | |
5194 | spin_unlock_irqrestore(&accelerator->vif_states_lock, flags); | |
5195 | ||
5196 | netif_tx_unlock_bh(vif_state->np->netdev); | |
5197 | - netif_poll_enable(vif_state->np->netdev); | |
5198 | + napi_enable(&vif_state->np->napi); | |
5199 | } | |
5200 | ||
5201 | ||
5202 | --- sle11-2009-06-29.orig/drivers/xen/netfront/netfront.c 2009-03-30 16:36:30.000000000 +0200 | |
5203 | +++ sle11-2009-06-29/drivers/xen/netfront/netfront.c 2009-03-30 16:39:44.000000000 +0200 | |
5204 | @@ -626,6 +626,7 @@ static int network_open(struct net_devic | |
5205 | struct netfront_info *np = netdev_priv(dev); | |
5206 | ||
5207 | memset(&np->stats, 0, sizeof(np->stats)); | |
5208 | + napi_enable(&np->napi); | |
5209 | ||
5210 | spin_lock_bh(&np->rx_lock); | |
5211 | if (netfront_carrier_ok(np)) { | |
5212 | @@ -634,7 +635,7 @@ static int network_open(struct net_devic | |
5213 | if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)){ | |
5214 | netfront_accelerator_call_stop_napi_irq(np, dev); | |
5215 | ||
5216 | - netif_rx_schedule(dev); | |
5217 | + netif_rx_schedule(dev, &np->napi); | |
5218 | } | |
5219 | } | |
5220 | spin_unlock_bh(&np->rx_lock); | |
5221 | @@ -706,7 +707,7 @@ static void rx_refill_timeout(unsigned l | |
5222 | ||
5223 | netfront_accelerator_call_stop_napi_irq(np, dev); | |
5224 | ||
5225 | - netif_rx_schedule(dev); | |
5226 | + netif_rx_schedule(dev, &np->napi); | |
5227 | } | |
5228 | ||
5229 | static void network_alloc_rx_buffers(struct net_device *dev) | |
5230 | @@ -1063,7 +1064,7 @@ static irqreturn_t netif_int(int irq, vo | |
5231 | if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)) { | |
5232 | netfront_accelerator_call_stop_napi_irq(np, dev); | |
5233 | ||
5234 | - netif_rx_schedule(dev); | |
5235 | + netif_rx_schedule(dev, &np->napi); | |
5236 | dev->last_rx = jiffies; | |
5237 | } | |
5238 | } | |
5239 | @@ -1316,16 +1317,17 @@ static int xennet_set_skb_gso(struct sk_ | |
5240 | #endif | |
5241 | } | |
5242 | ||
5243 | -static int netif_poll(struct net_device *dev, int *pbudget) | |
5244 | +static int netif_poll(struct napi_struct *napi, int budget) | |
5245 | { | |
5246 | - struct netfront_info *np = netdev_priv(dev); | |
5247 | + struct netfront_info *np = container_of(napi, struct netfront_info, napi); | |
5248 | + struct net_device *dev = np->netdev; | |
5249 | struct sk_buff *skb; | |
5250 | struct netfront_rx_info rinfo; | |
5251 | struct netif_rx_response *rx = &rinfo.rx; | |
5252 | struct netif_extra_info *extras = rinfo.extras; | |
5253 | RING_IDX i, rp; | |
5254 | struct multicall_entry *mcl; | |
5255 | - int work_done, budget, more_to_do = 1, accel_more_to_do = 1; | |
5256 | + int work_done, more_to_do = 1, accel_more_to_do = 1; | |
5257 | struct sk_buff_head rxq; | |
5258 | struct sk_buff_head errq; | |
5259 | struct sk_buff_head tmpq; | |
5260 | @@ -1345,8 +1347,6 @@ static int netif_poll(struct net_device | |
5261 | skb_queue_head_init(&errq); | |
5262 | skb_queue_head_init(&tmpq); | |
5263 | ||
5264 | - if ((budget = *pbudget) > dev->quota) | |
5265 | - budget = dev->quota; | |
5266 | rp = np->rx.sring->rsp_prod; | |
5267 | rmb(); /* Ensure we see queued responses up to 'rp'. */ | |
5268 | ||
5269 | @@ -1508,9 +1508,6 @@ err: | |
5270 | accel_more_to_do = 0; | |
5271 | } | |
5272 | ||
5273 | - *pbudget -= work_done; | |
5274 | - dev->quota -= work_done; | |
5275 | - | |
5276 | if (work_done < budget) { | |
5277 | local_irq_save(flags); | |
5278 | ||
5279 | @@ -1527,14 +1524,14 @@ err: | |
5280 | } | |
5281 | ||
5282 | if (!more_to_do && !accel_more_to_do) | |
5283 | - __netif_rx_complete(dev); | |
5284 | + __netif_rx_complete(dev, napi); | |
5285 | ||
5286 | local_irq_restore(flags); | |
5287 | } | |
5288 | ||
5289 | spin_unlock(&np->rx_lock); | |
5290 | ||
5291 | - return more_to_do | accel_more_to_do; | |
5292 | + return work_done; | |
5293 | } | |
5294 | ||
5295 | static void netif_release_tx_bufs(struct netfront_info *np) | |
5296 | @@ -1681,6 +1678,7 @@ static int network_close(struct net_devi | |
5297 | { | |
5298 | struct netfront_info *np = netdev_priv(dev); | |
5299 | netif_stop_queue(np->netdev); | |
5300 | + napi_disable(&np->napi); | |
5301 | return 0; | |
5302 | } | |
5303 | ||
5304 | @@ -2088,16 +2086,14 @@ static struct net_device * __devinit cre | |
5305 | netdev->hard_start_xmit = network_start_xmit; | |
5306 | netdev->stop = network_close; | |
5307 | netdev->get_stats = network_get_stats; | |
5308 | - netdev->poll = netif_poll; | |
5309 | + netif_napi_add(netdev, &np->napi, netif_poll, 64); | |
5310 | netdev->set_multicast_list = network_set_multicast_list; | |
5311 | netdev->uninit = netif_uninit; | |
5312 | netdev->set_mac_address = xennet_set_mac_address; | |
5313 | netdev->change_mtu = xennet_change_mtu; | |
5314 | - netdev->weight = 64; | |
5315 | netdev->features = NETIF_F_IP_CSUM; | |
5316 | ||
5317 | SET_ETHTOOL_OPS(netdev, &network_ethtool_ops); | |
5318 | - SET_MODULE_OWNER(netdev); | |
5319 | SET_NETDEV_DEV(netdev, &dev->dev); | |
5320 | ||
5321 | np->netdev = netdev; | |
5322 | --- sle11-2009-06-29.orig/drivers/xen/netfront/netfront.h 2009-06-29 15:14:52.000000000 +0200 | |
5323 | +++ sle11-2009-06-29/drivers/xen/netfront/netfront.h 2009-02-16 16:18:36.000000000 +0100 | |
5324 | @@ -157,6 +157,8 @@ struct netfront_info { | |
5325 | spinlock_t tx_lock; | |
5326 | spinlock_t rx_lock; | |
5327 | ||
5328 | + struct napi_struct napi; | |
5329 | + | |
5330 | unsigned int irq; | |
5331 | unsigned int copying_receiver; | |
5332 | unsigned int carrier; | |
5333 | --- sle11-2009-06-29.orig/drivers/xen/pciback/Makefile 2009-06-29 15:14:52.000000000 +0200 | |
5334 | +++ sle11-2009-06-29/drivers/xen/pciback/Makefile 2009-02-16 16:18:36.000000000 +0100 | |
5335 | @@ -12,6 +12,4 @@ pciback-$(CONFIG_XEN_PCIDEV_BACKEND_SLOT | |
5336 | pciback-$(CONFIG_XEN_PCIDEV_BACKEND_PASS) += passthrough.o | |
5337 | pciback-$(CONFIG_XEN_PCIDEV_BACKEND_CONTROLLER) += controller.o | |
5338 | ||
5339 | -ifeq ($(CONFIG_XEN_PCIDEV_BE_DEBUG),y) | |
5340 | -EXTRA_CFLAGS += -DDEBUG | |
5341 | -endif | |
5342 | +ccflags-$(CONFIG_XEN_PCIDEV_BE_DEBUG) += -DDEBUG | |
5343 | --- sle11-2009-06-29.orig/drivers/xen/pcifront/Makefile 2009-06-29 15:14:52.000000000 +0200 | |
5344 | +++ sle11-2009-06-29/drivers/xen/pcifront/Makefile 2009-02-16 16:18:36.000000000 +0100 | |
5345 | @@ -2,6 +2,4 @@ obj-y += pcifront.o | |
5346 | ||
5347 | pcifront-y := pci_op.o xenbus.o pci.o | |
5348 | ||
5349 | -ifeq ($(CONFIG_XEN_PCIDEV_FE_DEBUG),y) | |
5350 | -EXTRA_CFLAGS += -DDEBUG | |
5351 | -endif | |
5352 | +ccflags-$(CONFIG_XEN_PCIDEV_FE_DEBUG) += -DDEBUG | |
5353 | --- sle11-2009-06-29.orig/drivers/xen/scsiback/emulate.c 2009-06-29 15:14:52.000000000 +0200 | |
5354 | +++ sle11-2009-06-29/drivers/xen/scsiback/emulate.c 2009-02-16 16:18:36.000000000 +0100 | |
5355 | @@ -104,9 +104,10 @@ static void resp_not_supported_cmd(pendi | |
5356 | } | |
5357 | ||
5358 | ||
5359 | -static int __copy_to_sg(struct scatterlist *sg, unsigned int nr_sg, | |
5360 | +static int __copy_to_sg(struct scatterlist *sgl, unsigned int nr_sg, | |
5361 | void *buf, unsigned int buflen) | |
5362 | { | |
5363 | + struct scatterlist *sg; | |
5364 | void *from = buf; | |
5365 | void *to; | |
5366 | unsigned int from_rest = buflen; | |
5367 | @@ -115,8 +116,8 @@ static int __copy_to_sg(struct scatterli | |
5368 | unsigned int i; | |
5369 | unsigned long pfn; | |
5370 | ||
5371 | - for (i = 0; i < nr_sg; i++) { | |
5372 | - if (sg->page == NULL) { | |
5373 | + for_each_sg (sgl, sg, nr_sg, i) { | |
5374 | + if (sg_page(sg) == NULL) { | |
5375 | printk(KERN_WARNING "%s: inconsistent length field in " | |
5376 | "scatterlist\n", __FUNCTION__); | |
5377 | return -ENOMEM; | |
5378 | @@ -125,7 +126,7 @@ static int __copy_to_sg(struct scatterli | |
5379 | to_capa = sg->length; | |
5380 | copy_size = min_t(unsigned int, to_capa, from_rest); | |
5381 | ||
5382 | - pfn = page_to_pfn(sg->page); | |
5383 | + pfn = page_to_pfn(sg_page(sg)); | |
5384 | to = pfn_to_kaddr(pfn) + (sg->offset); | |
5385 | memcpy(to, from, copy_size); | |
5386 | ||
5387 | @@ -134,7 +135,6 @@ static int __copy_to_sg(struct scatterli | |
5388 | return 0; | |
5389 | } | |
5390 | ||
5391 | - sg++; | |
5392 | from += copy_size; | |
5393 | } | |
5394 | ||
5395 | @@ -143,9 +143,10 @@ static int __copy_to_sg(struct scatterli | |
5396 | return -ENOMEM; | |
5397 | } | |
5398 | ||
5399 | -static int __copy_from_sg(struct scatterlist *sg, unsigned int nr_sg, | |
5400 | +static int __copy_from_sg(struct scatterlist *sgl, unsigned int nr_sg, | |
5401 | void *buf, unsigned int buflen) | |
5402 | { | |
5403 | + struct scatterlist *sg; | |
5404 | void *from; | |
5405 | void *to = buf; | |
5406 | unsigned int from_rest; | |
5407 | @@ -154,8 +155,8 @@ static int __copy_from_sg(struct scatter | |
5408 | unsigned int i; | |
5409 | unsigned long pfn; | |
5410 | ||
5411 | - for (i = 0; i < nr_sg; i++) { | |
5412 | - if (sg->page == NULL) { | |
5413 | + for_each_sg (sgl, sg, nr_sg, i) { | |
5414 | + if (sg_page(sg) == NULL) { | |
5415 | printk(KERN_WARNING "%s: inconsistent length field in " | |
5416 | "scatterlist\n", __FUNCTION__); | |
5417 | return -ENOMEM; | |
5418 | @@ -170,13 +171,11 @@ static int __copy_from_sg(struct scatter | |
5419 | } | |
5420 | copy_size = from_rest; | |
5421 | ||
5422 | - pfn = page_to_pfn(sg->page); | |
5423 | + pfn = page_to_pfn(sg_page(sg)); | |
5424 | from = pfn_to_kaddr(pfn) + (sg->offset); | |
5425 | memcpy(to, from, copy_size); | |
5426 | ||
5427 | to_capa -= copy_size; | |
5428 | - | |
5429 | - sg++; | |
5430 | to += copy_size; | |
5431 | } | |
5432 | ||
5433 | --- sle11-2009-06-29.orig/drivers/xen/scsiback/scsiback.c 2008-12-15 11:26:44.000000000 +0100 | |
5434 | +++ sle11-2009-06-29/drivers/xen/scsiback/scsiback.c 2009-02-16 16:18:36.000000000 +0100 | |
5435 | @@ -247,6 +247,8 @@ static int scsiback_gnttab_data_map(vscs | |
5436 | write = (data_dir == DMA_TO_DEVICE); | |
5437 | ||
5438 | if (nr_segments) { | |
5439 | + struct scatterlist *sg; | |
5440 | + | |
5441 | /* free of (sgl) in fast_flush_area()*/ | |
5442 | pending_req->sgl = kmalloc(sizeof(struct scatterlist) * nr_segments, | |
5443 | GFP_KERNEL); | |
5444 | @@ -255,6 +257,8 @@ static int scsiback_gnttab_data_map(vscs | |
5445 | return -ENOMEM; | |
5446 | } | |
5447 | ||
5448 | + sg_init_table(pending_req->sgl, nr_segments); | |
5449 | + | |
5450 | for (i = 0; i < nr_segments; i++) { | |
5451 | flags = GNTMAP_host_map; | |
5452 | if (write) | |
5453 | @@ -267,7 +271,7 @@ static int scsiback_gnttab_data_map(vscs | |
5454 | err = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nr_segments); | |
5455 | BUG_ON(err); | |
5456 | ||
5457 | - for (i = 0; i < nr_segments; i++) { | |
5458 | + for_each_sg (pending_req->sgl, sg, nr_segments, i) { | |
5459 | if (unlikely(map[i].status != 0)) { | |
5460 | printk(KERN_ERR "scsiback: invalid buffer -- could not remap it\n"); | |
5461 | map[i].handle = SCSIBACK_INVALID_HANDLE; | |
5462 | @@ -283,15 +287,15 @@ static int scsiback_gnttab_data_map(vscs | |
5463 | pending_req, i)) >> PAGE_SHIFT, | |
5464 | FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT)); | |
5465 | ||
5466 | - pending_req->sgl[i].page = virt_to_page(vaddr(pending_req, i)); | |
5467 | - pending_req->sgl[i].offset = ring_req->seg[i].offset; | |
5468 | - pending_req->sgl[i].length = ring_req->seg[i].length; | |
5469 | - data_len += pending_req->sgl[i].length; | |
5470 | + sg_set_page(sg, virt_to_page(vaddr(pending_req, i)), | |
5471 | + ring_req->seg[i].length, | |
5472 | + ring_req->seg[i].offset); | |
5473 | + data_len += sg->length; | |
5474 | ||
5475 | barrier(); | |
5476 | - if (pending_req->sgl[i].offset >= PAGE_SIZE || | |
5477 | - pending_req->sgl[i].length > PAGE_SIZE || | |
5478 | - pending_req->sgl[i].offset + pending_req->sgl[i].length > PAGE_SIZE) | |
5479 | + if (sg->offset >= PAGE_SIZE || | |
5480 | + sg->length > PAGE_SIZE || | |
5481 | + sg->offset + sg->length > PAGE_SIZE) | |
5482 | err |= 1; | |
5483 | ||
5484 | } | |
5485 | @@ -320,27 +324,14 @@ static int scsiback_merge_bio(struct req | |
5486 | ||
5487 | blk_queue_bounce(q, &bio); | |
5488 | ||
5489 | - if (!rq->bio) | |
5490 | - blk_rq_bio_prep(q, rq, bio); | |
5491 | - else if (!ll_back_merge_fn(q, rq, bio)) | |
5492 | - return -EINVAL; | |
5493 | - else { | |
5494 | - rq->biotail->bi_next = bio; | |
5495 | - rq->biotail = bio; | |
5496 | - } | |
5497 | - | |
5498 | - return 0; | |
5499 | + return blk_rq_append_bio(q, rq, bio); | |
5500 | } | |
5501 | ||
5502 | ||
5503 | /* quoted scsi_lib.c/scsi_bi_endio */ | |
5504 | -static int scsiback_bi_endio(struct bio *bio, unsigned int bytes_done, int error) | |
5505 | +static void scsiback_bi_endio(struct bio *bio, int error) | |
5506 | { | |
5507 | - if (bio->bi_size) | |
5508 | - return 1; | |
5509 | - | |
5510 | bio_put(bio); | |
5511 | - return 0; | |
5512 | } | |
5513 | ||
5514 | ||
5515 | @@ -351,16 +342,16 @@ static int request_map_sg(struct request | |
5516 | struct request_queue *q = rq->q; | |
5517 | int nr_pages; | |
5518 | unsigned int nsegs = count; | |
5519 | - | |
5520 | unsigned int data_len = 0, len, bytes, off; | |
5521 | + struct scatterlist *sg; | |
5522 | struct page *page; | |
5523 | struct bio *bio = NULL; | |
5524 | int i, err, nr_vecs = 0; | |
5525 | ||
5526 | - for (i = 0; i < nsegs; i++) { | |
5527 | - page = pending_req->sgl[i].page; | |
5528 | - off = (unsigned int)pending_req->sgl[i].offset; | |
5529 | - len = (unsigned int)pending_req->sgl[i].length; | |
5530 | + for_each_sg (pending_req->sgl, sg, nsegs, i) { | |
5531 | + page = sg_page(sg); | |
5532 | + off = sg->offset; | |
5533 | + len = sg->length; | |
5534 | data_len += len; | |
5535 | ||
5536 | nr_pages = (len + off + PAGE_SIZE - 1) >> PAGE_SHIFT; | |
5537 | @@ -388,7 +379,7 @@ static int request_map_sg(struct request | |
5538 | if (bio->bi_vcnt >= nr_vecs) { | |
5539 | err = scsiback_merge_bio(rq, bio); | |
5540 | if (err) { | |
5541 | - bio_endio(bio, bio->bi_size, 0); | |
5542 | + bio_endio(bio, 0); | |
5543 | goto free_bios; | |
5544 | } | |
5545 | bio = NULL; | |
5546 | @@ -411,7 +402,7 @@ free_bios: | |
5547 | /* | |
5548 | * call endio instead of bio_put incase it was bounced | |
5549 | */ | |
5550 | - bio_endio(bio, bio->bi_size, 0); | |
5551 | + bio_endio(bio, 0); | |
5552 | } | |
5553 | ||
5554 | return err; | |
5555 | --- sle11-2009-06-29.orig/drivers/xen/scsifront/scsifront.c 2009-02-16 16:17:21.000000000 +0100 | |
5556 | +++ sle11-2009-06-29/drivers/xen/scsifront/scsifront.c 2009-02-16 16:18:36.000000000 +0100 | |
5557 | @@ -246,11 +246,10 @@ static int map_data_for_request(struct v | |
5558 | { | |
5559 | grant_ref_t gref_head; | |
5560 | struct page *page; | |
5561 | - int err, i, ref, ref_cnt = 0; | |
5562 | + int err, ref, ref_cnt = 0; | |
5563 | int write = (sc->sc_data_direction == DMA_TO_DEVICE); | |
5564 | - int nr_pages, off, len, bytes; | |
5565 | + unsigned int i, nr_pages, off, len, bytes; | |
5566 | unsigned long buffer_pfn; | |
5567 | - unsigned int data_len = 0; | |
5568 | ||
5569 | if (sc->sc_data_direction == DMA_NONE) | |
5570 | return 0; | |
5571 | @@ -263,25 +262,31 @@ static int map_data_for_request(struct v | |
5572 | ||
5573 | if (sc->use_sg) { | |
5574 | /* quoted scsi_lib.c/scsi_req_map_sg . */ | |
5575 | - struct scatterlist *sg = (struct scatterlist *)sc->request_buffer; | |
5576 | - nr_pages = (sc->request_bufflen + sg[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT; | |
5577 | + struct scatterlist *sg, *sgl = (struct scatterlist *)sc->request_buffer; | |
5578 | + unsigned int data_len = sc->request_bufflen; | |
5579 | ||
5580 | + nr_pages = (sc->request_bufflen + sgl->offset + PAGE_SIZE - 1) >> PAGE_SHIFT; | |
5581 | if (nr_pages > VSCSIIF_SG_TABLESIZE) { | |
5582 | printk(KERN_ERR "scsifront: Unable to map request_buffer for command!\n"); | |
5583 | ref_cnt = (-E2BIG); | |
5584 | goto big_to_sg; | |
5585 | } | |
5586 | ||
5587 | - for (i = 0; i < sc->use_sg; i++) { | |
5588 | - page = sg[i].page; | |
5589 | - off = sg[i].offset; | |
5590 | - len = sg[i].length; | |
5591 | - data_len += len; | |
5592 | + for_each_sg (sgl, sg, sc->use_sg, i) { | |
5593 | + page = sg_page(sg); | |
5594 | + off = sg->offset; | |
5595 | + len = sg->length; | |
5596 | ||
5597 | buffer_pfn = page_to_phys(page) >> PAGE_SHIFT; | |
5598 | ||
5599 | - while (len > 0) { | |
5600 | + while (len > 0 && data_len > 0) { | |
5601 | + /* | |
5602 | + * sg sends a scatterlist that is larger than | |
5603 | + * the data_len it wants transferred for certain | |
5604 | + * IO sizes | |
5605 | + */ | |
5606 | bytes = min_t(unsigned int, len, PAGE_SIZE - off); | |
5607 | + bytes = min(bytes, data_len); | |
5608 | ||
5609 | ref = gnttab_claim_grant_reference(&gref_head); | |
5610 | BUG_ON(ref == -ENOSPC); | |
5611 | @@ -296,6 +301,7 @@ static int map_data_for_request(struct v | |
5612 | ||
5613 | buffer_pfn++; | |
5614 | len -= bytes; | |
5615 | + data_len -= bytes; | |
5616 | off = 0; | |
5617 | ref_cnt++; | |
5618 | } | |
5619 | --- sle11-2009-06-29.orig/drivers/xen/sfc_netback/accel_fwd.c 2008-12-15 11:27:22.000000000 +0100 | |
5620 | +++ sle11-2009-06-29/drivers/xen/sfc_netback/accel_fwd.c 2009-02-16 16:18:36.000000000 +0100 | |
5621 | @@ -181,10 +181,11 @@ int netback_accel_fwd_add(const __u8 *ma | |
5622 | unsigned long flags; | |
5623 | cuckoo_hash_mac_key key = cuckoo_mac_to_key(mac); | |
5624 | struct port_fwd *fwd_set = (struct port_fwd *)fwd_priv; | |
5625 | + DECLARE_MAC_BUF(buf); | |
5626 | ||
5627 | BUG_ON(fwd_priv == NULL); | |
5628 | ||
5629 | - DPRINTK("Adding mac " MAC_FMT "\n", MAC_ARG(mac)); | |
5630 | + DPRINTK("Adding mac %s\n", print_mac(buf, mac)); | |
5631 | ||
5632 | spin_lock_irqsave(&fwd_set->fwd_lock, flags); | |
5633 | ||
5634 | @@ -199,8 +200,8 @@ int netback_accel_fwd_add(const __u8 *ma | |
5635 | if (cuckoo_hash_lookup(&fwd_set->fwd_hash_table, | |
5636 | (cuckoo_hash_key *)(&key), &rc) != 0) { | |
5637 | spin_unlock_irqrestore(&fwd_set->fwd_lock, flags); | |
5638 | - EPRINTK("MAC address " MAC_FMT " already accelerated.\n", | |
5639 | - MAC_ARG(mac)); | |
5640 | + EPRINTK("MAC address %s already accelerated.\n", | |
5641 | + print_mac(buf, mac)); | |
5642 | return -EEXIST; | |
5643 | } | |
5644 | ||
5645 | @@ -235,8 +236,9 @@ void netback_accel_fwd_remove(const __u8 | |
5646 | unsigned long flags; | |
5647 | cuckoo_hash_mac_key key = cuckoo_mac_to_key(mac); | |
5648 | struct port_fwd *fwd_set = (struct port_fwd *)fwd_priv; | |
5649 | + DECLARE_MAC_BUF(buf); | |
5650 | ||
5651 | - DPRINTK("Removing mac " MAC_FMT "\n", MAC_ARG(mac)); | |
5652 | + DPRINTK("Removing mac %s\n", print_mac(buf, mac)); | |
5653 | ||
5654 | BUG_ON(fwd_priv == NULL); | |
5655 | ||
5656 | @@ -394,14 +396,16 @@ void netback_accel_tx_packet(struct sk_b | |
5657 | ||
5658 | if (is_broadcast_ether_addr(skb_mac_header(skb)) | |
5659 | && packet_is_arp_reply(skb)) { | |
5660 | + DECLARE_MAC_BUF(buf); | |
5661 | + | |
5662 | /* | |
5663 | * update our fast path forwarding to reflect this | |
5664 | * gratuitous ARP | |
5665 | */ | |
5666 | mac = skb_mac_header(skb)+ETH_ALEN; | |
5667 | ||
5668 | - DPRINTK("%s: found gratuitous ARP for " MAC_FMT "\n", | |
5669 | - __FUNCTION__, MAC_ARG(mac)); | |
5670 | + DPRINTK("%s: found gratuitous ARP for %s\n", | |
5671 | + __FUNCTION__, print_mac(buf, mac)); | |
5672 | ||
5673 | spin_lock_irqsave(&fwd_set->fwd_lock, flags); | |
5674 | /* | |
5675 | --- sle11-2009-06-29.orig/drivers/xen/sfc_netback/accel_msg.c 2009-06-29 15:14:52.000000000 +0200 | |
5676 | +++ sle11-2009-06-29/drivers/xen/sfc_netback/accel_msg.c 2009-02-16 16:18:36.000000000 +0100 | |
5677 | @@ -57,11 +57,11 @@ static void netback_accel_msg_tx_localma | |
5678 | { | |
5679 | unsigned long lock_state; | |
5680 | struct net_accel_msg *msg; | |
5681 | + DECLARE_MAC_BUF(buf); | |
5682 | ||
5683 | BUG_ON(bend == NULL || mac == NULL); | |
5684 | ||
5685 | - VPRINTK("Sending local mac message: " MAC_FMT "\n", | |
5686 | - MAC_ARG((const char *)mac)); | |
5687 | + VPRINTK("Sending local mac message: %s\n", print_mac(buf, mac)); | |
5688 | ||
5689 | msg = net_accel_msg_start_send(bend->shared_page, &bend->to_domU, | |
5690 | &lock_state); | |
5691 | --- sle11-2009-06-29.orig/drivers/xen/sfc_netfront/accel_msg.c 2009-03-04 11:28:34.000000000 +0100 | |
5692 | +++ sle11-2009-06-29/drivers/xen/sfc_netfront/accel_msg.c 2009-02-16 16:18:36.000000000 +0100 | |
5693 | @@ -41,11 +41,13 @@ static void vnic_start_interrupts(netfro | |
5694 | /* Prime our interrupt */ | |
5695 | spin_lock_irqsave(&vnic->irq_enabled_lock, flags); | |
5696 | if (!netfront_accel_vi_enable_interrupts(vnic)) { | |
5697 | + struct netfront_info *np = netdev_priv(vnic->net_dev); | |
5698 | + | |
5699 | /* Cripes, that was quick, better pass it up */ | |
5700 | netfront_accel_disable_net_interrupts(vnic); | |
5701 | vnic->irq_enabled = 0; | |
5702 | NETFRONT_ACCEL_STATS_OP(vnic->stats.poll_schedule_count++); | |
5703 | - netif_rx_schedule(vnic->net_dev); | |
5704 | + netif_rx_schedule(vnic->net_dev, &np->napi); | |
5705 | } else { | |
5706 | /* | |
5707 | * Nothing yet, make sure we get interrupts through | |
5708 | @@ -72,6 +74,7 @@ static void vnic_stop_interrupts(netfron | |
5709 | static void vnic_start_fastpath(netfront_accel_vnic *vnic) | |
5710 | { | |
5711 | struct net_device *net_dev = vnic->net_dev; | |
5712 | + struct netfront_info *np = netdev_priv(net_dev); | |
5713 | unsigned long flags; | |
5714 | ||
5715 | DPRINTK("%s\n", __FUNCTION__); | |
5716 | @@ -80,9 +83,9 @@ static void vnic_start_fastpath(netfront | |
5717 | vnic->tx_enabled = 1; | |
5718 | spin_unlock_irqrestore(&vnic->tx_lock, flags); | |
5719 | ||
5720 | - netif_poll_disable(net_dev); | |
5721 | + napi_disable(&np->napi); | |
5722 | vnic->poll_enabled = 1; | |
5723 | - netif_poll_enable(net_dev); | |
5724 | + napi_enable(&np->napi); | |
5725 | ||
5726 | vnic_start_interrupts(vnic); | |
5727 | } | |
5728 | @@ -114,11 +117,11 @@ void vnic_stop_fastpath(netfront_accel_v | |
5729 | spin_unlock_irqrestore(&vnic->tx_lock, flags1); | |
5730 | ||
5731 | /* Must prevent polls and hold lock to modify poll_enabled */ | |
5732 | - netif_poll_disable(net_dev); | |
5733 | + napi_disable(&np->napi); | |
5734 | spin_lock_irqsave(&vnic->irq_enabled_lock, flags1); | |
5735 | vnic->poll_enabled = 0; | |
5736 | spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags1); | |
5737 | - netif_poll_enable(net_dev); | |
5738 | + napi_enable(&np->napi); | |
5739 | } | |
5740 | ||
5741 | ||
5742 | @@ -326,8 +329,10 @@ static int vnic_process_localmac_msg(net | |
5743 | cuckoo_hash_mac_key key; | |
5744 | ||
5745 | if (msg->u.localmac.flags & NET_ACCEL_MSG_ADD) { | |
5746 | - DPRINTK("MAC has moved, could be local: " MAC_FMT "\n", | |
5747 | - MAC_ARG(msg->u.localmac.mac)); | |
5748 | + DECLARE_MAC_BUF(buf); | |
5749 | + | |
5750 | + DPRINTK("MAC has moved, could be local: %s\n", | |
5751 | + print_mac(buf, msg->u.localmac.mac)); | |
5752 | key = cuckoo_mac_to_key(msg->u.localmac.mac); | |
5753 | spin_lock_irqsave(&vnic->table_lock, flags); | |
5754 | /* Try to remove it, not a big deal if not there */ | |
5755 | @@ -515,6 +520,8 @@ irqreturn_t netfront_accel_net_channel_i | |
5756 | ||
5757 | spin_lock_irqsave(&vnic->irq_enabled_lock, flags); | |
5758 | if (vnic->irq_enabled) { | |
5759 | + struct netfront_info *np = netdev_priv(net_dev); | |
5760 | + | |
5761 | netfront_accel_disable_net_interrupts(vnic); | |
5762 | vnic->irq_enabled = 0; | |
5763 | spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags); | |
5764 | @@ -527,7 +534,7 @@ irqreturn_t netfront_accel_net_channel_i | |
5765 | vnic->stats.event_count_since_irq; | |
5766 | vnic->stats.event_count_since_irq = 0; | |
5767 | #endif | |
5768 | - netif_rx_schedule(net_dev); | |
5769 | + netif_rx_schedule(net_dev, &np->napi); | |
5770 | } | |
5771 | else { | |
5772 | spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags); | |
5773 | --- sle11-2009-06-29.orig/drivers/xen/sfc_netfront/accel_vi.c 2009-03-30 16:36:26.000000000 +0200 | |
5774 | +++ sle11-2009-06-29/drivers/xen/sfc_netfront/accel_vi.c 2009-03-30 16:39:38.000000000 +0200 | |
5775 | @@ -641,8 +641,10 @@ netfront_accel_vi_tx_post(netfront_accel | |
5776 | (cuckoo_hash_key *)(&key), &value); | |
5777 | ||
5778 | if (!try_fastpath) { | |
5779 | - VPRINTK("try fast path false for mac: " MAC_FMT "\n", | |
5780 | - MAC_ARG(skb->data)); | |
5781 | + DECLARE_MAC_BUF(buf); | |
5782 | + | |
5783 | + VPRINTK("try fast path false for mac: %s\n", | |
5784 | + print_mac(buf, skb->data)); | |
5785 | ||
5786 | return NETFRONT_ACCEL_STATUS_CANT; | |
5787 | } | |
5788 | @@ -768,9 +770,10 @@ static void netfront_accel_vi_rx_comple | |
5789 | if (compare_ether_addr(skb->data, vnic->mac)) { | |
5790 | struct iphdr *ip = (struct iphdr *)(skb->data + ETH_HLEN); | |
5791 | u16 port; | |
5792 | + DECLARE_MAC_BUF(buf); | |
5793 | ||
5794 | - DPRINTK("%s: saw wrong MAC address " MAC_FMT "\n", | |
5795 | - __FUNCTION__, MAC_ARG(skb->data)); | |
5796 | + DPRINTK("%s: saw wrong MAC address %s\n", | |
5797 | + __FUNCTION__, print_mac(buf, skb->data)); | |
5798 | ||
5799 | if (ip->protocol == IPPROTO_TCP) { | |
5800 | struct tcphdr *tcp = (struct tcphdr *) | |
5801 | --- sle11-2009-06-29.orig/drivers/xen/sfc_netutil/accel_util.h 2009-06-29 15:14:52.000000000 +0200 | |
5802 | +++ sle11-2009-06-29/drivers/xen/sfc_netutil/accel_util.h 2009-02-16 16:18:36.000000000 +0100 | |
5803 | @@ -63,9 +63,6 @@ | |
5804 | DPRINTK("%s at %s:%d\n", #exp, __FILE__, __LINE__); \ | |
5805 | } while(0) | |
5806 | ||
5807 | -#define MAC_FMT "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x" | |
5808 | -#define MAC_ARG(_mac) (_mac)[0], (_mac)[1], (_mac)[2], (_mac)[3], (_mac)[4], (_mac)[5] | |
5809 | - | |
5810 | #include <xen/xenbus.h> | |
5811 | ||
5812 | /*! Map a set of pages from another domain | |
5813 | --- sle11-2009-06-29.orig/drivers/xen/xenbus/xenbus_probe.c 2009-02-16 16:17:21.000000000 +0100 | |
5814 | +++ sle11-2009-06-29/drivers/xen/xenbus/xenbus_probe.c 2009-02-16 16:18:36.000000000 +0100 | |
5815 | @@ -174,11 +174,9 @@ static int read_backend_details(struct x | |
5816 | } | |
5817 | ||
5818 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && (defined(CONFIG_XEN) || defined(MODULE)) | |
5819 | -static int xenbus_uevent_frontend(struct device *dev, char **envp, | |
5820 | - int num_envp, char *buffer, int buffer_size) | |
5821 | +static int xenbus_uevent_frontend(struct device *dev, struct kobj_uevent_env *env) | |
5822 | { | |
5823 | struct xenbus_device *xdev; | |
5824 | - int length = 0, i = 0; | |
5825 | ||
5826 | if (dev == NULL) | |
5827 | return -ENODEV; | |
5828 | @@ -187,12 +185,9 @@ static int xenbus_uevent_frontend(struct | |
5829 | return -ENODEV; | |
5830 | ||
5831 | /* stuff we want to pass to /sbin/hotplug */ | |
5832 | - add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, | |
5833 | - "XENBUS_TYPE=%s", xdev->devicetype); | |
5834 | - add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, | |
5835 | - "XENBUS_PATH=%s", xdev->nodename); | |
5836 | - add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, | |
5837 | - "MODALIAS=xen:%s", xdev->devicetype); | |
5838 | + add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype); | |
5839 | + add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename); | |
5840 | + add_uevent_var(env, "MODALIAS=xen:%s", xdev->devicetype); | |
5841 | ||
5842 | return 0; | |
5843 | } | |
5844 | --- sle11-2009-06-29.orig/drivers/xen/xenbus/xenbus_probe_backend.c 2009-02-16 16:17:21.000000000 +0100 | |
5845 | +++ sle11-2009-06-29/drivers/xen/xenbus/xenbus_probe_backend.c 2009-02-16 16:18:36.000000000 +0100 | |
5846 | @@ -60,8 +60,7 @@ | |
5847 | #include <xen/platform-compat.h> | |
5848 | #endif | |
5849 | ||
5850 | -static int xenbus_uevent_backend(struct device *dev, char **envp, | |
5851 | - int num_envp, char *buffer, int buffer_size); | |
5852 | +static int xenbus_uevent_backend(struct device *dev, struct kobj_uevent_env *env); | |
5853 | static int xenbus_probe_backend(const char *type, const char *domid); | |
5854 | ||
5855 | extern int read_otherend_details(struct xenbus_device *xendev, | |
5856 | @@ -128,13 +127,10 @@ static struct xen_bus_type xenbus_backen | |
5857 | }, | |
5858 | }; | |
5859 | ||
5860 | -static int xenbus_uevent_backend(struct device *dev, char **envp, | |
5861 | - int num_envp, char *buffer, int buffer_size) | |
5862 | +static int xenbus_uevent_backend(struct device *dev, struct kobj_uevent_env *env) | |
5863 | { | |
5864 | struct xenbus_device *xdev; | |
5865 | struct xenbus_driver *drv; | |
5866 | - int i = 0; | |
5867 | - int length = 0; | |
5868 | ||
5869 | DPRINTK(""); | |
5870 | ||
5871 | @@ -146,27 +142,16 @@ static int xenbus_uevent_backend(struct | |
5872 | return -ENODEV; | |
5873 | ||
5874 | /* stuff we want to pass to /sbin/hotplug */ | |
5875 | - add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, | |
5876 | - "XENBUS_TYPE=%s", xdev->devicetype); | |
5877 | + add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype); | |
5878 | ||
5879 | - add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, | |
5880 | - "XENBUS_PATH=%s", xdev->nodename); | |
5881 | + add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename); | |
5882 | ||
5883 | - add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, | |
5884 | - "XENBUS_BASE_PATH=%s", xenbus_backend.root); | |
5885 | - | |
5886 | - /* terminate, set to next free slot, shrink available space */ | |
5887 | - envp[i] = NULL; | |
5888 | - envp = &envp[i]; | |
5889 | - num_envp -= i; | |
5890 | - buffer = &buffer[length]; | |
5891 | - buffer_size -= length; | |
5892 | + add_uevent_var(env, "XENBUS_BASE_PATH=%s", xenbus_backend.root); | |
5893 | ||
5894 | if (dev->driver) { | |
5895 | drv = to_xenbus_driver(dev->driver); | |
5896 | if (drv && drv->uevent) | |
5897 | - return drv->uevent(xdev, envp, num_envp, buffer, | |
5898 | - buffer_size); | |
5899 | + return drv->uevent(xdev, env); | |
5900 | } | |
5901 | ||
5902 | return 0; | |
5903 | --- sle11-2009-06-29.orig/drivers/xen/xenoprof/xenoprofile.c 2009-03-04 11:25:55.000000000 +0100 | |
5904 | +++ sle11-2009-06-29/drivers/xen/xenoprof/xenoprofile.c 2009-03-11 15:39:38.000000000 +0100 | |
5905 | @@ -29,7 +29,6 @@ | |
5906 | #include <xen/driver_util.h> | |
5907 | #include <xen/interface/xen.h> | |
5908 | #include <xen/interface/xenoprof.h> | |
5909 | -#include "../../../drivers/oprofile/cpu_buffer.h" | |
5910 | #include "../../../drivers/oprofile/event_buffer.h" | |
5911 | ||
5912 | #define MAX_XENOPROF_SAMPLES 16 | |
5913 | @@ -142,8 +141,7 @@ static void xenoprof_add_pc(xenoprof_buf | |
5914 | if (xenoprof_is_escape(buf, tail) && | |
5915 | xenoprof_get_event(buf, tail) == XENOPROF_TRACE_BEGIN) { | |
5916 | tracing=1; | |
5917 | - oprofile_add_pc(ESCAPE_CODE, buf->event_log[tail].mode, | |
5918 | - CPU_TRACE_BEGIN); | |
5919 | + oprofile_add_mode(buf->event_log[tail].mode); | |
5920 | if (!is_passive) | |
5921 | oprofile_samples++; | |
5922 | else | |
5923 | --- sle11-2009-06-29.orig/fs/xfs/linux-2.6/xfs_buf.c 2009-06-29 15:14:52.000000000 +0200 | |
5924 | +++ sle11-2009-06-29/fs/xfs/linux-2.6/xfs_buf.c 2009-02-16 16:18:36.000000000 +0100 | |
5925 | @@ -187,7 +187,7 @@ free_address( | |
5926 | { | |
5927 | a_list_t *aentry; | |
5928 | ||
5929 | -#ifdef CONFIG_XEN | |
5930 | +#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN) | |
5931 | /* | |
5932 | * Xen needs to be able to make sure it can get an exclusive | |
5933 | * RO mapping of pages it wants to turn into a pagetable. If | |
5934 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/agp.h 2009-06-29 15:14:52.000000000 +0200 | |
5935 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/agp.h 2009-02-16 16:18:36.000000000 +0100 | |
5936 | @@ -1,20 +1,22 @@ | |
5937 | -#ifndef AGP_H | |
5938 | -#define AGP_H 1 | |
5939 | +#ifndef _ASM_X86_AGP_H | |
5940 | +#define _ASM_X86_AGP_H | |
5941 | ||
5942 | #include <asm/pgtable.h> | |
5943 | #include <asm/cacheflush.h> | |
5944 | #include <asm/system.h> | |
5945 | ||
5946 | -/* | |
5947 | - * Functions to keep the agpgart mappings coherent with the MMU. | |
5948 | - * The GART gives the CPU a physical alias of pages in memory. The alias region is | |
5949 | - * mapped uncacheable. Make sure there are no conflicting mappings | |
5950 | - * with different cachability attributes for the same page. This avoids | |
5951 | - * data corruption on some CPUs. | |
5952 | +/* | |
5953 | + * Functions to keep the agpgart mappings coherent with the MMU. The | |
5954 | + * GART gives the CPU a physical alias of pages in memory. The alias | |
5955 | + * region is mapped uncacheable. Make sure there are no conflicting | |
5956 | + * mappings with different cachability attributes for the same | |
5957 | + * page. This avoids data corruption on some CPUs. | |
5958 | */ | |
5959 | ||
5960 | -/* Caller's responsibility to call global_flush_tlb() for | |
5961 | - * performance reasons */ | |
5962 | +/* | |
5963 | + * Caller's responsibility to call global_flush_tlb() for performance | |
5964 | + * reasons | |
5965 | + */ | |
5966 | #define map_page_into_agp(page) ( \ | |
5967 | xen_create_contiguous_region((unsigned long)page_address(page), 0, 32) \ | |
5968 | ?: change_page_attr(page, 1, PAGE_KERNEL_NOCACHE)) | |
5969 | @@ -24,9 +26,11 @@ | |
5970 | change_page_attr(page, 1, PAGE_KERNEL)) | |
5971 | #define flush_agp_mappings() global_flush_tlb() | |
5972 | ||
5973 | -/* Could use CLFLUSH here if the cpu supports it. But then it would | |
5974 | - need to be called for each cacheline of the whole page so it may not be | |
5975 | - worth it. Would need a page for it. */ | |
5976 | +/* | |
5977 | + * Could use CLFLUSH here if the cpu supports it. But then it would | |
5978 | + * need to be called for each cacheline of the whole page so it may | |
5979 | + * not be worth it. Would need a page for it. | |
5980 | + */ | |
5981 | #define flush_agp_cache() wbinvd() | |
5982 | ||
5983 | /* Convert a physical address to an address suitable for the GART. */ | |
5984 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
5985 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/desc.h 2009-02-16 16:18:36.000000000 +0100 | |
5986 | @@ -0,0 +1,5 @@ | |
5987 | +#ifdef CONFIG_X86_32 | |
5988 | +# include "desc_32.h" | |
5989 | +#else | |
5990 | +# include "desc_64.h" | |
5991 | +#endif | |
5992 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/desc_64.h 2008-12-15 11:27:22.000000000 +0100 | |
5993 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/desc_64.h 2009-02-16 16:18:36.000000000 +0100 | |
5994 | @@ -34,6 +34,18 @@ static inline void clear_LDT(void) | |
5995 | put_cpu(); | |
5996 | } | |
5997 | ||
5998 | +#ifndef CONFIG_X86_NO_TSS | |
5999 | +static inline unsigned long __store_tr(void) | |
6000 | +{ | |
6001 | + unsigned long tr; | |
6002 | + | |
6003 | + asm volatile ("str %w0":"=r" (tr)); | |
6004 | + return tr; | |
6005 | +} | |
6006 | + | |
6007 | +#define store_tr(tr) (tr) = __store_tr() | |
6008 | +#endif | |
6009 | + | |
6010 | /* | |
6011 | * This is the ldt that every process will get unless we need | |
6012 | * something other than this. | |
6013 | @@ -47,6 +59,18 @@ extern struct desc_ptr cpu_gdt_descr[]; | |
6014 | /* the cpu gdt accessor */ | |
6015 | #define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address) | |
6016 | ||
6017 | +#ifndef CONFIG_XEN | |
6018 | +static inline void load_gdt(const struct desc_ptr *ptr) | |
6019 | +{ | |
6020 | + asm volatile("lgdt %w0"::"m" (*ptr)); | |
6021 | +} | |
6022 | + | |
6023 | +static inline void store_gdt(struct desc_ptr *ptr) | |
6024 | +{ | |
6025 | + asm("sgdt %w0":"=m" (*ptr)); | |
6026 | +} | |
6027 | +#endif | |
6028 | + | |
6029 | static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) | |
6030 | { | |
6031 | struct gate_struct s; | |
6032 | @@ -87,6 +111,16 @@ static inline void set_system_gate_ist(i | |
6033 | { | |
6034 | _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist); | |
6035 | } | |
6036 | + | |
6037 | +static inline void load_idt(const struct desc_ptr *ptr) | |
6038 | +{ | |
6039 | + asm volatile("lidt %w0"::"m" (*ptr)); | |
6040 | +} | |
6041 | + | |
6042 | +static inline void store_idt(struct desc_ptr *dtr) | |
6043 | +{ | |
6044 | + asm("sidt %w0":"=m" (*dtr)); | |
6045 | +} | |
6046 | #endif | |
6047 | ||
6048 | static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, | |
6049 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
6050 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/dma-mapping.h 2009-02-16 16:18:36.000000000 +0100 | |
6051 | @@ -0,0 +1,5 @@ | |
6052 | +#ifdef CONFIG_X86_32 | |
6053 | +# include "dma-mapping_32.h" | |
6054 | +#else | |
6055 | +# include "dma-mapping_64.h" | |
6056 | +#endif | |
6057 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/dma-mapping_32.h 2008-12-15 11:26:44.000000000 +0100 | |
6058 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/dma-mapping_32.h 2009-02-16 16:18:36.000000000 +0100 | |
6059 | @@ -7,9 +7,9 @@ | |
6060 | */ | |
6061 | ||
6062 | #include <linux/mm.h> | |
6063 | +#include <linux/scatterlist.h> | |
6064 | #include <asm/cache.h> | |
6065 | #include <asm/io.h> | |
6066 | -#include <asm/scatterlist.h> | |
6067 | #include <asm/swiotlb.h> | |
6068 | ||
6069 | static inline int | |
6070 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/dma-mapping_64.h 2008-12-15 11:27:22.000000000 +0100 | |
6071 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/dma-mapping_64.h 2009-02-16 16:18:36.000000000 +0100 | |
6072 | @@ -6,8 +6,7 @@ | |
6073 | * documentation. | |
6074 | */ | |
6075 | ||
6076 | - | |
6077 | -#include <asm/scatterlist.h> | |
6078 | +#include <linux/scatterlist.h> | |
6079 | #include <asm/io.h> | |
6080 | ||
6081 | struct dma_mapping_ops { | |
6082 | @@ -203,4 +202,4 @@ extern int panic_on_overflow; | |
6083 | ||
6084 | #endif /* _X8664_DMA_MAPPING_H */ | |
6085 | ||
6086 | -#include <asm-i386/mach-xen/asm/dma-mapping.h> | |
6087 | +#include "dma-mapping_32.h" | |
6088 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
6089 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/fixmap.h 2009-02-16 16:18:36.000000000 +0100 | |
6090 | @@ -0,0 +1,5 @@ | |
6091 | +#ifdef CONFIG_X86_32 | |
6092 | +# include "fixmap_32.h" | |
6093 | +#else | |
6094 | +# include "fixmap_64.h" | |
6095 | +#endif | |
6096 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
6097 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/hypercall.h 2009-02-16 16:18:36.000000000 +0100 | |
6098 | @@ -0,0 +1,404 @@ | |
6099 | +/****************************************************************************** | |
6100 | + * hypercall.h | |
6101 | + * | |
6102 | + * Linux-specific hypervisor handling. | |
6103 | + * | |
6104 | + * Copyright (c) 2002-2004, K A Fraser | |
6105 | + * | |
6106 | + * 64-bit updates: | |
6107 | + * Benjamin Liu <benjamin.liu@intel.com> | |
6108 | + * Jun Nakajima <jun.nakajima@intel.com> | |
6109 | + * | |
6110 | + * This program is free software; you can redistribute it and/or | |
6111 | + * modify it under the terms of the GNU General Public License version 2 | |
6112 | + * as published by the Free Software Foundation; or, when distributed | |
6113 | + * separately from the Linux kernel or incorporated into other | |
6114 | + * software packages, subject to the following license: | |
6115 | + * | |
6116 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | |
6117 | + * of this source file (the "Software"), to deal in the Software without | |
6118 | + * restriction, including without limitation the rights to use, copy, modify, | |
6119 | + * merge, publish, distribute, sublicense, and/or sell copies of the Software, | |
6120 | + * and to permit persons to whom the Software is furnished to do so, subject to | |
6121 | + * the following conditions: | |
6122 | + * | |
6123 | + * The above copyright notice and this permission notice shall be included in | |
6124 | + * all copies or substantial portions of the Software. | |
6125 | + * | |
6126 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
6127 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
6128 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
6129 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
6130 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
6131 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
6132 | + * IN THE SOFTWARE. | |
6133 | + */ | |
6134 | + | |
6135 | +#ifndef __HYPERCALL_H__ | |
6136 | +#define __HYPERCALL_H__ | |
6137 | + | |
6138 | +#ifndef __HYPERVISOR_H__ | |
6139 | +# error "please don't include this file directly" | |
6140 | +#endif | |
6141 | + | |
6142 | +#if CONFIG_XEN_COMPAT <= 0x030002 | |
6143 | +# include <linux/string.h> /* memcpy() */ | |
6144 | +#endif | |
6145 | + | |
6146 | +#ifdef CONFIG_XEN | |
6147 | +#define HYPERCALL_ASM_OPERAND "%c" | |
6148 | +#define HYPERCALL_LOCATION(op) (hypercall_page + (op) * 32) | |
6149 | +#define HYPERCALL_C_OPERAND(name) "i" (HYPERCALL_LOCATION(__HYPERVISOR_##name)) | |
6150 | +#else | |
6151 | +#define HYPERCALL_ASM_OPERAND "*%" | |
6152 | +#define HYPERCALL_LOCATION(op) (hypercall_stubs + (op) * 32) | |
6153 | +#define HYPERCALL_C_OPERAND(name) "g" (HYPERCALL_LOCATION(__HYPERVISOR_##name)) | |
6154 | +#endif | |
6155 | + | |
6156 | +#define HYPERCALL_ARG(arg, n) \ | |
6157 | + register typeof((arg)+0) __arg##n asm(HYPERCALL_arg##n) = (arg) | |
6158 | + | |
6159 | +#define _hypercall0(type, name) \ | |
6160 | +({ \ | |
6161 | + type __res; \ | |
6162 | + asm volatile ( \ | |
6163 | + "call " HYPERCALL_ASM_OPERAND "1" \ | |
6164 | + : "=a" (__res) \ | |
6165 | + : HYPERCALL_C_OPERAND(name) \ | |
6166 | + : "memory" ); \ | |
6167 | + __res; \ | |
6168 | +}) | |
6169 | + | |
6170 | +#define _hypercall1(type, name, arg) \ | |
6171 | +({ \ | |
6172 | + type __res; \ | |
6173 | + HYPERCALL_ARG(arg, 1); \ | |
6174 | + asm volatile ( \ | |
6175 | + "call " HYPERCALL_ASM_OPERAND "2" \ | |
6176 | + : "=a" (__res), "+r" (__arg1) \ | |
6177 | + : HYPERCALL_C_OPERAND(name) \ | |
6178 | + : "memory" ); \ | |
6179 | + __res; \ | |
6180 | +}) | |
6181 | + | |
6182 | +#define _hypercall2(type, name, a1, a2) \ | |
6183 | +({ \ | |
6184 | + type __res; \ | |
6185 | + HYPERCALL_ARG(a1, 1); \ | |
6186 | + HYPERCALL_ARG(a2, 2); \ | |
6187 | + asm volatile ( \ | |
6188 | + "call " HYPERCALL_ASM_OPERAND "3" \ | |
6189 | + : "=a" (__res), "+r" (__arg1), "+r" (__arg2) \ | |
6190 | + : HYPERCALL_C_OPERAND(name) \ | |
6191 | + : "memory" ); \ | |
6192 | + __res; \ | |
6193 | +}) | |
6194 | + | |
6195 | +#define _hypercall3(type, name, a1, a2, a3) \ | |
6196 | +({ \ | |
6197 | + type __res; \ | |
6198 | + HYPERCALL_ARG(a1, 1); \ | |
6199 | + HYPERCALL_ARG(a2, 2); \ | |
6200 | + HYPERCALL_ARG(a3, 3); \ | |
6201 | + asm volatile ( \ | |
6202 | + "call " HYPERCALL_ASM_OPERAND "4" \ | |
6203 | + : "=a" (__res), "+r" (__arg1), \ | |
6204 | + "+r" (__arg2), "+r" (__arg3) \ | |
6205 | + : HYPERCALL_C_OPERAND(name) \ | |
6206 | + : "memory" ); \ | |
6207 | + __res; \ | |
6208 | +}) | |
6209 | + | |
6210 | +#define _hypercall4(type, name, a1, a2, a3, a4) \ | |
6211 | +({ \ | |
6212 | + type __res; \ | |
6213 | + HYPERCALL_ARG(a1, 1); \ | |
6214 | + HYPERCALL_ARG(a2, 2); \ | |
6215 | + HYPERCALL_ARG(a3, 3); \ | |
6216 | + HYPERCALL_ARG(a4, 4); \ | |
6217 | + asm volatile ( \ | |
6218 | + "call " HYPERCALL_ASM_OPERAND "5" \ | |
6219 | + : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ | |
6220 | + "+r" (__arg3), "+r" (__arg4) \ | |
6221 | + : HYPERCALL_C_OPERAND(name) \ | |
6222 | + : "memory" ); \ | |
6223 | + __res; \ | |
6224 | +}) | |
6225 | + | |
6226 | +#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ | |
6227 | +({ \ | |
6228 | + type __res; \ | |
6229 | + HYPERCALL_ARG(a1, 1); \ | |
6230 | + HYPERCALL_ARG(a2, 2); \ | |
6231 | + HYPERCALL_ARG(a3, 3); \ | |
6232 | + HYPERCALL_ARG(a4, 4); \ | |
6233 | + HYPERCALL_ARG(a5, 5); \ | |
6234 | + asm volatile ( \ | |
6235 | + "call " HYPERCALL_ASM_OPERAND "6" \ | |
6236 | + : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ | |
6237 | + "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ | |
6238 | + : HYPERCALL_C_OPERAND(name) \ | |
6239 | + : "memory" ); \ | |
6240 | + __res; \ | |
6241 | +}) | |
6242 | + | |
6243 | +#define _hypercall(type, op, a1, a2, a3, a4, a5) \ | |
6244 | +({ \ | |
6245 | + type __res; \ | |
6246 | + HYPERCALL_ARG(a1, 1); \ | |
6247 | + HYPERCALL_ARG(a2, 2); \ | |
6248 | + HYPERCALL_ARG(a3, 3); \ | |
6249 | + HYPERCALL_ARG(a4, 4); \ | |
6250 | + HYPERCALL_ARG(a5, 5); \ | |
6251 | + asm volatile ( \ | |
6252 | + "call *%6" \ | |
6253 | + : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ | |
6254 | + "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ | |
6255 | + : "g" (HYPERCALL_LOCATION(op)) \ | |
6256 | + : "memory" ); \ | |
6257 | + __res; \ | |
6258 | +}) | |
6259 | + | |
6260 | +#ifdef CONFIG_X86_32 | |
6261 | +# include "hypercall_32.h" | |
6262 | +#else | |
6263 | +# include "hypercall_64.h" | |
6264 | +#endif | |
6265 | + | |
6266 | +static inline int __must_check | |
6267 | +HYPERVISOR_set_trap_table( | |
6268 | + const trap_info_t *table) | |
6269 | +{ | |
6270 | + return _hypercall1(int, set_trap_table, table); | |
6271 | +} | |
6272 | + | |
6273 | +static inline int __must_check | |
6274 | +HYPERVISOR_mmu_update( | |
6275 | + mmu_update_t *req, unsigned int count, unsigned int *success_count, | |
6276 | + domid_t domid) | |
6277 | +{ | |
6278 | + if (arch_use_lazy_mmu_mode()) | |
6279 | + return xen_multi_mmu_update(req, count, success_count, domid); | |
6280 | + return _hypercall4(int, mmu_update, req, count, success_count, domid); | |
6281 | +} | |
6282 | + | |
6283 | +static inline int __must_check | |
6284 | +HYPERVISOR_mmuext_op( | |
6285 | + struct mmuext_op *op, unsigned int count, unsigned int *success_count, | |
6286 | + domid_t domid) | |
6287 | +{ | |
6288 | + if (arch_use_lazy_mmu_mode()) | |
6289 | + return xen_multi_mmuext_op(op, count, success_count, domid); | |
6290 | + return _hypercall4(int, mmuext_op, op, count, success_count, domid); | |
6291 | +} | |
6292 | + | |
6293 | +static inline int __must_check | |
6294 | +HYPERVISOR_set_gdt( | |
6295 | + unsigned long *frame_list, unsigned int entries) | |
6296 | +{ | |
6297 | + return _hypercall2(int, set_gdt, frame_list, entries); | |
6298 | +} | |
6299 | + | |
6300 | +static inline int __must_check | |
6301 | +HYPERVISOR_stack_switch( | |
6302 | + unsigned long ss, unsigned long esp) | |
6303 | +{ | |
6304 | + return _hypercall2(int, stack_switch, ss, esp); | |
6305 | +} | |
6306 | + | |
6307 | +static inline int | |
6308 | +HYPERVISOR_fpu_taskswitch( | |
6309 | + int set) | |
6310 | +{ | |
6311 | + return _hypercall1(int, fpu_taskswitch, set); | |
6312 | +} | |
6313 | + | |
6314 | +#if CONFIG_XEN_COMPAT <= 0x030002 | |
6315 | +static inline int __must_check | |
6316 | +HYPERVISOR_sched_op_compat( | |
6317 | + int cmd, unsigned long arg) | |
6318 | +{ | |
6319 | + return _hypercall2(int, sched_op_compat, cmd, arg); | |
6320 | +} | |
6321 | +#endif | |
6322 | + | |
6323 | +static inline int __must_check | |
6324 | +HYPERVISOR_sched_op( | |
6325 | + int cmd, void *arg) | |
6326 | +{ | |
6327 | + return _hypercall2(int, sched_op, cmd, arg); | |
6328 | +} | |
6329 | + | |
6330 | +static inline int __must_check | |
6331 | +HYPERVISOR_platform_op( | |
6332 | + struct xen_platform_op *platform_op) | |
6333 | +{ | |
6334 | + platform_op->interface_version = XENPF_INTERFACE_VERSION; | |
6335 | + return _hypercall1(int, platform_op, platform_op); | |
6336 | +} | |
6337 | + | |
6338 | +static inline int __must_check | |
6339 | +HYPERVISOR_set_debugreg( | |
6340 | + unsigned int reg, unsigned long value) | |
6341 | +{ | |
6342 | + return _hypercall2(int, set_debugreg, reg, value); | |
6343 | +} | |
6344 | + | |
6345 | +static inline unsigned long __must_check | |
6346 | +HYPERVISOR_get_debugreg( | |
6347 | + unsigned int reg) | |
6348 | +{ | |
6349 | + return _hypercall1(unsigned long, get_debugreg, reg); | |
6350 | +} | |
6351 | + | |
6352 | +static inline int __must_check | |
6353 | +HYPERVISOR_memory_op( | |
6354 | + unsigned int cmd, void *arg) | |
6355 | +{ | |
6356 | + if (arch_use_lazy_mmu_mode()) | |
6357 | + xen_multicall_flush(false); | |
6358 | + return _hypercall2(int, memory_op, cmd, arg); | |
6359 | +} | |
6360 | + | |
6361 | +static inline int __must_check | |
6362 | +HYPERVISOR_multicall( | |
6363 | + multicall_entry_t *call_list, unsigned int nr_calls) | |
6364 | +{ | |
6365 | + return _hypercall2(int, multicall, call_list, nr_calls); | |
6366 | +} | |
6367 | + | |
6368 | +static inline int __must_check | |
6369 | +HYPERVISOR_event_channel_op( | |
6370 | + int cmd, void *arg) | |
6371 | +{ | |
6372 | + int rc = _hypercall2(int, event_channel_op, cmd, arg); | |
6373 | + | |
6374 | +#if CONFIG_XEN_COMPAT <= 0x030002 | |
6375 | + if (unlikely(rc == -ENOSYS)) { | |
6376 | + struct evtchn_op op; | |
6377 | + op.cmd = cmd; | |
6378 | + memcpy(&op.u, arg, sizeof(op.u)); | |
6379 | + rc = _hypercall1(int, event_channel_op_compat, &op); | |
6380 | + memcpy(arg, &op.u, sizeof(op.u)); | |
6381 | + } | |
6382 | +#endif | |
6383 | + | |
6384 | + return rc; | |
6385 | +} | |
6386 | + | |
6387 | +static inline int __must_check | |
6388 | +HYPERVISOR_xen_version( | |
6389 | + int cmd, void *arg) | |
6390 | +{ | |
6391 | + return _hypercall2(int, xen_version, cmd, arg); | |
6392 | +} | |
6393 | + | |
6394 | +static inline int __must_check | |
6395 | +HYPERVISOR_console_io( | |
6396 | + int cmd, unsigned int count, char *str) | |
6397 | +{ | |
6398 | + return _hypercall3(int, console_io, cmd, count, str); | |
6399 | +} | |
6400 | + | |
6401 | +static inline int __must_check | |
6402 | +HYPERVISOR_physdev_op( | |
6403 | + int cmd, void *arg) | |
6404 | +{ | |
6405 | + int rc = _hypercall2(int, physdev_op, cmd, arg); | |
6406 | + | |
6407 | +#if CONFIG_XEN_COMPAT <= 0x030002 | |
6408 | + if (unlikely(rc == -ENOSYS)) { | |
6409 | + struct physdev_op op; | |
6410 | + op.cmd = cmd; | |
6411 | + memcpy(&op.u, arg, sizeof(op.u)); | |
6412 | + rc = _hypercall1(int, physdev_op_compat, &op); | |
6413 | + memcpy(arg, &op.u, sizeof(op.u)); | |
6414 | + } | |
6415 | +#endif | |
6416 | + | |
6417 | + return rc; | |
6418 | +} | |
6419 | + | |
6420 | +static inline int __must_check | |
6421 | +HYPERVISOR_grant_table_op( | |
6422 | + unsigned int cmd, void *uop, unsigned int count) | |
6423 | +{ | |
6424 | + if (arch_use_lazy_mmu_mode()) | |
6425 | + xen_multicall_flush(false); | |
6426 | + return _hypercall3(int, grant_table_op, cmd, uop, count); | |
6427 | +} | |
6428 | + | |
6429 | +static inline int __must_check | |
6430 | +HYPERVISOR_vm_assist( | |
6431 | + unsigned int cmd, unsigned int type) | |
6432 | +{ | |
6433 | + return _hypercall2(int, vm_assist, cmd, type); | |
6434 | +} | |
6435 | + | |
6436 | +static inline int __must_check | |
6437 | +HYPERVISOR_vcpu_op( | |
6438 | + int cmd, unsigned int vcpuid, void *extra_args) | |
6439 | +{ | |
6440 | + return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); | |
6441 | +} | |
6442 | + | |
6443 | +static inline int __must_check | |
6444 | +HYPERVISOR_suspend( | |
6445 | + unsigned long srec) | |
6446 | +{ | |
6447 | + struct sched_shutdown sched_shutdown = { | |
6448 | + .reason = SHUTDOWN_suspend | |
6449 | + }; | |
6450 | + | |
6451 | + int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, | |
6452 | + &sched_shutdown, srec); | |
6453 | + | |
6454 | +#if CONFIG_XEN_COMPAT <= 0x030002 | |
6455 | + if (rc == -ENOSYS) | |
6456 | + rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, | |
6457 | + SHUTDOWN_suspend, srec); | |
6458 | +#endif | |
6459 | + | |
6460 | + return rc; | |
6461 | +} | |
6462 | + | |
6463 | +#if CONFIG_XEN_COMPAT <= 0x030002 | |
6464 | +static inline int | |
6465 | +HYPERVISOR_nmi_op( | |
6466 | + unsigned long op, void *arg) | |
6467 | +{ | |
6468 | + return _hypercall2(int, nmi_op, op, arg); | |
6469 | +} | |
6470 | +#endif | |
6471 | + | |
6472 | +#ifndef CONFIG_XEN | |
6473 | +static inline unsigned long __must_check | |
6474 | +HYPERVISOR_hvm_op( | |
6475 | + int op, void *arg) | |
6476 | +{ | |
6477 | + return _hypercall2(unsigned long, hvm_op, op, arg); | |
6478 | +} | |
6479 | +#endif | |
6480 | + | |
6481 | +static inline int __must_check | |
6482 | +HYPERVISOR_callback_op( | |
6483 | + int cmd, const void *arg) | |
6484 | +{ | |
6485 | + return _hypercall2(int, callback_op, cmd, arg); | |
6486 | +} | |
6487 | + | |
6488 | +static inline int __must_check | |
6489 | +HYPERVISOR_xenoprof_op( | |
6490 | + int op, void *arg) | |
6491 | +{ | |
6492 | + return _hypercall2(int, xenoprof_op, op, arg); | |
6493 | +} | |
6494 | + | |
6495 | +static inline int __must_check | |
6496 | +HYPERVISOR_kexec_op( | |
6497 | + unsigned long op, void *args) | |
6498 | +{ | |
6499 | + return _hypercall2(int, kexec_op, op, args); | |
6500 | +} | |
6501 | + | |
6502 | +#endif /* __HYPERCALL_H__ */ | |
6503 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/hypercall_32.h 2009-03-04 11:28:34.000000000 +0100 | |
6504 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/hypercall_32.h 2009-02-16 16:18:36.000000000 +0100 | |
6505 | @@ -1,191 +1,10 @@ | |
6506 | -/****************************************************************************** | |
6507 | - * hypercall.h | |
6508 | - * | |
6509 | - * Linux-specific hypervisor handling. | |
6510 | - * | |
6511 | - * Copyright (c) 2002-2004, K A Fraser | |
6512 | - * | |
6513 | - * This program is free software; you can redistribute it and/or | |
6514 | - * modify it under the terms of the GNU General Public License version 2 | |
6515 | - * as published by the Free Software Foundation; or, when distributed | |
6516 | - * separately from the Linux kernel or incorporated into other | |
6517 | - * software packages, subject to the following license: | |
6518 | - * | |
6519 | - * Permission is hereby granted, free of charge, to any person obtaining a copy | |
6520 | - * of this source file (the "Software"), to deal in the Software without | |
6521 | - * restriction, including without limitation the rights to use, copy, modify, | |
6522 | - * merge, publish, distribute, sublicense, and/or sell copies of the Software, | |
6523 | - * and to permit persons to whom the Software is furnished to do so, subject to | |
6524 | - * the following conditions: | |
6525 | - * | |
6526 | - * The above copyright notice and this permission notice shall be included in | |
6527 | - * all copies or substantial portions of the Software. | |
6528 | - * | |
6529 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
6530 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
6531 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
6532 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
6533 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
6534 | - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
6535 | - * IN THE SOFTWARE. | |
6536 | - */ | |
6537 | - | |
6538 | -#ifndef __HYPERCALL_H__ | |
6539 | -#define __HYPERCALL_H__ | |
6540 | - | |
6541 | -#include <linux/string.h> /* memcpy() */ | |
6542 | -#include <linux/stringify.h> | |
6543 | - | |
6544 | -#ifndef __HYPERVISOR_H__ | |
6545 | -# error "please don't include this file directly" | |
6546 | -#endif | |
6547 | - | |
6548 | -#ifdef CONFIG_XEN | |
6549 | -#define HYPERCALL_STR(name) \ | |
6550 | - "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)" | |
6551 | -#else | |
6552 | -#define HYPERCALL_STR(name) \ | |
6553 | - "mov hypercall_stubs,%%eax; " \ | |
6554 | - "add $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\ | |
6555 | - "call *%%eax" | |
6556 | -#endif | |
6557 | - | |
6558 | -#define _hypercall0(type, name) \ | |
6559 | -({ \ | |
6560 | - type __res; \ | |
6561 | - asm volatile ( \ | |
6562 | - HYPERCALL_STR(name) \ | |
6563 | - : "=a" (__res) \ | |
6564 | - : \ | |
6565 | - : "memory" ); \ | |
6566 | - __res; \ | |
6567 | -}) | |
6568 | - | |
6569 | -#define _hypercall1(type, name, a1) \ | |
6570 | -({ \ | |
6571 | - type __res; \ | |
6572 | - long __ign1; \ | |
6573 | - asm volatile ( \ | |
6574 | - HYPERCALL_STR(name) \ | |
6575 | - : "=a" (__res), "=b" (__ign1) \ | |
6576 | - : "1" ((long)(a1)) \ | |
6577 | - : "memory" ); \ | |
6578 | - __res; \ | |
6579 | -}) | |
6580 | - | |
6581 | -#define _hypercall2(type, name, a1, a2) \ | |
6582 | -({ \ | |
6583 | - type __res; \ | |
6584 | - long __ign1, __ign2; \ | |
6585 | - asm volatile ( \ | |
6586 | - HYPERCALL_STR(name) \ | |
6587 | - : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \ | |
6588 | - : "1" ((long)(a1)), "2" ((long)(a2)) \ | |
6589 | - : "memory" ); \ | |
6590 | - __res; \ | |
6591 | -}) | |
6592 | - | |
6593 | -#define _hypercall3(type, name, a1, a2, a3) \ | |
6594 | -({ \ | |
6595 | - type __res; \ | |
6596 | - long __ign1, __ign2, __ign3; \ | |
6597 | - asm volatile ( \ | |
6598 | - HYPERCALL_STR(name) \ | |
6599 | - : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ | |
6600 | - "=d" (__ign3) \ | |
6601 | - : "1" ((long)(a1)), "2" ((long)(a2)), \ | |
6602 | - "3" ((long)(a3)) \ | |
6603 | - : "memory" ); \ | |
6604 | - __res; \ | |
6605 | -}) | |
6606 | - | |
6607 | -#define _hypercall4(type, name, a1, a2, a3, a4) \ | |
6608 | -({ \ | |
6609 | - type __res; \ | |
6610 | - long __ign1, __ign2, __ign3, __ign4; \ | |
6611 | - asm volatile ( \ | |
6612 | - HYPERCALL_STR(name) \ | |
6613 | - : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ | |
6614 | - "=d" (__ign3), "=S" (__ign4) \ | |
6615 | - : "1" ((long)(a1)), "2" ((long)(a2)), \ | |
6616 | - "3" ((long)(a3)), "4" ((long)(a4)) \ | |
6617 | - : "memory" ); \ | |
6618 | - __res; \ | |
6619 | -}) | |
6620 | - | |
6621 | -#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ | |
6622 | -({ \ | |
6623 | - type __res; \ | |
6624 | - long __ign1, __ign2, __ign3, __ign4, __ign5; \ | |
6625 | - asm volatile ( \ | |
6626 | - HYPERCALL_STR(name) \ | |
6627 | - : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ | |
6628 | - "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \ | |
6629 | - : "1" ((long)(a1)), "2" ((long)(a2)), \ | |
6630 | - "3" ((long)(a3)), "4" ((long)(a4)), \ | |
6631 | - "5" ((long)(a5)) \ | |
6632 | - : "memory" ); \ | |
6633 | - __res; \ | |
6634 | -}) | |
6635 | - | |
6636 | -#define _hypercall(type, op, a1, a2, a3, a4, a5) \ | |
6637 | -({ \ | |
6638 | - type __res; \ | |
6639 | - register typeof((a1)+0) __arg1 asm("ebx") = (a1); \ | |
6640 | - register typeof((a2)+0) __arg2 asm("ecx") = (a2); \ | |
6641 | - register typeof((a3)+0) __arg3 asm("edx") = (a3); \ | |
6642 | - register typeof((a4)+0) __arg4 asm("esi") = (a4); \ | |
6643 | - register typeof((a5)+0) __arg5 asm("edi") = (a5); \ | |
6644 | - asm volatile ( \ | |
6645 | - "call *%6" \ | |
6646 | - : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ | |
6647 | - "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ | |
6648 | - : "0" (hypercall_page + (op) * 32) \ | |
6649 | - : "memory" ); \ | |
6650 | - __res; \ | |
6651 | -}) | |
6652 | - | |
6653 | -static inline int __must_check | |
6654 | -HYPERVISOR_set_trap_table( | |
6655 | - const trap_info_t *table) | |
6656 | -{ | |
6657 | - return _hypercall1(int, set_trap_table, table); | |
6658 | -} | |
6659 | - | |
6660 | -static inline int __must_check | |
6661 | -HYPERVISOR_mmu_update( | |
6662 | - mmu_update_t *req, unsigned int count, unsigned int *success_count, | |
6663 | - domid_t domid) | |
6664 | -{ | |
6665 | - if (arch_use_lazy_mmu_mode()) | |
6666 | - return xen_multi_mmu_update(req, count, success_count, domid); | |
6667 | - return _hypercall4(int, mmu_update, req, count, success_count, domid); | |
6668 | -} | |
6669 | - | |
6670 | -static inline int __must_check | |
6671 | -HYPERVISOR_mmuext_op( | |
6672 | - struct mmuext_op *op, unsigned int count, unsigned int *success_count, | |
6673 | - domid_t domid) | |
6674 | -{ | |
6675 | - if (arch_use_lazy_mmu_mode()) | |
6676 | - return xen_multi_mmuext_op(op, count, success_count, domid); | |
6677 | - return _hypercall4(int, mmuext_op, op, count, success_count, domid); | |
6678 | -} | |
6679 | - | |
6680 | -static inline int __must_check | |
6681 | -HYPERVISOR_set_gdt( | |
6682 | - unsigned long *frame_list, unsigned int entries) | |
6683 | -{ | |
6684 | - return _hypercall2(int, set_gdt, frame_list, entries); | |
6685 | -} | |
6686 | - | |
6687 | -static inline int __must_check | |
6688 | -HYPERVISOR_stack_switch( | |
6689 | - unsigned long ss, unsigned long esp) | |
6690 | -{ | |
6691 | - return _hypercall2(int, stack_switch, ss, esp); | |
6692 | -} | |
6693 | +#define HYPERCALL_arg1 "ebx" | |
6694 | +#define HYPERCALL_arg2 "ecx" | |
6695 | +#define HYPERCALL_arg3 "edx" | |
6696 | +#define HYPERCALL_arg4 "esi" | |
6697 | +#define HYPERCALL_arg5 "edi" | |
6698 | ||
6699 | +#if CONFIG_XEN_COMPAT <= 0x030002 | |
6700 | static inline int __must_check | |
6701 | HYPERVISOR_set_callbacks( | |
6702 | unsigned long event_selector, unsigned long event_address, | |
6703 | @@ -195,80 +14,24 @@ HYPERVISOR_set_callbacks( | |
6704 | event_selector, event_address, | |
6705 | failsafe_selector, failsafe_address); | |
6706 | } | |
6707 | - | |
6708 | -static inline int | |
6709 | -HYPERVISOR_fpu_taskswitch( | |
6710 | - int set) | |
6711 | -{ | |
6712 | - return _hypercall1(int, fpu_taskswitch, set); | |
6713 | -} | |
6714 | - | |
6715 | -static inline int __must_check | |
6716 | -HYPERVISOR_sched_op_compat( | |
6717 | - int cmd, unsigned long arg) | |
6718 | -{ | |
6719 | - return _hypercall2(int, sched_op_compat, cmd, arg); | |
6720 | -} | |
6721 | - | |
6722 | -static inline int __must_check | |
6723 | -HYPERVISOR_sched_op( | |
6724 | - int cmd, void *arg) | |
6725 | -{ | |
6726 | - return _hypercall2(int, sched_op, cmd, arg); | |
6727 | -} | |
6728 | +#endif | |
6729 | ||
6730 | static inline long __must_check | |
6731 | HYPERVISOR_set_timer_op( | |
6732 | u64 timeout) | |
6733 | { | |
6734 | - unsigned long timeout_hi = (unsigned long)(timeout>>32); | |
6735 | - unsigned long timeout_lo = (unsigned long)timeout; | |
6736 | - return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi); | |
6737 | -} | |
6738 | - | |
6739 | -static inline int __must_check | |
6740 | -HYPERVISOR_platform_op( | |
6741 | - struct xen_platform_op *platform_op) | |
6742 | -{ | |
6743 | - platform_op->interface_version = XENPF_INTERFACE_VERSION; | |
6744 | - return _hypercall1(int, platform_op, platform_op); | |
6745 | -} | |
6746 | - | |
6747 | -static inline int __must_check | |
6748 | -HYPERVISOR_set_debugreg( | |
6749 | - unsigned int reg, unsigned long value) | |
6750 | -{ | |
6751 | - return _hypercall2(int, set_debugreg, reg, value); | |
6752 | -} | |
6753 | - | |
6754 | -static inline unsigned long __must_check | |
6755 | -HYPERVISOR_get_debugreg( | |
6756 | - unsigned int reg) | |
6757 | -{ | |
6758 | - return _hypercall1(unsigned long, get_debugreg, reg); | |
6759 | + return _hypercall2(long, set_timer_op, | |
6760 | + (unsigned long)timeout, | |
6761 | + (unsigned long)(timeout>>32)); | |
6762 | } | |
6763 | ||
6764 | static inline int __must_check | |
6765 | HYPERVISOR_update_descriptor( | |
6766 | u64 ma, u64 desc) | |
6767 | { | |
6768 | - return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32); | |
6769 | -} | |
6770 | - | |
6771 | -static inline int __must_check | |
6772 | -HYPERVISOR_memory_op( | |
6773 | - unsigned int cmd, void *arg) | |
6774 | -{ | |
6775 | - if (arch_use_lazy_mmu_mode()) | |
6776 | - xen_multicall_flush(false); | |
6777 | - return _hypercall2(int, memory_op, cmd, arg); | |
6778 | -} | |
6779 | - | |
6780 | -static inline int __must_check | |
6781 | -HYPERVISOR_multicall( | |
6782 | - multicall_entry_t *call_list, unsigned int nr_calls) | |
6783 | -{ | |
6784 | - return _hypercall2(int, multicall, call_list, nr_calls); | |
6785 | + return _hypercall4(int, update_descriptor, | |
6786 | + (unsigned long)ma, (unsigned long)(ma>>32), | |
6787 | + (unsigned long)desc, (unsigned long)(desc>>32)); | |
6788 | } | |
6789 | ||
6790 | static inline int __must_check | |
6791 | @@ -287,67 +50,6 @@ HYPERVISOR_update_va_mapping( | |
6792 | } | |
6793 | ||
6794 | static inline int __must_check | |
6795 | -HYPERVISOR_event_channel_op( | |
6796 | - int cmd, void *arg) | |
6797 | -{ | |
6798 | - int rc = _hypercall2(int, event_channel_op, cmd, arg); | |
6799 | - | |
6800 | -#if CONFIG_XEN_COMPAT <= 0x030002 | |
6801 | - if (unlikely(rc == -ENOSYS)) { | |
6802 | - struct evtchn_op op; | |
6803 | - op.cmd = cmd; | |
6804 | - memcpy(&op.u, arg, sizeof(op.u)); | |
6805 | - rc = _hypercall1(int, event_channel_op_compat, &op); | |
6806 | - memcpy(arg, &op.u, sizeof(op.u)); | |
6807 | - } | |
6808 | -#endif | |
6809 | - | |
6810 | - return rc; | |
6811 | -} | |
6812 | - | |
6813 | -static inline int __must_check | |
6814 | -HYPERVISOR_xen_version( | |
6815 | - int cmd, void *arg) | |
6816 | -{ | |
6817 | - return _hypercall2(int, xen_version, cmd, arg); | |
6818 | -} | |
6819 | - | |
6820 | -static inline int __must_check | |
6821 | -HYPERVISOR_console_io( | |
6822 | - int cmd, unsigned int count, char *str) | |
6823 | -{ | |
6824 | - return _hypercall3(int, console_io, cmd, count, str); | |
6825 | -} | |
6826 | - | |
6827 | -static inline int __must_check | |
6828 | -HYPERVISOR_physdev_op( | |
6829 | - int cmd, void *arg) | |
6830 | -{ | |
6831 | - int rc = _hypercall2(int, physdev_op, cmd, arg); | |
6832 | - | |
6833 | -#if CONFIG_XEN_COMPAT <= 0x030002 | |
6834 | - if (unlikely(rc == -ENOSYS)) { | |
6835 | - struct physdev_op op; | |
6836 | - op.cmd = cmd; | |
6837 | - memcpy(&op.u, arg, sizeof(op.u)); | |
6838 | - rc = _hypercall1(int, physdev_op_compat, &op); | |
6839 | - memcpy(arg, &op.u, sizeof(op.u)); | |
6840 | - } | |
6841 | -#endif | |
6842 | - | |
6843 | - return rc; | |
6844 | -} | |
6845 | - | |
6846 | -static inline int __must_check | |
6847 | -HYPERVISOR_grant_table_op( | |
6848 | - unsigned int cmd, void *uop, unsigned int count) | |
6849 | -{ | |
6850 | - if (arch_use_lazy_mmu_mode()) | |
6851 | - xen_multicall_flush(false); | |
6852 | - return _hypercall3(int, grant_table_op, cmd, uop, count); | |
6853 | -} | |
6854 | - | |
6855 | -static inline int __must_check | |
6856 | HYPERVISOR_update_va_mapping_otherdomain( | |
6857 | unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) | |
6858 | { | |
6859 | @@ -358,80 +60,3 @@ HYPERVISOR_update_va_mapping_otherdomain | |
6860 | return _hypercall5(int, update_va_mapping_otherdomain, va, | |
6861 | new_val.pte_low, pte_hi, flags, domid); | |
6862 | } | |
6863 | - | |
6864 | -static inline int __must_check | |
6865 | -HYPERVISOR_vm_assist( | |
6866 | - unsigned int cmd, unsigned int type) | |
6867 | -{ | |
6868 | - return _hypercall2(int, vm_assist, cmd, type); | |
6869 | -} | |
6870 | - | |
6871 | -static inline int __must_check | |
6872 | -HYPERVISOR_vcpu_op( | |
6873 | - int cmd, unsigned int vcpuid, void *extra_args) | |
6874 | -{ | |
6875 | - return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); | |
6876 | -} | |
6877 | - | |
6878 | -static inline int __must_check | |
6879 | -HYPERVISOR_suspend( | |
6880 | - unsigned long srec) | |
6881 | -{ | |
6882 | - struct sched_shutdown sched_shutdown = { | |
6883 | - .reason = SHUTDOWN_suspend | |
6884 | - }; | |
6885 | - | |
6886 | - int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, | |
6887 | - &sched_shutdown, srec); | |
6888 | - | |
6889 | -#if CONFIG_XEN_COMPAT <= 0x030002 | |
6890 | - if (rc == -ENOSYS) | |
6891 | - rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, | |
6892 | - SHUTDOWN_suspend, srec); | |
6893 | -#endif | |
6894 | - | |
6895 | - return rc; | |
6896 | -} | |
6897 | - | |
6898 | -#if CONFIG_XEN_COMPAT <= 0x030002 | |
6899 | -static inline int | |
6900 | -HYPERVISOR_nmi_op( | |
6901 | - unsigned long op, void *arg) | |
6902 | -{ | |
6903 | - return _hypercall2(int, nmi_op, op, arg); | |
6904 | -} | |
6905 | -#endif | |
6906 | - | |
6907 | -#ifndef CONFIG_XEN | |
6908 | -static inline unsigned long __must_check | |
6909 | -HYPERVISOR_hvm_op( | |
6910 | - int op, void *arg) | |
6911 | -{ | |
6912 | - return _hypercall2(unsigned long, hvm_op, op, arg); | |
6913 | -} | |
6914 | -#endif | |
6915 | - | |
6916 | -static inline int __must_check | |
6917 | -HYPERVISOR_callback_op( | |
6918 | - int cmd, const void *arg) | |
6919 | -{ | |
6920 | - return _hypercall2(int, callback_op, cmd, arg); | |
6921 | -} | |
6922 | - | |
6923 | -static inline int __must_check | |
6924 | -HYPERVISOR_xenoprof_op( | |
6925 | - int op, void *arg) | |
6926 | -{ | |
6927 | - return _hypercall2(int, xenoprof_op, op, arg); | |
6928 | -} | |
6929 | - | |
6930 | -static inline int __must_check | |
6931 | -HYPERVISOR_kexec_op( | |
6932 | - unsigned long op, void *args) | |
6933 | -{ | |
6934 | - return _hypercall2(int, kexec_op, op, args); | |
6935 | -} | |
6936 | - | |
6937 | - | |
6938 | - | |
6939 | -#endif /* __HYPERCALL_H__ */ | |
6940 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/hypercall_64.h 2009-03-04 11:28:34.000000000 +0100 | |
6941 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/hypercall_64.h 2009-02-16 16:18:36.000000000 +0100 | |
6942 | @@ -1,197 +1,10 @@ | |
6943 | -/****************************************************************************** | |
6944 | - * hypercall.h | |
6945 | - * | |
6946 | - * Linux-specific hypervisor handling. | |
6947 | - * | |
6948 | - * Copyright (c) 2002-2004, K A Fraser | |
6949 | - * | |
6950 | - * 64-bit updates: | |
6951 | - * Benjamin Liu <benjamin.liu@intel.com> | |
6952 | - * Jun Nakajima <jun.nakajima@intel.com> | |
6953 | - * | |
6954 | - * This program is free software; you can redistribute it and/or | |
6955 | - * modify it under the terms of the GNU General Public License version 2 | |
6956 | - * as published by the Free Software Foundation; or, when distributed | |
6957 | - * separately from the Linux kernel or incorporated into other | |
6958 | - * software packages, subject to the following license: | |
6959 | - * | |
6960 | - * Permission is hereby granted, free of charge, to any person obtaining a copy | |
6961 | - * of this source file (the "Software"), to deal in the Software without | |
6962 | - * restriction, including without limitation the rights to use, copy, modify, | |
6963 | - * merge, publish, distribute, sublicense, and/or sell copies of the Software, | |
6964 | - * and to permit persons to whom the Software is furnished to do so, subject to | |
6965 | - * the following conditions: | |
6966 | - * | |
6967 | - * The above copyright notice and this permission notice shall be included in | |
6968 | - * all copies or substantial portions of the Software. | |
6969 | - * | |
6970 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
6971 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
6972 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
6973 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
6974 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
6975 | - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
6976 | - * IN THE SOFTWARE. | |
6977 | - */ | |
6978 | - | |
6979 | -#ifndef __HYPERCALL_H__ | |
6980 | -#define __HYPERCALL_H__ | |
6981 | - | |
6982 | -#include <linux/string.h> /* memcpy() */ | |
6983 | -#include <linux/stringify.h> | |
6984 | - | |
6985 | -#ifndef __HYPERVISOR_H__ | |
6986 | -# error "please don't include this file directly" | |
6987 | -#endif | |
6988 | - | |
6989 | -#ifdef CONFIG_XEN | |
6990 | -#define HYPERCALL_STR(name) \ | |
6991 | - "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)" | |
6992 | -#else | |
6993 | -#define HYPERCALL_STR(name) \ | |
6994 | - "mov $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\ | |
6995 | - "add hypercall_stubs(%%rip),%%rax; " \ | |
6996 | - "call *%%rax" | |
6997 | -#endif | |
6998 | - | |
6999 | -#define _hypercall0(type, name) \ | |
7000 | -({ \ | |
7001 | - type __res; \ | |
7002 | - asm volatile ( \ | |
7003 | - HYPERCALL_STR(name) \ | |
7004 | - : "=a" (__res) \ | |
7005 | - : \ | |
7006 | - : "memory" ); \ | |
7007 | - __res; \ | |
7008 | -}) | |
7009 | - | |
7010 | -#define _hypercall1(type, name, a1) \ | |
7011 | -({ \ | |
7012 | - type __res; \ | |
7013 | - long __ign1; \ | |
7014 | - asm volatile ( \ | |
7015 | - HYPERCALL_STR(name) \ | |
7016 | - : "=a" (__res), "=D" (__ign1) \ | |
7017 | - : "1" ((long)(a1)) \ | |
7018 | - : "memory" ); \ | |
7019 | - __res; \ | |
7020 | -}) | |
7021 | - | |
7022 | -#define _hypercall2(type, name, a1, a2) \ | |
7023 | -({ \ | |
7024 | - type __res; \ | |
7025 | - long __ign1, __ign2; \ | |
7026 | - asm volatile ( \ | |
7027 | - HYPERCALL_STR(name) \ | |
7028 | - : "=a" (__res), "=D" (__ign1), "=S" (__ign2) \ | |
7029 | - : "1" ((long)(a1)), "2" ((long)(a2)) \ | |
7030 | - : "memory" ); \ | |
7031 | - __res; \ | |
7032 | -}) | |
7033 | - | |
7034 | -#define _hypercall3(type, name, a1, a2, a3) \ | |
7035 | -({ \ | |
7036 | - type __res; \ | |
7037 | - long __ign1, __ign2, __ign3; \ | |
7038 | - asm volatile ( \ | |
7039 | - HYPERCALL_STR(name) \ | |
7040 | - : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ | |
7041 | - "=d" (__ign3) \ | |
7042 | - : "1" ((long)(a1)), "2" ((long)(a2)), \ | |
7043 | - "3" ((long)(a3)) \ | |
7044 | - : "memory" ); \ | |
7045 | - __res; \ | |
7046 | -}) | |
7047 | - | |
7048 | -#define _hypercall4(type, name, a1, a2, a3, a4) \ | |
7049 | -({ \ | |
7050 | - type __res; \ | |
7051 | - long __ign1, __ign2, __ign3; \ | |
7052 | - register long __arg4 asm("r10") = (long)(a4); \ | |
7053 | - asm volatile ( \ | |
7054 | - HYPERCALL_STR(name) \ | |
7055 | - : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ | |
7056 | - "=d" (__ign3), "+r" (__arg4) \ | |
7057 | - : "1" ((long)(a1)), "2" ((long)(a2)), \ | |
7058 | - "3" ((long)(a3)) \ | |
7059 | - : "memory" ); \ | |
7060 | - __res; \ | |
7061 | -}) | |
7062 | - | |
7063 | -#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ | |
7064 | -({ \ | |
7065 | - type __res; \ | |
7066 | - long __ign1, __ign2, __ign3; \ | |
7067 | - register long __arg4 asm("r10") = (long)(a4); \ | |
7068 | - register long __arg5 asm("r8") = (long)(a5); \ | |
7069 | - asm volatile ( \ | |
7070 | - HYPERCALL_STR(name) \ | |
7071 | - : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ | |
7072 | - "=d" (__ign3), "+r" (__arg4), "+r" (__arg5) \ | |
7073 | - : "1" ((long)(a1)), "2" ((long)(a2)), \ | |
7074 | - "3" ((long)(a3)) \ | |
7075 | - : "memory" ); \ | |
7076 | - __res; \ | |
7077 | -}) | |
7078 | - | |
7079 | -#define _hypercall(type, op, a1, a2, a3, a4, a5) \ | |
7080 | -({ \ | |
7081 | - type __res; \ | |
7082 | - register typeof((a1)+0) __arg1 asm("rdi") = (a1); \ | |
7083 | - register typeof((a2)+0) __arg2 asm("rsi") = (a2); \ | |
7084 | - register typeof((a3)+0) __arg3 asm("rdx") = (a3); \ | |
7085 | - register typeof((a4)+0) __arg4 asm("r10") = (a4); \ | |
7086 | - register typeof((a5)+0) __arg5 asm("r8") = (a5); \ | |
7087 | - asm volatile ( \ | |
7088 | - "call *%6" \ | |
7089 | - : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ | |
7090 | - "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ | |
7091 | - : "0" (hypercall_page + (op) * 32) \ | |
7092 | - : "memory" ); \ | |
7093 | - __res; \ | |
7094 | -}) | |
7095 | - | |
7096 | -static inline int __must_check | |
7097 | -HYPERVISOR_set_trap_table( | |
7098 | - const trap_info_t *table) | |
7099 | -{ | |
7100 | - return _hypercall1(int, set_trap_table, table); | |
7101 | -} | |
7102 | - | |
7103 | -static inline int __must_check | |
7104 | -HYPERVISOR_mmu_update( | |
7105 | - mmu_update_t *req, unsigned int count, unsigned int *success_count, | |
7106 | - domid_t domid) | |
7107 | -{ | |
7108 | - if (arch_use_lazy_mmu_mode()) | |
7109 | - return xen_multi_mmu_update(req, count, success_count, domid); | |
7110 | - return _hypercall4(int, mmu_update, req, count, success_count, domid); | |
7111 | -} | |
7112 | - | |
7113 | -static inline int __must_check | |
7114 | -HYPERVISOR_mmuext_op( | |
7115 | - struct mmuext_op *op, unsigned int count, unsigned int *success_count, | |
7116 | - domid_t domid) | |
7117 | -{ | |
7118 | - if (arch_use_lazy_mmu_mode()) | |
7119 | - return xen_multi_mmuext_op(op, count, success_count, domid); | |
7120 | - return _hypercall4(int, mmuext_op, op, count, success_count, domid); | |
7121 | -} | |
7122 | - | |
7123 | -static inline int __must_check | |
7124 | -HYPERVISOR_set_gdt( | |
7125 | - unsigned long *frame_list, unsigned int entries) | |
7126 | -{ | |
7127 | - return _hypercall2(int, set_gdt, frame_list, entries); | |
7128 | -} | |
7129 | - | |
7130 | -static inline int __must_check | |
7131 | -HYPERVISOR_stack_switch( | |
7132 | - unsigned long ss, unsigned long esp) | |
7133 | -{ | |
7134 | - return _hypercall2(int, stack_switch, ss, esp); | |
7135 | -} | |
7136 | +#define HYPERCALL_arg1 "rdi" | |
7137 | +#define HYPERCALL_arg2 "rsi" | |
7138 | +#define HYPERCALL_arg3 "rdx" | |
7139 | +#define HYPERCALL_arg4 "r10" | |
7140 | +#define HYPERCALL_arg5 "r8" | |
7141 | ||
7142 | +#if CONFIG_XEN_COMPAT <= 0x030002 | |
7143 | static inline int __must_check | |
7144 | HYPERVISOR_set_callbacks( | |
7145 | unsigned long event_address, unsigned long failsafe_address, | |
7146 | @@ -200,27 +13,7 @@ HYPERVISOR_set_callbacks( | |
7147 | return _hypercall3(int, set_callbacks, | |
7148 | event_address, failsafe_address, syscall_address); | |
7149 | } | |
7150 | - | |
7151 | -static inline int | |
7152 | -HYPERVISOR_fpu_taskswitch( | |
7153 | - int set) | |
7154 | -{ | |
7155 | - return _hypercall1(int, fpu_taskswitch, set); | |
7156 | -} | |
7157 | - | |
7158 | -static inline int __must_check | |
7159 | -HYPERVISOR_sched_op_compat( | |
7160 | - int cmd, unsigned long arg) | |
7161 | -{ | |
7162 | - return _hypercall2(int, sched_op_compat, cmd, arg); | |
7163 | -} | |
7164 | - | |
7165 | -static inline int __must_check | |
7166 | -HYPERVISOR_sched_op( | |
7167 | - int cmd, void *arg) | |
7168 | -{ | |
7169 | - return _hypercall2(int, sched_op, cmd, arg); | |
7170 | -} | |
7171 | +#endif | |
7172 | ||
7173 | static inline long __must_check | |
7174 | HYPERVISOR_set_timer_op( | |
7175 | @@ -230,28 +23,6 @@ HYPERVISOR_set_timer_op( | |
7176 | } | |
7177 | ||
7178 | static inline int __must_check | |
7179 | -HYPERVISOR_platform_op( | |
7180 | - struct xen_platform_op *platform_op) | |
7181 | -{ | |
7182 | - platform_op->interface_version = XENPF_INTERFACE_VERSION; | |
7183 | - return _hypercall1(int, platform_op, platform_op); | |
7184 | -} | |
7185 | - | |
7186 | -static inline int __must_check | |
7187 | -HYPERVISOR_set_debugreg( | |
7188 | - unsigned int reg, unsigned long value) | |
7189 | -{ | |
7190 | - return _hypercall2(int, set_debugreg, reg, value); | |
7191 | -} | |
7192 | - | |
7193 | -static inline unsigned long __must_check | |
7194 | -HYPERVISOR_get_debugreg( | |
7195 | - unsigned int reg) | |
7196 | -{ | |
7197 | - return _hypercall1(unsigned long, get_debugreg, reg); | |
7198 | -} | |
7199 | - | |
7200 | -static inline int __must_check | |
7201 | HYPERVISOR_update_descriptor( | |
7202 | unsigned long ma, unsigned long word) | |
7203 | { | |
7204 | @@ -259,22 +30,6 @@ HYPERVISOR_update_descriptor( | |
7205 | } | |
7206 | ||
7207 | static inline int __must_check | |
7208 | -HYPERVISOR_memory_op( | |
7209 | - unsigned int cmd, void *arg) | |
7210 | -{ | |
7211 | - if (arch_use_lazy_mmu_mode()) | |
7212 | - xen_multicall_flush(false); | |
7213 | - return _hypercall2(int, memory_op, cmd, arg); | |
7214 | -} | |
7215 | - | |
7216 | -static inline int __must_check | |
7217 | -HYPERVISOR_multicall( | |
7218 | - multicall_entry_t *call_list, unsigned int nr_calls) | |
7219 | -{ | |
7220 | - return _hypercall2(int, multicall, call_list, nr_calls); | |
7221 | -} | |
7222 | - | |
7223 | -static inline int __must_check | |
7224 | HYPERVISOR_update_va_mapping( | |
7225 | unsigned long va, pte_t new_val, unsigned long flags) | |
7226 | { | |
7227 | @@ -284,67 +39,6 @@ HYPERVISOR_update_va_mapping( | |
7228 | } | |
7229 | ||
7230 | static inline int __must_check | |
7231 | -HYPERVISOR_event_channel_op( | |
7232 | - int cmd, void *arg) | |
7233 | -{ | |
7234 | - int rc = _hypercall2(int, event_channel_op, cmd, arg); | |
7235 | - | |
7236 | -#if CONFIG_XEN_COMPAT <= 0x030002 | |
7237 | - if (unlikely(rc == -ENOSYS)) { | |
7238 | - struct evtchn_op op; | |
7239 | - op.cmd = cmd; | |
7240 | - memcpy(&op.u, arg, sizeof(op.u)); | |
7241 | - rc = _hypercall1(int, event_channel_op_compat, &op); | |
7242 | - memcpy(arg, &op.u, sizeof(op.u)); | |
7243 | - } | |
7244 | -#endif | |
7245 | - | |
7246 | - return rc; | |
7247 | -} | |
7248 | - | |
7249 | -static inline int __must_check | |
7250 | -HYPERVISOR_xen_version( | |
7251 | - int cmd, void *arg) | |
7252 | -{ | |
7253 | - return _hypercall2(int, xen_version, cmd, arg); | |
7254 | -} | |
7255 | - | |
7256 | -static inline int __must_check | |
7257 | -HYPERVISOR_console_io( | |
7258 | - int cmd, unsigned int count, char *str) | |
7259 | -{ | |
7260 | - return _hypercall3(int, console_io, cmd, count, str); | |
7261 | -} | |
7262 | - | |
7263 | -static inline int __must_check | |
7264 | -HYPERVISOR_physdev_op( | |
7265 | - int cmd, void *arg) | |
7266 | -{ | |
7267 | - int rc = _hypercall2(int, physdev_op, cmd, arg); | |
7268 | - | |
7269 | -#if CONFIG_XEN_COMPAT <= 0x030002 | |
7270 | - if (unlikely(rc == -ENOSYS)) { | |
7271 | - struct physdev_op op; | |
7272 | - op.cmd = cmd; | |
7273 | - memcpy(&op.u, arg, sizeof(op.u)); | |
7274 | - rc = _hypercall1(int, physdev_op_compat, &op); | |
7275 | - memcpy(arg, &op.u, sizeof(op.u)); | |
7276 | - } | |
7277 | -#endif | |
7278 | - | |
7279 | - return rc; | |
7280 | -} | |
7281 | - | |
7282 | -static inline int __must_check | |
7283 | -HYPERVISOR_grant_table_op( | |
7284 | - unsigned int cmd, void *uop, unsigned int count) | |
7285 | -{ | |
7286 | - if (arch_use_lazy_mmu_mode()) | |
7287 | - xen_multicall_flush(false); | |
7288 | - return _hypercall3(int, grant_table_op, cmd, uop, count); | |
7289 | -} | |
7290 | - | |
7291 | -static inline int __must_check | |
7292 | HYPERVISOR_update_va_mapping_otherdomain( | |
7293 | unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) | |
7294 | { | |
7295 | @@ -353,83 +47,8 @@ HYPERVISOR_update_va_mapping_otherdomain | |
7296 | } | |
7297 | ||
7298 | static inline int __must_check | |
7299 | -HYPERVISOR_vm_assist( | |
7300 | - unsigned int cmd, unsigned int type) | |
7301 | -{ | |
7302 | - return _hypercall2(int, vm_assist, cmd, type); | |
7303 | -} | |
7304 | - | |
7305 | -static inline int __must_check | |
7306 | -HYPERVISOR_vcpu_op( | |
7307 | - int cmd, unsigned int vcpuid, void *extra_args) | |
7308 | -{ | |
7309 | - return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); | |
7310 | -} | |
7311 | - | |
7312 | -static inline int __must_check | |
7313 | HYPERVISOR_set_segment_base( | |
7314 | int reg, unsigned long value) | |
7315 | { | |
7316 | return _hypercall2(int, set_segment_base, reg, value); | |
7317 | } | |
7318 | - | |
7319 | -static inline int __must_check | |
7320 | -HYPERVISOR_suspend( | |
7321 | - unsigned long srec) | |
7322 | -{ | |
7323 | - struct sched_shutdown sched_shutdown = { | |
7324 | - .reason = SHUTDOWN_suspend | |
7325 | - }; | |
7326 | - | |
7327 | - int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, | |
7328 | - &sched_shutdown, srec); | |
7329 | - | |
7330 | -#if CONFIG_XEN_COMPAT <= 0x030002 | |
7331 | - if (rc == -ENOSYS) | |
7332 | - rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, | |
7333 | - SHUTDOWN_suspend, srec); | |
7334 | -#endif | |
7335 | - | |
7336 | - return rc; | |
7337 | -} | |
7338 | - | |
7339 | -#if CONFIG_XEN_COMPAT <= 0x030002 | |
7340 | -static inline int | |
7341 | -HYPERVISOR_nmi_op( | |
7342 | - unsigned long op, void *arg) | |
7343 | -{ | |
7344 | - return _hypercall2(int, nmi_op, op, arg); | |
7345 | -} | |
7346 | -#endif | |
7347 | - | |
7348 | -#ifndef CONFIG_XEN | |
7349 | -static inline unsigned long __must_check | |
7350 | -HYPERVISOR_hvm_op( | |
7351 | - int op, void *arg) | |
7352 | -{ | |
7353 | - return _hypercall2(unsigned long, hvm_op, op, arg); | |
7354 | -} | |
7355 | -#endif | |
7356 | - | |
7357 | -static inline int __must_check | |
7358 | -HYPERVISOR_callback_op( | |
7359 | - int cmd, const void *arg) | |
7360 | -{ | |
7361 | - return _hypercall2(int, callback_op, cmd, arg); | |
7362 | -} | |
7363 | - | |
7364 | -static inline int __must_check | |
7365 | -HYPERVISOR_xenoprof_op( | |
7366 | - int op, void *arg) | |
7367 | -{ | |
7368 | - return _hypercall2(int, xenoprof_op, op, arg); | |
7369 | -} | |
7370 | - | |
7371 | -static inline int __must_check | |
7372 | -HYPERVISOR_kexec_op( | |
7373 | - unsigned long op, void *args) | |
7374 | -{ | |
7375 | - return _hypercall2(int, kexec_op, op, args); | |
7376 | -} | |
7377 | - | |
7378 | -#endif /* __HYPERCALL_H__ */ | |
7379 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/hypervisor.h 2009-03-04 11:28:11.000000000 +0100 | |
7380 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/hypervisor.h 2009-02-16 16:18:36.000000000 +0100 | |
7381 | @@ -194,7 +194,6 @@ static inline void xen_multicall_flush(b | |
7382 | extern char hypercall_page[PAGE_SIZE]; | |
7383 | #else | |
7384 | extern char *hypercall_stubs; | |
7385 | -#define hypercall_page hypercall_stubs | |
7386 | #define is_running_on_xen() (!!hypercall_stubs) | |
7387 | #endif | |
7388 | ||
7389 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7390 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/io.h 2009-02-16 16:18:36.000000000 +0100 | |
7391 | @@ -0,0 +1,5 @@ | |
7392 | +#ifdef CONFIG_X86_32 | |
7393 | +# include "io_32.h" | |
7394 | +#else | |
7395 | +# include "io_64.h" | |
7396 | +#endif | |
7397 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7398 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/irqflags.h 2009-02-16 16:18:36.000000000 +0100 | |
7399 | @@ -0,0 +1,5 @@ | |
7400 | +#ifdef CONFIG_X86_32 | |
7401 | +# include "irqflags_32.h" | |
7402 | +#else | |
7403 | +# include "irqflags_64.h" | |
7404 | +#endif | |
7405 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/irqflags_32.h 2008-12-15 11:27:22.000000000 +0100 | |
7406 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/irqflags_32.h 2009-02-16 16:18:36.000000000 +0100 | |
7407 | @@ -148,6 +148,23 @@ static inline int raw_irqs_disabled_flag | |
7408 | \ | |
7409 | raw_irqs_disabled_flags(flags); \ | |
7410 | }) | |
7411 | + | |
7412 | +/* | |
7413 | + * makes the traced hardirq state match with the machine state | |
7414 | + * | |
7415 | + * should be a rarely used function, only in places where its | |
7416 | + * otherwise impossible to know the irq state, like in traps. | |
7417 | + */ | |
7418 | +static inline void trace_hardirqs_fixup_flags(unsigned long flags) | |
7419 | +{ | |
7420 | + if (raw_irqs_disabled_flags(flags)) | |
7421 | + trace_hardirqs_off(); | |
7422 | + else | |
7423 | + trace_hardirqs_on(); | |
7424 | +} | |
7425 | + | |
7426 | +#define trace_hardirqs_fixup() \ | |
7427 | + trace_hardirqs_fixup_flags(__raw_local_save_flags()) | |
7428 | #endif /* __ASSEMBLY__ */ | |
7429 | ||
7430 | /* | |
7431 | @@ -179,4 +196,17 @@ static inline int raw_irqs_disabled_flag | |
7432 | # define TRACE_IRQS_OFF | |
7433 | #endif | |
7434 | ||
7435 | +#ifdef CONFIG_DEBUG_LOCK_ALLOC | |
7436 | +# define LOCKDEP_SYS_EXIT \ | |
7437 | + pushl %eax; \ | |
7438 | + pushl %ecx; \ | |
7439 | + pushl %edx; \ | |
7440 | + call lockdep_sys_exit; \ | |
7441 | + popl %edx; \ | |
7442 | + popl %ecx; \ | |
7443 | + popl %eax; | |
7444 | +#else | |
7445 | +# define LOCKDEP_SYS_EXIT | |
7446 | +#endif | |
7447 | + | |
7448 | #endif | |
7449 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/irqflags_64.h 2008-12-15 11:27:22.000000000 +0100 | |
7450 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/irqflags_64.h 2009-02-16 16:18:36.000000000 +0100 | |
7451 | @@ -116,6 +116,22 @@ static inline int raw_irqs_disabled_flag | |
7452 | }) | |
7453 | ||
7454 | /* | |
7455 | + * makes the traced hardirq state match with the machine state | |
7456 | + * | |
7457 | + * should be a rarely used function, only in places where its | |
7458 | + * otherwise impossible to know the irq state, like in traps. | |
7459 | + */ | |
7460 | +static inline void trace_hardirqs_fixup_flags(unsigned long flags) | |
7461 | +{ | |
7462 | + if (raw_irqs_disabled_flags(flags)) | |
7463 | + trace_hardirqs_off(); | |
7464 | + else | |
7465 | + trace_hardirqs_on(); | |
7466 | +} | |
7467 | + | |
7468 | +#define trace_hardirqs_fixup() \ | |
7469 | + trace_hardirqs_fixup_flags(__raw_local_save_flags()) | |
7470 | +/* | |
7471 | * Used in the idle loop; sti takes one instruction cycle | |
7472 | * to complete: | |
7473 | */ | |
7474 | @@ -143,6 +159,20 @@ static inline void halt(void) | |
7475 | # define TRACE_IRQS_ON | |
7476 | # define TRACE_IRQS_OFF | |
7477 | # endif | |
7478 | +# ifdef CONFIG_DEBUG_LOCK_ALLOC | |
7479 | +# define LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk | |
7480 | +# define LOCKDEP_SYS_EXIT_IRQ \ | |
7481 | + TRACE_IRQS_ON; \ | |
7482 | + sti; \ | |
7483 | + SAVE_REST; \ | |
7484 | + LOCKDEP_SYS_EXIT; \ | |
7485 | + RESTORE_REST; \ | |
7486 | + cli; \ | |
7487 | + TRACE_IRQS_OFF; | |
7488 | +# else | |
7489 | +# define LOCKDEP_SYS_EXIT | |
7490 | +# define LOCKDEP_SYS_EXIT_IRQ | |
7491 | +# endif | |
7492 | #endif | |
7493 | ||
7494 | #endif | |
7495 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7496 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/maddr.h 2009-02-16 16:18:36.000000000 +0100 | |
7497 | @@ -0,0 +1,5 @@ | |
7498 | +#ifdef CONFIG_X86_32 | |
7499 | +# include "maddr_32.h" | |
7500 | +#else | |
7501 | +# include "maddr_64.h" | |
7502 | +#endif | |
7503 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7504 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/mmu_context.h 2009-02-16 16:18:36.000000000 +0100 | |
7505 | @@ -0,0 +1,5 @@ | |
7506 | +#ifdef CONFIG_X86_32 | |
7507 | +# include "mmu_context_32.h" | |
7508 | +#else | |
7509 | +# include "mmu_context_64.h" | |
7510 | +#endif | |
7511 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7512 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/page.h 2009-02-16 16:18:36.000000000 +0100 | |
7513 | @@ -0,0 +1,13 @@ | |
7514 | +#ifdef __KERNEL__ | |
7515 | +# ifdef CONFIG_X86_32 | |
7516 | +# include "page_32.h" | |
7517 | +# else | |
7518 | +# include "page_64.h" | |
7519 | +# endif | |
7520 | +#else | |
7521 | +# ifdef __i386__ | |
7522 | +# include "page_32.h" | |
7523 | +# else | |
7524 | +# include "page_64.h" | |
7525 | +# endif | |
7526 | +#endif | |
7527 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/page_64.h 2009-02-16 16:17:21.000000000 +0100 | |
7528 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/page_64.h 2009-02-16 16:18:36.000000000 +0100 | |
7529 | @@ -207,6 +207,7 @@ static inline unsigned long __phys_addr( | |
7530 | VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | |
7531 | ||
7532 | #define __HAVE_ARCH_GATE_AREA 1 | |
7533 | +#define vmemmap ((struct page *)VMEMMAP_START) | |
7534 | ||
7535 | #include <asm-generic/memory_model.h> | |
7536 | #include <asm-generic/page.h> | |
7537 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7538 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/pci.h 2009-02-16 16:18:36.000000000 +0100 | |
7539 | @@ -0,0 +1,100 @@ | |
7540 | +#ifndef __x86_PCI_H | |
7541 | +#define __x86_PCI_H | |
7542 | + | |
7543 | +#include <linux/mm.h> /* for struct page */ | |
7544 | +#include <linux/types.h> | |
7545 | +#include <linux/slab.h> | |
7546 | +#include <linux/string.h> | |
7547 | +#include <asm/scatterlist.h> | |
7548 | +#include <asm/io.h> | |
7549 | + | |
7550 | + | |
7551 | +#ifdef __KERNEL__ | |
7552 | + | |
7553 | +struct pci_sysdata { | |
7554 | + int domain; /* PCI domain */ | |
7555 | + int node; /* NUMA node */ | |
7556 | +#ifdef CONFIG_X86_64 | |
7557 | + void* iommu; /* IOMMU private data */ | |
7558 | +#endif | |
7559 | +#ifdef CONFIG_XEN_PCIDEV_FRONTEND | |
7560 | + struct pcifront_device *pdev; | |
7561 | +#endif | |
7562 | +}; | |
7563 | + | |
7564 | +/* scan a bus after allocating a pci_sysdata for it */ | |
7565 | +extern struct pci_bus *pci_scan_bus_with_sysdata(int busno); | |
7566 | + | |
7567 | +static inline int pci_domain_nr(struct pci_bus *bus) | |
7568 | +{ | |
7569 | + struct pci_sysdata *sd = bus->sysdata; | |
7570 | + return sd->domain; | |
7571 | +} | |
7572 | + | |
7573 | +static inline int pci_proc_domain(struct pci_bus *bus) | |
7574 | +{ | |
7575 | + return pci_domain_nr(bus); | |
7576 | +} | |
7577 | + | |
7578 | + | |
7579 | +/* Can be used to override the logic in pci_scan_bus for skipping | |
7580 | + already-configured bus numbers - to be used for buggy BIOSes | |
7581 | + or architectures with incomplete PCI setup by the loader */ | |
7582 | + | |
7583 | +#ifdef CONFIG_PCI | |
7584 | +extern unsigned int pcibios_assign_all_busses(void); | |
7585 | +#else | |
7586 | +#define pcibios_assign_all_busses() 0 | |
7587 | +#endif | |
7588 | + | |
7589 | +#include <asm/hypervisor.h> | |
7590 | +#define pcibios_scan_all_fns(a, b) (!is_initial_xendomain()) | |
7591 | + | |
7592 | +extern unsigned long pci_mem_start; | |
7593 | +#define PCIBIOS_MIN_IO 0x1000 | |
7594 | +#define PCIBIOS_MIN_MEM (pci_mem_start) | |
7595 | + | |
7596 | +#define PCIBIOS_MIN_CARDBUS_IO 0x4000 | |
7597 | + | |
7598 | +void pcibios_config_init(void); | |
7599 | +struct pci_bus * pcibios_scan_root(int bus); | |
7600 | + | |
7601 | +void pcibios_set_master(struct pci_dev *dev); | |
7602 | +void pcibios_penalize_isa_irq(int irq, int active); | |
7603 | +struct irq_routing_table *pcibios_get_irq_routing_table(void); | |
7604 | +int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); | |
7605 | + | |
7606 | + | |
7607 | +#define HAVE_PCI_MMAP | |
7608 | +extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |
7609 | + enum pci_mmap_state mmap_state, int write_combine); | |
7610 | + | |
7611 | + | |
7612 | +#ifdef CONFIG_PCI | |
7613 | +static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |
7614 | + enum pci_dma_burst_strategy *strat, | |
7615 | + unsigned long *strategy_parameter) | |
7616 | +{ | |
7617 | + *strat = PCI_DMA_BURST_INFINITY; | |
7618 | + *strategy_parameter = ~0UL; | |
7619 | +} | |
7620 | +#endif | |
7621 | + | |
7622 | + | |
7623 | +#endif /* __KERNEL__ */ | |
7624 | + | |
7625 | +#ifdef CONFIG_X86_32 | |
7626 | +# include "pci_32.h" | |
7627 | +#else | |
7628 | +# include "pci_64.h" | |
7629 | +#endif | |
7630 | + | |
7631 | +/* implement the pci_ DMA API in terms of the generic device dma_ one */ | |
7632 | +#include <asm-generic/pci-dma-compat.h> | |
7633 | + | |
7634 | +/* generic pci stuff */ | |
7635 | +#include <asm-generic/pci.h> | |
7636 | + | |
7637 | + | |
7638 | + | |
7639 | +#endif | |
7640 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/pci_32.h 2009-02-16 16:17:21.000000000 +0100 | |
7641 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/pci_32.h 2009-02-16 16:18:36.000000000 +0100 | |
7642 | @@ -4,52 +4,10 @@ | |
7643 | ||
7644 | #ifdef __KERNEL__ | |
7645 | ||
7646 | -struct pci_sysdata { | |
7647 | - int node; /* NUMA node */ | |
7648 | -}; | |
7649 | - | |
7650 | -/* scan a bus after allocating a pci_sysdata for it */ | |
7651 | -extern struct pci_bus *pci_scan_bus_with_sysdata(int busno); | |
7652 | - | |
7653 | -#include <linux/mm.h> /* for struct page */ | |
7654 | - | |
7655 | -/* Can be used to override the logic in pci_scan_bus for skipping | |
7656 | - already-configured bus numbers - to be used for buggy BIOSes | |
7657 | - or architectures with incomplete PCI setup by the loader */ | |
7658 | - | |
7659 | -#ifdef CONFIG_PCI | |
7660 | -extern unsigned int pcibios_assign_all_busses(void); | |
7661 | -#else | |
7662 | -#define pcibios_assign_all_busses() 0 | |
7663 | -#endif | |
7664 | - | |
7665 | -#include <asm/hypervisor.h> | |
7666 | -#define pcibios_scan_all_fns(a, b) (!is_initial_xendomain()) | |
7667 | - | |
7668 | -extern unsigned long pci_mem_start; | |
7669 | -#define PCIBIOS_MIN_IO 0x1000 | |
7670 | -#define PCIBIOS_MIN_MEM (pci_mem_start) | |
7671 | - | |
7672 | -#define PCIBIOS_MIN_CARDBUS_IO 0x4000 | |
7673 | - | |
7674 | -void pcibios_config_init(void); | |
7675 | -struct pci_bus * pcibios_scan_root(int bus); | |
7676 | - | |
7677 | -void pcibios_set_master(struct pci_dev *dev); | |
7678 | -void pcibios_penalize_isa_irq(int irq, int active); | |
7679 | -struct irq_routing_table *pcibios_get_irq_routing_table(void); | |
7680 | -int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); | |
7681 | - | |
7682 | /* Dynamic DMA mapping stuff. | |
7683 | * i386 has everything mapped statically. | |
7684 | */ | |
7685 | ||
7686 | -#include <linux/types.h> | |
7687 | -#include <linux/slab.h> | |
7688 | -#include <asm/scatterlist.h> | |
7689 | -#include <linux/string.h> | |
7690 | -#include <asm/io.h> | |
7691 | - | |
7692 | struct pci_dev; | |
7693 | ||
7694 | #ifdef CONFIG_SWIOTLB | |
7695 | @@ -89,31 +47,8 @@ struct pci_dev; | |
7696 | ||
7697 | #endif | |
7698 | ||
7699 | -#define HAVE_PCI_MMAP | |
7700 | -extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |
7701 | - enum pci_mmap_state mmap_state, int write_combine); | |
7702 | - | |
7703 | - | |
7704 | -#ifdef CONFIG_PCI | |
7705 | -static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |
7706 | - enum pci_dma_burst_strategy *strat, | |
7707 | - unsigned long *strategy_parameter) | |
7708 | -{ | |
7709 | - *strat = PCI_DMA_BURST_INFINITY; | |
7710 | - *strategy_parameter = ~0UL; | |
7711 | -} | |
7712 | -#endif | |
7713 | ||
7714 | #endif /* __KERNEL__ */ | |
7715 | ||
7716 | -#ifdef CONFIG_XEN_PCIDEV_FRONTEND | |
7717 | -#include <xen/pcifront.h> | |
7718 | -#endif /* CONFIG_XEN_PCIDEV_FRONTEND */ | |
7719 | - | |
7720 | -/* implement the pci_ DMA API in terms of the generic device dma_ one */ | |
7721 | -#include <asm-generic/pci-dma-compat.h> | |
7722 | - | |
7723 | -/* generic pci stuff */ | |
7724 | -#include <asm-generic/pci.h> | |
7725 | ||
7726 | #endif /* __i386_PCI_H */ | |
7727 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7728 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/pgalloc.h 2009-02-16 16:18:36.000000000 +0100 | |
7729 | @@ -0,0 +1,5 @@ | |
7730 | +#ifdef CONFIG_X86_32 | |
7731 | +# include "pgalloc_32.h" | |
7732 | +#else | |
7733 | +# include "pgalloc_64.h" | |
7734 | +#endif | |
7735 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/pgalloc_64.h 2009-02-16 16:17:21.000000000 +0100 | |
7736 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/pgalloc_64.h 2009-02-16 16:18:36.000000000 +0100 | |
7737 | @@ -112,6 +112,8 @@ static inline void pgd_list_del(pgd_t *p | |
7738 | spin_unlock(&pgd_lock); | |
7739 | } | |
7740 | ||
7741 | +extern void pgd_test_and_unpin(pgd_t *); | |
7742 | + | |
7743 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | |
7744 | { | |
7745 | /* | |
7746 | @@ -122,6 +124,7 @@ static inline pgd_t *pgd_alloc(struct mm | |
7747 | if (!pgd) | |
7748 | return NULL; | |
7749 | pgd_list_add(pgd); | |
7750 | + pgd_test_and_unpin(pgd); | |
7751 | /* | |
7752 | * Copy kernel pointers in from init. | |
7753 | * Could keep a freelist or slab cache of those because the kernel | |
7754 | @@ -144,27 +147,7 @@ static inline pgd_t *pgd_alloc(struct mm | |
7755 | ||
7756 | static inline void pgd_free(pgd_t *pgd) | |
7757 | { | |
7758 | - pte_t *ptep = virt_to_ptep(pgd); | |
7759 | - | |
7760 | - if (!pte_write(*ptep)) { | |
7761 | - xen_pgd_unpin(__pa(pgd)); | |
7762 | - BUG_ON(HYPERVISOR_update_va_mapping( | |
7763 | - (unsigned long)pgd, | |
7764 | - pfn_pte(virt_to_phys(pgd)>>PAGE_SHIFT, PAGE_KERNEL), | |
7765 | - 0)); | |
7766 | - } | |
7767 | - | |
7768 | - ptep = virt_to_ptep(__user_pgd(pgd)); | |
7769 | - | |
7770 | - if (!pte_write(*ptep)) { | |
7771 | - xen_pgd_unpin(__pa(__user_pgd(pgd))); | |
7772 | - BUG_ON(HYPERVISOR_update_va_mapping( | |
7773 | - (unsigned long)__user_pgd(pgd), | |
7774 | - pfn_pte(virt_to_phys(__user_pgd(pgd))>>PAGE_SHIFT, | |
7775 | - PAGE_KERNEL), | |
7776 | - 0)); | |
7777 | - } | |
7778 | - | |
7779 | + pgd_test_and_unpin(pgd); | |
7780 | pgd_list_del(pgd); | |
7781 | free_pages((unsigned long)pgd, 1); | |
7782 | } | |
7783 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7784 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/pgtable.h 2009-02-16 16:18:36.000000000 +0100 | |
7785 | @@ -0,0 +1,5 @@ | |
7786 | +#ifdef CONFIG_X86_32 | |
7787 | +# include "pgtable_32.h" | |
7788 | +#else | |
7789 | +# include "pgtable_64.h" | |
7790 | +#endif | |
7791 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/pgtable_32.h 2009-02-16 16:17:21.000000000 +0100 | |
7792 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/pgtable_32.h 2009-02-16 16:18:36.000000000 +0100 | |
7793 | @@ -17,10 +17,7 @@ | |
7794 | #include <asm/fixmap.h> | |
7795 | #include <linux/threads.h> | |
7796 | ||
7797 | -#ifndef _I386_BITOPS_H | |
7798 | -#include <asm/bitops.h> | |
7799 | -#endif | |
7800 | - | |
7801 | +#include <linux/bitops.h> | |
7802 | #include <linux/slab.h> | |
7803 | #include <linux/list.h> | |
7804 | #include <linux/spinlock.h> | |
7805 | @@ -40,7 +37,7 @@ extern spinlock_t pgd_lock; | |
7806 | extern struct page *pgd_list; | |
7807 | void check_pgt_cache(void); | |
7808 | ||
7809 | -void pmd_ctor(void *, struct kmem_cache *, unsigned long); | |
7810 | +void pmd_ctor(struct kmem_cache *, void *); | |
7811 | void pgtable_cache_init(void); | |
7812 | void paging_init(void); | |
7813 | ||
7814 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/pgtable_64.h 2009-02-16 16:17:21.000000000 +0100 | |
7815 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/pgtable_64.h 2009-02-16 16:18:36.000000000 +0100 | |
7816 | @@ -9,7 +9,7 @@ | |
7817 | * the x86-64 page table tree. | |
7818 | */ | |
7819 | #include <asm/processor.h> | |
7820 | -#include <asm/bitops.h> | |
7821 | +#include <linux/bitops.h> | |
7822 | #include <linux/threads.h> | |
7823 | #include <linux/sched.h> | |
7824 | #include <asm/pda.h> | |
7825 | @@ -139,6 +139,7 @@ static inline void pgd_clear (pgd_t * pg | |
7826 | #define MAXMEM _AC(0x3fffffffffff, UL) | |
7827 | #define VMALLOC_START _AC(0xffffc20000000000, UL) | |
7828 | #define VMALLOC_END _AC(0xffffe1ffffffffff, UL) | |
7829 | +#define VMEMMAP_START _AC(0xffffe20000000000, UL) | |
7830 | #define MODULES_VADDR _AC(0xffffffff88000000, UL) | |
7831 | #define MODULES_END _AC(0xfffffffffff00000, UL) | |
7832 | #define MODULES_LEN (MODULES_END - MODULES_VADDR) | |
7833 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7834 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/processor.h 2009-02-16 16:18:36.000000000 +0100 | |
7835 | @@ -0,0 +1,5 @@ | |
7836 | +#ifdef CONFIG_X86_32 | |
7837 | +# include "processor_32.h" | |
7838 | +#else | |
7839 | +# include "processor_64.h" | |
7840 | +#endif | |
7841 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/processor_32.h 2009-02-16 16:17:21.000000000 +0100 | |
7842 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/processor_32.h 2009-02-16 16:18:36.000000000 +0100 | |
7843 | @@ -80,6 +80,7 @@ struct cpuinfo_x86 { | |
7844 | unsigned char booted_cores; /* number of cores as seen by OS */ | |
7845 | __u8 phys_proc_id; /* Physical processor id. */ | |
7846 | __u8 cpu_core_id; /* Core id */ | |
7847 | + __u8 cpu_index; /* index into per_cpu list */ | |
7848 | #endif | |
7849 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | |
7850 | ||
7851 | @@ -106,14 +107,19 @@ DECLARE_PER_CPU(struct tss_struct, init_ | |
7852 | #endif | |
7853 | ||
7854 | #ifdef CONFIG_SMP | |
7855 | -extern struct cpuinfo_x86 cpu_data[]; | |
7856 | -#define current_cpu_data cpu_data[smp_processor_id()] | |
7857 | +DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); | |
7858 | +#define cpu_data(cpu) per_cpu(cpu_info, cpu) | |
7859 | +#define current_cpu_data cpu_data(smp_processor_id()) | |
7860 | #else | |
7861 | -#define cpu_data (&boot_cpu_data) | |
7862 | -#define current_cpu_data boot_cpu_data | |
7863 | +#define cpu_data(cpu) boot_cpu_data | |
7864 | +#define current_cpu_data boot_cpu_data | |
7865 | #endif | |
7866 | ||
7867 | -extern int cpu_llc_id[NR_CPUS]; | |
7868 | +/* | |
7869 | + * the following now lives in the per cpu area: | |
7870 | + * extern int cpu_llc_id[NR_CPUS]; | |
7871 | + */ | |
7872 | +DECLARE_PER_CPU(u8, cpu_llc_id); | |
7873 | extern char ignore_fpu_irq; | |
7874 | ||
7875 | void __init cpu_detect(struct cpuinfo_x86 *c); | |
7876 | @@ -560,7 +566,9 @@ static inline void xen_set_iopl_mask(uns | |
7877 | * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx | |
7878 | * resulting in stale register contents being returned. | |
7879 | */ | |
7880 | -static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) | |
7881 | +static inline void cpuid(unsigned int op, | |
7882 | + unsigned int *eax, unsigned int *ebx, | |
7883 | + unsigned int *ecx, unsigned int *edx) | |
7884 | { | |
7885 | *eax = op; | |
7886 | *ecx = 0; | |
7887 | @@ -568,8 +576,9 @@ static inline void cpuid(unsigned int op | |
7888 | } | |
7889 | ||
7890 | /* Some CPUID calls want 'count' to be placed in ecx */ | |
7891 | -static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, | |
7892 | - int *edx) | |
7893 | +static inline void cpuid_count(unsigned int op, int count, | |
7894 | + unsigned int *eax, unsigned int *ebx, | |
7895 | + unsigned int *ecx, unsigned int *edx) | |
7896 | { | |
7897 | *eax = op; | |
7898 | *ecx = count; | |
7899 | @@ -639,6 +648,17 @@ static inline unsigned int cpuid_edx(uns | |
7900 | #define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n" | |
7901 | #define K7_NOP8 K7_NOP7 ASM_NOP1 | |
7902 | ||
7903 | +/* P6 nops */ | |
7904 | +/* uses eax dependencies (Intel-recommended choice) */ | |
7905 | +#define P6_NOP1 GENERIC_NOP1 | |
7906 | +#define P6_NOP2 ".byte 0x66,0x90\n" | |
7907 | +#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" | |
7908 | +#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n" | |
7909 | +#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n" | |
7910 | +#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n" | |
7911 | +#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n" | |
7912 | +#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n" | |
7913 | + | |
7914 | #ifdef CONFIG_MK8 | |
7915 | #define ASM_NOP1 K8_NOP1 | |
7916 | #define ASM_NOP2 K8_NOP2 | |
7917 | @@ -657,6 +677,17 @@ static inline unsigned int cpuid_edx(uns | |
7918 | #define ASM_NOP6 K7_NOP6 | |
7919 | #define ASM_NOP7 K7_NOP7 | |
7920 | #define ASM_NOP8 K7_NOP8 | |
7921 | +#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \ | |
7922 | + defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \ | |
7923 | + defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4) | |
7924 | +#define ASM_NOP1 P6_NOP1 | |
7925 | +#define ASM_NOP2 P6_NOP2 | |
7926 | +#define ASM_NOP3 P6_NOP3 | |
7927 | +#define ASM_NOP4 P6_NOP4 | |
7928 | +#define ASM_NOP5 P6_NOP5 | |
7929 | +#define ASM_NOP6 P6_NOP6 | |
7930 | +#define ASM_NOP7 P6_NOP7 | |
7931 | +#define ASM_NOP8 P6_NOP8 | |
7932 | #else | |
7933 | #define ASM_NOP1 GENERIC_NOP1 | |
7934 | #define ASM_NOP2 GENERIC_NOP2 | |
7935 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/processor_64.h 2009-02-16 16:17:21.000000000 +0100 | |
7936 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/processor_64.h 2009-02-16 16:18:36.000000000 +0100 | |
7937 | @@ -74,6 +74,7 @@ struct cpuinfo_x86 { | |
7938 | __u8 booted_cores; /* number of cores as seen by OS */ | |
7939 | __u8 phys_proc_id; /* Physical Processor id. */ | |
7940 | __u8 cpu_core_id; /* Core id. */ | |
7941 | + __u8 cpu_index; /* index into per_cpu list */ | |
7942 | #endif | |
7943 | } ____cacheline_aligned; | |
7944 | ||
7945 | @@ -88,11 +89,12 @@ struct cpuinfo_x86 { | |
7946 | #define X86_VENDOR_UNKNOWN 0xff | |
7947 | ||
7948 | #ifdef CONFIG_SMP | |
7949 | -extern struct cpuinfo_x86 cpu_data[]; | |
7950 | -#define current_cpu_data cpu_data[smp_processor_id()] | |
7951 | +DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); | |
7952 | +#define cpu_data(cpu) per_cpu(cpu_info, cpu) | |
7953 | +#define current_cpu_data cpu_data(smp_processor_id()) | |
7954 | #else | |
7955 | -#define cpu_data (&boot_cpu_data) | |
7956 | -#define current_cpu_data boot_cpu_data | |
7957 | +#define cpu_data(cpu) boot_cpu_data | |
7958 | +#define current_cpu_data boot_cpu_data | |
7959 | #endif | |
7960 | ||
7961 | extern char ignore_irq13; | |
7962 | @@ -343,6 +345,16 @@ struct extended_sigtable { | |
7963 | }; | |
7964 | ||
7965 | ||
7966 | +#if defined(CONFIG_MPSC) || defined(CONFIG_MCORE2) | |
7967 | +#define ASM_NOP1 P6_NOP1 | |
7968 | +#define ASM_NOP2 P6_NOP2 | |
7969 | +#define ASM_NOP3 P6_NOP3 | |
7970 | +#define ASM_NOP4 P6_NOP4 | |
7971 | +#define ASM_NOP5 P6_NOP5 | |
7972 | +#define ASM_NOP6 P6_NOP6 | |
7973 | +#define ASM_NOP7 P6_NOP7 | |
7974 | +#define ASM_NOP8 P6_NOP8 | |
7975 | +#else | |
7976 | #define ASM_NOP1 K8_NOP1 | |
7977 | #define ASM_NOP2 K8_NOP2 | |
7978 | #define ASM_NOP3 K8_NOP3 | |
7979 | @@ -351,6 +363,7 @@ struct extended_sigtable { | |
7980 | #define ASM_NOP6 K8_NOP6 | |
7981 | #define ASM_NOP7 K8_NOP7 | |
7982 | #define ASM_NOP8 K8_NOP8 | |
7983 | +#endif | |
7984 | ||
7985 | /* Opteron nops */ | |
7986 | #define K8_NOP1 ".byte 0x90\n" | |
7987 | @@ -362,6 +375,17 @@ struct extended_sigtable { | |
7988 | #define K8_NOP7 K8_NOP4 K8_NOP3 | |
7989 | #define K8_NOP8 K8_NOP4 K8_NOP4 | |
7990 | ||
7991 | +/* P6 nops */ | |
7992 | +/* uses eax dependencies (Intel-recommended choice) */ | |
7993 | +#define P6_NOP1 ".byte 0x90\n" | |
7994 | +#define P6_NOP2 ".byte 0x66,0x90\n" | |
7995 | +#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" | |
7996 | +#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n" | |
7997 | +#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n" | |
7998 | +#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n" | |
7999 | +#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n" | |
8000 | +#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n" | |
8001 | + | |
8002 | #define ASM_NOP_MAX 8 | |
8003 | ||
8004 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ | |
8005 | @@ -377,12 +401,6 @@ static inline void sync_core(void) | |
8006 | asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); | |
8007 | } | |
8008 | ||
8009 | -#define ARCH_HAS_PREFETCH | |
8010 | -static inline void prefetch(void *x) | |
8011 | -{ | |
8012 | - asm volatile("prefetcht0 (%0)" :: "r" (x)); | |
8013 | -} | |
8014 | - | |
8015 | #define ARCH_HAS_PREFETCHW 1 | |
8016 | static inline void prefetchw(void *x) | |
8017 | { | |
8018 | @@ -398,11 +416,6 @@ static inline void prefetchw(void *x) | |
8019 | ||
8020 | #define cpu_relax() rep_nop() | |
8021 | ||
8022 | -static inline void serialize_cpu(void) | |
8023 | -{ | |
8024 | - __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx"); | |
8025 | -} | |
8026 | - | |
8027 | static inline void __monitor(const void *eax, unsigned long ecx, | |
8028 | unsigned long edx) | |
8029 | { | |
8030 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
8031 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/segment.h 2009-02-16 16:18:36.000000000 +0100 | |
8032 | @@ -0,0 +1,5 @@ | |
8033 | +#ifdef CONFIG_X86_32 | |
8034 | +# include "segment_32.h" | |
8035 | +#else | |
8036 | +# include "../../segment_64.h" | |
8037 | +#endif | |
8038 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
8039 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/smp.h 2009-02-16 16:18:36.000000000 +0100 | |
8040 | @@ -0,0 +1,5 @@ | |
8041 | +#ifdef CONFIG_X86_32 | |
8042 | +# include "smp_32.h" | |
8043 | +#else | |
8044 | +# include "smp_64.h" | |
8045 | +#endif | |
8046 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/smp_32.h 2008-12-15 11:27:22.000000000 +0100 | |
8047 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/smp_32.h 2009-02-16 16:18:36.000000000 +0100 | |
8048 | @@ -11,7 +11,7 @@ | |
8049 | #endif | |
8050 | ||
8051 | #if defined(CONFIG_X86_LOCAL_APIC) && !defined(__ASSEMBLY__) | |
8052 | -#include <asm/bitops.h> | |
8053 | +#include <linux/bitops.h> | |
8054 | #include <asm/mpspec.h> | |
8055 | #include <asm/apic.h> | |
8056 | #ifdef CONFIG_X86_IO_APIC | |
8057 | @@ -30,8 +30,8 @@ | |
8058 | extern void smp_alloc_memory(void); | |
8059 | extern int pic_mode; | |
8060 | extern int smp_num_siblings; | |
8061 | -extern cpumask_t cpu_sibling_map[]; | |
8062 | -extern cpumask_t cpu_core_map[]; | |
8063 | +DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | |
8064 | +DECLARE_PER_CPU(cpumask_t, cpu_core_map); | |
8065 | ||
8066 | extern void (*mtrr_hook) (void); | |
8067 | extern void zap_low_mappings (void); | |
8068 | @@ -39,9 +39,11 @@ extern void lock_ipi_call_lock(void); | |
8069 | extern void unlock_ipi_call_lock(void); | |
8070 | ||
8071 | #define MAX_APICID 256 | |
8072 | -extern u8 x86_cpu_to_apicid[]; | |
8073 | +extern u8 __initdata x86_cpu_to_apicid_init[]; | |
8074 | +extern void *x86_cpu_to_apicid_ptr; | |
8075 | +DECLARE_PER_CPU(u8, x86_cpu_to_apicid); | |
8076 | ||
8077 | -#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] | |
8078 | +#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) | |
8079 | ||
8080 | #ifdef CONFIG_HOTPLUG_CPU | |
8081 | extern void cpu_exit_clear(void); | |
8082 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/smp_64.h 2008-12-15 11:27:22.000000000 +0100 | |
8083 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/smp_64.h 2009-02-16 16:18:36.000000000 +0100 | |
8084 | @@ -40,10 +40,19 @@ extern void lock_ipi_call_lock(void); | |
8085 | extern void unlock_ipi_call_lock(void); | |
8086 | extern int smp_num_siblings; | |
8087 | extern void smp_send_reschedule(int cpu); | |
8088 | +extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *), | |
8089 | + void *info, int wait); | |
8090 | ||
8091 | -extern cpumask_t cpu_sibling_map[NR_CPUS]; | |
8092 | -extern cpumask_t cpu_core_map[NR_CPUS]; | |
8093 | -extern u8 cpu_llc_id[NR_CPUS]; | |
8094 | +/* | |
8095 | + * cpu_sibling_map and cpu_core_map now live | |
8096 | + * in the per cpu area | |
8097 | + * | |
8098 | + * extern cpumask_t cpu_sibling_map[NR_CPUS]; | |
8099 | + * extern cpumask_t cpu_core_map[NR_CPUS]; | |
8100 | + */ | |
8101 | +DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | |
8102 | +DECLARE_PER_CPU(cpumask_t, cpu_core_map); | |
8103 | +DECLARE_PER_CPU(u8, cpu_llc_id); | |
8104 | ||
8105 | #define SMP_TRAMPOLINE_BASE 0x6000 | |
8106 | ||
8107 | @@ -70,6 +79,8 @@ extern unsigned __cpuinitdata disabled_c | |
8108 | ||
8109 | #endif /* CONFIG_SMP */ | |
8110 | ||
8111 | +#define safe_smp_processor_id() smp_processor_id() | |
8112 | + | |
8113 | #ifdef CONFIG_X86_LOCAL_APIC | |
8114 | static inline int hard_smp_processor_id(void) | |
8115 | { | |
8116 | @@ -82,8 +93,9 @@ static inline int hard_smp_processor_id( | |
8117 | * Some lowlevel functions might want to know about | |
8118 | * the real APIC ID <-> CPU # mapping. | |
8119 | */ | |
8120 | -extern u8 x86_cpu_to_apicid[NR_CPUS]; /* physical ID */ | |
8121 | -extern u8 x86_cpu_to_log_apicid[NR_CPUS]; | |
8122 | +extern u8 __initdata x86_cpu_to_apicid_init[]; | |
8123 | +extern void *x86_cpu_to_apicid_ptr; | |
8124 | +DECLARE_PER_CPU(u8, x86_cpu_to_apicid); /* physical ID */ | |
8125 | extern u8 bios_cpu_apicid[]; | |
8126 | ||
8127 | #ifdef CONFIG_X86_LOCAL_APIC | |
8128 | @@ -118,8 +130,9 @@ static __inline int logical_smp_processo | |
8129 | #endif | |
8130 | ||
8131 | #ifdef CONFIG_SMP | |
8132 | -#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] | |
8133 | +#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) | |
8134 | #else | |
8135 | +extern unsigned int boot_cpu_id; | |
8136 | #define cpu_physical_id(cpu) boot_cpu_id | |
8137 | #endif /* !CONFIG_SMP */ | |
8138 | #endif | |
8139 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
8140 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/swiotlb.h 2009-02-16 16:18:36.000000000 +0100 | |
8141 | @@ -0,0 +1,5 @@ | |
8142 | +#ifdef CONFIG_X86_32 | |
8143 | +# include "swiotlb_32.h" | |
8144 | +#else | |
8145 | +# include "../../swiotlb.h" | |
8146 | +#endif | |
8147 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
8148 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/system.h 2009-02-16 16:18:36.000000000 +0100 | |
8149 | @@ -0,0 +1,5 @@ | |
8150 | +#ifdef CONFIG_X86_32 | |
8151 | +# include "system_32.h" | |
8152 | +#else | |
8153 | +# include "system_64.h" | |
8154 | +#endif | |
8155 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/system_32.h 2009-02-16 16:17:21.000000000 +0100 | |
8156 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/system_32.h 2009-02-16 16:18:36.000000000 +0100 | |
8157 | @@ -9,6 +9,7 @@ | |
8158 | #include <asm/hypervisor.h> | |
8159 | ||
8160 | #ifdef __KERNEL__ | |
8161 | +#define AT_VECTOR_SIZE_ARCH 2 /* entries in ARCH_DLINFO */ | |
8162 | ||
8163 | struct task_struct; /* one of the stranger aspects of C forward declarations.. */ | |
8164 | extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next)); | |
8165 | @@ -138,7 +139,7 @@ static inline unsigned long xen_read_cr4 | |
8166 | { | |
8167 | unsigned long val; | |
8168 | /* This could fault if %cr4 does not exist */ | |
8169 | - asm("1: movl %%cr4, %0 \n" | |
8170 | + asm volatile("1: movl %%cr4, %0 \n" | |
8171 | "2: \n" | |
8172 | ".section __ex_table,\"a\" \n" | |
8173 | ".long 1b,2b \n" | |
8174 | @@ -157,6 +158,11 @@ static inline void xen_wbinvd(void) | |
8175 | asm volatile("wbinvd": : :"memory"); | |
8176 | } | |
8177 | ||
8178 | +static inline void clflush(volatile void *__p) | |
8179 | +{ | |
8180 | + asm volatile("clflush %0" : "+m" (*(char __force *)__p)); | |
8181 | +} | |
8182 | + | |
8183 | #define read_cr0() (xen_read_cr0()) | |
8184 | #define write_cr0(x) (xen_write_cr0(x)) | |
8185 | #define read_cr2() (xen_read_cr2()) | |
8186 | @@ -207,6 +213,7 @@ static inline unsigned long get_limit(un | |
8187 | ||
8188 | #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2) | |
8189 | #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2) | |
8190 | +#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM) | |
8191 | ||
8192 | /** | |
8193 | * read_barrier_depends - Flush all pending reads that subsequents reads | |
8194 | @@ -262,18 +269,18 @@ static inline unsigned long get_limit(un | |
8195 | ||
8196 | #define read_barrier_depends() do { } while(0) | |
8197 | ||
8198 | +#ifdef CONFIG_SMP | |
8199 | +#define smp_mb() mb() | |
8200 | +#ifdef CONFIG_X86_PPRO_FENCE | |
8201 | +# define smp_rmb() rmb() | |
8202 | +#else | |
8203 | +# define smp_rmb() barrier() | |
8204 | +#endif | |
8205 | #ifdef CONFIG_X86_OOSTORE | |
8206 | -/* Actually there are no OOO store capable CPUs for now that do SSE, | |
8207 | - but make it already an possibility. */ | |
8208 | -#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM) | |
8209 | +# define smp_wmb() wmb() | |
8210 | #else | |
8211 | -#define wmb() __asm__ __volatile__ ("": : :"memory") | |
8212 | +# define smp_wmb() barrier() | |
8213 | #endif | |
8214 | - | |
8215 | -#ifdef CONFIG_SMP | |
8216 | -#define smp_mb() mb() | |
8217 | -#define smp_rmb() rmb() | |
8218 | -#define smp_wmb() wmb() | |
8219 | #define smp_read_barrier_depends() read_barrier_depends() | |
8220 | #define set_mb(var, value) do { (void) xchg(&var, value); } while (0) | |
8221 | #else | |
8222 | @@ -300,5 +307,6 @@ extern unsigned long arch_align_stack(un | |
8223 | extern void free_init_pages(char *what, unsigned long begin, unsigned long end); | |
8224 | ||
8225 | void default_idle(void); | |
8226 | +void __show_registers(struct pt_regs *, int all); | |
8227 | ||
8228 | #endif | |
8229 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/system_64.h 2009-02-16 16:17:21.000000000 +0100 | |
8230 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/system_64.h 2009-02-16 16:18:36.000000000 +0100 | |
8231 | @@ -11,8 +11,12 @@ | |
8232 | ||
8233 | #ifdef __KERNEL__ | |
8234 | ||
8235 | -#define __STR(x) #x | |
8236 | -#define STR(x) __STR(x) | |
8237 | +/* entries in ARCH_DLINFO: */ | |
8238 | +#ifdef CONFIG_IA32_EMULATION | |
8239 | +# define AT_VECTOR_SIZE_ARCH 2 | |
8240 | +#else | |
8241 | +# define AT_VECTOR_SIZE_ARCH 1 | |
8242 | +#endif | |
8243 | ||
8244 | #define __SAVE(reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t" | |
8245 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" | |
8246 | @@ -92,7 +96,7 @@ static inline void write_cr0(unsigned lo | |
8247 | ||
8248 | #define read_cr3() ({ \ | |
8249 | unsigned long __dummy; \ | |
8250 | - asm("movq %%cr3,%0" : "=r" (__dummy)); \ | |
8251 | + asm volatile("movq %%cr3,%0" : "=r" (__dummy)); \ | |
8252 | machine_to_phys(__dummy); \ | |
8253 | }) | |
8254 | ||
8255 | @@ -105,7 +109,7 @@ static inline void write_cr3(unsigned lo | |
8256 | static inline unsigned long read_cr4(void) | |
8257 | { | |
8258 | unsigned long cr4; | |
8259 | - asm("movq %%cr4,%0" : "=r" (cr4)); | |
8260 | + asm volatile("movq %%cr4,%0" : "=r" (cr4)); | |
8261 | return cr4; | |
8262 | } | |
8263 | ||
8264 | @@ -131,12 +135,17 @@ static inline void write_cr8(unsigned lo | |
8265 | ||
8266 | #endif /* __KERNEL__ */ | |
8267 | ||
8268 | +static inline void clflush(volatile void *__p) | |
8269 | +{ | |
8270 | + asm volatile("clflush %0" : "+m" (*(char __force *)__p)); | |
8271 | +} | |
8272 | + | |
8273 | #define nop() __asm__ __volatile__ ("nop") | |
8274 | ||
8275 | #ifdef CONFIG_SMP | |
8276 | #define smp_mb() mb() | |
8277 | -#define smp_rmb() rmb() | |
8278 | -#define smp_wmb() wmb() | |
8279 | +#define smp_rmb() barrier() | |
8280 | +#define smp_wmb() barrier() | |
8281 | #define smp_read_barrier_depends() do {} while(0) | |
8282 | #else | |
8283 | #define smp_mb() barrier() | |
8284 | @@ -153,12 +162,8 @@ static inline void write_cr8(unsigned lo | |
8285 | */ | |
8286 | #define mb() asm volatile("mfence":::"memory") | |
8287 | #define rmb() asm volatile("lfence":::"memory") | |
8288 | - | |
8289 | -#ifdef CONFIG_UNORDERED_IO | |
8290 | #define wmb() asm volatile("sfence" ::: "memory") | |
8291 | -#else | |
8292 | -#define wmb() asm volatile("" ::: "memory") | |
8293 | -#endif | |
8294 | + | |
8295 | #define read_barrier_depends() do {} while(0) | |
8296 | #define set_mb(var, value) do { (void) xchg(&var, value); } while (0) | |
8297 | ||
8298 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
8299 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/tlbflush.h 2009-02-16 16:18:36.000000000 +0100 | |
8300 | @@ -0,0 +1,5 @@ | |
8301 | +#ifdef CONFIG_X86_32 | |
8302 | +# include "tlbflush_32.h" | |
8303 | +#else | |
8304 | +# include "tlbflush_64.h" | |
8305 | +#endif | |
8306 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/tlbflush_32.h 2009-02-16 16:17:21.000000000 +0100 | |
8307 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/tlbflush_32.h 2009-02-16 16:18:36.000000000 +0100 | |
8308 | @@ -23,7 +23,6 @@ | |
8309 | * - flush_tlb_page(vma, vmaddr) flushes one page | |
8310 | * - flush_tlb_range(vma, start, end) flushes a range of pages | |
8311 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | |
8312 | - * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables | |
8313 | * | |
8314 | * ..but the i386 has somewhat limited tlb flushing capabilities, | |
8315 | * and page-granular flushes are available only on i486 and up. | |
8316 | @@ -97,10 +96,4 @@ static inline void flush_tlb_kernel_rang | |
8317 | flush_tlb_all(); | |
8318 | } | |
8319 | ||
8320 | -static inline void flush_tlb_pgtables(struct mm_struct *mm, | |
8321 | - unsigned long start, unsigned long end) | |
8322 | -{ | |
8323 | - /* i386 does not keep any page table caches in TLB */ | |
8324 | -} | |
8325 | - | |
8326 | #endif /* _I386_TLBFLUSH_H */ | |
8327 | --- sle11-2009-06-29.orig/include/asm-x86/mach-xen/asm/tlbflush_64.h 2009-02-16 16:17:21.000000000 +0100 | |
8328 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/tlbflush_64.h 2009-02-16 16:18:36.000000000 +0100 | |
8329 | @@ -28,7 +28,6 @@ | |
8330 | * - flush_tlb_page(vma, vmaddr) flushes one page | |
8331 | * - flush_tlb_range(vma, start, end) flushes a range of pages | |
8332 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | |
8333 | - * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables | |
8334 | * | |
8335 | * x86-64 can only flush individual pages or full VMs. For a range flush | |
8336 | * we always do the full VM. Might be worth trying if for a small | |
8337 | @@ -95,12 +94,4 @@ static inline void flush_tlb_kernel_rang | |
8338 | flush_tlb_all(); | |
8339 | } | |
8340 | ||
8341 | -static inline void flush_tlb_pgtables(struct mm_struct *mm, | |
8342 | - unsigned long start, unsigned long end) | |
8343 | -{ | |
8344 | - /* x86_64 does not keep any page table caches in a software TLB. | |
8345 | - The CPUs do in their hardware TLBs, but they are handled | |
8346 | - by the normal TLB flushing algorithms. */ | |
8347 | -} | |
8348 | - | |
8349 | #endif /* _X8664_TLBFLUSH_H */ | |
8350 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
8351 | +++ sle11-2009-06-29/include/asm-x86/mach-xen/asm/xor.h 2009-02-16 16:18:36.000000000 +0100 | |
8352 | @@ -0,0 +1,5 @@ | |
8353 | +#ifdef CONFIG_X86_32 | |
8354 | +# include "../../xor_32.h" | |
8355 | +#else | |
8356 | +# include "xor_64.h" | |
8357 | +#endif | |
8358 | --- sle11-2009-06-29.orig/include/asm-x86/mmu.h 2009-06-29 15:14:52.000000000 +0200 | |
8359 | +++ sle11-2009-06-29/include/asm-x86/mmu.h 2009-02-16 16:18:36.000000000 +0100 | |
8360 | @@ -16,6 +16,9 @@ typedef struct { | |
8361 | rwlock_t ldtlock; | |
8362 | #endif | |
8363 | int size; | |
8364 | +#ifdef CONFIG_XEN | |
8365 | + unsigned has_foreign_mappings:1; | |
8366 | +#endif | |
8367 | struct mutex lock; | |
8368 | void *vdso; | |
8369 | } mm_context_t; | |
8370 | --- sle11-2009-06-29.orig/include/linux/kexec.h 2009-02-16 15:58:14.000000000 +0100 | |
8371 | +++ sle11-2009-06-29/include/linux/kexec.h 2009-02-17 12:43:57.000000000 +0100 | |
8372 | @@ -202,8 +202,15 @@ extern int dump_after_notifier; | |
8373 | #define VMCOREINFO_BYTES (4096) | |
8374 | #define VMCOREINFO_NOTE_NAME "VMCOREINFO" | |
8375 | #define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4) | |
8376 | +#if !defined(CONFIG_XEN) || !defined(CONFIG_X86) | |
8377 | #define VMCOREINFO_NOTE_SIZE (KEXEC_NOTE_HEAD_BYTES*2 + VMCOREINFO_BYTES \ | |
8378 | + VMCOREINFO_NOTE_NAME_BYTES) | |
8379 | +#else | |
8380 | +#define VMCOREINFO_NOTE_SIZE ALIGN(KEXEC_NOTE_HEAD_BYTES*2 \ | |
8381 | + + VMCOREINFO_BYTES \ | |
8382 | + + VMCOREINFO_NOTE_NAME_BYTES, \ | |
8383 | + PAGE_SIZE) | |
8384 | +#endif | |
8385 | ||
8386 | /* Location of a reserved region to hold the crash kernel. | |
8387 | */ | |
8388 | --- sle11-2009-06-29.orig/include/linux/oprofile.h 2009-06-29 15:28:01.000000000 +0200 | |
8389 | +++ sle11-2009-06-29/include/linux/oprofile.h 2009-06-29 15:28:57.000000000 +0200 | |
8390 | @@ -119,6 +119,8 @@ void oprofile_add_pc(unsigned long pc, i | |
8391 | /* add a backtrace entry, to be called from the ->backtrace callback */ | |
8392 | void oprofile_add_trace(unsigned long eip); | |
8393 | ||
8394 | +void oprofile_add_mode(int cpu_mode); | |
8395 | + | |
8396 | /* add a domain switch entry */ | |
8397 | int oprofile_add_domain_switch(int32_t domain_id); | |
8398 | ||
8399 | --- sle11-2009-06-29.orig/include/linux/sysctl.h 2009-06-29 15:14:52.000000000 +0200 | |
8400 | +++ sle11-2009-06-29/include/linux/sysctl.h 2009-02-16 16:18:36.000000000 +0100 | |
8401 | @@ -69,6 +69,7 @@ enum | |
8402 | CTL_BUS=8, /* Busses */ | |
8403 | CTL_ABI=9, /* Binary emulation */ | |
8404 | CTL_CPU=10, /* CPU stuff (speed scaling, etc) */ | |
8405 | + CTL_XEN=123, /* Xen info and control */ | |
8406 | CTL_ARLAN=254, /* arlan wireless driver */ | |
8407 | CTL_S390DBF=5677, /* s390 debug */ | |
8408 | CTL_SUNRPC=7249, /* sunrpc debug */ | |
8409 | --- sle11-2009-06-29.orig/include/xen/pcifront.h 2009-06-29 15:14:52.000000000 +0200 | |
8410 | +++ sle11-2009-06-29/include/xen/pcifront.h 2009-02-16 16:18:36.000000000 +0100 | |
8411 | @@ -12,13 +12,11 @@ | |
8412 | ||
8413 | #ifndef __ia64__ | |
8414 | ||
8415 | +#include <asm/pci.h> | |
8416 | + | |
8417 | struct pcifront_device; | |
8418 | struct pci_bus; | |
8419 | - | |
8420 | -struct pcifront_sd { | |
8421 | - int domain; | |
8422 | - struct pcifront_device *pdev; | |
8423 | -}; | |
8424 | +#define pcifront_sd pci_sysdata | |
8425 | ||
8426 | static inline struct pcifront_device * | |
8427 | pcifront_get_pdev(struct pcifront_sd *sd) | |
8428 | @@ -34,18 +32,6 @@ static inline void pcifront_init_sd(stru | |
8429 | sd->pdev = pdev; | |
8430 | } | |
8431 | ||
8432 | -#if defined(CONFIG_PCI_DOMAINS) | |
8433 | -static inline int pci_domain_nr(struct pci_bus *bus) | |
8434 | -{ | |
8435 | - struct pcifront_sd *sd = bus->sysdata; | |
8436 | - return sd->domain; | |
8437 | -} | |
8438 | -static inline int pci_proc_domain(struct pci_bus *bus) | |
8439 | -{ | |
8440 | - return pci_domain_nr(bus); | |
8441 | -} | |
8442 | -#endif /* CONFIG_PCI_DOMAINS */ | |
8443 | - | |
8444 | static inline void pcifront_setup_root_resources(struct pci_bus *bus, | |
8445 | struct pcifront_sd *sd) | |
8446 | { | |
8447 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
8448 | +++ sle11-2009-06-29/include/xen/sysctl.h 2009-02-16 16:18:36.000000000 +0100 | |
8449 | @@ -0,0 +1,11 @@ | |
8450 | +#ifndef _XEN_SYSCTL_H | |
8451 | +#define _XEN_SYSCTL_H | |
8452 | + | |
8453 | +/* CTL_XEN names: */ | |
8454 | +enum | |
8455 | +{ | |
8456 | + CTL_XEN_INDEPENDENT_WALLCLOCK=1, | |
8457 | + CTL_XEN_PERMITTED_CLOCK_JITTER=2, | |
8458 | +}; | |
8459 | + | |
8460 | +#endif /* _XEN_SYSCTL_H */ | |
8461 | --- sle11-2009-06-29.orig/include/xen/xenbus.h 2009-02-16 16:17:21.000000000 +0100 | |
8462 | +++ sle11-2009-06-29/include/xen/xenbus.h 2009-02-16 16:18:36.000000000 +0100 | |
8463 | @@ -107,7 +107,7 @@ struct xenbus_driver { | |
8464 | int (*suspend)(struct xenbus_device *dev); | |
8465 | int (*suspend_cancel)(struct xenbus_device *dev); | |
8466 | int (*resume)(struct xenbus_device *dev); | |
8467 | - int (*uevent)(struct xenbus_device *, char **, int, char *, int); | |
8468 | + int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); | |
8469 | struct device_driver driver; | |
8470 | int (*read_otherend_details)(struct xenbus_device *dev); | |
8471 | int (*is_ready)(struct xenbus_device *dev); | |
8472 | --- sle11-2009-06-29.orig/kernel/kexec.c 2009-02-17 11:34:22.000000000 +0100 | |
8473 | +++ sle11-2009-06-29/kernel/kexec.c 2009-02-17 12:38:20.000000000 +0100 | |
8474 | @@ -52,7 +52,11 @@ int dump_after_notifier; | |
8475 | ||
8476 | /* vmcoreinfo stuff */ | |
8477 | unsigned char vmcoreinfo_data[VMCOREINFO_BYTES]; | |
8478 | -u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; | |
8479 | +u32 | |
8480 | +#if defined(CONFIG_XEN) && defined(CONFIG_X86) | |
8481 | +__attribute__((__section__(".bss.page_aligned"), __aligned__(PAGE_SIZE))) | |
8482 | +#endif | |
8483 | +vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; | |
8484 | size_t vmcoreinfo_size; | |
8485 | size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data); | |
8486 | ||
8487 | @@ -1240,6 +1244,7 @@ static int __init crash_notes_memory_ini | |
8488 | module_init(crash_notes_memory_init) | |
8489 | ||
8490 | ||
8491 | +#ifndef CONFIG_XEN | |
8492 | /* | |
8493 | * parsing the "crashkernel" commandline | |
8494 | * | |
8495 | @@ -1402,7 +1407,7 @@ int __init parse_crashkernel(char *cm | |
8496 | ||
8497 | return 0; | |
8498 | } | |
8499 | - | |
8500 | +#endif | |
8501 | ||
8502 | ||
8503 | void crash_save_vmcoreinfo(void) | |
8504 | @@ -1459,7 +1464,18 @@ static int __init crash_save_vmcoreinfo_ | |
8505 | ||
8506 | VMCOREINFO_SYMBOL(init_uts_ns); | |
8507 | VMCOREINFO_SYMBOL(node_online_map); | |
8508 | +#ifndef CONFIG_X86_XEN | |
8509 | VMCOREINFO_SYMBOL(swapper_pg_dir); | |
8510 | +#else | |
8511 | +/* | |
8512 | + * Since for x86-32 Xen swapper_pg_dir is a pointer rather than an array, | |
8513 | + * make the value stored consistent with native (i.e. the base address of | |
8514 | + * the page directory). | |
8515 | + */ | |
8516 | +# define swapper_pg_dir *swapper_pg_dir | |
8517 | + VMCOREINFO_SYMBOL(swapper_pg_dir); | |
8518 | +# undef swapper_pg_dir | |
8519 | +#endif | |
8520 | VMCOREINFO_SYMBOL(_stext); | |
8521 | ||
8522 | #ifndef CONFIG_NEED_MULTIPLE_NODES | |
8523 | --- sle11-2009-06-29.orig/kernel/sysctl_check.c 2009-06-29 15:14:52.000000000 +0200 | |
8524 | +++ sle11-2009-06-29/kernel/sysctl_check.c 2009-02-16 16:18:36.000000000 +0100 | |
8525 | @@ -4,6 +4,7 @@ | |
8526 | #include <linux/sunrpc/debug.h> | |
8527 | #include <linux/string.h> | |
8528 | #include <net/ip_vs.h> | |
8529 | +#include <xen/sysctl.h> | |
8530 | ||
8531 | struct trans_ctl_table { | |
8532 | int ctl_name; | |
8533 | @@ -897,6 +898,14 @@ static const struct trans_ctl_table tran | |
8534 | {} | |
8535 | }; | |
8536 | ||
8537 | +#ifdef CONFIG_XEN | |
8538 | +static struct trans_ctl_table trans_xen_table[] = { | |
8539 | + { CTL_XEN_INDEPENDENT_WALLCLOCK, "independent_wallclock" }, | |
8540 | + { CTL_XEN_PERMITTED_CLOCK_JITTER, "permitted_clock_jitter" }, | |
8541 | + {} | |
8542 | +}; | |
8543 | +#endif | |
8544 | + | |
8545 | static const struct trans_ctl_table trans_arlan_conf_table0[] = { | |
8546 | { 1, "spreadingCode" }, | |
8547 | { 2, "channelNumber" }, | |
8548 | @@ -1232,6 +1241,9 @@ static const struct trans_ctl_table tran | |
8549 | { CTL_BUS, "bus", trans_bus_table }, | |
8550 | { CTL_ABI, "abi" }, | |
8551 | /* CTL_CPU not used */ | |
8552 | +#ifdef CONFIG_XEN | |
8553 | + { CTL_XEN, "xen", trans_xen_table }, | |
8554 | +#endif | |
8555 | { CTL_ARLAN, "arlan", trans_arlan_table }, | |
8556 | { CTL_S390DBF, "s390dbf", trans_s390dbf_table }, | |
8557 | { CTL_SUNRPC, "sunrpc", trans_sunrpc_table }, | |
8558 | --- sle11-2009-06-29.orig/lib/swiotlb-xen.c 2009-02-05 11:16:51.000000000 +0100 | |
8559 | +++ sle11-2009-06-29/lib/swiotlb-xen.c 2009-02-16 16:18:36.000000000 +0100 | |
8560 | @@ -27,7 +27,7 @@ | |
8561 | #include <asm/uaccess.h> | |
8562 | #include <xen/gnttab.h> | |
8563 | #include <xen/interface/memory.h> | |
8564 | -#include <asm-i386/mach-xen/asm/gnttab_dma.h> | |
8565 | +#include <asm/gnttab_dma.h> | |
8566 | ||
8567 | int swiotlb; | |
8568 | EXPORT_SYMBOL(swiotlb); | |
8569 | @@ -574,9 +574,10 @@ swiotlb_sync_single_for_device(struct de | |
8570 | * same here. | |
8571 | */ | |
8572 | int | |
8573 | -swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems, | |
8574 | +swiotlb_map_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, | |
8575 | int dir) | |
8576 | { | |
8577 | + struct scatterlist *sg; | |
8578 | struct phys_addr buffer; | |
8579 | dma_addr_t dev_addr; | |
8580 | char *map; | |
8581 | @@ -584,22 +585,22 @@ swiotlb_map_sg(struct device *hwdev, str | |
8582 | ||
8583 | BUG_ON(dir == DMA_NONE); | |
8584 | ||
8585 | - for (i = 0; i < nelems; i++, sg++) { | |
8586 | - dev_addr = gnttab_dma_map_page(sg->page) + sg->offset; | |
8587 | + for_each_sg(sgl, sg, nelems, i) { | |
8588 | + dev_addr = gnttab_dma_map_page(sg_page(sg)) + sg->offset; | |
8589 | ||
8590 | - if (range_straddles_page_boundary(page_to_pseudophys(sg->page) | |
8591 | + if (range_straddles_page_boundary(page_to_pseudophys(sg_page(sg)) | |
8592 | + sg->offset, sg->length) | |
8593 | || address_needs_mapping(hwdev, dev_addr)) { | |
8594 | gnttab_dma_unmap_page(dev_addr); | |
8595 | - buffer.page = sg->page; | |
8596 | + buffer.page = sg_page(sg); | |
8597 | buffer.offset = sg->offset; | |
8598 | map = map_single(hwdev, buffer, sg->length, dir); | |
8599 | if (!map) { | |
8600 | /* Don't panic here, we expect map_sg users | |
8601 | to do proper error handling. */ | |
8602 | swiotlb_full(hwdev, sg->length, dir, 0); | |
8603 | - swiotlb_unmap_sg(hwdev, sg - i, i, dir); | |
8604 | - sg[0].dma_length = 0; | |
8605 | + swiotlb_unmap_sg(hwdev, sgl, i, dir); | |
8606 | + sgl[0].dma_length = 0; | |
8607 | return 0; | |
8608 | } | |
8609 | sg->dma_address = virt_to_bus(map); | |
8610 | @@ -615,19 +616,21 @@ swiotlb_map_sg(struct device *hwdev, str | |
8611 | * concerning calls here are the same as for swiotlb_unmap_single() above. | |
8612 | */ | |
8613 | void | |
8614 | -swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nelems, | |
8615 | +swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, | |
8616 | int dir) | |
8617 | { | |
8618 | + struct scatterlist *sg; | |
8619 | int i; | |
8620 | ||
8621 | BUG_ON(dir == DMA_NONE); | |
8622 | ||
8623 | - for (i = 0; i < nelems; i++, sg++) | |
8624 | + for_each_sg(sgl, sg, nelems, i) { | |
8625 | if (in_swiotlb_aperture(sg->dma_address)) | |
8626 | unmap_single(hwdev, bus_to_virt(sg->dma_address), | |
8627 | sg->dma_length, dir); | |
8628 | else | |
8629 | gnttab_dma_unmap_page(sg->dma_address); | |
8630 | + } | |
8631 | } | |
8632 | ||
8633 | /* | |
8634 | @@ -638,31 +641,35 @@ swiotlb_unmap_sg(struct device *hwdev, s | |
8635 | * and usage. | |
8636 | */ | |
8637 | void | |
8638 | -swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, | |
8639 | +swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sgl, | |
8640 | int nelems, int dir) | |
8641 | { | |
8642 | + struct scatterlist *sg; | |
8643 | int i; | |
8644 | ||
8645 | BUG_ON(dir == DMA_NONE); | |
8646 | ||
8647 | - for (i = 0; i < nelems; i++, sg++) | |
8648 | + for_each_sg(sgl, sg, nelems, i) { | |
8649 | if (in_swiotlb_aperture(sg->dma_address)) | |
8650 | sync_single(hwdev, bus_to_virt(sg->dma_address), | |
8651 | sg->dma_length, dir); | |
8652 | + } | |
8653 | } | |
8654 | ||
8655 | void | |
8656 | -swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, | |
8657 | +swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sgl, | |
8658 | int nelems, int dir) | |
8659 | { | |
8660 | + struct scatterlist *sg; | |
8661 | int i; | |
8662 | ||
8663 | BUG_ON(dir == DMA_NONE); | |
8664 | ||
8665 | - for (i = 0; i < nelems; i++, sg++) | |
8666 | + for_each_sg(sgl, sg, nelems, i) { | |
8667 | if (in_swiotlb_aperture(sg->dma_address)) | |
8668 | sync_single(hwdev, bus_to_virt(sg->dma_address), | |
8669 | sg->dma_length, dir); | |
8670 | + } | |
8671 | } | |
8672 | ||
8673 | #ifdef CONFIG_HIGHMEM |