]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.xen/xen3-patch-2.6.23
Add a patch to fix Intel E100 wake-on-lan problems.
[ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.xen / xen3-patch-2.6.23
1 From: www.kernel.org
2 Subject: Update to 2.6.23
3 Patch-mainline: 2.6.23
4
5 Automatically created from "patches.kernel.org/patch-2.6.23" by xen-port-patches.py
6
7 Acked-by: jbeulich@novell.com
8
9 --- sle11-2009-05-14.orig/arch/x86/Makefile 2008-12-01 11:11:08.000000000 +0100
10 +++ sle11-2009-05-14/arch/x86/Makefile 2009-02-16 16:17:21.000000000 +0100
11 @@ -148,7 +148,7 @@ libs-y += arch/x86/lib/
12 core-y += $(fcore-y)
13
14 # Xen paravirtualization support
15 -core-$(CONFIG_XEN) += arch/x86/xen/
16 +core-$(CONFIG_PARAVIRT_XEN) += arch/x86/xen/
17
18 # lguest paravirtualization support
19 core-$(CONFIG_LGUEST_GUEST) += arch/x86/lguest/
20 --- sle11-2009-05-14.orig/arch/x86/kernel/acpi/sleep_32-xen.c 2009-05-14 10:56:29.000000000 +0200
21 +++ sle11-2009-05-14/arch/x86/kernel/acpi/sleep_32-xen.c 2009-02-16 16:17:21.000000000 +0100
22 @@ -15,7 +15,7 @@
23 #ifndef CONFIG_ACPI_PV_SLEEP
24 /* address in low memory of the wakeup routine. */
25 unsigned long acpi_wakeup_address = 0;
26 -unsigned long acpi_video_flags;
27 +unsigned long acpi_realmode_flags;
28 extern char wakeup_start, wakeup_end;
29
30 extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
31 @@ -74,9 +74,11 @@ static int __init acpi_sleep_setup(char
32 {
33 while ((str != NULL) && (*str != '\0')) {
34 if (strncmp(str, "s3_bios", 7) == 0)
35 - acpi_video_flags = 1;
36 + acpi_realmode_flags |= 1;
37 if (strncmp(str, "s3_mode", 7) == 0)
38 - acpi_video_flags |= 2;
39 + acpi_realmode_flags |= 2;
40 + if (strncmp(str, "s3_beep", 7) == 0)
41 + acpi_realmode_flags |= 4;
42 str = strchr(str, ',');
43 if (str != NULL)
44 str += strspn(str, ", \t");
45 @@ -86,9 +88,11 @@ static int __init acpi_sleep_setup(char
46
47 __setup("acpi_sleep=", acpi_sleep_setup);
48
49 +/* Ouch, we want to delete this. We already have better version in userspace, in
50 + s2ram from suspend.sf.net project */
51 static __init int reset_videomode_after_s3(struct dmi_system_id *d)
52 {
53 - acpi_video_flags |= 2;
54 + acpi_realmode_flags |= 2;
55 return 0;
56 }
57
58 --- sle11-2009-05-14.orig/arch/x86/kernel/asm-offsets_32.c 2008-12-15 11:27:22.000000000 +0100
59 +++ sle11-2009-05-14/arch/x86/kernel/asm-offsets_32.c 2009-02-16 16:17:21.000000000 +0100
60 @@ -19,7 +19,9 @@
61 #include <asm/bootparam.h>
62 #include <asm/elf.h>
63
64 +#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN)
65 #include <xen/interface/xen.h>
66 +#endif
67
68 #include <linux/lguest.h>
69 #include "../../../drivers/lguest/lg.h"
70 @@ -121,7 +123,7 @@ void foo(void)
71 OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
72 #endif
73
74 -#ifdef CONFIG_XEN
75 +#ifdef CONFIG_PARAVIRT_XEN
76 BLANK();
77 OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
78 OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
79 --- sle11-2009-05-14.orig/arch/x86/kernel/cpu/common-xen.c 2008-12-15 11:27:22.000000000 +0100
80 +++ sle11-2009-05-14/arch/x86/kernel/cpu/common-xen.c 2009-02-16 16:17:21.000000000 +0100
81 @@ -360,6 +360,8 @@ static void __cpuinit generic_identify(s
82 if ( xlvl >= 0x80000004 )
83 get_model_name(c); /* Default name */
84 }
85 +
86 + init_scattered_cpuid_features(c);
87 }
88
89 early_intel_workaround(c);
90 @@ -611,7 +613,6 @@ extern int nsc_init_cpu(void);
91 extern int amd_init_cpu(void);
92 extern int centaur_init_cpu(void);
93 extern int transmeta_init_cpu(void);
94 -extern int rise_init_cpu(void);
95 extern int nexgen_init_cpu(void);
96 extern int umc_init_cpu(void);
97
98 @@ -623,7 +624,6 @@ void __init early_cpu_init(void)
99 amd_init_cpu();
100 centaur_init_cpu();
101 transmeta_init_cpu();
102 - rise_init_cpu();
103 nexgen_init_cpu();
104 umc_init_cpu();
105 early_cpu_detect();
106 --- sle11-2009-05-14.orig/arch/x86/kernel/cpu/mtrr/main-xen.c 2008-12-15 11:27:22.000000000 +0100
107 +++ sle11-2009-05-14/arch/x86/kernel/cpu/mtrr/main-xen.c 2009-02-16 16:17:21.000000000 +0100
108 @@ -167,7 +167,7 @@ mtrr_del(int reg, unsigned long base, un
109 EXPORT_SYMBOL(mtrr_add);
110 EXPORT_SYMBOL(mtrr_del);
111
112 -__init void mtrr_bp_init(void)
113 +void __init mtrr_bp_init(void)
114 {
115 }
116
117 --- sle11-2009-05-14.orig/arch/x86/kernel/e820_32-xen.c 2008-12-15 11:27:22.000000000 +0100
118 +++ sle11-2009-05-14/arch/x86/kernel/e820_32-xen.c 2009-02-16 16:17:21.000000000 +0100
119 @@ -10,6 +10,7 @@
120 #include <linux/efi.h>
121 #include <linux/pfn.h>
122 #include <linux/uaccess.h>
123 +#include <linux/suspend.h>
124
125 #include <asm/pgtable.h>
126 #include <asm/page.h>
127 @@ -343,6 +344,37 @@ static int __init request_standard_resou
128
129 subsys_initcall(request_standard_resources);
130
131 +#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
132 +/**
133 + * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
134 + * correspond to e820 RAM areas and mark the corresponding pages as nosave for
135 + * hibernation.
136 + *
137 + * This function requires the e820 map to be sorted and without any
138 + * overlapping entries and assumes the first e820 area to be RAM.
139 + */
140 +void __init e820_mark_nosave_regions(void)
141 +{
142 + int i;
143 + unsigned long pfn;
144 +
145 + pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
146 + for (i = 1; i < e820.nr_map; i++) {
147 + struct e820entry *ei = &e820.map[i];
148 +
149 + if (pfn < PFN_UP(ei->addr))
150 + register_nosave_region(pfn, PFN_UP(ei->addr));
151 +
152 + pfn = PFN_DOWN(ei->addr + ei->size);
153 + if (ei->type != E820_RAM)
154 + register_nosave_region(PFN_UP(ei->addr), pfn);
155 +
156 + if (pfn >= max_low_pfn)
157 + break;
158 + }
159 +}
160 +#endif
161 +
162 void __init add_memory_region(unsigned long long start,
163 unsigned long long size, int type)
164 {
165 @@ -804,7 +836,7 @@ void __init print_memory_map(char *who)
166 case E820_NVS:
167 printk("(ACPI NVS)\n");
168 break;
169 - default: printk("type %lu\n", e820.map[i].type);
170 + default: printk("type %u\n", e820.map[i].type);
171 break;
172 }
173 }
174 --- sle11-2009-05-14.orig/arch/x86/kernel/entry_32.S 2008-11-25 12:35:53.000000000 +0100
175 +++ sle11-2009-05-14/arch/x86/kernel/entry_32.S 2009-02-16 16:17:21.000000000 +0100
176 @@ -1112,7 +1112,7 @@ ENTRY(kernel_thread_helper)
177 CFI_ENDPROC
178 ENDPROC(kernel_thread_helper)
179
180 -#ifdef CONFIG_XEN
181 +#ifdef CONFIG_PARAVIRT_XEN
182 /* Xen doesn't set %esp to be precisely what the normal sysenter
183 entrypoint expects, so fix it up before using the normal path. */
184 ENTRY(xen_sysenter_target)
185 @@ -1205,7 +1205,7 @@ ENTRY(xen_failsafe_callback)
186 .previous
187 ENDPROC(xen_failsafe_callback)
188
189 -#endif /* CONFIG_XEN */
190 +#endif /* CONFIG_PARAVIRT_XEN */
191
192 #ifdef CONFIG_FTRACE
193 #ifdef CONFIG_DYNAMIC_FTRACE
194 --- sle11-2009-05-14.orig/arch/x86/kernel/entry_32-xen.S 2008-12-15 11:27:22.000000000 +0100
195 +++ sle11-2009-05-14/arch/x86/kernel/entry_32-xen.S 2009-02-16 16:17:21.000000000 +0100
196 @@ -452,9 +452,6 @@ restore_nocheck_notrace:
197 1: INTERRUPT_RETURN
198 .section .fixup,"ax"
199 iret_exc:
200 -#ifndef CONFIG_XEN
201 - ENABLE_INTERRUPTS(CLBR_NONE)
202 -#endif
203 pushl $0 # no error code
204 pushl $do_iret_error
205 jmp error_code
206 --- sle11-2009-05-14.orig/arch/x86/kernel/head_32-xen.S 2008-12-15 11:27:22.000000000 +0100
207 +++ sle11-2009-05-14/arch/x86/kernel/head_32-xen.S 2009-02-16 16:17:21.000000000 +0100
208 @@ -86,7 +86,10 @@ ENTRY(_stext)
209 /*
210 * BSS section
211 */
212 -.section ".bss.page_aligned","w"
213 +.section ".bss.page_aligned","wa"
214 + .align PAGE_SIZE_asm
215 +ENTRY(swapper_pg_pmd)
216 + .fill 1024,4,0
217 ENTRY(empty_zero_page)
218 .fill 4096,1,0
219
220 @@ -136,25 +139,25 @@ ENTRY(empty_zero_page)
221 #endif /* CONFIG_XEN_COMPAT <= 0x030002 */
222
223
224 - ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux")
225 - ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6")
226 - ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0")
227 - ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long, __PAGE_OFFSET)
228 + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
229 + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
230 + ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")
231 + ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long __PAGE_OFFSET)
232 #if CONFIG_XEN_COMPAT <= 0x030002
233 - ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, __PAGE_OFFSET)
234 + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long __PAGE_OFFSET)
235 #else
236 - ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, 0)
237 + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long 0)
238 #endif
239 - ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, startup_32)
240 - ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page)
241 - ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long, HYPERVISOR_VIRT_START)
242 - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
243 + ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long startup_32)
244 + ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long hypercall_page)
245 + ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long HYPERVISOR_VIRT_START)
246 + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
247 #ifdef CONFIG_X86_PAE
248 - ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes")
249 - ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT)
250 + ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes")
251 + ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad _PAGE_PRESENT, _PAGE_PRESENT)
252 #else
253 - ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "no")
254 - ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .long, _PAGE_PRESENT,_PAGE_PRESENT)
255 + ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "no")
256 + ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .long _PAGE_PRESENT, _PAGE_PRESENT)
257 #endif
258 - ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic")
259 - ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1)
260 + ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
261 + ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
262 --- sle11-2009-05-14.orig/arch/x86/kernel/init_task-xen.c 2009-05-14 10:56:29.000000000 +0200
263 +++ sle11-2009-05-14/arch/x86/kernel/init_task-xen.c 2009-02-16 16:17:21.000000000 +0100
264 @@ -46,6 +46,6 @@ EXPORT_SYMBOL(init_task);
265 * per-CPU TSS segments. Threads are completely 'soft' on Linux,
266 * no more per-task TSS's.
267 */
268 -DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS;
269 +DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS;
270 #endif
271
272 --- sle11-2009-05-14.orig/arch/x86/kernel/io_apic_32-xen.c 2008-12-15 11:27:22.000000000 +0100
273 +++ sle11-2009-05-14/arch/x86/kernel/io_apic_32-xen.c 2009-02-16 16:17:21.000000000 +0100
274 @@ -402,14 +402,6 @@ static void set_ioapic_affinity_irq(unsi
275 # include <linux/slab.h> /* kmalloc() */
276 # include <linux/timer.h> /* time_after() */
277
278 -#ifdef CONFIG_BALANCED_IRQ_DEBUG
279 -# define TDprintk(x...) do { printk("<%ld:%s:%d>: ", jiffies, __FILE__, __LINE__); printk(x); } while (0)
280 -# define Dprintk(x...) do { TDprintk(x); } while (0)
281 -# else
282 -# define TDprintk(x...)
283 -# define Dprintk(x...)
284 -# endif
285 -
286 #define IRQBALANCE_CHECK_ARCH -999
287 #define MAX_BALANCED_IRQ_INTERVAL (5*HZ)
288 #define MIN_BALANCED_IRQ_INTERVAL (HZ/2)
289 @@ -492,7 +484,7 @@ static inline void balance_irq(int cpu,
290 static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold)
291 {
292 int i, j;
293 - Dprintk("Rotating IRQs among CPUs.\n");
294 +
295 for_each_online_cpu(i) {
296 for (j = 0; j < NR_IRQS; j++) {
297 if (!irq_desc[j].action)
298 @@ -609,19 +601,11 @@ tryanothercpu:
299 max_loaded = tmp_loaded; /* processor */
300 imbalance = (max_cpu_irq - min_cpu_irq) / 2;
301
302 - Dprintk("max_loaded cpu = %d\n", max_loaded);
303 - Dprintk("min_loaded cpu = %d\n", min_loaded);
304 - Dprintk("max_cpu_irq load = %ld\n", max_cpu_irq);
305 - Dprintk("min_cpu_irq load = %ld\n", min_cpu_irq);
306 - Dprintk("load imbalance = %lu\n", imbalance);
307 -
308 /* if imbalance is less than approx 10% of max load, then
309 * observe diminishing returns action. - quit
310 */
311 - if (imbalance < (max_cpu_irq >> 3)) {
312 - Dprintk("Imbalance too trivial\n");
313 + if (imbalance < (max_cpu_irq >> 3))
314 goto not_worth_the_effort;
315 - }
316
317 tryanotherirq:
318 /* if we select an IRQ to move that can't go where we want, then
319 @@ -678,9 +662,6 @@ tryanotherirq:
320 cpus_and(tmp, target_cpu_mask, allowed_mask);
321
322 if (!cpus_empty(tmp)) {
323 -
324 - Dprintk("irq = %d moved to cpu = %d\n",
325 - selected_irq, min_loaded);
326 /* mark for change destination */
327 set_pending_irq(selected_irq, cpumask_of_cpu(min_loaded));
328
329 @@ -700,7 +681,6 @@ not_worth_the_effort:
330 */
331 balanced_irq_interval = min((long)MAX_BALANCED_IRQ_INTERVAL,
332 balanced_irq_interval + BALANCED_IRQ_MORE_DELTA);
333 - Dprintk("IRQ worth rotating not found\n");
334 return;
335 }
336
337 @@ -716,6 +696,7 @@ static int balanced_irq(void *unused)
338 set_pending_irq(i, cpumask_of_cpu(0));
339 }
340
341 + set_freezable();
342 for ( ; ; ) {
343 time_remaining = schedule_timeout_interruptible(time_remaining);
344 try_to_freeze();
345 @@ -825,14 +806,6 @@ static int pirq_entries [MAX_PIRQS];
346 static int pirqs_enabled;
347 int skip_ioapic_setup;
348
349 -static int __init ioapic_setup(char *str)
350 -{
351 - skip_ioapic_setup = 1;
352 - return 1;
353 -}
354 -
355 -__setup("noapic", ioapic_setup);
356 -
357 static int __init ioapic_pirq_setup(char *str)
358 {
359 int i, max;
360 @@ -1323,12 +1296,15 @@ static struct irq_chip ioapic_chip;
361 static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
362 {
363 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
364 - trigger == IOAPIC_LEVEL)
365 + trigger == IOAPIC_LEVEL) {
366 + irq_desc[irq].status |= IRQ_LEVEL;
367 set_irq_chip_and_handler_name(irq, &ioapic_chip,
368 handle_fasteoi_irq, "fasteoi");
369 - else
370 + } else {
371 + irq_desc[irq].status &= ~IRQ_LEVEL;
372 set_irq_chip_and_handler_name(irq, &ioapic_chip,
373 handle_edge_irq, "edge");
374 + }
375 set_intr_gate(vector, interrupt[irq]);
376 }
377 #else
378 @@ -1957,7 +1933,7 @@ __setup("no_timer_check", notimercheck);
379 * - if this function detects that timer IRQs are defunct, then we fall
380 * back to ISA timer IRQs
381 */
382 -int __init timer_irq_works(void)
383 +static int __init timer_irq_works(void)
384 {
385 unsigned long t1 = jiffies;
386
387 --- sle11-2009-05-14.orig/arch/x86/kernel/irq_32-xen.c 2008-12-15 11:27:22.000000000 +0100
388 +++ sle11-2009-05-14/arch/x86/kernel/irq_32-xen.c 2009-02-16 16:17:21.000000000 +0100
389 @@ -21,7 +21,7 @@
390 #include <asm/apic.h>
391 #include <asm/uaccess.h>
392
393 -DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_internodealigned_in_smp;
394 +DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
395 EXPORT_PER_CPU_SYMBOL(irq_stat);
396
397 DEFINE_PER_CPU(struct pt_regs *, irq_regs);
398 @@ -149,15 +149,11 @@ fastcall unsigned int do_IRQ(struct pt_r
399
400 #ifdef CONFIG_4KSTACKS
401
402 -/*
403 - * These should really be __section__(".bss.page_aligned") as well, but
404 - * gcc's 3.0 and earlier don't handle that correctly.
405 - */
406 static char softirq_stack[NR_CPUS * THREAD_SIZE]
407 - __attribute__((__aligned__(THREAD_SIZE)));
408 + __attribute__((__section__(".bss.page_aligned")));
409
410 static char hardirq_stack[NR_CPUS * THREAD_SIZE]
411 - __attribute__((__aligned__(THREAD_SIZE)));
412 + __attribute__((__section__(".bss.page_aligned")));
413
414 /*
415 * allocate per-cpu stacks for hardirq and for softirq processing
416 --- sle11-2009-05-14.orig/arch/x86/kernel/microcode-xen.c 2008-12-15 11:27:22.000000000 +0100
417 +++ sle11-2009-05-14/arch/x86/kernel/microcode-xen.c 2009-02-16 16:17:21.000000000 +0100
418 @@ -33,6 +33,7 @@
419 #include <linux/miscdevice.h>
420 #include <linux/spinlock.h>
421 #include <linux/mm.h>
422 +#include <linux/fs.h>
423 #include <linux/mutex.h>
424 #include <linux/cpu.h>
425 #include <linux/firmware.h>
426 --- sle11-2009-05-14.orig/arch/x86/kernel/pci-dma-xen.c 2008-12-15 11:27:22.000000000 +0100
427 +++ sle11-2009-05-14/arch/x86/kernel/pci-dma-xen.c 2009-02-16 16:17:21.000000000 +0100
428 @@ -24,7 +24,7 @@
429 #include <asm/bug.h>
430
431 #ifdef __x86_64__
432 -#include <asm/proto.h>
433 +#include <asm/iommu.h>
434
435 int iommu_merge __read_mostly = 0;
436 EXPORT_SYMBOL(iommu_merge);
437 --- sle11-2009-05-14.orig/arch/x86/kernel/process_32-xen.c 2008-12-15 11:27:22.000000000 +0100
438 +++ sle11-2009-05-14/arch/x86/kernel/process_32-xen.c 2009-02-16 16:17:21.000000000 +0100
439 @@ -241,6 +241,7 @@ early_param("idle", idle_setup);
440 void show_regs(struct pt_regs * regs)
441 {
442 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
443 + unsigned long d0, d1, d2, d3, d6, d7;
444
445 printk("\n");
446 printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
447 @@ -265,6 +266,17 @@ void show_regs(struct pt_regs * regs)
448 cr3 = read_cr3();
449 cr4 = read_cr4_safe();
450 printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
451 +
452 + get_debugreg(d0, 0);
453 + get_debugreg(d1, 1);
454 + get_debugreg(d2, 2);
455 + get_debugreg(d3, 3);
456 + printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
457 + d0, d1, d2, d3);
458 + get_debugreg(d6, 6);
459 + get_debugreg(d7, 7);
460 + printk("DR6: %08lx DR7: %08lx\n", d6, d7);
461 +
462 show_trace(NULL, regs, &regs->esp);
463 }
464
465 @@ -473,7 +485,30 @@ int dump_task_regs(struct task_struct *t
466 return 1;
467 }
468
469 -static noinline void __switch_to_xtra(struct task_struct *next_p)
470 +#ifdef CONFIG_SECCOMP
471 +void hard_disable_TSC(void)
472 +{
473 + write_cr4(read_cr4() | X86_CR4_TSD);
474 +}
475 +void disable_TSC(void)
476 +{
477 + preempt_disable();
478 + if (!test_and_set_thread_flag(TIF_NOTSC))
479 + /*
480 + * Must flip the CPU state synchronously with
481 + * TIF_NOTSC in the current running context.
482 + */
483 + hard_disable_TSC();
484 + preempt_enable();
485 +}
486 +void hard_enable_TSC(void)
487 +{
488 + write_cr4(read_cr4() & ~X86_CR4_TSD);
489 +}
490 +#endif /* CONFIG_SECCOMP */
491 +
492 +static noinline void
493 +__switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p)
494 {
495 struct thread_struct *next;
496
497 @@ -488,33 +523,17 @@ static noinline void __switch_to_xtra(st
498 set_debugreg(next->debugreg[6], 6);
499 set_debugreg(next->debugreg[7], 7);
500 }
501 -}
502
503 -/*
504 - * This function selects if the context switch from prev to next
505 - * has to tweak the TSC disable bit in the cr4.
506 - */
507 -static inline void disable_tsc(struct task_struct *prev_p,
508 - struct task_struct *next_p)
509 -{
510 - struct thread_info *prev, *next;
511 -
512 - /*
513 - * gcc should eliminate the ->thread_info dereference if
514 - * has_secure_computing returns 0 at compile time (SECCOMP=n).
515 - */
516 - prev = task_thread_info(prev_p);
517 - next = task_thread_info(next_p);
518 -
519 - if (has_secure_computing(prev) || has_secure_computing(next)) {
520 - /* slow path here */
521 - if (has_secure_computing(prev) &&
522 - !has_secure_computing(next)) {
523 - write_cr4(read_cr4() & ~X86_CR4_TSD);
524 - } else if (!has_secure_computing(prev) &&
525 - has_secure_computing(next))
526 - write_cr4(read_cr4() | X86_CR4_TSD);
527 +#ifdef CONFIG_SECCOMP
528 + if (test_tsk_thread_flag(prev_p, TIF_NOTSC) ^
529 + test_tsk_thread_flag(next_p, TIF_NOTSC)) {
530 + /* prev and next are different */
531 + if (test_tsk_thread_flag(next_p, TIF_NOTSC))
532 + hard_disable_TSC();
533 + else
534 + hard_enable_TSC();
535 }
536 +#endif
537 }
538
539 /*
540 @@ -649,10 +668,9 @@ struct task_struct fastcall * __switch_t
541 /*
542 * Now maybe handle debug registers
543 */
544 - if (unlikely(task_thread_info(next_p)->flags & _TIF_WORK_CTXSW))
545 - __switch_to_xtra(next_p);
546 -
547 - disable_tsc(prev_p, next_p);
548 + if (unlikely(task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV ||
549 + task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT))
550 + __switch_to_xtra(prev_p, next_p);
551
552 /*
553 * Leave lazy mode, flushing any hypercalls made here.
554 --- sle11-2009-05-14.orig/arch/x86/kernel/setup_32-xen.c 2009-03-04 11:25:55.000000000 +0100
555 +++ sle11-2009-05-14/arch/x86/kernel/setup_32-xen.c 2009-02-16 16:17:21.000000000 +0100
556 @@ -114,19 +114,10 @@ static unsigned int highmem_pages = -1;
557 /*
558 * Setup options
559 */
560 -struct drive_info_struct { char dummy[32]; } drive_info;
561 -#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || \
562 - defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
563 -EXPORT_SYMBOL(drive_info);
564 -#endif
565 struct screen_info screen_info;
566 EXPORT_SYMBOL(screen_info);
567 struct apm_info apm_info;
568 EXPORT_SYMBOL(apm_info);
569 -struct sys_desc_table_struct {
570 - unsigned short length;
571 - unsigned char table[0];
572 -};
573 struct edid_info edid_info;
574 EXPORT_SYMBOL_GPL(edid_info);
575 #ifndef CONFIG_XEN
576 @@ -149,7 +140,7 @@ unsigned long saved_videomode;
577
578 static char __initdata command_line[COMMAND_LINE_SIZE];
579
580 -unsigned char __initdata boot_params[PARAM_SIZE];
581 +struct boot_params __initdata boot_params;
582
583 /*
584 * Point at the empty zero page to start with. We map the real shared_info
585 @@ -316,18 +307,18 @@ unsigned long __init find_max_low_pfn(vo
586 printk(KERN_WARNING "Warning only %ldMB will be used.\n",
587 MAXMEM>>20);
588 if (max_pfn > MAX_NONPAE_PFN)
589 - printk(KERN_WARNING "Use a PAE enabled kernel.\n");
590 + printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
591 else
592 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
593 max_pfn = MAXMEM_PFN;
594 #else /* !CONFIG_HIGHMEM */
595 -#ifndef CONFIG_X86_PAE
596 +#ifndef CONFIG_HIGHMEM64G
597 if (max_pfn > MAX_NONPAE_PFN) {
598 max_pfn = MAX_NONPAE_PFN;
599 printk(KERN_WARNING "Warning only 4GB will be used.\n");
600 - printk(KERN_WARNING "Use a PAE enabled kernel.\n");
601 + printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
602 }
603 -#endif /* !CONFIG_X86_PAE */
604 +#endif /* !CONFIG_HIGHMEM64G */
605 #endif /* !CONFIG_HIGHMEM */
606 } else {
607 if (highmem_pages == -1)
608 @@ -514,7 +505,7 @@ void __init setup_bootmem_allocator(void
609 *
610 * This should all compile down to nothing when NUMA is off.
611 */
612 -void __init remapped_pgdat_init(void)
613 +static void __init remapped_pgdat_init(void)
614 {
615 int nid;
616
617 @@ -589,7 +580,6 @@ void __init setup_arch(char **cmdline_p)
618 properly. Setting ROOT_DEV to default to /dev/ram0 breaks initrd.
619 */
620 ROOT_DEV = MKDEV(UNNAMED_MAJOR,0);
621 - drive_info = DRIVE_INFO;
622 screen_info = SCREEN_INFO;
623 copy_edid();
624 apm_info.bios = APM_BIOS_INFO;
625 @@ -767,6 +757,8 @@ void __init setup_arch(char **cmdline_p)
626 * NOTE: at this point the bootmem allocator is fully available.
627 */
628
629 + paravirt_post_allocator_init();
630 +
631 if (is_initial_xendomain())
632 dmi_scan_machine();
633
634 @@ -814,6 +806,7 @@ void __init setup_arch(char **cmdline_p)
635 #endif
636
637 e820_register_memory();
638 + e820_mark_nosave_regions();
639
640 if (is_initial_xendomain()) {
641 #ifdef CONFIG_VT
642 --- sle11-2009-05-14.orig/arch/x86/kernel/smp_32-xen.c 2008-12-15 11:27:22.000000000 +0100
643 +++ sle11-2009-05-14/arch/x86/kernel/smp_32-xen.c 2009-02-16 16:17:21.000000000 +0100
644 @@ -22,6 +22,7 @@
645
646 #include <asm/mtrr.h>
647 #include <asm/tlbflush.h>
648 +#include <asm/mmu_context.h>
649 #if 0
650 #include <mach_apic.h>
651 #endif
652 @@ -217,13 +218,13 @@ static unsigned long flush_va;
653 static DEFINE_SPINLOCK(tlbstate_lock);
654
655 /*
656 - * We cannot call mmdrop() because we are in interrupt context,
657 + * We cannot call mmdrop() because we are in interrupt context,
658 * instead update mm->cpu_vm_mask.
659 *
660 * We need to reload %cr3 since the page tables may be going
661 * away from under us..
662 */
663 -static inline void leave_mm (unsigned long cpu)
664 +void leave_mm(unsigned long cpu)
665 {
666 if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
667 BUG();
668 --- sle11-2009-05-14.orig/arch/x86/kernel/time_32-xen.c 2009-03-24 10:11:31.000000000 +0100
669 +++ sle11-2009-05-14/arch/x86/kernel/time_32-xen.c 2009-03-24 10:12:09.000000000 +0100
670 @@ -76,11 +76,12 @@
671 #include <xen/evtchn.h>
672 #include <xen/interface/vcpu.h>
673
674 -#ifdef CONFIG_X86_32
675 #include <asm/i8253.h>
676 DEFINE_SPINLOCK(i8253_lock);
677 EXPORT_SYMBOL(i8253_lock);
678 -#else
679 +
680 +#ifdef CONFIG_X86_64
681 +#include <asm/vsyscall.h>
682 volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
683 #endif
684
685 @@ -756,56 +757,10 @@ unsigned long read_persistent_clock(void
686 return retval;
687 }
688
689 -static void sync_cmos_clock(unsigned long dummy);
690 -
691 -static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0);
692 -int no_sync_cmos_clock;
693 -
694 -static void sync_cmos_clock(unsigned long dummy)
695 -{
696 - struct timeval now, next;
697 - int fail = 1;
698 -
699 - /*
700 - * If we have an externally synchronized Linux clock, then update
701 - * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
702 - * called as close as possible to 500 ms before the new second starts.
703 - * This code is run on a timer. If the clock is set, that timer
704 - * may not expire at the correct time. Thus, we adjust...
705 - */
706 - if (!ntp_synced())
707 - /*
708 - * Not synced, exit, do not restart a timer (if one is
709 - * running, let it run out).
710 - */
711 - return;
712 -
713 - do_gettimeofday(&now);
714 - if (now.tv_usec >= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 &&
715 - now.tv_usec <= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2)
716 - fail = set_rtc_mmss(now.tv_sec);
717 -
718 - next.tv_usec = USEC_AFTER - now.tv_usec;
719 - if (next.tv_usec <= 0)
720 - next.tv_usec += USEC_PER_SEC;
721 -
722 - if (!fail)
723 - next.tv_sec = 659;
724 - else
725 - next.tv_sec = 0;
726 -
727 - if (next.tv_usec >= USEC_PER_SEC) {
728 - next.tv_sec++;
729 - next.tv_usec -= USEC_PER_SEC;
730 - }
731 - mod_timer(&sync_cmos_timer, jiffies + timeval_to_jiffies(&next));
732 -}
733 -
734 -void notify_arch_cmos_timer(void)
735 +int update_persistent_clock(struct timespec now)
736 {
737 - if (!no_sync_cmos_clock)
738 - mod_timer(&sync_cmos_timer, jiffies + 1);
739 mod_timer(&sync_xen_wallclock_timer, jiffies + 1);
740 + return set_rtc_mmss(now.tv_sec);
741 }
742
743 extern void (*late_time_init)(void);
744 --- sle11-2009-05-14.orig/arch/x86/kernel/traps_32-xen.c 2008-12-15 11:27:22.000000000 +0100
745 +++ sle11-2009-05-14/arch/x86/kernel/traps_32-xen.c 2009-02-16 16:17:21.000000000 +0100
746 @@ -41,6 +41,10 @@
747 #include <linux/mca.h>
748 #endif
749
750 +#if defined(CONFIG_EDAC)
751 +#include <linux/edac.h>
752 +#endif
753 +
754 #include <asm/processor.h>
755 #include <asm/system.h>
756 #include <asm/io.h>
757 @@ -102,36 +106,45 @@ asmlinkage void machine_check(void);
758 int kstack_depth_to_print = 24;
759 static unsigned int code_bytes = 64;
760
761 -static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
762 +static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size)
763 {
764 return p > (void *)tinfo &&
765 - p < (void *)tinfo + THREAD_SIZE - 3;
766 + p <= (void *)tinfo + THREAD_SIZE - size;
767 }
768
769 +/* The form of the top of the frame on the stack */
770 +struct stack_frame {
771 + struct stack_frame *next_frame;
772 + unsigned long return_address;
773 +};
774 +
775 static inline unsigned long print_context_stack(struct thread_info *tinfo,
776 unsigned long *stack, unsigned long ebp,
777 struct stacktrace_ops *ops, void *data)
778 {
779 - unsigned long addr;
780 -
781 #ifdef CONFIG_FRAME_POINTER
782 - while (valid_stack_ptr(tinfo, (void *)ebp)) {
783 - unsigned long new_ebp;
784 - addr = *(unsigned long *)(ebp + 4);
785 + struct stack_frame *frame = (struct stack_frame *)ebp;
786 + while (valid_stack_ptr(tinfo, frame, sizeof(*frame))) {
787 + struct stack_frame *next;
788 + unsigned long addr;
789 +
790 + addr = frame->return_address;
791 ops->address(data, addr);
792 /*
793 * break out of recursive entries (such as
794 * end_of_stack_stop_unwind_function). Also,
795 * we can never allow a frame pointer to
796 * move downwards!
797 - */
798 - new_ebp = *(unsigned long *)ebp;
799 - if (new_ebp <= ebp)
800 + */
801 + next = frame->next_frame;
802 + if (next <= frame)
803 break;
804 - ebp = new_ebp;
805 + frame = next;
806 }
807 #else
808 - while (valid_stack_ptr(tinfo, stack)) {
809 + while (valid_stack_ptr(tinfo, stack, sizeof(*stack))) {
810 + unsigned long addr;
811 +
812 addr = *stack++;
813 if (__kernel_text_address(addr))
814 ops->address(data, addr);
815 @@ -154,7 +167,7 @@ void dump_trace(struct task_struct *task
816 if (!stack) {
817 unsigned long dummy;
818 stack = &dummy;
819 - if (task && task != current)
820 + if (task != current)
821 stack = (unsigned long *)task->thread.esp;
822 }
823
824 @@ -213,6 +226,7 @@ static void print_trace_address(void *da
825 {
826 printk("%s [<%08lx>] ", (char *)data, addr);
827 print_symbol("%s\n", addr);
828 + touch_nmi_watchdog();
829 }
830
831 static struct stacktrace_ops print_trace_ops = {
832 @@ -396,7 +410,7 @@ void die(const char * str, struct pt_reg
833 unsigned long esp;
834 unsigned short ss;
835
836 - report_bug(regs->eip);
837 + report_bug(regs->eip, regs);
838
839 printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
840 #ifdef CONFIG_PREEMPT
841 @@ -439,6 +453,7 @@ void die(const char * str, struct pt_reg
842
843 bust_spinlocks(0);
844 die.lock_owner = -1;
845 + add_taint(TAINT_DIE);
846 spin_unlock_irqrestore(&die.lock, flags);
847
848 if (!regs)
849 @@ -523,10 +538,12 @@ fastcall void do_##name(struct pt_regs *
850 do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \
851 }
852
853 -#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
854 +#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr, irq) \
855 fastcall void do_##name(struct pt_regs * regs, long error_code) \
856 { \
857 siginfo_t info; \
858 + if (irq) \
859 + local_irq_enable(); \
860 info.si_signo = signr; \
861 info.si_errno = 0; \
862 info.si_code = sicode; \
863 @@ -566,13 +583,13 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3)
864 #endif
865 DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow)
866 DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds)
867 -DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip)
868 +DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip, 0)
869 DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
870 DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
871 DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
872 DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
873 -DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
874 -DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0)
875 +DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0)
876 +DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0, 1)
877
878 fastcall void __kprobes do_general_protection(struct pt_regs * regs,
879 long error_code)
880 @@ -585,6 +602,13 @@ fastcall void __kprobes do_general_prote
881
882 current->thread.error_code = error_code;
883 current->thread.trap_no = 13;
884 + if (show_unhandled_signals && unhandled_signal(current, SIGSEGV) &&
885 + printk_ratelimit())
886 + printk(KERN_INFO
887 + "%s[%d] general protection eip:%lx esp:%lx error:%lx\n",
888 + current->comm, current->pid,
889 + regs->eip, regs->esp, error_code);
890 +
891 force_sig(SIGSEGV, current);
892 return;
893
894 @@ -610,6 +634,14 @@ mem_parity_error(unsigned char reason, s
895 printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on "
896 "CPU %d.\n", reason, smp_processor_id());
897 printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n");
898 +
899 +#if defined(CONFIG_EDAC)
900 + if(edac_handler_set()) {
901 + edac_atomic_assert_error();
902 + return;
903 + }
904 +#endif
905 +
906 if (panic_on_unrecovered_nmi)
907 panic("NMI: Not continuing");
908
909 @@ -720,6 +752,8 @@ static __kprobes void default_do_nmi(str
910 reassert_nmi();
911 }
912
913 +static int ignore_nmis;
914 +
915 fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code)
916 {
917 int cpu;
918 @@ -730,11 +764,24 @@ fastcall __kprobes void do_nmi(struct pt
919
920 ++nmi_count(cpu);
921
922 - default_do_nmi(regs);
923 + if (!ignore_nmis)
924 + default_do_nmi(regs);
925
926 nmi_exit();
927 }
928
929 +void stop_nmi(void)
930 +{
931 + acpi_nmi_disable();
932 + ignore_nmis++;
933 +}
934 +
935 +void restart_nmi(void)
936 +{
937 + ignore_nmis--;
938 + acpi_nmi_enable();
939 +}
940 +
941 #ifdef CONFIG_KPROBES
942 fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code)
943 {
944 @@ -1023,6 +1070,7 @@ asmlinkage void math_state_restore(void)
945 thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */
946 tsk->fpu_counter++;
947 }
948 +EXPORT_SYMBOL_GPL(math_state_restore);
949
950 #ifndef CONFIG_MATH_EMULATION
951
952 --- sle11-2009-05-14.orig/arch/x86/mach-xen/setup.c 2009-03-04 11:28:34.000000000 +0100
953 +++ sle11-2009-05-14/arch/x86/mach-xen/setup.c 2009-02-16 16:17:21.000000000 +0100
954 @@ -12,6 +12,7 @@
955 #include <asm/e820.h>
956 #include <asm/setup.h>
957 #include <asm/fixmap.h>
958 +#include <asm/pgtable.h>
959
960 #include <xen/interface/callback.h>
961 #include <xen/interface/memory.h>
962 @@ -101,7 +102,7 @@ void __init pre_setup_arch_hook(void)
963
964 init_mm.pgd = swapper_pg_dir = (pgd_t *)xen_start_info->pt_base;
965
966 - setup_xen_features();
967 + xen_setup_features();
968
969 if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) {
970 hypervisor_virt_start = pp.virt_start;
971 @@ -157,4 +158,18 @@ void __init machine_specific_arch_setup(
972 HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
973 }
974 #endif
975 +
976 + /* Do an early initialization of the fixmap area */
977 + {
978 + extern pte_t swapper_pg_pmd[PTRS_PER_PTE];
979 + unsigned long addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE);
980 + pgd_t *pgd = (pgd_t *)xen_start_info->pt_base;
981 + pud_t *pud = pud_offset(pgd + pgd_index(addr), addr);
982 + pmd_t *pmd = pmd_offset(pud, addr);
983 +
984 + swapper_pg_dir = pgd;
985 + init_mm.pgd = pgd;
986 + make_lowmem_page_readonly(swapper_pg_pmd, XENFEAT_writable_page_tables);
987 + set_pmd(pmd, __pmd(__pa_symbol(swapper_pg_pmd) | _PAGE_TABLE));
988 + }
989 }
990 --- sle11-2009-05-14.orig/arch/x86/mm/fault_32-xen.c 2008-12-15 11:27:22.000000000 +0100
991 +++ sle11-2009-05-14/arch/x86/mm/fault_32-xen.c 2009-02-16 16:17:21.000000000 +0100
992 @@ -346,7 +346,10 @@ static inline pmd_t *vmalloc_sync_one(pg
993 pmd_k = pmd_offset(pud_k, address);
994 if (!pmd_present(*pmd_k))
995 return NULL;
996 - if (!pmd_present(*pmd))
997 + if (!pmd_present(*pmd)) {
998 + bool lazy = x86_read_percpu(xen_lazy_mmu);
999 +
1000 + x86_write_percpu(xen_lazy_mmu, false);
1001 #if CONFIG_XEN_COMPAT > 0x030002
1002 set_pmd(pmd, *pmd_k);
1003 #else
1004 @@ -356,7 +359,8 @@ static inline pmd_t *vmalloc_sync_one(pg
1005 */
1006 set_pmd(pmd, __pmd(pmd_val(*pmd_k)));
1007 #endif
1008 - else
1009 + x86_write_percpu(xen_lazy_mmu, lazy);
1010 + } else
1011 BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k));
1012 return pmd_k;
1013 }
1014 @@ -388,6 +392,8 @@ static inline int vmalloc_fault(unsigned
1015 return 0;
1016 }
1017
1018 +int show_unhandled_signals = 1;
1019 +
1020 /*
1021 * This routine handles page faults. It determines the address,
1022 * and the problem, and then passes it off to one of the appropriate
1023 @@ -408,6 +414,7 @@ fastcall void __kprobes do_page_fault(st
1024 struct vm_area_struct * vma;
1025 unsigned long address;
1026 int write, si_code;
1027 + int fault;
1028
1029 /* get the address */
1030 address = read_cr2();
1031 @@ -541,20 +548,18 @@ good_area:
1032 * make sure we exit gracefully rather than endlessly redo
1033 * the fault.
1034 */
1035 - switch (handle_mm_fault(mm, vma, address, write)) {
1036 - case VM_FAULT_MINOR:
1037 - tsk->min_flt++;
1038 - break;
1039 - case VM_FAULT_MAJOR:
1040 - tsk->maj_flt++;
1041 - break;
1042 - case VM_FAULT_SIGBUS:
1043 - goto do_sigbus;
1044 - case VM_FAULT_OOM:
1045 + fault = handle_mm_fault(mm, vma, address, write);
1046 + if (unlikely(fault & VM_FAULT_ERROR)) {
1047 + if (fault & VM_FAULT_OOM)
1048 goto out_of_memory;
1049 - default:
1050 - BUG();
1051 + else if (fault & VM_FAULT_SIGBUS)
1052 + goto do_sigbus;
1053 + BUG();
1054 }
1055 + if (fault & VM_FAULT_MAJOR)
1056 + tsk->maj_flt++;
1057 + else
1058 + tsk->min_flt++;
1059
1060 /*
1061 * Did it hit the DOS screen memory VA from vm86 mode?
1062 @@ -589,6 +594,14 @@ bad_area_nosemaphore:
1063 if (is_prefetch(regs, address, error_code))
1064 return;
1065
1066 + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
1067 + printk_ratelimit()) {
1068 + printk("%s%s[%d]: segfault at %08lx eip %08lx "
1069 + "esp %08lx error %lx\n",
1070 + tsk->pid > 1 ? KERN_INFO : KERN_EMERG,
1071 + tsk->comm, tsk->pid, address, regs->eip,
1072 + regs->esp, error_code);
1073 + }
1074 tsk->thread.cr2 = address;
1075 /* Kernel addresses are always protection faults */
1076 tsk->thread.error_code = error_code | (address >= TASK_SIZE);
1077 --- sle11-2009-05-14.orig/arch/x86/mm/highmem_32-xen.c 2008-12-15 11:27:22.000000000 +0100
1078 +++ sle11-2009-05-14/arch/x86/mm/highmem_32-xen.c 2009-02-16 16:17:21.000000000 +0100
1079 @@ -34,17 +34,16 @@ void *kmap_atomic_prot(struct page *page
1080 /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
1081 pagefault_disable();
1082
1083 - idx = type + KM_TYPE_NR*smp_processor_id();
1084 - BUG_ON(!pte_none(*(kmap_pte-idx)));
1085 -
1086 if (!PageHighMem(page))
1087 return page_address(page);
1088
1089 + idx = type + KM_TYPE_NR*smp_processor_id();
1090 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
1091 + BUG_ON(!pte_none(*(kmap_pte-idx)));
1092 set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
1093 /*arch_flush_lazy_mmu_mode();*/
1094
1095 - return (void*) vaddr;
1096 + return (void *)vaddr;
1097 }
1098
1099 void *kmap_atomic(struct page *page, enum km_type type)
1100 --- sle11-2009-05-14.orig/arch/x86/mm/init_32-xen.c 2008-12-15 11:27:22.000000000 +0100
1101 +++ sle11-2009-05-14/arch/x86/mm/init_32-xen.c 2009-02-16 16:17:21.000000000 +0100
1102 @@ -96,7 +96,7 @@ static pte_t * __init one_page_table_ini
1103 #endif
1104 pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
1105
1106 - paravirt_alloc_pt(__pa(page_table) >> PAGE_SHIFT);
1107 + paravirt_alloc_pt(&init_mm, __pa(page_table) >> PAGE_SHIFT);
1108 make_lowmem_page_readonly(page_table,
1109 XENFEAT_writable_page_tables);
1110 set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE));
1111 @@ -446,7 +446,7 @@ static void __init pagetable_init (void)
1112 xen_pagetable_setup_done(pgd_base);
1113 }
1114
1115 -#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI_SLEEP)
1116 +#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI)
1117 /*
1118 * Swap suspend & friends need this for resume because things like the intel-agp
1119 * driver might have split up a kernel 4MB mapping.
1120 @@ -485,9 +485,13 @@ void zap_low_mappings (void)
1121 flush_tlb_all();
1122 }
1123
1124 +int nx_enabled = 0;
1125 +
1126 +#ifdef CONFIG_X86_PAE
1127 +
1128 static int disable_nx __initdata = 0;
1129 u64 __supported_pte_mask __read_mostly = ~_PAGE_NX;
1130 -EXPORT_SYMBOL(__supported_pte_mask);
1131 +EXPORT_SYMBOL_GPL(__supported_pte_mask);
1132
1133 /*
1134 * noexec = on|off
1135 @@ -514,9 +518,6 @@ static int __init noexec_setup(char *str
1136 }
1137 early_param("noexec", noexec_setup);
1138
1139 -int nx_enabled = 0;
1140 -#ifdef CONFIG_X86_PAE
1141 -
1142 static void __init set_nx(void)
1143 {
1144 unsigned int v[4], l, h;
1145 @@ -764,7 +765,7 @@ void __init mem_init(void)
1146 zap_low_mappings();
1147 #endif
1148
1149 - set_bit(PG_pinned, &virt_to_page(init_mm.pgd)->flags);
1150 + SetPagePinned(virt_to_page(init_mm.pgd));
1151 }
1152
1153 #ifdef CONFIG_MEMORY_HOTPLUG
1154 @@ -796,8 +797,7 @@ void __init pgtable_cache_init(void)
1155 PTRS_PER_PMD*sizeof(pmd_t),
1156 PTRS_PER_PMD*sizeof(pmd_t),
1157 SLAB_PANIC,
1158 - pmd_ctor,
1159 - NULL);
1160 + pmd_ctor);
1161 if (!SHARED_KERNEL_PMD) {
1162 /* If we're in PAE mode and have a non-shared
1163 kernel pmd, then the pgd size must be a
1164 --- sle11-2009-05-14.orig/arch/x86/mm/ioremap_32-xen.c 2008-12-15 11:27:22.000000000 +0100
1165 +++ sle11-2009-05-14/arch/x86/mm/ioremap_32-xen.c 2009-02-16 16:17:21.000000000 +0100
1166 @@ -363,9 +363,8 @@ void iounmap(volatile void __iomem *addr
1167
1168 /* Reset the direct mapping. Can block */
1169 if ((p->flags >> 20) && is_local_lowmem(p->phys_addr)) {
1170 - /* p->size includes the guard page, but cpa doesn't like that */
1171 change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)),
1172 - (p->size - PAGE_SIZE) >> PAGE_SHIFT,
1173 + get_vm_area_size(p) >> PAGE_SHIFT,
1174 PAGE_KERNEL);
1175 global_flush_tlb();
1176 }
1177 --- sle11-2009-05-14.orig/arch/x86/mm/pgtable_32-xen.c 2008-12-15 11:27:22.000000000 +0100
1178 +++ sle11-2009-05-14/arch/x86/mm/pgtable_32-xen.c 2009-02-16 16:17:21.000000000 +0100
1179 @@ -198,7 +198,7 @@ void pte_free(struct page *pte)
1180 va, pfn_pte(pfn, PAGE_KERNEL), 0))
1181 BUG();
1182 } else
1183 - clear_bit(PG_pinned, &pte->flags);
1184 + ClearPagePinned(pte);
1185
1186 ClearPageForeign(pte);
1187 init_page_count(pte);
1188 @@ -248,7 +248,7 @@ static inline void pgd_list_del(pgd_t *p
1189
1190 #if (PTRS_PER_PMD == 1)
1191 /* Non-PAE pgd constructor */
1192 -void pgd_ctor(void *pgd)
1193 +static void pgd_ctor(void *pgd)
1194 {
1195 unsigned long flags;
1196
1197 @@ -271,7 +271,7 @@ void pgd_ctor(void *pgd)
1198 }
1199 #else /* PTRS_PER_PMD > 1 */
1200 /* PAE pgd constructor */
1201 -void pgd_ctor(void *pgd)
1202 +static void pgd_ctor(void *pgd)
1203 {
1204 /* PAE, kernel PMD may be shared */
1205
1206 @@ -285,7 +285,7 @@ void pgd_ctor(void *pgd)
1207 }
1208 #endif /* PTRS_PER_PMD */
1209
1210 -void pgd_dtor(void *pgd)
1211 +static void pgd_dtor(void *pgd)
1212 {
1213 unsigned long flags; /* can be called from interrupt context */
1214
1215 @@ -637,9 +637,9 @@ static inline unsigned int pgd_walk_set_
1216
1217 if (PageHighMem(page)) {
1218 if (pgprot_val(flags) & _PAGE_RW)
1219 - clear_bit(PG_pinned, &page->flags);
1220 + ClearPagePinned(page);
1221 else
1222 - set_bit(PG_pinned, &page->flags);
1223 + SetPagePinned(page);
1224 } else {
1225 MULTI_update_va_mapping(per_cpu(pb_mcl, cpu) + seq,
1226 (unsigned long)__va(pfn << PAGE_SHIFT),
1227 @@ -709,19 +709,19 @@ static void __pgd_pin(pgd_t *pgd)
1228 pgd_walk(pgd, PAGE_KERNEL_RO);
1229 kmap_flush_unused();
1230 xen_pgd_pin(__pa(pgd));
1231 - set_bit(PG_pinned, &virt_to_page(pgd)->flags);
1232 + SetPagePinned(virt_to_page(pgd));
1233 }
1234
1235 static void __pgd_unpin(pgd_t *pgd)
1236 {
1237 xen_pgd_unpin(__pa(pgd));
1238 pgd_walk(pgd, PAGE_KERNEL);
1239 - clear_bit(PG_pinned, &virt_to_page(pgd)->flags);
1240 + ClearPagePinned(virt_to_page(pgd));
1241 }
1242
1243 static void pgd_test_and_unpin(pgd_t *pgd)
1244 {
1245 - if (test_bit(PG_pinned, &virt_to_page(pgd)->flags))
1246 + if (PagePinned(virt_to_page(pgd)))
1247 __pgd_unpin(pgd);
1248 }
1249
1250 @@ -759,7 +759,7 @@ void mm_pin_all(void)
1251 */
1252 spin_lock_irqsave(&pgd_lock, flags);
1253 for (page = pgd_list; page; page = (struct page *)page->index) {
1254 - if (!test_bit(PG_pinned, &page->flags))
1255 + if (!PagePinned(page))
1256 __pgd_pin((pgd_t *)page_address(page));
1257 }
1258 spin_unlock_irqrestore(&pgd_lock, flags);
1259 @@ -767,7 +767,7 @@ void mm_pin_all(void)
1260
1261 void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
1262 {
1263 - if (!test_bit(PG_pinned, &virt_to_page(mm->pgd)->flags))
1264 + if (!PagePinned(virt_to_page(mm->pgd)))
1265 mm_pin(mm);
1266 }
1267
1268 @@ -793,7 +793,7 @@ void arch_exit_mmap(struct mm_struct *mm
1269
1270 task_unlock(tsk);
1271
1272 - if (test_bit(PG_pinned, &virt_to_page(mm->pgd)->flags) &&
1273 + if (PagePinned(virt_to_page(mm->pgd)) &&
1274 (atomic_read(&mm->mm_count) == 1) &&
1275 !mm->context.has_foreign_mappings)
1276 mm_unpin(mm);
1277 --- sle11-2009-05-14.orig/arch/x86/pci/irq-xen.c 2008-12-15 11:26:44.000000000 +0100
1278 +++ sle11-2009-05-14/arch/x86/pci/irq-xen.c 2009-02-16 16:17:21.000000000 +0100
1279 @@ -142,8 +142,9 @@ static void __init pirq_peer_trick(void)
1280 for(i = 1; i < 256; i++) {
1281 if (!busmap[i] || pci_find_bus(0, i))
1282 continue;
1283 - if (pci_scan_bus(i, &pci_root_ops, NULL))
1284 - printk(KERN_INFO "PCI: Discovered primary peer bus %02x [IRQ]\n", i);
1285 + if (pci_scan_bus_with_sysdata(i))
1286 + printk(KERN_INFO "PCI: Discovered primary peer "
1287 + "bus %02x [IRQ]\n", i);
1288 }
1289 pcibios_last_bus = -1;
1290 }
1291 @@ -553,6 +554,7 @@ static __init int intel_router_probe(str
1292 case PCI_DEVICE_ID_INTEL_ICH9_3:
1293 case PCI_DEVICE_ID_INTEL_ICH9_4:
1294 case PCI_DEVICE_ID_INTEL_ICH9_5:
1295 + case PCI_DEVICE_ID_INTEL_TOLAPAI_0:
1296 r->name = "PIIX/ICH";
1297 r->get = pirq_piix_get;
1298 r->set = pirq_piix_set;
1299 --- sle11-2009-05-14.orig/arch/x86/xen/Kconfig 2009-05-14 10:56:29.000000000 +0200
1300 +++ sle11-2009-05-14/arch/x86/xen/Kconfig 2009-02-16 16:17:21.000000000 +0100
1301 @@ -2,7 +2,7 @@
1302 # This Kconfig describes xen options
1303 #
1304
1305 -config XEN
1306 +config PARAVIRT_XEN
1307 bool "Xen guest support"
1308 select PARAVIRT
1309 select PARAVIRT_CLOCK
1310 --- sle11-2009-05-14.orig/arch/x86/xen/xen-head.S 2009-05-14 10:56:29.000000000 +0200
1311 +++ sle11-2009-05-14/arch/x86/xen/xen-head.S 2009-02-16 16:17:21.000000000 +0100
1312 @@ -1,7 +1,7 @@
1313 /* Xen-specific pieces of head.S, intended to be included in the right
1314 place in head.S */
1315
1316 -#ifdef CONFIG_XEN
1317 +#ifdef CONFIG_PARAVIRT_XEN
1318
1319 #include <linux/elfnote.h>
1320 #include <linux/init.h>
1321 @@ -52,4 +52,4 @@ ENTRY(hypercall_page)
1322 ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, _ASM_PTR __HYPERVISOR_VIRT_START)
1323 ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, _ASM_PTR 0)
1324
1325 -#endif /*CONFIG_XEN */
1326 +#endif /* CONFIG_PARAVIRT_XEN */
1327 --- sle11-2009-05-14.orig/arch/x86/ia32/ia32entry-xen.S 2008-12-15 11:27:22.000000000 +0100
1328 +++ sle11-2009-05-14/arch/x86/ia32/ia32entry-xen.S 2009-02-16 16:17:21.000000000 +0100
1329 @@ -105,7 +105,7 @@ ENTRY(ia32_sysenter_target)
1330 movl $VSYSCALL32_SYSEXIT,8(%rsp)
1331 movq %rax,(%rsp)
1332 cld
1333 - SAVE_ARGS 0,0,0
1334 + SAVE_ARGS 0,0,1
1335 /* no need to do an access_ok check here because rbp has been
1336 32bit zero extended */
1337 1: movl (%rbp),%r9d
1338 @@ -244,7 +244,7 @@ ia32_badarg:
1339 */
1340
1341 ENTRY(ia32_syscall)
1342 - CFI_STARTPROC simple
1343 + CFI_STARTPROC32 simple
1344 CFI_SIGNAL_FRAME
1345 CFI_DEF_CFA rsp,SS+8-RIP+16
1346 /*CFI_REL_OFFSET ss,SS-RIP+16*/
1347 @@ -280,6 +280,7 @@ ia32_sysret:
1348
1349 ia32_tracesys:
1350 SAVE_REST
1351 + CLEAR_RREGS
1352 movq $-ENOSYS,RAX(%rsp) /* really needed? */
1353 movq %rsp,%rdi /* &pt_regs -> arg1 */
1354 call syscall_trace_enter
1355 @@ -476,7 +477,7 @@ ia32_sys_call_table:
1356 .quad sys_init_module
1357 .quad sys_delete_module
1358 .quad quiet_ni_syscall /* 130 get_kernel_syms */
1359 - .quad sys_quotactl
1360 + .quad sys32_quotactl
1361 .quad sys_getpgid
1362 .quad sys_fchdir
1363 .quad quiet_ni_syscall /* bdflush */
1364 @@ -669,4 +670,5 @@ ia32_sys_call_table:
1365 .quad compat_sys_signalfd
1366 .quad compat_sys_timerfd
1367 .quad sys_eventfd
1368 + .quad sys32_fallocate
1369 ia32_syscall_end:
1370 --- sle11-2009-05-14.orig/arch/x86/kernel/acpi/sleep_64-xen.c 2008-12-15 11:27:22.000000000 +0100
1371 +++ sle11-2009-05-14/arch/x86/kernel/acpi/sleep_64-xen.c 2009-02-16 16:17:21.000000000 +0100
1372 @@ -51,12 +51,10 @@
1373 Low-Level Sleep Support
1374 -------------------------------------------------------------------------- */
1375
1376 -#ifdef CONFIG_ACPI_SLEEP
1377 -
1378 #ifndef CONFIG_ACPI_PV_SLEEP
1379 /* address in low memory of the wakeup routine. */
1380 unsigned long acpi_wakeup_address = 0;
1381 -unsigned long acpi_video_flags;
1382 +unsigned long acpi_realmode_flags;
1383 extern char wakeup_start, wakeup_end;
1384
1385 extern unsigned long acpi_copy_wakeup_routine(unsigned long);
1386 @@ -109,9 +107,11 @@ static int __init acpi_sleep_setup(char
1387 {
1388 while ((str != NULL) && (*str != '\0')) {
1389 if (strncmp(str, "s3_bios", 7) == 0)
1390 - acpi_video_flags = 1;
1391 + acpi_realmode_flags |= 1;
1392 if (strncmp(str, "s3_mode", 7) == 0)
1393 - acpi_video_flags |= 2;
1394 + acpi_realmode_flags |= 2;
1395 + if (strncmp(str, "s3_beep", 7) == 0)
1396 + acpi_realmode_flags |= 4;
1397 str = strchr(str, ',');
1398 if (str != NULL)
1399 str += strspn(str, ", \t");
1400 @@ -123,8 +123,6 @@ static int __init acpi_sleep_setup(char
1401 __setup("acpi_sleep=", acpi_sleep_setup);
1402 #endif /* CONFIG_ACPI_PV_SLEEP */
1403
1404 -#endif /*CONFIG_ACPI_SLEEP */
1405 -
1406 void acpi_pci_link_exit(void)
1407 {
1408 }
1409 --- sle11-2009-05-14.orig/arch/x86/kernel/apic_64-xen.c 2008-12-15 11:27:22.000000000 +0100
1410 +++ sle11-2009-05-14/arch/x86/kernel/apic_64-xen.c 2009-02-16 16:17:21.000000000 +0100
1411 @@ -50,7 +50,7 @@ void ack_bad_irq(unsigned int irq)
1412 * holds up an irq slot - in excessive cases (when multiple
1413 * unexpected vectors occur) that might lock up the APIC
1414 * completely.
1415 - * But don't ack when the APIC is disabled. -AK
1416 + * But don't ack when the APIC is disabled. -AK
1417 */
1418 if (!disable_apic)
1419 ack_APIC_irq();
1420 @@ -132,20 +132,6 @@ asmlinkage void smp_spurious_interrupt(v
1421 if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
1422 ack_APIC_irq();
1423
1424 -#if 0
1425 - static unsigned long last_warning;
1426 - static unsigned long skipped;
1427 -
1428 - /* see sw-dev-man vol 3, chapter 7.4.13.5 */
1429 - if (time_before(last_warning+30*HZ,jiffies)) {
1430 - printk(KERN_INFO "spurious APIC interrupt on CPU#%d, %ld skipped.\n",
1431 - smp_processor_id(), skipped);
1432 - last_warning = jiffies;
1433 - skipped = 0;
1434 - } else {
1435 - skipped++;
1436 - }
1437 -#endif
1438 irq_exit();
1439 }
1440
1441 @@ -177,7 +163,7 @@ asmlinkage void smp_error_interrupt(void
1442 7: Illegal register address
1443 */
1444 printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n",
1445 - smp_processor_id(), v , v1);
1446 + smp_processor_id(), v , v1);
1447 irq_exit();
1448 }
1449
1450 --- sle11-2009-05-14.orig/arch/x86/kernel/e820_64-xen.c 2008-12-15 11:27:22.000000000 +0100
1451 +++ sle11-2009-05-14/arch/x86/kernel/e820_64-xen.c 2009-02-16 16:17:21.000000000 +0100
1452 @@ -222,37 +222,6 @@ unsigned long __init e820_end_of_ram(voi
1453 }
1454
1455 /*
1456 - * Find the hole size in the range.
1457 - */
1458 -unsigned long __init e820_hole_size(unsigned long start, unsigned long end)
1459 -{
1460 - unsigned long ram = 0;
1461 - int i;
1462 -
1463 - for (i = 0; i < e820.nr_map; i++) {
1464 - struct e820entry *ei = &e820.map[i];
1465 - unsigned long last, addr;
1466 -
1467 - if (ei->type != E820_RAM ||
1468 - ei->addr+ei->size <= start ||
1469 - ei->addr >= end)
1470 - continue;
1471 -
1472 - addr = round_up(ei->addr, PAGE_SIZE);
1473 - if (addr < start)
1474 - addr = start;
1475 -
1476 - last = round_down(ei->addr + ei->size, PAGE_SIZE);
1477 - if (last >= end)
1478 - last = end;
1479 -
1480 - if (last > addr)
1481 - ram += last - addr;
1482 - }
1483 - return ((end - start) - ram);
1484 -}
1485 -
1486 -/*
1487 * Mark e820 reserved areas as busy for the resource manager.
1488 */
1489 void __init e820_reserve_resources(struct e820entry *e820, int nr_map)
1490 @@ -325,47 +294,61 @@ void __init e820_mark_nosave_regions(voi
1491 }
1492 #endif
1493
1494 +/*
1495 + * Finds an active region in the address range from start_pfn to end_pfn and
1496 + * returns its range in ei_startpfn and ei_endpfn for the e820 entry.
1497 + */
1498 +static int __init e820_find_active_region(const struct e820entry *ei,
1499 + unsigned long start_pfn,
1500 + unsigned long end_pfn,
1501 + unsigned long *ei_startpfn,
1502 + unsigned long *ei_endpfn)
1503 +{
1504 + *ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT;
1505 + *ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) >> PAGE_SHIFT;
1506 +
1507 + /* Skip map entries smaller than a page */
1508 + if (*ei_startpfn >= *ei_endpfn)
1509 + return 0;
1510 +
1511 + /* Check if end_pfn_map should be updated */
1512 + if (ei->type != E820_RAM && *ei_endpfn > end_pfn_map)
1513 + end_pfn_map = *ei_endpfn;
1514 +
1515 + /* Skip if map is outside the node */
1516 + if (ei->type != E820_RAM || *ei_endpfn <= start_pfn ||
1517 + *ei_startpfn >= end_pfn)
1518 + return 0;
1519 +
1520 + /* Check for overlaps */
1521 + if (*ei_startpfn < start_pfn)
1522 + *ei_startpfn = start_pfn;
1523 + if (*ei_endpfn > end_pfn)
1524 + *ei_endpfn = end_pfn;
1525 +
1526 + /* Obey end_user_pfn to save on memmap */
1527 + if (*ei_startpfn >= end_user_pfn)
1528 + return 0;
1529 + if (*ei_endpfn > end_user_pfn)
1530 + *ei_endpfn = end_user_pfn;
1531 +
1532 + return 1;
1533 +}
1534 +
1535 /* Walk the e820 map and register active regions within a node */
1536 void __init
1537 e820_register_active_regions(int nid, unsigned long start_pfn,
1538 unsigned long end_pfn)
1539 {
1540 + unsigned long ei_startpfn;
1541 + unsigned long ei_endpfn;
1542 int i;
1543 - unsigned long ei_startpfn, ei_endpfn;
1544 - for (i = 0; i < e820.nr_map; i++) {
1545 - struct e820entry *ei = &e820.map[i];
1546 - ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT;
1547 - ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE)
1548 - >> PAGE_SHIFT;
1549 -
1550 - /* Skip map entries smaller than a page */
1551 - if (ei_startpfn >= ei_endpfn)
1552 - continue;
1553 -
1554 - /* Check if end_pfn_map should be updated */
1555 - if (ei->type != E820_RAM && ei_endpfn > end_pfn_map)
1556 - end_pfn_map = ei_endpfn;
1557 -
1558 - /* Skip if map is outside the node */
1559 - if (ei->type != E820_RAM ||
1560 - ei_endpfn <= start_pfn ||
1561 - ei_startpfn >= end_pfn)
1562 - continue;
1563 -
1564 - /* Check for overlaps */
1565 - if (ei_startpfn < start_pfn)
1566 - ei_startpfn = start_pfn;
1567 - if (ei_endpfn > end_pfn)
1568 - ei_endpfn = end_pfn;
1569 -
1570 - /* Obey end_user_pfn to save on memmap */
1571 - if (ei_startpfn >= end_user_pfn)
1572 - continue;
1573 - if (ei_endpfn > end_user_pfn)
1574 - ei_endpfn = end_user_pfn;
1575
1576 - add_active_range(nid, ei_startpfn, ei_endpfn);
1577 - }
1578 + for (i = 0; i < e820.nr_map; i++)
1579 + if (e820_find_active_region(&e820.map[i],
1580 + start_pfn, end_pfn,
1581 + &ei_startpfn, &ei_endpfn))
1582 + add_active_range(nid, ei_startpfn, ei_endpfn);
1583 }
1584
1585 /*
1586 @@ -386,12 +369,35 @@ void __init add_memory_region(unsigned l
1587 e820.nr_map++;
1588 }
1589
1590 +/*
1591 + * Find the hole size (in bytes) in the memory range.
1592 + * @start: starting address of the memory range to scan
1593 + * @end: ending address of the memory range to scan
1594 + */
1595 +unsigned long __init e820_hole_size(unsigned long start, unsigned long end)
1596 +{
1597 + unsigned long start_pfn = start >> PAGE_SHIFT;
1598 + unsigned long end_pfn = end >> PAGE_SHIFT;
1599 + unsigned long ei_startpfn;
1600 + unsigned long ei_endpfn;
1601 + unsigned long ram = 0;
1602 + int i;
1603 +
1604 + for (i = 0; i < e820.nr_map; i++) {
1605 + if (e820_find_active_region(&e820.map[i],
1606 + start_pfn, end_pfn,
1607 + &ei_startpfn, &ei_endpfn))
1608 + ram += ei_endpfn - ei_startpfn;
1609 + }
1610 + return end - start - (ram << PAGE_SHIFT);
1611 +}
1612 +
1613 void __init e820_print_map(char *who)
1614 {
1615 int i;
1616
1617 for (i = 0; i < e820.nr_map; i++) {
1618 - printk(" %s: %016Lx - %016Lx ", who,
1619 + printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
1620 (unsigned long long) e820.map[i].addr,
1621 (unsigned long long) (e820.map[i].addr + e820.map[i].size));
1622 switch (e820.map[i].type) {
1623 --- sle11-2009-05-14.orig/arch/x86/kernel/early_printk-xen.c 2008-12-15 11:27:22.000000000 +0100
1624 +++ sle11-2009-05-14/arch/x86/kernel/early_printk-xen.c 2009-02-16 16:17:21.000000000 +0100
1625 @@ -174,6 +174,7 @@ static __init void early_serial_init(cha
1626 * mappings. Someone should fix this for domain 0. For now, use fake serial.
1627 */
1628 #define early_vga_console early_serial_console
1629 +#define xenboot_console early_serial_console
1630
1631 #endif
1632
1633 @@ -261,20 +262,22 @@ static int __init setup_early_printk(cha
1634 } else if (!strncmp(buf, "ttyS", 4)) {
1635 early_serial_init(buf);
1636 early_console = &early_serial_console;
1637 - } else if (!strncmp(buf, "vga", 3)
1638 + } else if (!strncmp(buf, "vga", 3)) {
1639 #ifndef CONFIG_XEN
1640 && SCREEN_INFO.orig_video_isVGA == 1) {
1641 max_xpos = SCREEN_INFO.orig_video_cols;
1642 max_ypos = SCREEN_INFO.orig_video_lines;
1643 current_ypos = SCREEN_INFO.orig_y;
1644 -#else
1645 - || !strncmp(buf, "xen", 3)) {
1646 #endif
1647 early_console = &early_vga_console;
1648 } else if (!strncmp(buf, "simnow", 6)) {
1649 simnow_init(buf + 6);
1650 early_console = &simnow_console;
1651 keep_early = 1;
1652 +#ifdef CONFIG_XEN
1653 + } else if (!strncmp(buf, "xen", 3)) {
1654 + early_console = &xenboot_console;
1655 +#endif
1656 }
1657
1658 if (keep_early)
1659 --- sle11-2009-05-14.orig/arch/x86/kernel/entry_64-xen.S 2008-12-15 11:27:22.000000000 +0100
1660 +++ sle11-2009-05-14/arch/x86/kernel/entry_64-xen.S 2009-02-16 16:17:21.000000000 +0100
1661 @@ -310,7 +310,7 @@ sysret_signal:
1662 TRACE_IRQS_ON
1663 /* sti */
1664 XEN_UNBLOCK_EVENTS(%rsi)
1665 - testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
1666 + testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
1667 jz 1f
1668
1669 /* Really a signal */
1670 @@ -409,7 +409,7 @@ int_very_careful:
1671 jmp int_restore_rest
1672
1673 int_signal:
1674 - testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP),%edx
1675 + testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
1676 jz 1f
1677 movq %rsp,%rdi # &ptregs -> arg1
1678 xorl %esi,%esi # oldset -> arg2
1679 @@ -552,7 +552,7 @@ retint_careful:
1680 jmp retint_check
1681
1682 retint_signal:
1683 - testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
1684 + testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
1685 jz retint_restore_args
1686 TRACE_IRQS_ON
1687 XEN_UNBLOCK_EVENTS(%rsi)
1688 --- sle11-2009-05-14.orig/arch/x86/kernel/head_64-xen.S 2008-12-15 11:27:22.000000000 +0100
1689 +++ sle11-2009-05-14/arch/x86/kernel/head_64-xen.S 2009-02-16 16:17:21.000000000 +0100
1690 @@ -23,7 +23,7 @@
1691 #include <asm/dwarf2.h>
1692 #include <xen/interface/elfnote.h>
1693
1694 - .section .bootstrap.text, "ax", @progbits
1695 + .section .text.head, "ax", @progbits
1696 .code64
1697 .globl startup_64
1698 startup_64:
1699 @@ -39,7 +39,7 @@ startup_64:
1700
1701 #define NEXT_PAGE(name) \
1702 .balign PAGE_SIZE; \
1703 - phys_##name = . - .bootstrap.text; \
1704 + phys_##name = . - .text.head; \
1705 ENTRY(name)
1706
1707 NEXT_PAGE(init_level4_pgt)
1708 @@ -66,6 +66,12 @@ NEXT_PAGE(level3_user_pgt)
1709 NEXT_PAGE(level2_kernel_pgt)
1710 .fill 512,8,0
1711
1712 +NEXT_PAGE(level2_fixmap_pgt)
1713 + .fill 512,8,0
1714 +
1715 +NEXT_PAGE(level1_fixmap_pgt)
1716 + .fill 512,8,0
1717 +
1718 NEXT_PAGE(hypercall_page)
1719 CFI_STARTPROC
1720 .rept 0x1000 / 0x20
1721 @@ -172,18 +178,18 @@ ENTRY(empty_zero_page)
1722 .byte 0
1723 #endif /* CONFIG_XEN_COMPAT <= 0x030002 */
1724
1725 - ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux")
1726 - ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6")
1727 - ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0")
1728 - ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad, __START_KERNEL_map)
1729 + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
1730 + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
1731 + ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")
1732 + ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad __START_KERNEL_map)
1733 #if CONFIG_XEN_COMPAT <= 0x030002
1734 - ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, __START_KERNEL_map)
1735 + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad __START_KERNEL_map)
1736 #else
1737 - ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, 0)
1738 + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad 0)
1739 #endif
1740 - ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad, startup_64)
1741 - ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad, hypercall_page)
1742 - ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT)
1743 - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
1744 - ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic")
1745 - ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1)
1746 + ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad startup_64)
1747 + ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad hypercall_page)
1748 + ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad _PAGE_PRESENT, _PAGE_PRESENT)
1749 + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
1750 + ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
1751 + ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
1752 --- sle11-2009-05-14.orig/arch/x86/kernel/head64-xen.c 2008-12-15 11:27:22.000000000 +0100
1753 +++ sle11-2009-05-14/arch/x86/kernel/head64-xen.c 2009-02-16 16:17:21.000000000 +0100
1754 @@ -90,7 +90,7 @@ void __init x86_64_start_kernel(char * r
1755 unsigned long machine_to_phys_nr_ents;
1756 int i;
1757
1758 - setup_xen_features();
1759 + xen_setup_features();
1760
1761 xen_start_info = (struct start_info *)real_mode_data;
1762 if (!xen_feature(XENFEAT_auto_translated_physmap))
1763 --- sle11-2009-05-14.orig/arch/x86/kernel/io_apic_64-xen.c 2008-12-15 11:27:22.000000000 +0100
1764 +++ sle11-2009-05-14/arch/x86/kernel/io_apic_64-xen.c 2009-02-16 16:17:21.000000000 +0100
1765 @@ -165,7 +165,9 @@ static inline void io_apic_write(unsigne
1766 #endif
1767 }
1768
1769 -#ifndef CONFIG_XEN
1770 +#ifdef CONFIG_XEN
1771 +#define io_apic_modify io_apic_write
1772 +#else
1773 /*
1774 * Re-write a value: to be used for read-modify-write
1775 * cycles where the read already set up the index register.
1776 @@ -175,8 +177,32 @@ static inline void io_apic_modify(unsign
1777 struct io_apic __iomem *io_apic = io_apic_base(apic);
1778 writel(value, &io_apic->data);
1779 }
1780 -#else
1781 -#define io_apic_modify io_apic_write
1782 +
1783 +static int io_apic_level_ack_pending(unsigned int irq)
1784 +{
1785 + struct irq_pin_list *entry;
1786 + unsigned long flags;
1787 + int pending = 0;
1788 +
1789 + spin_lock_irqsave(&ioapic_lock, flags);
1790 + entry = irq_2_pin + irq;
1791 + for (;;) {
1792 + unsigned int reg;
1793 + int pin;
1794 +
1795 + pin = entry->pin;
1796 + if (pin == -1)
1797 + break;
1798 + reg = io_apic_read(entry->apic, 0x10 + pin*2);
1799 + /* Is the remote IRR bit set? */
1800 + pending |= (reg >> 14) & 1;
1801 + if (!entry->next)
1802 + break;
1803 + entry = irq_2_pin + entry->next;
1804 + }
1805 + spin_unlock_irqrestore(&ioapic_lock, flags);
1806 + return pending;
1807 +}
1808 #endif
1809
1810 /*
1811 @@ -406,14 +432,12 @@ static void clear_IO_APIC (void)
1812 int skip_ioapic_setup;
1813 int ioapic_force;
1814
1815 -/* dummy parsing: see setup.c */
1816 -
1817 -static int __init disable_ioapic_setup(char *str)
1818 +static int __init parse_noapic(char *str)
1819 {
1820 - skip_ioapic_setup = 1;
1821 + disable_ioapic_setup();
1822 return 0;
1823 }
1824 -early_param("noapic", disable_ioapic_setup);
1825 +early_param("noapic", parse_noapic);
1826
1827 /* Actually the next is obsolete, but keep it for paranoid reasons -AK */
1828 static int __init disable_timer_pin_setup(char *arg)
1829 @@ -765,12 +789,15 @@ static struct irq_chip ioapic_chip;
1830
1831 static void ioapic_register_intr(int irq, unsigned long trigger)
1832 {
1833 - if (trigger)
1834 + if (trigger) {
1835 + irq_desc[irq].status |= IRQ_LEVEL;
1836 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1837 handle_fasteoi_irq, "fasteoi");
1838 - else
1839 + } else {
1840 + irq_desc[irq].status &= ~IRQ_LEVEL;
1841 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1842 handle_edge_irq, "edge");
1843 + }
1844 }
1845 #else
1846 #define ioapic_register_intr(irq, trigger) evtchn_register_pirq(irq)
1847 @@ -1419,9 +1446,37 @@ static void ack_apic_level(unsigned int
1848 ack_APIC_irq();
1849
1850 /* Now we can move and renable the irq */
1851 - move_masked_irq(irq);
1852 - if (unlikely(do_unmask_irq))
1853 + if (unlikely(do_unmask_irq)) {
1854 + /* Only migrate the irq if the ack has been received.
1855 + *
1856 + * On rare occasions the broadcast level triggered ack gets
1857 + * delayed going to ioapics, and if we reprogram the
1858 + * vector while Remote IRR is still set the irq will never
1859 + * fire again.
1860 + *
1861 + * To prevent this scenario we read the Remote IRR bit
1862 + * of the ioapic. This has two effects.
1863 + * - On any sane system the read of the ioapic will
1864 + * flush writes (and acks) going to the ioapic from
1865 + * this cpu.
1866 + * - We get to see if the ACK has actually been delivered.
1867 + *
1868 + * Based on failed experiments of reprogramming the
1869 + * ioapic entry from outside of irq context starting
1870 + * with masking the ioapic entry and then polling until
1871 + * Remote IRR was clear before reprogramming the
1872 + * ioapic I don't trust the Remote IRR bit to be
1873 + * completey accurate.
1874 + *
1875 + * However there appears to be no other way to plug
1876 + * this race, so if the Remote IRR bit is not
1877 + * accurate and is causing problems then it is a hardware bug
1878 + * and you can go talk to the chipset vendor about it.
1879 + */
1880 + if (!io_apic_level_ack_pending(irq))
1881 + move_masked_irq(irq);
1882 unmask_IO_APIC_irq(irq);
1883 + }
1884 }
1885
1886 static struct irq_chip ioapic_chip __read_mostly = {
1887 --- sle11-2009-05-14.orig/arch/x86/kernel/ldt_64-xen.c 2008-12-15 11:27:22.000000000 +0100
1888 +++ sle11-2009-05-14/arch/x86/kernel/ldt_64-xen.c 2009-02-16 16:17:21.000000000 +0100
1889 @@ -114,6 +114,8 @@ int init_new_context(struct task_struct
1890 memset(&mm->context, 0, sizeof(mm->context));
1891 init_MUTEX(&mm->context.sem);
1892 old_mm = current->mm;
1893 + if (old_mm)
1894 + mm->context.vdso = old_mm->context.vdso;
1895 if (old_mm && old_mm->context.size > 0) {
1896 down(&old_mm->context.sem);
1897 retval = copy_ldt(&mm->context, &old_mm->context);
1898 @@ -146,7 +148,7 @@ void destroy_context(struct mm_struct *m
1899 kfree(mm->context.ldt);
1900 mm->context.size = 0;
1901 }
1902 - if (!mm->context.pinned) {
1903 + if (!PagePinned(virt_to_page(mm->pgd))) {
1904 spin_lock(&mm_unpinned_lock);
1905 list_del(&mm->context.unpinned);
1906 spin_unlock(&mm_unpinned_lock);
1907 --- sle11-2009-05-14.orig/arch/x86/kernel/mpparse_64-xen.c 2008-12-15 11:27:22.000000000 +0100
1908 +++ sle11-2009-05-14/arch/x86/kernel/mpparse_64-xen.c 2009-02-16 16:17:21.000000000 +0100
1909 @@ -32,7 +32,6 @@
1910
1911 /* Have we found an MP table */
1912 int smp_found_config;
1913 -unsigned int __initdata maxcpus = NR_CPUS;
1914
1915 /*
1916 * Various Linux-internal data structures created from the
1917 @@ -657,6 +656,20 @@ static int mp_find_ioapic(int gsi)
1918 return -1;
1919 }
1920
1921 +static u8 uniq_ioapic_id(u8 id)
1922 +{
1923 + int i;
1924 + DECLARE_BITMAP(used, 256);
1925 + bitmap_zero(used, 256);
1926 + for (i = 0; i < nr_ioapics; i++) {
1927 + struct mpc_config_ioapic *ia = &mp_ioapics[i];
1928 + __set_bit(ia->mpc_apicid, used);
1929 + }
1930 + if (!test_bit(id, used))
1931 + return id;
1932 + return find_first_zero_bit(used, 256);
1933 +}
1934 +
1935 void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base)
1936 {
1937 int idx = 0;
1938 @@ -664,7 +677,7 @@ void __init mp_register_ioapic(u8 id, u3
1939 if (bad_ioapic(address))
1940 return;
1941
1942 - idx = nr_ioapics++;
1943 + idx = nr_ioapics;
1944
1945 mp_ioapics[idx].mpc_type = MP_IOAPIC;
1946 mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE;
1947 @@ -673,7 +686,7 @@ void __init mp_register_ioapic(u8 id, u3
1948 #ifndef CONFIG_XEN
1949 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
1950 #endif
1951 - mp_ioapics[idx].mpc_apicid = id;
1952 + mp_ioapics[idx].mpc_apicid = uniq_ioapic_id(id);
1953 mp_ioapics[idx].mpc_apicver = 0;
1954
1955 /*
1956 @@ -690,6 +703,8 @@ void __init mp_register_ioapic(u8 id, u3
1957 mp_ioapics[idx].mpc_apicaddr,
1958 mp_ioapic_routing[idx].gsi_start,
1959 mp_ioapic_routing[idx].gsi_end);
1960 +
1961 + nr_ioapics++;
1962 }
1963
1964 void __init
1965 --- sle11-2009-05-14.orig/arch/x86/kernel/process_64-xen.c 2008-12-15 11:27:22.000000000 +0100
1966 +++ sle11-2009-05-14/arch/x86/kernel/process_64-xen.c 2009-02-16 16:17:21.000000000 +0100
1967 @@ -26,6 +26,7 @@
1968 #include <linux/sched.h>
1969 #include <linux/kernel.h>
1970 #include <linux/mm.h>
1971 +#include <linux/fs.h>
1972 #include <linux/elfcore.h>
1973 #include <linux/smp.h>
1974 #include <linux/slab.h>
1975 @@ -249,6 +250,7 @@ early_param("idle", idle_setup);
1976 void __show_regs(struct pt_regs * regs)
1977 {
1978 unsigned long fs, gs, shadowgs;
1979 + unsigned long d0, d1, d2, d3, d6, d7;
1980 unsigned int fsindex,gsindex;
1981 unsigned int ds,cs,es;
1982
1983 @@ -288,6 +290,14 @@ void __show_regs(struct pt_regs * regs)
1984 fs,fsindex,gs,gsindex,shadowgs);
1985 printk("CS: %04x DS: %04x ES: %04x\n", cs, ds, es);
1986
1987 + get_debugreg(d0, 0);
1988 + get_debugreg(d1, 1);
1989 + get_debugreg(d2, 2);
1990 + printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
1991 + get_debugreg(d3, 3);
1992 + get_debugreg(d6, 6);
1993 + get_debugreg(d7, 7);
1994 + printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
1995 }
1996
1997 void show_regs(struct pt_regs *regs)
1998 --- sle11-2009-05-14.orig/arch/x86/kernel/setup_64-xen.c 2008-12-15 11:27:22.000000000 +0100
1999 +++ sle11-2009-05-14/arch/x86/kernel/setup_64-xen.c 2009-02-16 16:17:21.000000000 +0100
2000 @@ -827,6 +827,8 @@ static void __cpuinit init_amd(struct cp
2001 level = cpuid_eax(1);
2002 if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58))
2003 set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
2004 + if (c->x86 == 0x10)
2005 + set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
2006
2007 /* Enable workaround for FXSAVE leak */
2008 if (c->x86 >= 6)
2009 @@ -852,8 +854,14 @@ static void __cpuinit init_amd(struct cp
2010 if (c->extended_cpuid_level >= 0x80000008)
2011 amd_detect_cmp(c);
2012
2013 - /* Fix cpuid4 emulation for more */
2014 - num_cache_leaves = 3;
2015 + if (c->extended_cpuid_level >= 0x80000006 &&
2016 + (cpuid_edx(0x80000006) & 0xf000))
2017 + num_cache_leaves = 4;
2018 + else
2019 + num_cache_leaves = 3;
2020 +
2021 + if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x11)
2022 + set_bit(X86_FEATURE_K8, &c->x86_capability);
2023
2024 /* RDTSC can be speculated around */
2025 clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
2026 @@ -1098,6 +1106,8 @@ void __cpuinit identify_cpu(struct cpuin
2027 c->x86_capability[2] = cpuid_edx(0x80860001);
2028 }
2029
2030 + init_scattered_cpuid_features(c);
2031 +
2032 c->apicid = phys_pkg_id(0);
2033
2034 /*
2035 @@ -1183,7 +1193,7 @@ static int show_cpuinfo(struct seq_file
2036 "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
2037 "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
2038 "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
2039 - "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
2040 + "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",
2041
2042 /* AMD-defined */
2043 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2044 @@ -1199,10 +1209,11 @@ static int show_cpuinfo(struct seq_file
2045 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2046
2047 /* Other (Linux-defined) */
2048 - "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
2049 - "constant_tsc", NULL, NULL,
2050 - "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2051 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2052 + "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
2053 + NULL, NULL, NULL, NULL,
2054 + "constant_tsc", "up", NULL, "arch_perfmon",
2055 + "pebs", "bts", NULL, "sync_rdtsc",
2056 + "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2057 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2058
2059 /* Intel-defined (#2) */
2060 @@ -1213,7 +1224,7 @@ static int show_cpuinfo(struct seq_file
2061
2062 /* VIA/Cyrix/Centaur-defined */
2063 NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
2064 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2065 + "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL,
2066 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2067 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2068
2069 @@ -1224,6 +1235,12 @@ static int show_cpuinfo(struct seq_file
2070 "osvw", "ibs", NULL, NULL, NULL, NULL,
2071 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2072 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2073 +
2074 + /* Auxiliary (Linux-defined) */
2075 + "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2076 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2077 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2078 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2079 };
2080 static char *x86_power_flags[] = {
2081 "ts", /* temperature sensor */
2082 --- sle11-2009-05-14.orig/arch/x86/kernel/setup64-xen.c 2008-12-15 11:27:22.000000000 +0100
2083 +++ sle11-2009-05-14/arch/x86/kernel/setup64-xen.c 2009-02-16 16:17:21.000000000 +0100
2084 @@ -125,11 +125,14 @@ void __init setup_per_cpu_areas(void)
2085 }
2086
2087 #ifdef CONFIG_XEN
2088 -static void switch_pt(void)
2089 +static void __init_refok switch_pt(int cpu)
2090 {
2091 + if (cpu == 0)
2092 + xen_init_pt();
2093 xen_pt_switch(__pa_symbol(init_level4_pgt));
2094 xen_new_user_pt(__pa_symbol(__user_pgd(init_level4_pgt)));
2095 }
2096 +#define switch_pt() switch_pt(cpu)
2097
2098 static void __cpuinit cpu_gdt_init(const struct desc_ptr *gdt_descr)
2099 {
2100 @@ -185,9 +188,6 @@ void pda_init(int cpu)
2101 pda->mmu_state = 0;
2102
2103 if (cpu == 0) {
2104 -#ifdef CONFIG_XEN
2105 - xen_init_pt();
2106 -#endif
2107 /* others are initialized in smpboot.c */
2108 pda->pcurrent = &init_task;
2109 pda->irqstackptr = boot_cpu_stack;
2110 --- sle11-2009-05-14.orig/arch/x86/kernel/smp_64-xen.c 2008-12-15 11:27:22.000000000 +0100
2111 +++ sle11-2009-05-14/arch/x86/kernel/smp_64-xen.c 2009-02-16 16:17:21.000000000 +0100
2112 @@ -362,7 +362,7 @@ __smp_call_function_single(int cpu, void
2113 }
2114
2115 /*
2116 - * smp_call_function_single - Run a function on another CPU
2117 + * smp_call_function_single - Run a function on a specific CPU
2118 * @func: The function to run. This must be fast and non-blocking.
2119 * @info: An arbitrary pointer to pass to the function.
2120 * @nonatomic: Currently unused.
2121 @@ -379,17 +379,21 @@ int smp_call_function_single (int cpu, v
2122 {
2123 /* prevent preemption and reschedule on another processor */
2124 int me = get_cpu();
2125 +
2126 + /* Can deadlock when called with interrupts disabled */
2127 + WARN_ON(irqs_disabled());
2128 +
2129 if (cpu == me) {
2130 + local_irq_disable();
2131 + func(info);
2132 + local_irq_enable();
2133 put_cpu();
2134 return 0;
2135 }
2136
2137 - /* Can deadlock when called with interrupts disabled */
2138 - WARN_ON(irqs_disabled());
2139 -
2140 - spin_lock_bh(&call_lock);
2141 + spin_lock(&call_lock);
2142 __smp_call_function_single(cpu, func, info, nonatomic, wait);
2143 - spin_unlock_bh(&call_lock);
2144 + spin_unlock(&call_lock);
2145 put_cpu();
2146 return 0;
2147 }
2148 --- sle11-2009-05-14.orig/arch/x86/kernel/traps_64-xen.c 2008-12-15 11:27:22.000000000 +0100
2149 +++ sle11-2009-05-14/arch/x86/kernel/traps_64-xen.c 2009-02-16 16:17:21.000000000 +0100
2150 @@ -34,6 +34,10 @@
2151 #include <linux/bug.h>
2152 #include <linux/kdebug.h>
2153
2154 +#if defined(CONFIG_EDAC)
2155 +#include <linux/edac.h>
2156 +#endif
2157 +
2158 #include <asm/system.h>
2159 #include <asm/io.h>
2160 #include <asm/atomic.h>
2161 @@ -332,6 +336,7 @@ static int print_trace_stack(void *data,
2162
2163 static void print_trace_address(void *data, unsigned long addr)
2164 {
2165 + touch_nmi_watchdog();
2166 printk_address(addr);
2167 }
2168
2169 @@ -520,6 +525,7 @@ void __kprobes __die(const char * str, s
2170 printk("\n");
2171 notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV);
2172 show_registers(regs);
2173 + add_taint(TAINT_DIE);
2174 /* Executive summary in case the oops scrolled away */
2175 printk(KERN_ALERT "RIP ");
2176 printk_address(regs->rip);
2177 @@ -533,7 +539,7 @@ void die(const char * str, struct pt_reg
2178 unsigned long flags = oops_begin();
2179
2180 if (!user_mode(regs))
2181 - report_bug(regs->rip);
2182 + report_bug(regs->rip, regs);
2183
2184 __die(str, regs, err);
2185 oops_end(flags);
2186 @@ -582,7 +588,8 @@ static void __kprobes do_trap(int trapnr
2187 tsk->thread.error_code = error_code;
2188 tsk->thread.trap_no = trapnr;
2189
2190 - if (exception_trace && unhandled_signal(tsk, signr))
2191 + if (show_unhandled_signals && unhandled_signal(tsk, signr) &&
2192 + printk_ratelimit())
2193 printk(KERN_INFO
2194 "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
2195 tsk->comm, tsk->pid, str,
2196 @@ -686,7 +693,8 @@ asmlinkage void __kprobes do_general_pro
2197 tsk->thread.error_code = error_code;
2198 tsk->thread.trap_no = 13;
2199
2200 - if (exception_trace && unhandled_signal(tsk, SIGSEGV))
2201 + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
2202 + printk_ratelimit())
2203 printk(KERN_INFO
2204 "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
2205 tsk->comm, tsk->pid,
2206 @@ -721,6 +729,13 @@ mem_parity_error(unsigned char reason, s
2207 reason);
2208 printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n");
2209
2210 +#if defined(CONFIG_EDAC)
2211 + if(edac_handler_set()) {
2212 + edac_atomic_assert_error();
2213 + return;
2214 + }
2215 +#endif
2216 +
2217 if (panic_on_unrecovered_nmi)
2218 panic("NMI: Not continuing");
2219
2220 --- sle11-2009-05-14.orig/arch/x86/kernel/vsyscall_64-xen.c 2008-12-15 11:27:22.000000000 +0100
2221 +++ sle11-2009-05-14/arch/x86/kernel/vsyscall_64-xen.c 2009-02-16 16:17:21.000000000 +0100
2222 @@ -42,6 +42,7 @@
2223 #include <asm/segment.h>
2224 #include <asm/desc.h>
2225 #include <asm/topology.h>
2226 +#include <asm/vgtod.h>
2227
2228 #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
2229 #define __syscall_clobber "r11","rcx","memory"
2230 @@ -57,26 +58,9 @@
2231 * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64)
2232 * Try to keep this structure as small as possible to avoid cache line ping pongs
2233 */
2234 -struct vsyscall_gtod_data_t {
2235 - seqlock_t lock;
2236 -
2237 - /* open coded 'struct timespec' */
2238 - time_t wall_time_sec;
2239 - u32 wall_time_nsec;
2240 -
2241 - int sysctl_enabled;
2242 - struct timezone sys_tz;
2243 - struct { /* extract of a clocksource struct */
2244 - cycle_t (*vread)(void);
2245 - cycle_t cycle_last;
2246 - cycle_t mask;
2247 - u32 mult;
2248 - u32 shift;
2249 - } clock;
2250 -};
2251 int __vgetcpu_mode __section_vgetcpu_mode;
2252
2253 -struct vsyscall_gtod_data_t __vsyscall_gtod_data __section_vsyscall_gtod_data =
2254 +struct vsyscall_gtod_data __vsyscall_gtod_data __section_vsyscall_gtod_data =
2255 {
2256 .lock = SEQLOCK_UNLOCKED,
2257 .sysctl_enabled = 1,
2258 @@ -96,6 +80,8 @@ void update_vsyscall(struct timespec *wa
2259 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec;
2260 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
2261 vsyscall_gtod_data.sys_tz = sys_tz;
2262 + vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
2263 + vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic;
2264 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
2265 }
2266
2267 --- sle11-2009-05-14.orig/arch/x86/mm/fault_64-xen.c 2008-12-15 11:27:22.000000000 +0100
2268 +++ sle11-2009-05-14/arch/x86/mm/fault_64-xen.c 2009-02-16 16:17:21.000000000 +0100
2269 @@ -159,7 +159,9 @@ void dump_pagetable(unsigned long addres
2270 pmd_t *pmd;
2271 pte_t *pte;
2272
2273 - pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
2274 + pgd = (pgd_t *)read_cr3();
2275 +
2276 + pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK);
2277 pgd += pgd_index(address);
2278 if (bad_address(pgd)) goto bad;
2279 printk("PGD %lx ", pgd_val(*pgd));
2280 @@ -219,16 +221,6 @@ static int is_errata93(struct pt_regs *r
2281 return 0;
2282 }
2283
2284 -int unhandled_signal(struct task_struct *tsk, int sig)
2285 -{
2286 - if (is_init(tsk))
2287 - return 1;
2288 - if (tsk->ptrace & PT_PTRACED)
2289 - return 0;
2290 - return (tsk->sighand->action[sig-1].sa.sa_handler == SIG_IGN) ||
2291 - (tsk->sighand->action[sig-1].sa.sa_handler == SIG_DFL);
2292 -}
2293 -
2294 static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs,
2295 unsigned long error_code)
2296 {
2297 @@ -302,8 +294,8 @@ static int vmalloc_fault(unsigned long a
2298 return 0;
2299 }
2300
2301 -int page_fault_trace = 0;
2302 -int exception_trace = 1;
2303 +static int page_fault_trace;
2304 +int show_unhandled_signals = 1;
2305
2306
2307 #define MEM_VERBOSE 1
2308 @@ -372,7 +364,7 @@ asmlinkage void __kprobes do_page_fault(
2309 struct vm_area_struct * vma;
2310 unsigned long address;
2311 const struct exception_table_entry *fixup;
2312 - int write;
2313 + int write, fault;
2314 unsigned long flags;
2315 siginfo_t info;
2316
2317 @@ -384,7 +376,7 @@ asmlinkage void __kprobes do_page_fault(
2318 prefetchw(&mm->mmap_sem);
2319
2320 /* get the address */
2321 - address = current_vcpu_info()->arch.cr2;
2322 + address = read_cr2();
2323
2324 info.si_code = SEGV_MAPERR;
2325
2326 @@ -445,6 +437,13 @@ asmlinkage void __kprobes do_page_fault(
2327 if (unlikely(in_atomic() || !mm))
2328 goto bad_area_nosemaphore;
2329
2330 + /*
2331 + * User-mode registers count as a user access even for any
2332 + * potential system fault or CPU buglet.
2333 + */
2334 + if (user_mode_vm(regs))
2335 + error_code |= PF_USER;
2336 +
2337 again:
2338 /* When running in the kernel we expect faults to occur only to
2339 * addresses in user space. All other faults represent errors in the
2340 @@ -511,19 +510,18 @@ good_area:
2341 * make sure we exit gracefully rather than endlessly redo
2342 * the fault.
2343 */
2344 - switch (handle_mm_fault(mm, vma, address, write)) {
2345 - case VM_FAULT_MINOR:
2346 - tsk->min_flt++;
2347 - break;
2348 - case VM_FAULT_MAJOR:
2349 - tsk->maj_flt++;
2350 - break;
2351 - case VM_FAULT_SIGBUS:
2352 - goto do_sigbus;
2353 - default:
2354 - goto out_of_memory;
2355 + fault = handle_mm_fault(mm, vma, address, write);
2356 + if (unlikely(fault & VM_FAULT_ERROR)) {
2357 + if (fault & VM_FAULT_OOM)
2358 + goto out_of_memory;
2359 + else if (fault & VM_FAULT_SIGBUS)
2360 + goto do_sigbus;
2361 + BUG();
2362 }
2363 -
2364 + if (fault & VM_FAULT_MAJOR)
2365 + tsk->maj_flt++;
2366 + else
2367 + tsk->min_flt++;
2368 up_read(&mm->mmap_sem);
2369 return;
2370
2371 @@ -556,7 +554,8 @@ bad_area_nosemaphore:
2372 (address >> 32))
2373 return;
2374
2375 - if (exception_trace && unhandled_signal(tsk, SIGSEGV)) {
2376 + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
2377 + printk_ratelimit()) {
2378 printk(
2379 "%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n",
2380 tsk->pid > 1 ? KERN_INFO : KERN_EMERG,
2381 @@ -630,7 +629,7 @@ out_of_memory:
2382 }
2383 printk("VM: killing process %s\n", tsk->comm);
2384 if (error_code & 4)
2385 - do_exit(SIGKILL);
2386 + do_group_exit(SIGKILL);
2387 goto no_context;
2388
2389 do_sigbus:
2390 --- sle11-2009-05-14.orig/arch/x86/mm/init_64-xen.c 2008-12-15 11:27:22.000000000 +0100
2391 +++ sle11-2009-05-14/arch/x86/mm/init_64-xen.c 2009-02-16 16:17:21.000000000 +0100
2392 @@ -66,6 +66,9 @@ int after_bootmem;
2393 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
2394 extern unsigned long start_pfn;
2395
2396 +extern pmd_t level2_fixmap_pgt[PTRS_PER_PMD];
2397 +extern pte_t level1_fixmap_pgt[PTRS_PER_PTE];
2398 +
2399 /*
2400 * Use this until direct mapping is established, i.e. before __va() is
2401 * available in init_memory_mapping().
2402 @@ -362,6 +365,10 @@ __set_fixmap (enum fixed_addresses idx,
2403 set_pte_phys(address, phys, prot, 0);
2404 set_pte_phys(address, phys, prot, 1);
2405 break;
2406 + case FIX_EARLYCON_MEM_BASE:
2407 + xen_l1_entry_update(level1_fixmap_pgt + pte_index(address),
2408 + pfn_pte_ma(phys >> PAGE_SHIFT, prot));
2409 + break;
2410 default:
2411 set_pte_phys_ma(address, phys, prot);
2412 break;
2413 @@ -594,6 +601,13 @@ void __init xen_init_pt(void)
2414 __user_pgd(init_level4_pgt)[pgd_index(VSYSCALL_START)] =
2415 __pgd(__pa_symbol(level3_user_pgt) | _PAGE_TABLE);
2416
2417 + /* Do an early initialization of the fixmap area. */
2418 + addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE);
2419 + level3_kernel_pgt[pud_index(addr)] =
2420 + __pud(__pa_symbol(level2_fixmap_pgt) | _PAGE_TABLE);
2421 + level2_fixmap_pgt[pmd_index(addr)] =
2422 + __pmd(__pa_symbol(level1_fixmap_pgt) | _PAGE_TABLE);
2423 +
2424 early_make_page_readonly(init_level4_pgt,
2425 XENFEAT_writable_page_tables);
2426 early_make_page_readonly(__user_pgd(init_level4_pgt),
2427 @@ -604,6 +618,10 @@ void __init xen_init_pt(void)
2428 XENFEAT_writable_page_tables);
2429 early_make_page_readonly(level2_kernel_pgt,
2430 XENFEAT_writable_page_tables);
2431 + early_make_page_readonly(level2_fixmap_pgt,
2432 + XENFEAT_writable_page_tables);
2433 + early_make_page_readonly(level1_fixmap_pgt,
2434 + XENFEAT_writable_page_tables);
2435
2436 if (!xen_feature(XENFEAT_writable_page_tables)) {
2437 xen_pgd_pin(__pa_symbol(init_level4_pgt));
2438 @@ -807,7 +825,7 @@ void __init paging_init(void)
2439 sparse_init();
2440 free_area_init_nodes(max_zone_pfns);
2441
2442 - init_mm.context.pinned = 1;
2443 + SetPagePinned(virt_to_page(init_mm.pgd));
2444 }
2445 #endif
2446
2447 @@ -1118,41 +1136,6 @@ int kern_addr_valid(unsigned long addr)
2448 return pfn_valid(pte_pfn(*pte));
2449 }
2450
2451 -#ifdef CONFIG_SYSCTL
2452 -#include <linux/sysctl.h>
2453 -
2454 -extern int exception_trace, page_fault_trace;
2455 -
2456 -static ctl_table debug_table2[] = {
2457 - {
2458 - .ctl_name = 99,
2459 - .procname = "exception-trace",
2460 - .data = &exception_trace,
2461 - .maxlen = sizeof(int),
2462 - .mode = 0644,
2463 - .proc_handler = proc_dointvec
2464 - },
2465 - {}
2466 -};
2467 -
2468 -static ctl_table debug_root_table2[] = {
2469 - {
2470 - .ctl_name = CTL_DEBUG,
2471 - .procname = "debug",
2472 - .mode = 0555,
2473 - .child = debug_table2
2474 - },
2475 - {}
2476 -};
2477 -
2478 -static __init int x8664_sysctl_init(void)
2479 -{
2480 - register_sysctl_table(debug_root_table2);
2481 - return 0;
2482 -}
2483 -__initcall(x8664_sysctl_init);
2484 -#endif
2485 -
2486 /* A pseudo VMA to allow ptrace access for the vsyscall page. This only
2487 covers the 64bit vsyscall page now. 32bit has a real VMA now and does
2488 not need special handling anymore. */
2489 @@ -1191,9 +1174,18 @@ int in_gate_area_no_task(unsigned long a
2490 }
2491
2492 #ifndef CONFIG_XEN
2493 -void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
2494 +void * __init alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
2495 {
2496 return __alloc_bootmem_core(pgdat->bdata, size,
2497 SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0);
2498 }
2499 #endif
2500 +
2501 +const char *arch_vma_name(struct vm_area_struct *vma)
2502 +{
2503 + if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
2504 + return "[vdso]";
2505 + if (vma == &gate_vma)
2506 + return "[vsyscall]";
2507 + return NULL;
2508 +}
2509 --- sle11-2009-05-14.orig/arch/x86/mm/pageattr_64-xen.c 2008-12-15 11:27:22.000000000 +0100
2510 +++ sle11-2009-05-14/arch/x86/mm/pageattr_64-xen.c 2009-02-16 16:17:21.000000000 +0100
2511 @@ -171,7 +171,7 @@ void mm_pin(struct mm_struct *mm)
2512 mm_walk(mm, PAGE_KERNEL_RO);
2513 xen_pgd_pin(__pa(mm->pgd)); /* kernel */
2514 xen_pgd_pin(__pa(__user_pgd(mm->pgd))); /* user */
2515 - mm->context.pinned = 1;
2516 + SetPagePinned(virt_to_page(mm->pgd));
2517 spin_lock(&mm_unpinned_lock);
2518 list_del(&mm->context.unpinned);
2519 spin_unlock(&mm_unpinned_lock);
2520 @@ -189,7 +189,7 @@ void mm_unpin(struct mm_struct *mm)
2521 xen_pgd_unpin(__pa(mm->pgd));
2522 xen_pgd_unpin(__pa(__user_pgd(mm->pgd)));
2523 mm_walk(mm, PAGE_KERNEL);
2524 - mm->context.pinned = 0;
2525 + ClearPagePinned(virt_to_page(mm->pgd));
2526 spin_lock(&mm_unpinned_lock);
2527 list_add(&mm->context.unpinned, &mm_unpinned);
2528 spin_unlock(&mm_unpinned_lock);
2529 @@ -217,7 +217,7 @@ void mm_pin_all(void)
2530
2531 void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
2532 {
2533 - if (!mm->context.pinned)
2534 + if (!PagePinned(virt_to_page(mm->pgd)))
2535 mm_pin(mm);
2536 }
2537
2538 @@ -243,8 +243,9 @@ void arch_exit_mmap(struct mm_struct *mm
2539
2540 task_unlock(tsk);
2541
2542 - if ( mm->context.pinned && (atomic_read(&mm->mm_count) == 1) &&
2543 - !mm->context.has_foreign_mappings )
2544 + if (PagePinned(virt_to_page(mm->pgd))
2545 + && (atomic_read(&mm->mm_count) == 1)
2546 + && !mm->context.has_foreign_mappings)
2547 mm_unpin(mm);
2548 }
2549
2550 @@ -343,14 +344,13 @@ static void flush_kernel_map(void *arg)
2551 struct page *pg;
2552
2553 /* When clflush is available always use it because it is
2554 - much cheaper than WBINVD. Disable clflush for now because
2555 - the high level code is not ready yet */
2556 + much cheaper than WBINVD. */
2557 + /* clflush is still broken. Disable for now. */
2558 if (1 || !cpu_has_clflush)
2559 asm volatile("wbinvd" ::: "memory");
2560 else list_for_each_entry(pg, l, lru) {
2561 void *adr = page_address(pg);
2562 - if (cpu_has_clflush)
2563 - cache_flush_page(adr);
2564 + cache_flush_page(adr);
2565 }
2566 __flush_tlb_all();
2567 }
2568 @@ -364,7 +364,8 @@ static LIST_HEAD(deferred_pages); /* pro
2569
2570 static inline void save_page(struct page *fpage)
2571 {
2572 - list_add(&fpage->lru, &deferred_pages);
2573 + if (!test_and_set_bit(PG_arch_1, &fpage->flags))
2574 + list_add(&fpage->lru, &deferred_pages);
2575 }
2576
2577 /*
2578 @@ -398,9 +399,12 @@ __change_page_attr(unsigned long address
2579 pte_t *kpte;
2580 struct page *kpte_page;
2581 pgprot_t ref_prot2;
2582 +
2583 kpte = lookup_address(address);
2584 if (!kpte) return 0;
2585 kpte_page = virt_to_page(((unsigned long)kpte) & PAGE_MASK);
2586 + BUG_ON(PageLRU(kpte_page));
2587 + BUG_ON(PageCompound(kpte_page));
2588 if (pgprot_val(prot) != pgprot_val(ref_prot)) {
2589 if (!pte_huge(*kpte)) {
2590 set_pte(kpte, pfn_pte(pfn, prot));
2591 @@ -439,10 +443,9 @@ __change_page_attr(unsigned long address
2592 return 0;
2593 #endif
2594
2595 - if (page_private(kpte_page) == 0) {
2596 - save_page(kpte_page);
2597 + save_page(kpte_page);
2598 + if (page_private(kpte_page) == 0)
2599 revert_page(address, ref_prot);
2600 - }
2601 return 0;
2602 }
2603
2604 @@ -514,6 +517,10 @@ void global_flush_tlb(void)
2605 flush_map(&l);
2606
2607 list_for_each_entry_safe(pg, next, &l, lru) {
2608 + list_del(&pg->lru);
2609 + clear_bit(PG_arch_1, &pg->flags);
2610 + if (page_private(pg) != 0)
2611 + continue;
2612 ClearPagePrivate(pg);
2613 __free_page(pg);
2614 }
2615 --- sle11-2009-05-14.orig/arch/x86/vdso/vdso32/note.S 2009-05-14 10:56:29.000000000 +0200
2616 +++ sle11-2009-05-14/arch/x86/vdso/vdso32/note.S 2009-02-16 16:17:21.000000000 +0100
2617 @@ -13,7 +13,7 @@ ELFNOTE_START(Linux, 0, "a")
2618 .long LINUX_VERSION_CODE
2619 ELFNOTE_END
2620
2621 -#ifdef CONFIG_XEN
2622 +#if defined(CONFIG_X86_XEN) || defined(CONFIG_PARAVIRT_XEN)
2623 /*
2624 * Add a special note telling glibc's dynamic linker a fake hardware
2625 * flavor that it will use to choose the search path for libraries in the
2626 @@ -37,8 +37,12 @@ ELFNOTE_END
2627
2628 ELFNOTE_START(GNU, 2, "a")
2629 .long 1 /* ncaps */
2630 +#ifdef CONFIG_PARAVIRT_XEN
2631 VDSO32_NOTE_MASK: /* Symbol used by arch/x86/xen/setup.c */
2632 .long 0 /* mask */
2633 +#else
2634 + .long 1 << VDSO_NOTE_NONEGSEG_BIT /* mask */
2635 +#endif
2636 .byte VDSO_NOTE_NONEGSEG_BIT; .asciz "nosegneg" /* bit, name */
2637 ELFNOTE_END
2638 #endif
2639 --- sle11-2009-05-14.orig/drivers/Makefile 2009-02-16 15:58:14.000000000 +0100
2640 +++ sle11-2009-05-14/drivers/Makefile 2009-02-16 16:17:21.000000000 +0100
2641 @@ -16,7 +16,7 @@ obj-$(CONFIG_ACPI) += acpi/
2642 obj-$(CONFIG_PNP) += pnp/
2643 obj-$(CONFIG_ARM_AMBA) += amba/
2644
2645 -obj-$(CONFIG_XEN) += xen/
2646 +obj-$(CONFIG_PARAVIRT_XEN) += xen/
2647
2648 # char/ comes before serial/ etc so that the VT console is the boot-time
2649 # default.
2650 --- sle11-2009-05-14.orig/drivers/block/Kconfig 2009-05-14 10:56:29.000000000 +0200
2651 +++ sle11-2009-05-14/drivers/block/Kconfig 2009-02-16 16:17:21.000000000 +0100
2652 @@ -423,9 +423,9 @@ config XILINX_SYSACE
2653 help
2654 Include support for the Xilinx SystemACE CompactFlash interface
2655
2656 -config XEN_BLKDEV_FRONTEND
2657 +config XEN_BLKFRONT
2658 tristate "Xen virtual block device support"
2659 - depends on XEN
2660 + depends on PARAVIRT_XEN
2661 default y
2662 help
2663 This driver implements the front-end of the Xen virtual
2664 --- sle11-2009-05-14.orig/drivers/block/Makefile 2009-05-14 10:56:29.000000000 +0200
2665 +++ sle11-2009-05-14/drivers/block/Makefile 2009-02-16 16:17:21.000000000 +0100
2666 @@ -31,5 +31,5 @@ obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
2667 obj-$(CONFIG_BLK_DEV_UB) += ub.o
2668 obj-$(CONFIG_BLK_DEV_HD) += hd.o
2669
2670 -obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o
2671 +obj-$(CONFIG_XEN_BLKFRONT) += xen-blkfront.o
2672 obj-$(CONFIG_CIPHER_TWOFISH) += loop_fish2.o
2673 --- sle11-2009-05-14.orig/drivers/block/xen-blkfront.c 2009-05-14 10:56:29.000000000 +0200
2674 +++ sle11-2009-05-14/drivers/block/xen-blkfront.c 2009-02-16 16:17:21.000000000 +0100
2675 @@ -1021,7 +1021,6 @@ static struct xenbus_device_id blkfront_
2676
2677 static struct xenbus_driver blkfront = {
2678 .name = "vbd",
2679 - .owner = THIS_MODULE,
2680 .ids = blkfront_ids,
2681 .probe = blkfront_probe,
2682 .remove = blkfront_remove,
2683 --- sle11-2009-05-14.orig/drivers/char/Kconfig 2009-02-16 15:58:02.000000000 +0100
2684 +++ sle11-2009-05-14/drivers/char/Kconfig 2009-02-16 16:17:21.000000000 +0100
2685 @@ -624,7 +624,7 @@ config HVC_BEAT
2686
2687 config HVC_XEN
2688 bool "Xen Hypervisor Console support"
2689 - depends on XEN
2690 + depends on PARAVIRT_XEN
2691 select HVC_DRIVER
2692 select HVC_IRQ
2693 default y
2694 --- sle11-2009-05-14.orig/drivers/net/Kconfig 2009-05-14 10:56:29.000000000 +0200
2695 +++ sle11-2009-05-14/drivers/net/Kconfig 2009-02-16 16:17:21.000000000 +0100
2696 @@ -2545,9 +2545,9 @@ source "drivers/atm/Kconfig"
2697
2698 source "drivers/s390/net/Kconfig"
2699
2700 -config XEN_NETDEV_FRONTEND
2701 +config XEN_NETFRONT
2702 tristate "Xen network device frontend driver"
2703 - depends on XEN
2704 + depends on PARAVIRT_XEN
2705 default y
2706 help
2707 The network device frontend driver allows the kernel to
2708 --- sle11-2009-05-14.orig/drivers/net/Makefile 2009-05-14 10:56:29.000000000 +0200
2709 +++ sle11-2009-05-14/drivers/net/Makefile 2009-02-16 16:17:21.000000000 +0100
2710 @@ -142,7 +142,7 @@ obj-$(CONFIG_PPPOL2TP) += pppox.o pppol2
2711 obj-$(CONFIG_SLIP) += slip.o
2712 obj-$(CONFIG_SLHC) += slhc.o
2713
2714 -obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o
2715 +obj-$(CONFIG_XEN_NETFRONT) += xen-netfront.o
2716
2717 obj-$(CONFIG_DUMMY) += dummy.o
2718 obj-$(CONFIG_IFB) += ifb.o
2719 --- sle11-2009-05-14.orig/drivers/net/xen-netfront.c 2009-05-14 10:56:29.000000000 +0200
2720 +++ sle11-2009-05-14/drivers/net/xen-netfront.c 2009-02-16 16:17:21.000000000 +0100
2721 @@ -36,8 +36,6 @@
2722 #include <linux/skbuff.h>
2723 #include <linux/ethtool.h>
2724 #include <linux/if_ether.h>
2725 -#include <linux/tcp.h>
2726 -#include <linux/udp.h>
2727 #include <linux/moduleparam.h>
2728 #include <linux/mm.h>
2729 #include <net/ip.h>
2730 @@ -765,45 +763,6 @@ static RING_IDX xennet_fill_frags(struct
2731 return cons;
2732 }
2733
2734 -static int skb_checksum_setup(struct sk_buff *skb)
2735 -{
2736 - struct iphdr *iph;
2737 - unsigned char *th;
2738 - int err = -EPROTO;
2739 -
2740 - if (skb->protocol != htons(ETH_P_IP))
2741 - goto out;
2742 -
2743 - iph = (void *)skb->data;
2744 - th = skb->data + 4 * iph->ihl;
2745 - if (th >= skb_tail_pointer(skb))
2746 - goto out;
2747 -
2748 - skb->csum_start = th - skb->head;
2749 - switch (iph->protocol) {
2750 - case IPPROTO_TCP:
2751 - skb->csum_offset = offsetof(struct tcphdr, check);
2752 - break;
2753 - case IPPROTO_UDP:
2754 - skb->csum_offset = offsetof(struct udphdr, check);
2755 - break;
2756 - default:
2757 - if (net_ratelimit())
2758 - printk(KERN_ERR "Attempting to checksum a non-"
2759 - "TCP/UDP packet, dropping a protocol"
2760 - " %d packet", iph->protocol);
2761 - goto out;
2762 - }
2763 -
2764 - if ((th + skb->csum_offset + 2) > skb_tail_pointer(skb))
2765 - goto out;
2766 -
2767 - err = 0;
2768 -
2769 -out:
2770 - return err;
2771 -}
2772 -
2773 static int handle_incoming_queue(struct net_device *dev,
2774 struct sk_buff_head *rxq)
2775 {
2776 @@ -1784,7 +1743,6 @@ static int __devexit xennet_remove(struc
2777
2778 static struct xenbus_driver netfront = {
2779 .name = "vif",
2780 - .owner = THIS_MODULE,
2781 .ids = netfront_ids,
2782 .probe = netfront_probe,
2783 .remove = __devexit_p(xennet_remove),
2784 --- sle11-2009-05-14.orig/drivers/xen/Makefile 2008-11-25 12:35:56.000000000 +0100
2785 +++ sle11-2009-05-14/drivers/xen/Makefile 2009-02-16 16:17:21.000000000 +0100
2786 @@ -1,10 +1,12 @@
2787 -obj-y += core/
2788 -obj-y += console/
2789 -obj-y += evtchn/
2790 -obj-y += xenbus/
2791 -obj-y += char/
2792 +obj-$(CONFIG_PARAVIRT_XEN) += grant-table.o
2793
2794 -obj-y += util.o
2795 +obj-$(CONFIG_XEN) += core/
2796 +obj-$(CONFIG_XEN) += console/
2797 +obj-$(CONFIG_XEN) += evtchn/
2798 +obj-y += xenbus/
2799 +obj-$(CONFIG_XEN) += char/
2800 +
2801 +obj-$(CONFIG_XEN) += util.o
2802 obj-$(CONFIG_XEN_BALLOON) += balloon/
2803 obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/
2804 obj-$(CONFIG_XEN_BLKDEV_TAP) += blktap/
2805 --- sle11-2009-05-14.orig/drivers/xen/blkback/blkback.c 2008-12-15 11:26:44.000000000 +0100
2806 +++ sle11-2009-05-14/drivers/xen/blkback/blkback.c 2009-02-16 16:17:21.000000000 +0100
2807 @@ -154,7 +154,7 @@ static void unplug_queue(blkif_t *blkif)
2808
2809 static void plug_queue(blkif_t *blkif, struct block_device *bdev)
2810 {
2811 - request_queue_t *q = bdev_get_queue(bdev);
2812 + struct request_queue *q = bdev_get_queue(bdev);
2813
2814 if (q == blkif->plug)
2815 return;
2816 --- sle11-2009-05-14.orig/drivers/xen/blkback/common.h 2009-03-04 11:28:34.000000000 +0100
2817 +++ sle11-2009-05-14/drivers/xen/blkback/common.h 2009-02-16 16:17:21.000000000 +0100
2818 @@ -79,7 +79,7 @@ typedef struct blkif_st {
2819 wait_queue_head_t wq;
2820 struct task_struct *xenblkd;
2821 unsigned int waiting_reqs;
2822 - request_queue_t *plug;
2823 + struct request_queue *plug;
2824
2825 /* statistics */
2826 unsigned long st_print;
2827 --- sle11-2009-05-14.orig/drivers/xen/blkback/interface.c 2008-12-15 11:26:44.000000000 +0100
2828 +++ sle11-2009-05-14/drivers/xen/blkback/interface.c 2009-02-16 16:17:21.000000000 +0100
2829 @@ -177,5 +177,5 @@ void blkif_free(blkif_t *blkif)
2830 void __init blkif_interface_init(void)
2831 {
2832 blkif_cachep = kmem_cache_create("blkif_cache", sizeof(blkif_t),
2833 - 0, 0, NULL, NULL);
2834 + 0, 0, NULL);
2835 }
2836 --- sle11-2009-05-14.orig/drivers/xen/blkfront/blkfront.c 2009-03-24 10:11:24.000000000 +0100
2837 +++ sle11-2009-05-14/drivers/xen/blkfront/blkfront.c 2009-03-24 10:12:03.000000000 +0100
2838 @@ -662,7 +662,7 @@ static int blkif_queue_request(struct re
2839 * do_blkif_request
2840 * read a block; request is in a request queue
2841 */
2842 -void do_blkif_request(request_queue_t *rq)
2843 +void do_blkif_request(struct request_queue *rq)
2844 {
2845 struct blkfront_info *info = NULL;
2846 struct request *req;
2847 --- sle11-2009-05-14.orig/drivers/xen/blkfront/block.h 2009-03-05 15:42:00.000000000 +0100
2848 +++ sle11-2009-05-14/drivers/xen/blkfront/block.h 2009-03-24 10:11:58.000000000 +0100
2849 @@ -106,7 +106,7 @@ struct blkfront_info
2850 struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
2851 unsigned int irq;
2852 struct xlbd_major_info *mi;
2853 - request_queue_t *rq;
2854 + struct request_queue *rq;
2855 struct work_struct work;
2856 struct gnttab_free_callback callback;
2857 struct blk_shadow shadow[BLK_RING_SIZE];
2858 @@ -130,7 +130,7 @@ extern int blkif_ioctl(struct inode *ino
2859 extern int blkif_getgeo(struct block_device *, struct hd_geometry *);
2860 extern int blkif_check(dev_t dev);
2861 extern int blkif_revalidate(dev_t dev);
2862 -extern void do_blkif_request (request_queue_t *rq);
2863 +extern void do_blkif_request (struct request_queue *rq);
2864
2865 /* Virtual block-device subsystem. */
2866 /* Note that xlvbd_add doesn't call add_disk for you: you're expected
2867 --- sle11-2009-05-14.orig/drivers/xen/blkfront/vbd.c 2009-05-14 10:56:29.000000000 +0200
2868 +++ sle11-2009-05-14/drivers/xen/blkfront/vbd.c 2009-02-16 16:17:21.000000000 +0100
2869 @@ -211,7 +211,7 @@ xlbd_put_major_info(struct xlbd_major_in
2870 static int
2871 xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size)
2872 {
2873 - request_queue_t *rq;
2874 + struct request_queue *rq;
2875
2876 rq = blk_init_queue(do_blkif_request, &blkif_io_lock);
2877 if (rq == NULL)
2878 --- sle11-2009-05-14.orig/drivers/xen/blktap/common.h 2009-03-04 11:28:34.000000000 +0100
2879 +++ sle11-2009-05-14/drivers/xen/blktap/common.h 2009-02-16 16:17:21.000000000 +0100
2880 @@ -68,7 +68,7 @@ typedef struct blkif_st {
2881 wait_queue_head_t wq;
2882 struct task_struct *xenblkd;
2883 unsigned int waiting_reqs;
2884 - request_queue_t *plug;
2885 + struct request_queue *plug;
2886
2887 /* statistics */
2888 unsigned long st_print;
2889 --- sle11-2009-05-14.orig/drivers/xen/blktap/interface.c 2008-12-15 11:26:44.000000000 +0100
2890 +++ sle11-2009-05-14/drivers/xen/blktap/interface.c 2009-02-16 16:17:21.000000000 +0100
2891 @@ -177,5 +177,5 @@ void tap_blkif_kmem_cache_free(blkif_t *
2892 void __init tap_blkif_interface_init(void)
2893 {
2894 blkif_cachep = kmem_cache_create("blktapif_cache", sizeof(blkif_t),
2895 - 0, 0, NULL, NULL);
2896 + 0, 0, NULL);
2897 }
2898 --- sle11-2009-05-14.orig/drivers/xen/core/features.c 2009-05-14 10:56:29.000000000 +0200
2899 +++ sle11-2009-05-14/drivers/xen/core/features.c 2009-02-16 16:17:21.000000000 +0100
2900 @@ -19,7 +19,7 @@ u8 xen_features[XENFEAT_NR_SUBMAPS * 32]
2901 /* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
2902 EXPORT_SYMBOL(xen_features);
2903
2904 -void setup_xen_features(void)
2905 +void xen_setup_features(void)
2906 {
2907 xen_feature_info_t fi;
2908 int i, j;
2909 --- sle11-2009-05-14.orig/drivers/xen/core/reboot.c 2008-12-15 11:26:44.000000000 +0100
2910 +++ sle11-2009-05-14/drivers/xen/core/reboot.c 2009-02-16 16:17:21.000000000 +0100
2911 @@ -4,6 +4,7 @@
2912 #include <linux/unistd.h>
2913 #include <linux/module.h>
2914 #include <linux/reboot.h>
2915 +#include <linux/sched.h>
2916 #include <linux/sysrq.h>
2917 #include <asm/hypervisor.h>
2918 #include <xen/xenbus.h>
2919 --- sle11-2009-05-14.orig/drivers/xen/scsiback/interface.c 2008-12-15 11:26:44.000000000 +0100
2920 +++ sle11-2009-05-14/drivers/xen/scsiback/interface.c 2009-02-16 16:17:21.000000000 +0100
2921 @@ -167,7 +167,7 @@ void scsiback_free(struct vscsibk_info *
2922 int __init scsiback_interface_init(void)
2923 {
2924 scsiback_cachep = kmem_cache_create("vscsiif_cache",
2925 - sizeof(struct vscsibk_info), 0, 0, NULL, NULL);
2926 + sizeof(struct vscsibk_info), 0, 0, NULL);
2927 if (!scsiback_cachep) {
2928 printk(KERN_ERR "scsiback: can't init scsi cache\n");
2929 return -ENOMEM;
2930 --- sle11-2009-05-14.orig/drivers/xen/scsifront/scsifront.c 2009-03-04 11:28:34.000000000 +0100
2931 +++ sle11-2009-05-14/drivers/xen/scsifront/scsifront.c 2009-02-16 16:17:21.000000000 +0100
2932 @@ -147,7 +147,7 @@ static void scsifront_cdb_cmd_done(struc
2933 add_id_to_freelist(info, id);
2934
2935 sc->result = ring_res->rslt;
2936 - sc->resid = ring_res->residual_len;
2937 + scsi_set_resid(sc, ring_res->residual_len);
2938
2939 if (ring_res->sense_len > VSCSIIF_SENSE_BUFFERSIZE)
2940 sense_len = VSCSIIF_SENSE_BUFFERSIZE;
2941 --- sle11-2009-05-14.orig/drivers/xen/tpmback/interface.c 2009-03-04 11:25:55.000000000 +0100
2942 +++ sle11-2009-05-14/drivers/xen/tpmback/interface.c 2009-02-16 16:17:21.000000000 +0100
2943 @@ -12,6 +12,7 @@
2944 */
2945
2946 #include "common.h"
2947 +#include <linux/err.h>
2948 #include <xen/balloon.h>
2949 #include <xen/gnttab.h>
2950
2951 @@ -159,7 +160,7 @@ void tpmif_disconnect_complete(tpmif_t *
2952 int __init tpmif_interface_init(void)
2953 {
2954 tpmif_cachep = kmem_cache_create("tpmif_cache", sizeof (tpmif_t),
2955 - 0, 0, NULL, NULL);
2956 + 0, 0, NULL);
2957 return tpmif_cachep ? 0 : -ENOMEM;
2958 }
2959
2960 --- sle11-2009-05-14.orig/drivers/xen/util.c 2009-05-14 10:56:29.000000000 +0200
2961 +++ sle11-2009-05-14/drivers/xen/util.c 2009-02-16 16:17:21.000000000 +0100
2962 @@ -1,8 +1,5 @@
2963 -#include <linux/mm.h>
2964 +#include <linux/err.h>
2965 #include <linux/module.h>
2966 -#include <linux/slab.h>
2967 -#include <linux/vmalloc.h>
2968 -#include <asm/uaccess.h>
2969 #include <xen/driver_util.h>
2970
2971 struct class *get_xen_class(void)
2972 @@ -21,45 +18,3 @@ struct class *get_xen_class(void)
2973 return xen_class;
2974 }
2975 EXPORT_SYMBOL_GPL(get_xen_class);
2976 -
2977 -#ifdef CONFIG_X86
2978 -static int f(pte_t *pte, struct page *pmd_page, unsigned long addr, void *data)
2979 -{
2980 - /* apply_to_page_range() does all the hard work. */
2981 - return 0;
2982 -}
2983 -
2984 -struct vm_struct *alloc_vm_area(unsigned long size)
2985 -{
2986 - struct vm_struct *area;
2987 -
2988 - area = get_vm_area(size, VM_IOREMAP);
2989 - if (area == NULL)
2990 - return NULL;
2991 -
2992 - /*
2993 - * This ensures that page tables are constructed for this region
2994 - * of kernel virtual address space and mapped into init_mm.
2995 - */
2996 - if (apply_to_page_range(&init_mm, (unsigned long)area->addr,
2997 - area->size, f, NULL)) {
2998 - free_vm_area(area);
2999 - return NULL;
3000 - }
3001 -
3002 - /* Map page directories into every address space. */
3003 - vmalloc_sync_all();
3004 -
3005 - return area;
3006 -}
3007 -EXPORT_SYMBOL_GPL(alloc_vm_area);
3008 -
3009 -void free_vm_area(struct vm_struct *area)
3010 -{
3011 - struct vm_struct *ret;
3012 - ret = remove_vm_area(area->addr);
3013 - BUG_ON(ret != area);
3014 - kfree(area);
3015 -}
3016 -EXPORT_SYMBOL_GPL(free_vm_area);
3017 -#endif /* CONFIG_X86 */
3018 --- sle11-2009-05-14.orig/drivers/xen/xenbus/xenbus_client.c 2009-03-17 15:27:31.000000000 +0100
3019 +++ sle11-2009-05-14/drivers/xen/xenbus/xenbus_client.c 2009-03-24 10:12:22.000000000 +0100
3020 @@ -30,19 +30,26 @@
3021 * IN THE SOFTWARE.
3022 */
3023
3024 +#if defined(CONFIG_XEN) || defined(MODULE)
3025 #include <linux/slab.h>
3026 #include <xen/evtchn.h>
3027 #include <xen/gnttab.h>
3028 -#include <xen/xenbus.h>
3029 #include <xen/driver_util.h>
3030 +#else
3031 +#include <linux/types.h>
3032 +#include <linux/vmalloc.h>
3033 +#include <asm/xen/hypervisor.h>
3034 +#include <xen/interface/xen.h>
3035 +#include <xen/interface/event_channel.h>
3036 +#include <xen/events.h>
3037 +#include <xen/grant_table.h>
3038 +#endif
3039 +#include <xen/xenbus.h>
3040
3041 #ifdef HAVE_XEN_PLATFORM_COMPAT_H
3042 #include <xen/platform-compat.h>
3043 #endif
3044
3045 -#define DPRINTK(fmt, args...) \
3046 - pr_debug("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
3047 -
3048 const char *xenbus_strstate(enum xenbus_state state)
3049 {
3050 static const char *const name[] = {
3051 @@ -60,6 +67,20 @@ const char *xenbus_strstate(enum xenbus_
3052 }
3053 EXPORT_SYMBOL_GPL(xenbus_strstate);
3054
3055 +/**
3056 + * xenbus_watch_path - register a watch
3057 + * @dev: xenbus device
3058 + * @path: path to watch
3059 + * @watch: watch to register
3060 + * @callback: callback to register
3061 + *
3062 + * Register a @watch on the given path, using the given xenbus_watch structure
3063 + * for storage, and the given @callback function as the callback. Return 0 on
3064 + * success, or -errno on error. On success, the given @path will be saved as
3065 + * @watch->node, and remains the caller's to free. On error, @watch->node will
3066 + * be NULL, the device will switch to %XenbusStateClosing, and the error will
3067 + * be saved in the store.
3068 + */
3069 int xenbus_watch_path(struct xenbus_device *dev, const char *path,
3070 struct xenbus_watch *watch,
3071 void (*callback)(struct xenbus_watch *,
3072 @@ -83,6 +104,7 @@ int xenbus_watch_path(struct xenbus_devi
3073 EXPORT_SYMBOL_GPL(xenbus_watch_path);
3074
3075
3076 +#if defined(CONFIG_XEN) || defined(MODULE)
3077 int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
3078 const char *path2, struct xenbus_watch *watch,
3079 void (*callback)(struct xenbus_watch *,
3080 @@ -101,8 +123,60 @@ int xenbus_watch_path2(struct xenbus_dev
3081 return err;
3082 }
3083 EXPORT_SYMBOL_GPL(xenbus_watch_path2);
3084 +#else
3085 +/**
3086 + * xenbus_watch_pathfmt - register a watch on a sprintf-formatted path
3087 + * @dev: xenbus device
3088 + * @watch: watch to register
3089 + * @callback: callback to register
3090 + * @pathfmt: format of path to watch
3091 + *
3092 + * Register a watch on the given @path, using the given xenbus_watch
3093 + * structure for storage, and the given @callback function as the callback.
3094 + * Return 0 on success, or -errno on error. On success, the watched path
3095 + * (@path/@path2) will be saved as @watch->node, and becomes the caller's to
3096 + * kfree(). On error, watch->node will be NULL, so the caller has nothing to
3097 + * free, the device will switch to %XenbusStateClosing, and the error will be
3098 + * saved in the store.
3099 + */
3100 +int xenbus_watch_pathfmt(struct xenbus_device *dev,
3101 + struct xenbus_watch *watch,
3102 + void (*callback)(struct xenbus_watch *,
3103 + const char **, unsigned int),
3104 + const char *pathfmt, ...)
3105 +{
3106 + int err;
3107 + va_list ap;
3108 + char *path;
3109
3110 + va_start(ap, pathfmt);
3111 + path = kvasprintf(GFP_KERNEL, pathfmt, ap);
3112 + va_end(ap);
3113
3114 + if (!path) {
3115 + xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch");
3116 + return -ENOMEM;
3117 + }
3118 + err = xenbus_watch_path(dev, path, watch, callback);
3119 +
3120 + if (err)
3121 + kfree(path);
3122 + return err;
3123 +}
3124 +EXPORT_SYMBOL_GPL(xenbus_watch_pathfmt);
3125 +#endif
3126 +
3127 +
3128 +/**
3129 + * xenbus_switch_state
3130 + * @dev: xenbus device
3131 + * @xbt: transaction handle
3132 + * @state: new state
3133 + *
3134 + * Advertise in the store a change of the given driver to the given new_state.
3135 + * Return 0 on success, or -errno on error. On error, the device will switch
3136 + * to XenbusStateClosing, and the error will be saved in the store.
3137 + */
3138 int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state state)
3139 {
3140 /* We check whether the state is currently set to the given value, and
3141 @@ -161,8 +235,8 @@ static char *error_path(struct xenbus_de
3142 }
3143
3144
3145 -void _dev_error(struct xenbus_device *dev, int err, const char *fmt,
3146 - va_list ap)
3147 +static void _dev_error(struct xenbus_device *dev, int err,
3148 + const char *fmt, va_list ap)
3149 {
3150 int ret;
3151 unsigned int len;
3152 @@ -183,14 +257,16 @@ void _dev_error(struct xenbus_device *de
3153 path_buffer = error_path(dev);
3154
3155 if (path_buffer == NULL) {
3156 - printk("xenbus: failed to write error node for %s (%s)\n",
3157 - dev->nodename, printf_buffer);
3158 + dev_err(&dev->dev,
3159 + "xenbus: failed to write error node for %s (%s)\n",
3160 + dev->nodename, printf_buffer);
3161 goto fail;
3162 }
3163
3164 if (xenbus_write(XBT_NIL, path_buffer, "error", printf_buffer) != 0) {
3165 - printk("xenbus: failed to write error node for %s (%s)\n",
3166 - dev->nodename, printf_buffer);
3167 + dev_err(&dev->dev,
3168 + "xenbus: failed to write error node for %s (%s)\n",
3169 + dev->nodename, printf_buffer);
3170 goto fail;
3171 }
3172
3173 @@ -202,6 +278,15 @@ fail:
3174 }
3175
3176
3177 +/**
3178 + * xenbus_dev_error
3179 + * @dev: xenbus device
3180 + * @err: error to report
3181 + * @fmt: error message format
3182 + *
3183 + * Report the given negative errno into the store, along with the given
3184 + * formatted message.
3185 + */
3186 void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt,
3187 ...)
3188 {
3189 @@ -214,6 +299,16 @@ void xenbus_dev_error(struct xenbus_devi
3190 EXPORT_SYMBOL_GPL(xenbus_dev_error);
3191
3192
3193 +/**
3194 + * xenbus_dev_fatal
3195 + * @dev: xenbus device
3196 + * @err: error to report
3197 + * @fmt: error message format
3198 + *
3199 + * Equivalent to xenbus_dev_error(dev, err, fmt, args), followed by
3200 + * xenbus_switch_state(dev, NULL, XenbusStateClosing) to schedule an orderly
3201 + * closedown of this driver and its peer.
3202 + */
3203 void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,
3204 ...)
3205 {
3206 @@ -228,6 +323,15 @@ void xenbus_dev_fatal(struct xenbus_devi
3207 EXPORT_SYMBOL_GPL(xenbus_dev_fatal);
3208
3209
3210 +/**
3211 + * xenbus_grant_ring
3212 + * @dev: xenbus device
3213 + * @ring_mfn: mfn of ring to grant
3214 + *
3215 + * Grant access to the given @ring_mfn to the peer of the given device. Return
3216 + * 0 on success, or -errno on error. On error, the device will switch to
3217 + * XenbusStateClosing, and the error will be saved in the store.
3218 + */
3219 int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn)
3220 {
3221 int err = gnttab_grant_foreign_access(dev->otherend_id, ring_mfn, 0);
3222 @@ -238,6 +342,12 @@ int xenbus_grant_ring(struct xenbus_devi
3223 EXPORT_SYMBOL_GPL(xenbus_grant_ring);
3224
3225
3226 +/**
3227 + * Allocate an event channel for the given xenbus_device, assigning the newly
3228 + * created local port to *port. Return 0 on success, or -errno on error. On
3229 + * error, the device will switch to XenbusStateClosing, and the error will be
3230 + * saved in the store.
3231 + */
3232 int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port)
3233 {
3234 struct evtchn_alloc_unbound alloc_unbound;
3235 @@ -258,6 +368,38 @@ int xenbus_alloc_evtchn(struct xenbus_de
3236 EXPORT_SYMBOL_GPL(xenbus_alloc_evtchn);
3237
3238
3239 +#if 0 /* !defined(CONFIG_XEN) && !defined(MODULE) */
3240 +/**
3241 + * Bind to an existing interdomain event channel in another domain. Returns 0
3242 + * on success and stores the local port in *port. On error, returns -errno,
3243 + * switches the device to XenbusStateClosing, and saves the error in XenStore.
3244 + */
3245 +int xenbus_bind_evtchn(struct xenbus_device *dev, int remote_port, int *port)
3246 +{
3247 + struct evtchn_bind_interdomain bind_interdomain;
3248 + int err;
3249 +
3250 + bind_interdomain.remote_dom = dev->otherend_id;
3251 + bind_interdomain.remote_port = remote_port;
3252 +
3253 + err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
3254 + &bind_interdomain);
3255 + if (err)
3256 + xenbus_dev_fatal(dev, err,
3257 + "binding to event channel %d from domain %d",
3258 + remote_port, dev->otherend_id);
3259 + else
3260 + *port = bind_interdomain.local_port;
3261 +
3262 + return err;
3263 +}
3264 +EXPORT_SYMBOL_GPL(xenbus_bind_evtchn);
3265 +#endif
3266 +
3267 +
3268 +/**
3269 + * Free an existing event channel. Returns 0 on success or -errno on error.
3270 + */
3271 int xenbus_free_evtchn(struct xenbus_device *dev, int port)
3272 {
3273 struct evtchn_close close;
3274 @@ -274,6 +416,191 @@ int xenbus_free_evtchn(struct xenbus_dev
3275 EXPORT_SYMBOL_GPL(xenbus_free_evtchn);
3276
3277
3278 +#if 0 /* !defined(CONFIG_XEN) && !defined(MODULE) */
3279 +/**
3280 + * xenbus_map_ring_valloc
3281 + * @dev: xenbus device
3282 + * @gnt_ref: grant reference
3283 + * @vaddr: pointer to address to be filled out by mapping
3284 + *
3285 + * Based on Rusty Russell's skeleton driver's map_page.
3286 + * Map a page of memory into this domain from another domain's grant table.
3287 + * xenbus_map_ring_valloc allocates a page of virtual address space, maps the
3288 + * page to that address, and sets *vaddr to that address.
3289 + * Returns 0 on success, and GNTST_* (see xen/include/interface/grant_table.h)
3290 + * or -ENOMEM on error. If an error is returned, device will switch to
3291 + * XenbusStateClosing and the error message will be saved in XenStore.
3292 + */
3293 +int xenbus_map_ring_valloc(struct xenbus_device *dev, int gnt_ref, void **vaddr)
3294 +{
3295 + struct gnttab_map_grant_ref op = {
3296 + .flags = GNTMAP_host_map,
3297 + .ref = gnt_ref,
3298 + .dom = dev->otherend_id,
3299 + };
3300 + struct vm_struct *area;
3301 +
3302 + *vaddr = NULL;
3303 +
3304 + area = alloc_vm_area(PAGE_SIZE);
3305 + if (!area)
3306 + return -ENOMEM;
3307 +
3308 + op.host_addr = (unsigned long)area->addr;
3309 +
3310 + if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1))
3311 + BUG();
3312 +
3313 + if (op.status != GNTST_okay) {
3314 + free_vm_area(area);
3315 + xenbus_dev_fatal(dev, op.status,
3316 + "mapping in shared page %d from domain %d",
3317 + gnt_ref, dev->otherend_id);
3318 + return op.status;
3319 + }
3320 +
3321 + /* Stuff the handle in an unused field */
3322 + area->phys_addr = (unsigned long)op.handle;
3323 +
3324 + *vaddr = area->addr;
3325 + return 0;
3326 +}
3327 +EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc);
3328 +
3329 +
3330 +/**
3331 + * xenbus_map_ring
3332 + * @dev: xenbus device
3333 + * @gnt_ref: grant reference
3334 + * @handle: pointer to grant handle to be filled
3335 + * @vaddr: address to be mapped to
3336 + *
3337 + * Map a page of memory into this domain from another domain's grant table.
3338 + * xenbus_map_ring does not allocate the virtual address space (you must do
3339 + * this yourself!). It only maps in the page to the specified address.
3340 + * Returns 0 on success, and GNTST_* (see xen/include/interface/grant_table.h)
3341 + * or -ENOMEM on error. If an error is returned, device will switch to
3342 + * XenbusStateClosing and the error message will be saved in XenStore.
3343 + */
3344 +int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
3345 + grant_handle_t *handle, void *vaddr)
3346 +{
3347 + struct gnttab_map_grant_ref op = {
3348 + .host_addr = (unsigned long)vaddr,
3349 + .flags = GNTMAP_host_map,
3350 + .ref = gnt_ref,
3351 + .dom = dev->otherend_id,
3352 + };
3353 +
3354 + if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1))
3355 + BUG();
3356 +
3357 + if (op.status != GNTST_okay) {
3358 + xenbus_dev_fatal(dev, op.status,
3359 + "mapping in shared page %d from domain %d",
3360 + gnt_ref, dev->otherend_id);
3361 + } else
3362 + *handle = op.handle;
3363 +
3364 + return op.status;
3365 +}
3366 +EXPORT_SYMBOL_GPL(xenbus_map_ring);
3367 +
3368 +
3369 +/**
3370 + * xenbus_unmap_ring_vfree
3371 + * @dev: xenbus device
3372 + * @vaddr: addr to unmap
3373 + *
3374 + * Based on Rusty Russell's skeleton driver's unmap_page.
3375 + * Unmap a page of memory in this domain that was imported from another domain.
3376 + * Use xenbus_unmap_ring_vfree if you mapped in your memory with
3377 + * xenbus_map_ring_valloc (it will free the virtual address space).
3378 + * Returns 0 on success and returns GNTST_* on error
3379 + * (see xen/include/interface/grant_table.h).
3380 + */
3381 +int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr)
3382 +{
3383 + struct vm_struct *area;
3384 + struct gnttab_unmap_grant_ref op = {
3385 + .host_addr = (unsigned long)vaddr,
3386 + };
3387 +
3388 + /* It'd be nice if linux/vmalloc.h provided a find_vm_area(void *addr)
3389 + * method so that we don't have to muck with vmalloc internals here.
3390 + * We could force the user to hang on to their struct vm_struct from
3391 + * xenbus_map_ring_valloc, but these 6 lines considerably simplify
3392 + * this API.
3393 + */
3394 + read_lock(&vmlist_lock);
3395 + for (area = vmlist; area != NULL; area = area->next) {
3396 + if (area->addr == vaddr)
3397 + break;
3398 + }
3399 + read_unlock(&vmlist_lock);
3400 +
3401 + if (!area) {
3402 + xenbus_dev_error(dev, -ENOENT,
3403 + "can't find mapped virtual address %p", vaddr);
3404 + return GNTST_bad_virt_addr;
3405 + }
3406 +
3407 + op.handle = (grant_handle_t)area->phys_addr;
3408 +
3409 + if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
3410 + BUG();
3411 +
3412 + if (op.status == GNTST_okay)
3413 + free_vm_area(area);
3414 + else
3415 + xenbus_dev_error(dev, op.status,
3416 + "unmapping page at handle %d error %d",
3417 + (int16_t)area->phys_addr, op.status);
3418 +
3419 + return op.status;
3420 +}
3421 +EXPORT_SYMBOL_GPL(xenbus_unmap_ring_vfree);
3422 +
3423 +
3424 +/**
3425 + * xenbus_unmap_ring
3426 + * @dev: xenbus device
3427 + * @handle: grant handle
3428 + * @vaddr: addr to unmap
3429 + *
3430 + * Unmap a page of memory in this domain that was imported from another domain.
3431 + * Returns 0 on success and returns GNTST_* on error
3432 + * (see xen/include/interface/grant_table.h).
3433 + */
3434 +int xenbus_unmap_ring(struct xenbus_device *dev,
3435 + grant_handle_t handle, void *vaddr)
3436 +{
3437 + struct gnttab_unmap_grant_ref op = {
3438 + .host_addr = (unsigned long)vaddr,
3439 + .handle = handle,
3440 + };
3441 +
3442 + if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
3443 + BUG();
3444 +
3445 + if (op.status != GNTST_okay)
3446 + xenbus_dev_error(dev, op.status,
3447 + "unmapping page at handle %d error %d",
3448 + handle, op.status);
3449 +
3450 + return op.status;
3451 +}
3452 +EXPORT_SYMBOL_GPL(xenbus_unmap_ring);
3453 +#endif
3454 +
3455 +
3456 +/**
3457 + * xenbus_read_driver_state
3458 + * @path: path for driver
3459 + *
3460 + * Return the state of the driver rooted at the given store path, or
3461 + * XenbusStateUnknown if no state can be read.
3462 + */
3463 enum xenbus_state xenbus_read_driver_state(const char *path)
3464 {
3465 enum xenbus_state result;
3466 --- sle11-2009-05-14.orig/drivers/xen/xenbus/xenbus_comms.c 2008-12-15 11:26:44.000000000 +0100
3467 +++ sle11-2009-05-14/drivers/xen/xenbus/xenbus_comms.c 2009-02-16 16:17:21.000000000 +0100
3468 @@ -34,12 +34,15 @@
3469 #include <linux/interrupt.h>
3470 #include <linux/sched.h>
3471 #include <linux/err.h>
3472 -#include <linux/ptrace.h>
3473 -#include <linux/workqueue.h>
3474 -#include <xen/evtchn.h>
3475 #include <xen/xenbus.h>
3476 -
3477 +#if defined(CONFIG_XEN) || defined(MODULE)
3478 +#include <xen/evtchn.h>
3479 #include <asm/hypervisor.h>
3480 +#else
3481 +#include <asm/xen/hypervisor.h>
3482 +#include <xen/events.h>
3483 +#include <xen/page.h>
3484 +#endif
3485
3486 #include "xenbus_comms.h"
3487
3488 @@ -91,6 +94,13 @@ static const void *get_input_chunk(XENST
3489 return buf + MASK_XENSTORE_IDX(cons);
3490 }
3491
3492 +/**
3493 + * xb_write - low level write
3494 + * @data: buffer to send
3495 + * @len: length of buffer
3496 + *
3497 + * Returns 0 on success, error otherwise.
3498 + */
3499 int xb_write(const void *data, unsigned len)
3500 {
3501 struct xenstore_domain_interface *intf = xen_store_interface;
3502 @@ -199,7 +209,9 @@ int xb_read(void *data, unsigned len)
3503 return 0;
3504 }
3505
3506 -/* Set up interrupt handler off store event channel. */
3507 +/**
3508 + * xb_init_comms - Set up interrupt handler off store event channel.
3509 + */
3510 int xb_init_comms(void)
3511 {
3512 struct xenstore_domain_interface *intf = xen_store_interface;
3513 @@ -219,7 +231,11 @@ int xb_init_comms(void)
3514 if (xenbus_irq)
3515 unbind_from_irqhandler(xenbus_irq, &xb_waitq);
3516
3517 +#if defined(CONFIG_XEN) || defined(MODULE)
3518 err = bind_caller_port_to_irqhandler(
3519 +#else
3520 + err = bind_evtchn_to_irqhandler(
3521 +#endif
3522 xen_store_evtchn, wake_waiting,
3523 0, "xenbus", &xb_waitq);
3524 if (err <= 0) {
3525 --- sle11-2009-05-14.orig/drivers/xen/xenbus/xenbus_probe.c 2009-03-04 11:25:55.000000000 +0100
3526 +++ sle11-2009-05-14/drivers/xen/xenbus/xenbus_probe.c 2009-02-16 16:17:21.000000000 +0100
3527 @@ -43,12 +43,11 @@
3528 #include <linux/mm.h>
3529 #include <linux/notifier.h>
3530 #include <linux/mutex.h>
3531 -#include <linux/module.h>
3532 +#include <linux/io.h>
3533
3534 -#include <asm/io.h>
3535 #include <asm/page.h>
3536 -#include <asm/maddr.h>
3537 #include <asm/pgtable.h>
3538 +#if defined(CONFIG_XEN) || defined(MODULE)
3539 #include <asm/hypervisor.h>
3540 #include <xen/xenbus.h>
3541 #include <xen/xen_proc.h>
3542 @@ -57,6 +56,12 @@
3543 #ifdef MODULE
3544 #include <xen/hvm.h>
3545 #endif
3546 +#else
3547 +#include <asm/xen/hypervisor.h>
3548 +#include <xen/xenbus.h>
3549 +#include <xen/events.h>
3550 +#include <xen/page.h>
3551 +#endif
3552
3553 #include "xenbus_comms.h"
3554 #include "xenbus_probe.h"
3555 @@ -168,7 +173,7 @@ static int read_backend_details(struct x
3556 return read_otherend_details(xendev, "backend-id", "backend");
3557 }
3558
3559 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
3560 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && (defined(CONFIG_XEN) || defined(MODULE))
3561 static int xenbus_uevent_frontend(struct device *dev, char **envp,
3562 int num_envp, char *buffer, int buffer_size)
3563 {
3564 @@ -207,12 +212,16 @@ static struct xen_bus_type xenbus_fronte
3565 .probe = xenbus_dev_probe,
3566 .remove = xenbus_dev_remove,
3567 .shutdown = xenbus_dev_shutdown,
3568 +#if defined(CONFIG_XEN) || defined(MODULE)
3569 .uevent = xenbus_uevent_frontend,
3570 #endif
3571 +#endif
3572 },
3573 +#if defined(CONFIG_XEN) || defined(MODULE)
3574 .dev = {
3575 .bus_id = "xen",
3576 },
3577 +#endif
3578 };
3579
3580 static void otherend_changed(struct xenbus_watch *watch,
3581 @@ -228,14 +237,15 @@ static void otherend_changed(struct xenb
3582 if (!dev->otherend ||
3583 strncmp(dev->otherend, vec[XS_WATCH_PATH],
3584 strlen(dev->otherend))) {
3585 - DPRINTK("Ignoring watch at %s", vec[XS_WATCH_PATH]);
3586 + dev_dbg(&dev->dev, "Ignoring watch at %s", vec[XS_WATCH_PATH]);
3587 return;
3588 }
3589
3590 state = xenbus_read_driver_state(dev->otherend);
3591
3592 - DPRINTK("state is %d (%s), %s, %s", state, xenbus_strstate(state),
3593 - dev->otherend_watch.node, vec[XS_WATCH_PATH]);
3594 + dev_dbg(&dev->dev, "state is %d (%s), %s, %s",
3595 + state, xenbus_strstate(state), dev->otherend_watch.node,
3596 + vec[XS_WATCH_PATH]);
3597
3598 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
3599 /*
3600 @@ -271,8 +281,13 @@ static int talk_to_otherend(struct xenbu
3601
3602 static int watch_otherend(struct xenbus_device *dev)
3603 {
3604 +#if defined(CONFIG_XEN) || defined(MODULE)
3605 return xenbus_watch_path2(dev, dev->otherend, "state",
3606 &dev->otherend_watch, otherend_changed);
3607 +#else
3608 + return xenbus_watch_pathfmt(dev, &dev->otherend_watch, otherend_changed,
3609 + "%s/%s", dev->otherend, "state");
3610 +#endif
3611 }
3612
3613
3614 @@ -298,9 +313,9 @@ int xenbus_dev_probe(struct device *_dev
3615
3616 err = talk_to_otherend(dev);
3617 if (err) {
3618 - printk(KERN_WARNING
3619 - "xenbus_probe: talk_to_otherend on %s failed.\n",
3620 - dev->nodename);
3621 + dev_warn(&dev->dev,
3622 + "xenbus_probe: talk_to_otherend on %s failed.\n",
3623 + dev->nodename);
3624 return err;
3625 }
3626
3627 @@ -310,9 +325,9 @@ int xenbus_dev_probe(struct device *_dev
3628
3629 err = watch_otherend(dev);
3630 if (err) {
3631 - printk(KERN_WARNING
3632 - "xenbus_probe: watch_otherend on %s failed.\n",
3633 - dev->nodename);
3634 + dev_warn(&dev->dev,
3635 + "xenbus_probe: watch_otherend on %s failed.\n",
3636 + dev->nodename);
3637 return err;
3638 }
3639
3640 @@ -352,14 +367,15 @@ static void xenbus_dev_shutdown(struct d
3641
3642 get_device(&dev->dev);
3643 if (dev->state != XenbusStateConnected) {
3644 - printk("%s: %s: %s != Connected, skipping\n", __FUNCTION__,
3645 - dev->nodename, xenbus_strstate(dev->state));
3646 + dev_info(&dev->dev, "%s: %s: %s != Connected, skipping\n", __FUNCTION__,
3647 + dev->nodename, xenbus_strstate(dev->state));
3648 goto out;
3649 }
3650 xenbus_switch_state(dev, XenbusStateClosing);
3651 timeout = wait_for_completion_timeout(&dev->down, timeout);
3652 if (!timeout)
3653 - printk("%s: %s timeout closing device\n", __FUNCTION__, dev->nodename);
3654 + dev_info(&dev->dev, "%s: %s timeout closing device\n",
3655 + __FUNCTION__, dev->nodename);
3656 out:
3657 put_device(&dev->dev);
3658 }
3659 @@ -547,7 +563,9 @@ int xenbus_probe_node(struct xen_bus_typ
3660 xendev->devicetype = tmpstring;
3661 init_completion(&xendev->down);
3662
3663 +#if defined(CONFIG_XEN) || defined(MODULE)
3664 xendev->dev.parent = &bus->dev;
3665 +#endif
3666 xendev->dev.bus = &bus->bus;
3667 xendev->dev.release = xenbus_dev_release;
3668
3669 @@ -562,15 +580,16 @@ int xenbus_probe_node(struct xen_bus_typ
3670
3671 err = device_create_file(&xendev->dev, &dev_attr_nodename);
3672 if (err)
3673 - goto unregister;
3674 + goto fail_unregister;
3675 +
3676 err = device_create_file(&xendev->dev, &dev_attr_devtype);
3677 if (err)
3678 - goto unregister;
3679 + goto fail_remove_file;
3680
3681 return 0;
3682 -unregister:
3683 +fail_remove_file:
3684 device_remove_file(&xendev->dev, &dev_attr_nodename);
3685 - device_remove_file(&xendev->dev, &dev_attr_devtype);
3686 +fail_unregister:
3687 device_unregister(&xendev->dev);
3688 fail:
3689 kfree(xendev);
3690 @@ -583,7 +602,8 @@ static int xenbus_probe_frontend(const c
3691 char *nodename;
3692 int err;
3693
3694 - nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", xenbus_frontend.root, type, name);
3695 + nodename = kasprintf(GFP_KERNEL, "%s/%s/%s",
3696 + xenbus_frontend.root, type, name);
3697 if (!nodename)
3698 return -ENOMEM;
3699
3700 @@ -659,7 +679,7 @@ static int strsep_len(const char *str, c
3701 return (len == 0) ? i : -ERANGE;
3702 }
3703
3704 -void dev_changed(const char *node, struct xen_bus_type *bus)
3705 +void xenbus_dev_changed(const char *node, struct xen_bus_type *bus)
3706 {
3707 int exists, rootlen;
3708 struct xenbus_device *dev;
3709 @@ -667,7 +687,7 @@ void dev_changed(const char *node, struc
3710 const char *p, *root;
3711
3712 if (bus->error || char_count(node, '/') < 2)
3713 - return;
3714 + return;
3715
3716 exists = xenbus_exists(XBT_NIL, node, "");
3717 if (!exists) {
3718 @@ -701,7 +721,7 @@ static void frontend_changed(struct xenb
3719 {
3720 DPRINTK("");
3721
3722 - dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend);
3723 + xenbus_dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend);
3724 }
3725
3726 /* We watch for devices appearing and vanishing. */
3727 @@ -904,10 +924,16 @@ static int xsd_port_read(char *page, cha
3728 }
3729 #endif
3730
3731 -static int xenbus_probe_init(void)
3732 +#ifndef MODULE
3733 +static int __init xenbus_probe_init(void)
3734 +#else
3735 +static int __devinit xenbus_probe_init(void)
3736 +#endif
3737 {
3738 int err = 0;
3739 +#if defined(CONFIG_XEN) || defined(MODULE)
3740 unsigned long page = 0;
3741 +#endif
3742
3743 DPRINTK("");
3744
3745 @@ -926,6 +952,7 @@ static int xenbus_probe_init(void)
3746 * Domain0 doesn't have a store_evtchn or store_mfn yet.
3747 */
3748 if (is_initial_xendomain()) {
3749 +#if defined(CONFIG_XEN) || defined(MODULE)
3750 struct evtchn_alloc_unbound alloc_unbound;
3751
3752 /* Allocate page. */
3753 @@ -963,10 +990,13 @@ static int xenbus_probe_init(void)
3754 if (xsd_port_intf)
3755 xsd_port_intf->read_proc = xsd_port_read;
3756 #endif
3757 +#else
3758 + /* dom0 not yet supported */
3759 +#endif
3760 xen_store_interface = mfn_to_virt(xen_store_mfn);
3761 } else {
3762 xenstored_ready = 1;
3763 -#ifdef CONFIG_XEN
3764 +#ifndef MODULE
3765 xen_store_evtchn = xen_start_info->store_evtchn;
3766 xen_store_mfn = xen_start_info->store_mfn;
3767 xen_store_interface = mfn_to_virt(xen_store_mfn);
3768 @@ -979,7 +1009,9 @@ static int xenbus_probe_init(void)
3769 }
3770
3771
3772 +#if defined(CONFIG_XEN) || defined(MODULE)
3773 xenbus_dev_init();
3774 +#endif
3775
3776 /* Initialize the interface to xenstore. */
3777 err = xs_init();
3778 @@ -989,6 +1021,7 @@ static int xenbus_probe_init(void)
3779 goto err;
3780 }
3781
3782 +#if defined(CONFIG_XEN) || defined(MODULE)
3783 /* Register ourselves with the kernel device subsystem */
3784 if (!xenbus_frontend.error) {
3785 xenbus_frontend.error = device_register(&xenbus_frontend.dev);
3786 @@ -999,6 +1032,7 @@ static int xenbus_probe_init(void)
3787 xenbus_frontend.error);
3788 }
3789 }
3790 +#endif
3791 xenbus_backend_device_register();
3792
3793 if (!is_initial_xendomain())
3794 @@ -1007,8 +1041,10 @@ static int xenbus_probe_init(void)
3795 return 0;
3796
3797 err:
3798 +#if defined(CONFIG_XEN) || defined(MODULE)
3799 if (page)
3800 free_page(page);
3801 +#endif
3802
3803 /*
3804 * Do not unregister the xenbus front/backend buses here. The buses
3805 @@ -1019,11 +1055,15 @@ static int xenbus_probe_init(void)
3806 return err;
3807 }
3808
3809 -#ifdef CONFIG_XEN
3810 +#ifndef MODULE
3811 postcore_initcall(xenbus_probe_init);
3812 +#ifdef CONFIG_XEN
3813 MODULE_LICENSE("Dual BSD/GPL");
3814 #else
3815 -int xenbus_init(void)
3816 +MODULE_LICENSE("GPL");
3817 +#endif
3818 +#else
3819 +int __devinit xenbus_init(void)
3820 {
3821 return xenbus_probe_init();
3822 }
3823 --- sle11-2009-05-14.orig/drivers/xen/xenbus/xenbus_probe.h 2009-03-04 11:25:55.000000000 +0100
3824 +++ sle11-2009-05-14/drivers/xen/xenbus/xenbus_probe.h 2009-02-16 16:17:21.000000000 +0100
3825 @@ -56,7 +56,9 @@ struct xen_bus_type
3826 int (*get_bus_id)(char bus_id[BUS_ID_SIZE], const char *nodename);
3827 int (*probe)(const char *type, const char *dir);
3828 struct bus_type bus;
3829 +#if defined(CONFIG_XEN) || defined(MODULE)
3830 struct device dev;
3831 +#endif
3832 };
3833
3834 extern int xenbus_match(struct device *_dev, struct device_driver *_drv);
3835 @@ -71,7 +73,7 @@ extern int xenbus_probe_node(struct xen_
3836 const char *nodename);
3837 extern int xenbus_probe_devices(struct xen_bus_type *bus);
3838
3839 -extern void dev_changed(const char *node, struct xen_bus_type *bus);
3840 +extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);
3841
3842 #endif
3843
3844 --- sle11-2009-05-14.orig/drivers/xen/xenbus/xenbus_probe_backend.c 2009-03-04 11:25:55.000000000 +0100
3845 +++ sle11-2009-05-14/drivers/xen/xenbus/xenbus_probe_backend.c 2009-02-16 16:17:21.000000000 +0100
3846 @@ -236,7 +236,7 @@ static void backend_changed(struct xenbu
3847 {
3848 DPRINTK("");
3849
3850 - dev_changed(vec[XS_WATCH_PATH], &xenbus_backend);
3851 + xenbus_dev_changed(vec[XS_WATCH_PATH], &xenbus_backend);
3852 }
3853
3854 static struct xenbus_watch be_watch = {
3855 --- sle11-2009-05-14.orig/drivers/xen/xenbus/xenbus_xs.c 2008-11-25 12:35:56.000000000 +0100
3856 +++ sle11-2009-05-14/drivers/xen/xenbus/xenbus_xs.c 2009-02-16 16:17:21.000000000 +0100
3857 @@ -221,7 +221,7 @@ static void *xs_talkv(struct xenbus_tran
3858 }
3859
3860 for (i = 0; i < num_vecs; i++) {
3861 - err = xb_write(iovec[i].iov_base, iovec[i].iov_len);;
3862 + err = xb_write(iovec[i].iov_base, iovec[i].iov_len);
3863 if (err) {
3864 mutex_unlock(&xs_state.request_mutex);
3865 return ERR_PTR(err);
3866 @@ -630,7 +630,9 @@ void unregister_xenbus_watch(struct xenb
3867 char token[sizeof(watch) * 2 + 1];
3868 int err;
3869
3870 +#if defined(CONFIG_XEN) || defined(MODULE)
3871 BUG_ON(watch->flags & XBWF_new_thread);
3872 +#endif
3873
3874 sprintf(token, "%lX", (long)watch);
3875
3876 @@ -649,6 +651,11 @@ void unregister_xenbus_watch(struct xenb
3877
3878 up_read(&xs_state.watch_mutex);
3879
3880 + /* Make sure there are no callbacks running currently (unless
3881 + its us) */
3882 + if (current->pid != xenwatch_pid)
3883 + mutex_lock(&xenwatch_mutex);
3884 +
3885 /* Cancel pending watch events. */
3886 spin_lock(&watch_events_lock);
3887 list_for_each_entry_safe(msg, tmp, &watch_events, list) {
3888 @@ -660,11 +667,8 @@ void unregister_xenbus_watch(struct xenb
3889 }
3890 spin_unlock(&watch_events_lock);
3891
3892 - /* Flush any currently-executing callback, unless we are it. :-) */
3893 - if (current->pid != xenwatch_pid) {
3894 - mutex_lock(&xenwatch_mutex);
3895 + if (current->pid != xenwatch_pid)
3896 mutex_unlock(&xenwatch_mutex);
3897 - }
3898 }
3899 EXPORT_SYMBOL_GPL(unregister_xenbus_watch);
3900
3901 @@ -702,6 +706,7 @@ void xs_suspend_cancel(void)
3902 up_write(&xs_state.transaction_mutex);
3903 }
3904
3905 +#if defined(CONFIG_XEN) || defined(MODULE)
3906 static int xenwatch_handle_callback(void *data)
3907 {
3908 struct xs_stored_msg *msg = data;
3909 @@ -719,6 +724,7 @@ static int xenwatch_handle_callback(void
3910
3911 return 0;
3912 }
3913 +#endif
3914
3915 static int xenwatch_thread(void *unused)
3916 {
3917 @@ -748,6 +754,7 @@ static int xenwatch_thread(void *unused)
3918
3919 msg = list_entry(ent, struct xs_stored_msg, list);
3920
3921 +#if defined(CONFIG_XEN) || defined(MODULE)
3922 /*
3923 * Unlock the mutex before running an XBWF_new_thread
3924 * handler. kthread_run can block which can deadlock
3925 @@ -764,6 +771,15 @@ static int xenwatch_thread(void *unused)
3926 xenwatch_handle_callback(msg);
3927 mutex_unlock(&xenwatch_mutex);
3928 }
3929 +#else
3930 + msg->u.watch.handle->callback(
3931 + msg->u.watch.handle,
3932 + (const char **)msg->u.watch.vec,
3933 + msg->u.watch.vec_size);
3934 + mutex_unlock(&xenwatch_mutex);
3935 + kfree(msg->u.watch.vec);
3936 + kfree(msg);
3937 +#endif
3938 }
3939
3940 return 0;
3941 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/fixmap_32.h 2008-12-15 11:27:22.000000000 +0100
3942 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/fixmap_32.h 2009-02-16 16:17:21.000000000 +0100
3943 @@ -53,6 +53,8 @@ extern unsigned long __FIXADDR_TOP;
3944 enum fixed_addresses {
3945 FIX_HOLE,
3946 FIX_VDSO,
3947 + FIX_DBGP_BASE,
3948 + FIX_EARLYCON_MEM_BASE,
3949 #ifdef CONFIG_X86_LOCAL_APIC
3950 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
3951 #endif
3952 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/highmem.h 2008-12-15 11:27:22.000000000 +0100
3953 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/highmem.h 2009-02-16 16:17:21.000000000 +0100
3954 @@ -76,8 +76,7 @@ struct page *kmap_atomic_to_page(void *p
3955
3956 #define kmap_atomic_pte(page, type) \
3957 kmap_atomic_prot(page, type, \
3958 - test_bit(PG_pinned, &(page)->flags) \
3959 - ? PAGE_KERNEL_RO : kmap_prot)
3960 + PagePinned(page) ? PAGE_KERNEL_RO : kmap_prot)
3961
3962 #define flush_cache_kmaps() do { } while (0)
3963
3964 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/maddr_32.h 2009-05-14 10:56:29.000000000 +0200
3965 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/maddr_32.h 2009-02-16 16:17:21.000000000 +0100
3966 @@ -155,6 +155,7 @@ static inline paddr_t pte_machine_to_phy
3967
3968 #ifdef CONFIG_X86_PAE
3969 #define __pte_ma(x) ((pte_t) { (x), (maddr_t)(x) >> 32 } )
3970 +extern unsigned long long __supported_pte_mask;
3971 static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot)
3972 {
3973 pte_t pte;
3974 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/mmu_context_32.h 2008-12-15 11:27:22.000000000 +0100
3975 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/mmu_context_32.h 2009-02-16 16:17:21.000000000 +0100
3976 @@ -16,7 +16,7 @@ void mm_pin_all(void);
3977 static inline void xen_activate_mm(struct mm_struct *prev,
3978 struct mm_struct *next)
3979 {
3980 - if (!test_bit(PG_pinned, &virt_to_page(next->pgd)->flags))
3981 + if (!PagePinned(virt_to_page(next->pgd)))
3982 mm_pin(next);
3983 }
3984
3985 @@ -51,6 +51,8 @@ static inline void __prepare_arch_switch
3986 : : "r" (0) );
3987 }
3988
3989 +void leave_mm(unsigned long cpu);
3990 +
3991 static inline void switch_mm(struct mm_struct *prev,
3992 struct mm_struct *next,
3993 struct task_struct *tsk)
3994 @@ -60,7 +62,7 @@ static inline void switch_mm(struct mm_s
3995
3996 if (likely(prev != next)) {
3997 BUG_ON(!xen_feature(XENFEAT_writable_page_tables) &&
3998 - !test_bit(PG_pinned, &virt_to_page(next->pgd)->flags));
3999 + !PagePinned(virt_to_page(next->pgd)));
4000
4001 /* stop flush ipis for the previous mm */
4002 cpu_clear(cpu, prev->cpu_vm_mask);
4003 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/pci_32.h 2009-05-14 10:56:29.000000000 +0200
4004 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/pci_32.h 2009-02-16 16:17:21.000000000 +0100
4005 @@ -3,6 +3,14 @@
4006
4007
4008 #ifdef __KERNEL__
4009 +
4010 +struct pci_sysdata {
4011 + int node; /* NUMA node */
4012 +};
4013 +
4014 +/* scan a bus after allocating a pci_sysdata for it */
4015 +extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
4016 +
4017 #include <linux/mm.h> /* for struct page */
4018
4019 /* Can be used to override the logic in pci_scan_bus for skipping
4020 @@ -81,48 +89,11 @@ struct pci_dev;
4021
4022 #endif
4023
4024 -/* This is always fine. */
4025 -#define pci_dac_dma_supported(pci_dev, mask) (1)
4026 -
4027 -static inline dma64_addr_t
4028 -pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
4029 -{
4030 - return ((dma64_addr_t) page_to_phys(page) +
4031 - (dma64_addr_t) offset);
4032 -}
4033 -
4034 -static inline struct page *
4035 -pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
4036 -{
4037 - return pfn_to_page(dma_addr >> PAGE_SHIFT);
4038 -}
4039 -
4040 -static inline unsigned long
4041 -pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
4042 -{
4043 - return (dma_addr & ~PAGE_MASK);
4044 -}
4045 -
4046 -static inline void
4047 -pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
4048 -{
4049 -}
4050 -
4051 -static inline void
4052 -pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
4053 -{
4054 - flush_write_buffers();
4055 -}
4056 -
4057 #define HAVE_PCI_MMAP
4058 extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
4059 enum pci_mmap_state mmap_state, int write_combine);
4060
4061
4062 -static inline void pcibios_add_platform_entries(struct pci_dev *dev)
4063 -{
4064 -}
4065 -
4066 #ifdef CONFIG_PCI
4067 static inline void pci_dma_burst_advice(struct pci_dev *pdev,
4068 enum pci_dma_burst_strategy *strat,
4069 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/pgalloc_32.h 2008-12-15 11:27:22.000000000 +0100
4070 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/pgalloc_32.h 2009-02-16 16:17:21.000000000 +0100
4071 @@ -5,7 +5,7 @@
4072 #include <linux/mm.h> /* for struct page */
4073 #include <asm/io.h> /* for phys_to_virt and page_to_pseudophys */
4074
4075 -#define paravirt_alloc_pt(pfn) do { } while (0)
4076 +#define paravirt_alloc_pt(mm, pfn) do { } while (0)
4077 #define paravirt_alloc_pd(pfn) do { } while (0)
4078 #define paravirt_alloc_pd(pfn) do { } while (0)
4079 #define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
4080 @@ -14,15 +14,15 @@
4081
4082 #define pmd_populate_kernel(mm, pmd, pte) \
4083 do { \
4084 - paravirt_alloc_pt(__pa(pte) >> PAGE_SHIFT); \
4085 + paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); \
4086 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \
4087 } while (0)
4088
4089 #define pmd_populate(mm, pmd, pte) \
4090 do { \
4091 unsigned long pfn = page_to_pfn(pte); \
4092 - paravirt_alloc_pt(pfn); \
4093 - if (test_bit(PG_pinned, &virt_to_page((mm)->pgd)->flags)) { \
4094 + paravirt_alloc_pt(mm, pfn); \
4095 + if (PagePinned(virt_to_page((mm)->pgd))) { \
4096 if (!PageHighMem(pte)) \
4097 BUG_ON(HYPERVISOR_update_va_mapping( \
4098 (unsigned long)__va(pfn << PAGE_SHIFT), \
4099 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/pgtable_32.h 2008-12-15 11:27:22.000000000 +0100
4100 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/pgtable_32.h 2009-02-16 16:17:21.000000000 +0100
4101 @@ -26,9 +26,6 @@
4102 #include <linux/spinlock.h>
4103 #include <linux/sched.h>
4104
4105 -/* Is this pagetable pinned? */
4106 -#define PG_pinned PG_arch_1
4107 -
4108 struct vm_area_struct;
4109
4110 /*
4111 @@ -82,7 +79,7 @@ void paging_init(void);
4112 * area for the same reason. ;)
4113 */
4114 #define VMALLOC_OFFSET (8*1024*1024)
4115 -#define VMALLOC_START (((unsigned long) high_memory + vmalloc_earlyreserve + \
4116 +#define VMALLOC_START (((unsigned long) high_memory + \
4117 2*VMALLOC_OFFSET-1) & ~(VMALLOC_OFFSET-1))
4118 #ifdef CONFIG_HIGHMEM
4119 # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
4120 @@ -231,8 +228,6 @@ extern unsigned long pg0[];
4121 * The following only work if pte_present() is true.
4122 * Undefined behaviour if not..
4123 */
4124 -static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
4125 -static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
4126 static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; }
4127 static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; }
4128 static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; }
4129 @@ -243,13 +238,9 @@ static inline int pte_huge(pte_t pte) {
4130 */
4131 static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; }
4132
4133 -static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
4134 -static inline pte_t pte_exprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
4135 static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; }
4136 static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; }
4137 static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; }
4138 -static inline pte_t pte_mkread(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
4139 -static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
4140 static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; }
4141 static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
4142 static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
4143 @@ -295,22 +286,20 @@ static inline pte_t xen_local_ptep_get_a
4144 #define ptep_set_access_flags(vma, address, ptep, entry, dirty) \
4145 ({ \
4146 int __changed = !pte_same(*(ptep), entry); \
4147 - if (__changed && (dirty)) \
4148 - ptep_establish(vma, address, ptep, entry); \
4149 + if (__changed && (dirty)) { \
4150 + if ( likely((vma)->vm_mm == current->mm) ) { \
4151 + BUG_ON(HYPERVISOR_update_va_mapping(address, \
4152 + entry, \
4153 + (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \
4154 + UVMF_INVLPG|UVMF_MULTI)); \
4155 + } else { \
4156 + xen_l1_entry_update(ptep, entry); \
4157 + flush_tlb_page(vma, address); \
4158 + } \
4159 + } \
4160 __changed; \
4161 })
4162
4163 -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
4164 -#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \
4165 - int __ret = 0; \
4166 - if (pte_dirty(*(ptep))) \
4167 - __ret = test_and_clear_bit(_PAGE_BIT_DIRTY, \
4168 - &(ptep)->pte_low); \
4169 - if (__ret) \
4170 - pte_update((vma)->vm_mm, addr, ptep); \
4171 - __ret; \
4172 -})
4173 -
4174 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
4175 #define ptep_test_and_clear_young(vma, addr, ptep) ({ \
4176 int __ret = 0; \
4177 @@ -322,44 +311,13 @@ static inline pte_t xen_local_ptep_get_a
4178 __ret; \
4179 })
4180
4181 -/*
4182 - * Rules for using ptep_establish: the pte MUST be a user pte, and
4183 - * must be a present->present transition.
4184 - */
4185 -#define __HAVE_ARCH_PTEP_ESTABLISH
4186 -#define ptep_establish(vma, address, ptep, pteval) \
4187 -do { \
4188 - if ( likely((vma)->vm_mm == current->mm) ) { \
4189 - BUG_ON(HYPERVISOR_update_va_mapping(address, \
4190 - pteval, \
4191 - (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \
4192 - UVMF_INVLPG|UVMF_MULTI)); \
4193 - } else { \
4194 - xen_l1_entry_update(ptep, pteval); \
4195 - flush_tlb_page(vma, address); \
4196 - } \
4197 -} while (0)
4198 -
4199 -#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
4200 -#define ptep_clear_flush_dirty(vma, address, ptep) \
4201 -({ \
4202 - pte_t __pte = *(ptep); \
4203 - int __dirty = pte_dirty(__pte); \
4204 - __pte = pte_mkclean(__pte); \
4205 - if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \
4206 - (void)ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \
4207 - else if (__dirty) \
4208 - (ptep)->pte_low = __pte.pte_low; \
4209 - __dirty; \
4210 -})
4211 -
4212 #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
4213 #define ptep_clear_flush_young(vma, address, ptep) \
4214 ({ \
4215 pte_t __pte = *(ptep); \
4216 int __young = pte_young(__pte); \
4217 __pte = pte_mkold(__pte); \
4218 - if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \
4219 + if (PagePinned(virt_to_page((vma)->vm_mm->pgd))) \
4220 (void)ptep_set_access_flags(vma, address, ptep, __pte, __young); \
4221 else if (__young) \
4222 (ptep)->pte_low = __pte.pte_low; \
4223 @@ -383,7 +341,7 @@ static inline pte_t ptep_get_and_clear(s
4224 #define ptep_get_and_clear_full(mm, addr, ptep, full) \
4225 ((full) ? ({ \
4226 pte_t __res = *(ptep); \
4227 - if (test_bit(PG_pinned, &virt_to_page((mm)->pgd)->flags)) \
4228 + if (PagePinned(virt_to_page((mm)->pgd))) \
4229 xen_l1_entry_update(ptep, __pte(0)); \
4230 else \
4231 *(ptep) = __pte(0); \
4232 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/pgtable-3level.h 2008-12-15 11:27:22.000000000 +0100
4233 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/pgtable-3level.h 2009-02-16 16:17:21.000000000 +0100
4234 @@ -23,26 +23,11 @@
4235 #define pud_present(pud) 1
4236
4237 /*
4238 - * Is the pte executable?
4239 - */
4240 -static inline int pte_x(pte_t pte)
4241 -{
4242 - return !(__pte_val(pte) & _PAGE_NX);
4243 -}
4244 -
4245 -/*
4246 - * All present user-pages with !NX bit are user-executable:
4247 - */
4248 -static inline int pte_exec(pte_t pte)
4249 -{
4250 - return pte_user(pte) && pte_x(pte);
4251 -}
4252 -/*
4253 * All present pages with !NX bit are kernel-executable:
4254 */
4255 static inline int pte_exec_kernel(pte_t pte)
4256 {
4257 - return pte_x(pte);
4258 + return !(__pte_val(pte) & _PAGE_NX);
4259 }
4260
4261 /* Rules for using set_pte: the pte being assigned *must* be
4262 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/processor_32.h 2008-12-15 11:27:22.000000000 +0100
4263 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/processor_32.h 2009-02-16 16:17:21.000000000 +0100
4264 @@ -89,7 +89,6 @@ struct cpuinfo_x86 {
4265 #define X86_VENDOR_UMC 3
4266 #define X86_VENDOR_NEXGEN 4
4267 #define X86_VENDOR_CENTAUR 5
4268 -#define X86_VENDOR_RISE 6
4269 #define X86_VENDOR_TRANSMETA 7
4270 #define X86_VENDOR_NSC 8
4271 #define X86_VENDOR_NUM 9
4272 @@ -122,6 +121,7 @@ void __init cpu_detect(struct cpuinfo_x8
4273 extern void identify_boot_cpu(void);
4274 extern void identify_secondary_cpu(struct cpuinfo_x86 *);
4275 extern void print_cpu_info(struct cpuinfo_x86 *);
4276 +extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
4277 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
4278 extern unsigned short num_cache_leaves;
4279
4280 @@ -171,17 +171,6 @@ static inline void clear_in_cr4 (unsigne
4281 write_cr4(cr4);
4282 }
4283
4284 -/*
4285 - * NSC/Cyrix CPU indexed register access macros
4286 - */
4287 -
4288 -#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); })
4289 -
4290 -#define setCx86(reg, data) do { \
4291 - outb((reg), 0x22); \
4292 - outb((data), 0x23); \
4293 -} while (0)
4294 -
4295 /* Stop speculative execution */
4296 static inline void sync_core(void)
4297 {
4298 @@ -230,6 +219,10 @@ extern int bootloader_type;
4299
4300 #define HAVE_ARCH_PICK_MMAP_LAYOUT
4301
4302 +extern void hard_disable_TSC(void);
4303 +extern void disable_TSC(void);
4304 +extern void hard_enable_TSC(void);
4305 +
4306 /*
4307 * Size of io_bitmap.
4308 */
4309 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/system_32.h 2008-12-15 11:27:22.000000000 +0100
4310 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/system_32.h 2009-02-16 16:17:21.000000000 +0100
4311 @@ -205,11 +205,6 @@ static inline unsigned long get_limit(un
4312 */
4313
4314
4315 -/*
4316 - * Actually only lfence would be needed for mb() because all stores done
4317 - * by the kernel should be already ordered. But keep a full barrier for now.
4318 - */
4319 -
4320 #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)
4321 #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)
4322
4323 @@ -301,15 +296,6 @@ void enable_hlt(void);
4324 extern int es7000_plat;
4325 void cpu_idle_wait(void);
4326
4327 -/*
4328 - * On SMP systems, when the scheduler does migration-cost autodetection,
4329 - * it needs a way to flush as much of the CPU's caches as possible:
4330 - */
4331 -static inline void sched_cacheflush(void)
4332 -{
4333 - wbinvd();
4334 -}
4335 -
4336 extern unsigned long arch_align_stack(unsigned long sp);
4337 extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
4338
4339 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/tlbflush_32.h 2008-12-15 11:27:22.000000000 +0100
4340 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/tlbflush_32.h 2009-02-16 16:17:21.000000000 +0100
4341 @@ -91,7 +91,11 @@ struct tlb_state
4342 DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate);
4343 #endif /* SMP */
4344
4345 -#define flush_tlb_kernel_range(start, end) flush_tlb_all()
4346 +static inline void flush_tlb_kernel_range(unsigned long start,
4347 + unsigned long end)
4348 +{
4349 + flush_tlb_all();
4350 +}
4351
4352 static inline void flush_tlb_pgtables(struct mm_struct *mm,
4353 unsigned long start, unsigned long end)
4354 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/fixmap_64.h 2008-12-15 11:27:22.000000000 +0100
4355 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/fixmap_64.h 2009-02-16 16:17:21.000000000 +0100
4356 @@ -23,9 +23,9 @@
4357 * compile time, but to set the physical address only
4358 * in the boot process.
4359 *
4360 - * these 'compile-time allocated' memory buffers are
4361 - * fixed-size 4k pages. (or larger if used with an increment
4362 - * highger than 1) use fixmap_set(idx,phys) to associate
4363 + * These 'compile-time allocated' memory buffers are
4364 + * fixed-size 4k pages (or larger if used with an increment
4365 + * higher than 1). Use set_fixmap(idx,phys) to associate
4366 * physical memory with fixmap indices.
4367 *
4368 * TLB entries of such buffers will not be flushed across
4369 @@ -36,6 +36,8 @@ enum fixed_addresses {
4370 VSYSCALL_LAST_PAGE,
4371 VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
4372 VSYSCALL_HPET,
4373 + FIX_DBGP_BASE,
4374 + FIX_EARLYCON_MEM_BASE,
4375 FIX_HPET_BASE,
4376 #ifdef CONFIG_X86_LOCAL_APIC
4377 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
4378 @@ -105,7 +107,7 @@ static __always_inline unsigned long fix
4379 if (idx >= __end_of_fixed_addresses)
4380 __this_fixmap_does_not_exist();
4381
4382 - return __fix_to_virt(idx);
4383 + return __fix_to_virt(idx);
4384 }
4385
4386 #endif
4387 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/mmu_context_64.h 2008-12-15 11:27:22.000000000 +0100
4388 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/mmu_context_64.h 2009-02-16 16:17:21.000000000 +0100
4389 @@ -76,7 +76,7 @@ static inline void switch_mm(struct mm_s
4390
4391 if (likely(prev != next)) {
4392 BUG_ON(!xen_feature(XENFEAT_writable_page_tables) &&
4393 - !next->context.pinned);
4394 + !PagePinned(virt_to_page(next->pgd)));
4395
4396 /* stop flush ipis for the previous mm */
4397 cpu_clear(cpu, prev->cpu_vm_mask);
4398 @@ -131,7 +131,7 @@ static inline void switch_mm(struct mm_s
4399
4400 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
4401 {
4402 - if (!next->context.pinned)
4403 + if (!PagePinned(virt_to_page(next->pgd)))
4404 mm_pin(next);
4405 switch_mm(prev, next, NULL);
4406 }
4407 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/page_64.h 2008-12-15 11:27:22.000000000 +0100
4408 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/page_64.h 2009-02-16 16:17:21.000000000 +0100
4409 @@ -72,7 +72,8 @@ void copy_page(void *, void *);
4410 #define clear_user_page(page, vaddr, pg) clear_page(page)
4411 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
4412
4413 -#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr)
4414 +#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
4415 + alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
4416 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
4417
4418 /*
4419 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/pgalloc_64.h 2008-12-15 11:27:22.000000000 +0100
4420 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/pgalloc_64.h 2009-02-16 16:17:21.000000000 +0100
4421 @@ -21,7 +21,7 @@ static inline void pmd_populate_kernel(s
4422
4423 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
4424 {
4425 - if (unlikely((mm)->context.pinned)) {
4426 + if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) {
4427 BUG_ON(HYPERVISOR_update_va_mapping(
4428 (unsigned long)__va(page_to_pfn(pte) << PAGE_SHIFT),
4429 pfn_pte(page_to_pfn(pte), PAGE_KERNEL_RO), 0));
4430 @@ -33,7 +33,7 @@ static inline void pmd_populate(struct m
4431
4432 static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
4433 {
4434 - if (unlikely((mm)->context.pinned)) {
4435 + if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) {
4436 BUG_ON(HYPERVISOR_update_va_mapping(
4437 (unsigned long)pmd,
4438 pfn_pte(virt_to_phys(pmd)>>PAGE_SHIFT,
4439 @@ -50,7 +50,7 @@ static inline void pud_populate(struct m
4440 */
4441 static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
4442 {
4443 - if (unlikely((mm)->context.pinned)) {
4444 + if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) {
4445 BUG_ON(HYPERVISOR_update_va_mapping(
4446 (unsigned long)pud,
4447 pfn_pte(virt_to_phys(pud)>>PAGE_SHIFT,
4448 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-15 11:27:22.000000000 +0100
4449 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/pgtable_64.h 2009-02-16 16:17:21.000000000 +0100
4450 @@ -304,7 +304,7 @@ static inline pte_t ptep_get_and_clear_f
4451 {
4452 if (full) {
4453 pte_t pte = *ptep;
4454 - if (mm->context.pinned)
4455 + if (PagePinned(virt_to_page(mm->pgd)))
4456 xen_l1_entry_update(ptep, __pte(0));
4457 else
4458 *ptep = __pte(0);
4459 @@ -333,21 +333,15 @@ static inline pte_t ptep_get_and_clear_f
4460 * Undefined behaviour if not..
4461 */
4462 #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
4463 -static inline int pte_user(pte_t pte) { return __pte_val(pte) & _PAGE_USER; }
4464 -static inline int pte_read(pte_t pte) { return __pte_val(pte) & _PAGE_USER; }
4465 -static inline int pte_exec(pte_t pte) { return !(__pte_val(pte) & _PAGE_NX); }
4466 static inline int pte_dirty(pte_t pte) { return __pte_val(pte) & _PAGE_DIRTY; }
4467 static inline int pte_young(pte_t pte) { return __pte_val(pte) & _PAGE_ACCESSED; }
4468 static inline int pte_write(pte_t pte) { return __pte_val(pte) & _PAGE_RW; }
4469 static inline int pte_file(pte_t pte) { return __pte_val(pte) & _PAGE_FILE; }
4470 static inline int pte_huge(pte_t pte) { return __pte_val(pte) & _PAGE_PSE; }
4471
4472 -static inline pte_t pte_rdprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_USER; return pte; }
4473 -static inline pte_t pte_exprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_USER; return pte; }
4474 static inline pte_t pte_mkclean(pte_t pte) { __pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
4475 static inline pte_t pte_mkold(pte_t pte) { __pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
4476 static inline pte_t pte_wrprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_RW; return pte; }
4477 -static inline pte_t pte_mkread(pte_t pte) { __pte_val(pte) |= _PAGE_USER; return pte; }
4478 static inline pte_t pte_mkexec(pte_t pte) { __pte_val(pte) &= ~_PAGE_NX; return pte; }
4479 static inline pte_t pte_mkdirty(pte_t pte) { __pte_val(pte) |= _PAGE_DIRTY; return pte; }
4480 static inline pte_t pte_mkyoung(pte_t pte) { __pte_val(pte) |= _PAGE_ACCESSED; return pte; }
4481 @@ -355,13 +349,6 @@ static inline pte_t pte_mkwrite(pte_t pt
4482 static inline pte_t pte_mkhuge(pte_t pte) { __pte_val(pte) |= _PAGE_PSE; return pte; }
4483 static inline pte_t pte_clrhuge(pte_t pte) { __pte_val(pte) &= ~_PAGE_PSE; return pte; }
4484
4485 -static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
4486 -{
4487 - if (!pte_dirty(*ptep))
4488 - return 0;
4489 - return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte);
4490 -}
4491 -
4492 static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
4493 {
4494 if (!pte_young(*ptep))
4495 @@ -500,26 +487,13 @@ static inline pte_t pte_modify(pte_t pte
4496 __changed; \
4497 })
4498
4499 -#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
4500 -#define ptep_clear_flush_dirty(vma, address, ptep) \
4501 -({ \
4502 - pte_t __pte = *(ptep); \
4503 - int __dirty = pte_dirty(__pte); \
4504 - __pte = pte_mkclean(__pte); \
4505 - if ((vma)->vm_mm->context.pinned) \
4506 - (void)ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \
4507 - else if (__dirty) \
4508 - set_pte(ptep, __pte); \
4509 - __dirty; \
4510 -})
4511 -
4512 #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
4513 #define ptep_clear_flush_young(vma, address, ptep) \
4514 ({ \
4515 pte_t __pte = *(ptep); \
4516 int __young = pte_young(__pte); \
4517 __pte = pte_mkold(__pte); \
4518 - if ((vma)->vm_mm->context.pinned) \
4519 + if (PagePinned(virt_to_page((vma)->vm_mm->pgd))) \
4520 (void)ptep_set_access_flags(vma, address, ptep, __pte, __young); \
4521 else if (__young) \
4522 set_pte(ptep, __pte); \
4523 @@ -570,6 +544,8 @@ int xen_change_pte_range(struct mm_struc
4524 #define arch_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) \
4525 xen_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable)
4526
4527 +pte_t *lookup_address(unsigned long addr);
4528 +
4529 #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
4530 direct_remap_pfn_range(vma,vaddr,pfn,size,prot,DOMID_IO)
4531
4532 @@ -587,7 +563,6 @@ int xen_change_pte_range(struct mm_struc
4533 (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o))
4534
4535 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
4536 -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
4537 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
4538 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
4539 #define __HAVE_ARCH_PTEP_CLEAR_FLUSH
4540 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/processor_64.h 2008-12-15 11:27:22.000000000 +0100
4541 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/processor_64.h 2009-02-16 16:17:21.000000000 +0100
4542 @@ -83,7 +83,6 @@ struct cpuinfo_x86 {
4543 #define X86_VENDOR_UMC 3
4544 #define X86_VENDOR_NEXGEN 4
4545 #define X86_VENDOR_CENTAUR 5
4546 -#define X86_VENDOR_RISE 6
4547 #define X86_VENDOR_TRANSMETA 7
4548 #define X86_VENDOR_NUM 8
4549 #define X86_VENDOR_UNKNOWN 0xff
4550 @@ -100,6 +99,7 @@ extern char ignore_irq13;
4551
4552 extern void identify_cpu(struct cpuinfo_x86 *);
4553 extern void print_cpu_info(struct cpuinfo_x86 *);
4554 +extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
4555 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
4556 extern unsigned short num_cache_leaves;
4557
4558 @@ -377,12 +377,10 @@ static inline void sync_core(void)
4559 asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
4560 }
4561
4562 -#define cpu_has_fpu 1
4563 -
4564 #define ARCH_HAS_PREFETCH
4565 static inline void prefetch(void *x)
4566 {
4567 - asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x));
4568 + asm volatile("prefetcht0 (%0)" :: "r" (x));
4569 }
4570
4571 #define ARCH_HAS_PREFETCHW 1
4572 @@ -400,17 +398,6 @@ static inline void prefetchw(void *x)
4573
4574 #define cpu_relax() rep_nop()
4575
4576 -/*
4577 - * NSC/Cyrix CPU indexed register access macros
4578 - */
4579 -
4580 -#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); })
4581 -
4582 -#define setCx86(reg, data) do { \
4583 - outb((reg), 0x22); \
4584 - outb((data), 0x23); \
4585 -} while (0)
4586 -
4587 static inline void serialize_cpu(void)
4588 {
4589 __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
4590 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/system_64.h 2008-12-15 11:27:22.000000000 +0100
4591 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/system_64.h 2009-02-16 16:17:21.000000000 +0100
4592 @@ -79,12 +79,16 @@ static inline unsigned long read_cr0(voi
4593 unsigned long cr0;
4594 asm volatile("movq %%cr0,%0" : "=r" (cr0));
4595 return cr0;
4596 -}
4597 +}
4598
4599 static inline void write_cr0(unsigned long val)
4600 {
4601 asm volatile("movq %0,%%cr0" :: "r" (val));
4602 -}
4603 +}
4604 +
4605 +#define read_cr2() current_vcpu_info()->arch.cr2
4606 +
4607 +#define write_cr2(val) ((void)(current_vcpu_info()->arch.cr2 = (val)))
4608
4609 #define read_cr3() ({ \
4610 unsigned long __dummy; \
4611 @@ -103,27 +107,28 @@ static inline unsigned long read_cr4(voi
4612 unsigned long cr4;
4613 asm("movq %%cr4,%0" : "=r" (cr4));
4614 return cr4;
4615 -}
4616 +}
4617
4618 static inline void write_cr4(unsigned long val)
4619 {
4620 asm volatile("movq %0,%%cr4" :: "r" (val) : "memory");
4621 -}
4622 -
4623 -#define stts() (HYPERVISOR_fpu_taskswitch(1))
4624 +}
4625
4626 -#define wbinvd() \
4627 - __asm__ __volatile__ ("wbinvd": : :"memory");
4628 +static inline unsigned long read_cr8(void)
4629 +{
4630 + return 0;
4631 +}
4632
4633 -/*
4634 - * On SMP systems, when the scheduler does migration-cost autodetection,
4635 - * it needs a way to flush as much of the CPU's caches as possible.
4636 - */
4637 -static inline void sched_cacheflush(void)
4638 +static inline void write_cr8(unsigned long val)
4639 {
4640 - wbinvd();
4641 + BUG_ON(val);
4642 }
4643
4644 +#define stts() (HYPERVISOR_fpu_taskswitch(1))
4645 +
4646 +#define wbinvd() \
4647 + __asm__ __volatile__ ("wbinvd": : :"memory")
4648 +
4649 #endif /* __KERNEL__ */
4650
4651 #define nop() __asm__ __volatile__ ("nop")
4652 --- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/tlbflush_64.h 2008-12-15 11:27:22.000000000 +0100
4653 +++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/tlbflush_64.h 2009-02-16 16:17:21.000000000 +0100
4654 @@ -89,7 +89,11 @@ static inline void flush_tlb_range(struc
4655
4656 #endif
4657
4658 -#define flush_tlb_kernel_range(start, end) flush_tlb_all()
4659 +static inline void flush_tlb_kernel_range(unsigned long start,
4660 + unsigned long end)
4661 +{
4662 + flush_tlb_all();
4663 +}
4664
4665 static inline void flush_tlb_pgtables(struct mm_struct *mm,
4666 unsigned long start, unsigned long end)
4667 --- sle11-2009-05-14.orig/include/asm-x86/thread_info.h 2009-04-20 11:36:10.000000000 +0200
4668 +++ sle11-2009-05-14/include/asm-x86/thread_info.h 2009-02-16 16:17:21.000000000 +0100
4669 @@ -150,7 +150,8 @@ struct thread_info {
4670 #define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW
4671 #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
4672 #else
4673 -#define _TIF_WORK_CTXSW _TIF_DEBUG
4674 +#define _TIF_WORK_CTXSW_NEXT (_TIF_NOTSC | _TIF_DEBUG)
4675 +#define _TIF_WORK_CTXSW_PREV (_TIF_NOTSC)
4676 #endif
4677
4678 #define PREEMPT_ACTIVE 0x10000000
4679 --- sle11-2009-05-14.orig/include/asm-x86/xen/interface.h 2009-05-14 10:56:29.000000000 +0200
4680 +++ sle11-2009-05-14/include/asm-x86/xen/interface.h 2009-02-16 16:17:21.000000000 +0100
4681 @@ -10,17 +10,17 @@
4682 #define __ASM_X86_XEN_INTERFACE_H
4683
4684 #ifdef __XEN__
4685 -#define __DEFINE_GUEST_HANDLE(name, type) \
4686 +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
4687 typedef struct { type *p; } __guest_handle_ ## name
4688 #else
4689 -#define __DEFINE_GUEST_HANDLE(name, type) \
4690 +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
4691 typedef type * __guest_handle_ ## name
4692 #endif
4693
4694 -#define DEFINE_GUEST_HANDLE_STRUCT(name) \
4695 - __DEFINE_GUEST_HANDLE(name, struct name)
4696 -#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
4697 -#define GUEST_HANDLE(name) __guest_handle_ ## name
4698 +#define DEFINE_XEN_GUEST_HANDLE_STRUCT(name) \
4699 + __DEFINE_XEN_GUEST_HANDLE(name, struct name)
4700 +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
4701 +#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
4702
4703 #ifdef __XEN__
4704 #if defined(__i386__)
4705 @@ -47,14 +47,8 @@
4706 #endif
4707
4708 #ifndef __ASSEMBLY__
4709 -/* Guest handles for primitive C types. */
4710 -__DEFINE_GUEST_HANDLE(uchar, unsigned char);
4711 -__DEFINE_GUEST_HANDLE(uint, unsigned int);
4712 -__DEFINE_GUEST_HANDLE(ulong, unsigned long);
4713 -DEFINE_GUEST_HANDLE(char);
4714 -DEFINE_GUEST_HANDLE(int);
4715 -DEFINE_GUEST_HANDLE(long);
4716 -DEFINE_GUEST_HANDLE(void);
4717 +typedef unsigned long xen_pfn_t;
4718 +typedef unsigned long xen_ulong_t;
4719 #endif
4720
4721 #ifndef HYPERVISOR_VIRT_START
4722 @@ -103,7 +97,7 @@ struct trap_info {
4723 uint16_t cs; /* code selector */
4724 unsigned long address; /* code offset */
4725 };
4726 -DEFINE_GUEST_HANDLE_STRUCT(trap_info);
4727 +DEFINE_XEN_GUEST_HANDLE_STRUCT(trap_info);
4728
4729 struct arch_shared_info {
4730 unsigned long max_pfn; /* max pfn that appears in table */
4731 @@ -157,7 +151,7 @@ struct vcpu_guest_context {
4732 uint64_t gs_base_user;
4733 #endif
4734 };
4735 -DEFINE_GUEST_HANDLE_STRUCT(vcpu_guest_context);
4736 +DEFINE_XEN_GUEST_HANDLE_STRUCT(vcpu_guest_context);
4737 #endif /* !__ASSEMBLY__ */
4738
4739 /*
4740 --- sle11-2009-05-14.orig/include/asm-x86/xen/interface_32.h 2009-05-14 10:56:29.000000000 +0200
4741 +++ sle11-2009-05-14/include/asm-x86/xen/interface_32.h 2009-02-16 16:17:21.000000000 +0100
4742 @@ -62,7 +62,7 @@ struct cpu_user_regs {
4743 uint16_t fs, _pad4;
4744 uint16_t gs, _pad5;
4745 };
4746 -DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
4747 +DEFINE_XEN_GUEST_HANDLE_STRUCT(cpu_user_regs);
4748
4749 typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
4750
4751 --- sle11-2009-05-14.orig/include/linux/elfnote.h 2009-05-14 10:56:29.000000000 +0200
4752 +++ sle11-2009-05-14/include/linux/elfnote.h 2009-02-16 16:17:21.000000000 +0100
4753 @@ -52,7 +52,7 @@
4754 4484:.balign 4 ; \
4755 .popsection ;
4756
4757 -#define ELFNOTE(name, type, desc) \
4758 +#define ELFNOTE(name, type, desc...) \
4759 ELFNOTE_START(name, type, "") \
4760 desc ; \
4761 ELFNOTE_END
4762 --- sle11-2009-05-14.orig/include/linux/page-flags.h 2009-01-16 10:20:18.000000000 +0100
4763 +++ sle11-2009-05-14/include/linux/page-flags.h 2009-02-16 16:17:21.000000000 +0100
4764 @@ -100,6 +100,10 @@ enum pageflags {
4765 #endif
4766 #ifdef CONFIG_XEN
4767 PG_foreign, /* Page is owned by foreign allocator. */
4768 + PG_pinned, /* Cannot alias with PG_owner_priv_1 since
4769 + * bad_page() checks include this bit.
4770 + * Also cannot use PG_arch_1 since that now
4771 + * has a different purpose on x86. */
4772 #endif
4773 __NR_PAGEFLAGS,
4774
4775 --- sle11-2009-05-14.orig/include/linux/skbuff.h 2009-03-04 11:28:34.000000000 +0100
4776 +++ sle11-2009-05-14/include/linux/skbuff.h 2009-02-16 16:17:21.000000000 +0100
4777 @@ -1772,7 +1772,7 @@ static inline void skb_forward_csum(stru
4778
4779 bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
4780
4781 -#ifdef CONFIG_XEN
4782 +#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN)
4783 int skb_checksum_setup(struct sk_buff *skb);
4784 #else
4785 static inline int skb_checksum_setup(struct sk_buff *skb) { return 0; }
4786 --- sle11-2009-05-14.orig/include/xen/driver_util.h 2009-05-14 10:56:29.000000000 +0200
4787 +++ sle11-2009-05-14/include/xen/driver_util.h 2009-02-16 16:17:21.000000000 +0100
4788 @@ -5,10 +5,6 @@
4789 #include <linux/vmalloc.h>
4790 #include <linux/device.h>
4791
4792 -/* Allocate/destroy a 'vmalloc' VM area. */
4793 -extern struct vm_struct *alloc_vm_area(unsigned long size);
4794 -extern void free_vm_area(struct vm_struct *area);
4795 -
4796 extern struct class *get_xen_class(void);
4797
4798 #endif /* __ASM_XEN_DRIVER_UTIL_H__ */
4799 --- sle11-2009-05-14.orig/include/xen/features.h 2009-05-14 10:56:29.000000000 +0200
4800 +++ sle11-2009-05-14/include/xen/features.h 2009-02-16 16:17:21.000000000 +0100
4801 @@ -10,6 +10,7 @@
4802 #define __XEN_FEATURES_H__
4803
4804 #include <xen/interface/features.h>
4805 +#include <xen/interface/version.h>
4806
4807 void xen_setup_features(void);
4808
4809 @@ -20,4 +21,4 @@ static inline int xen_feature(int flag)
4810 return xen_features[flag];
4811 }
4812
4813 -#endif /* __ASM_XEN_FEATURES_H__ */
4814 +#endif /* __XEN_FEATURES_H__ */
4815 --- sle11-2009-05-14.orig/include/xen/interface/arch-x86/xen.h 2009-05-14 10:56:29.000000000 +0200
4816 +++ sle11-2009-05-14/include/xen/interface/arch-x86/xen.h 2009-02-16 16:17:21.000000000 +0100
4817 @@ -49,6 +49,9 @@
4818 #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
4819 #endif
4820
4821 +/* Allow co-existing Linux 2.6.23+ Xen interface definitions. */
4822 +#define DEFINE_XEN_GUEST_HANDLE_STRUCT(name) struct name
4823 +
4824 #if defined(__i386__)
4825 #include "xen-x86_32.h"
4826 #elif defined(__x86_64__)
4827 --- sle11-2009-05-14.orig/include/xen/interface/event_channel.h 2008-11-25 12:35:56.000000000 +0100
4828 +++ sle11-2009-05-14/include/xen/interface/event_channel.h 2009-02-16 16:17:21.000000000 +0100
4829 @@ -248,6 +248,7 @@ struct evtchn_op {
4830 struct evtchn_unmask unmask;
4831 } u;
4832 };
4833 +DEFINE_XEN_GUEST_HANDLE_STRUCT(evtchn_op);
4834 typedef struct evtchn_op evtchn_op_t;
4835 DEFINE_XEN_GUEST_HANDLE(evtchn_op_t);
4836
4837 --- sle11-2009-05-14.orig/include/xen/interface/io/netif.h 2008-11-25 12:35:56.000000000 +0100
4838 +++ sle11-2009-05-14/include/xen/interface/io/netif.h 2009-02-16 16:17:21.000000000 +0100
4839 @@ -183,8 +183,22 @@ typedef struct netif_rx_response netif_r
4840 * Generate netif ring structures and types.
4841 */
4842
4843 +#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
4844 DEFINE_RING_TYPES(netif_tx, struct netif_tx_request, struct netif_tx_response);
4845 DEFINE_RING_TYPES(netif_rx, struct netif_rx_request, struct netif_rx_response);
4846 +#else
4847 +#define xen_netif_tx_request netif_tx_request
4848 +#define xen_netif_rx_request netif_rx_request
4849 +#define xen_netif_tx_response netif_tx_response
4850 +#define xen_netif_rx_response netif_rx_response
4851 +DEFINE_RING_TYPES(xen_netif_tx,
4852 + struct xen_netif_tx_request,
4853 + struct xen_netif_tx_response);
4854 +DEFINE_RING_TYPES(xen_netif_rx,
4855 + struct xen_netif_rx_request,
4856 + struct xen_netif_rx_response);
4857 +#define xen_netif_extra_info netif_extra_info
4858 +#endif
4859
4860 #define NETIF_RSP_DROPPED -2
4861 #define NETIF_RSP_ERROR -1
4862 --- sle11-2009-05-14.orig/include/xen/interface/memory.h 2008-11-25 12:35:56.000000000 +0100
4863 +++ sle11-2009-05-14/include/xen/interface/memory.h 2009-02-16 16:17:21.000000000 +0100
4864 @@ -82,6 +82,7 @@ struct xen_memory_reservation {
4865 domid_t domid;
4866
4867 };
4868 +DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_memory_reservation);
4869 typedef struct xen_memory_reservation xen_memory_reservation_t;
4870 DEFINE_XEN_GUEST_HANDLE(xen_memory_reservation_t);
4871
4872 @@ -175,6 +176,7 @@ struct xen_machphys_mfn_list {
4873 */
4874 unsigned int nr_extents;
4875 };
4876 +DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
4877 typedef struct xen_machphys_mfn_list xen_machphys_mfn_list_t;
4878 DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn_list_t);
4879
4880 @@ -214,6 +216,7 @@ struct xen_add_to_physmap {
4881 /* GPFN where the source mapping page should appear. */
4882 xen_pfn_t gpfn;
4883 };
4884 +DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
4885 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
4886 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
4887
4888 @@ -254,6 +257,7 @@ struct xen_translate_gpfn_list {
4889 */
4890 XEN_GUEST_HANDLE(xen_pfn_t) mfn_list;
4891 };
4892 +DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
4893 typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t;
4894 DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t);
4895
4896 --- sle11-2009-05-14.orig/include/xen/interface/sched.h 2008-11-25 12:35:56.000000000 +0100
4897 +++ sle11-2009-05-14/include/xen/interface/sched.h 2009-02-16 16:17:21.000000000 +0100
4898 @@ -67,6 +67,7 @@
4899 struct sched_shutdown {
4900 unsigned int reason; /* SHUTDOWN_* */
4901 };
4902 +DEFINE_XEN_GUEST_HANDLE_STRUCT(sched_shutdown);
4903 typedef struct sched_shutdown sched_shutdown_t;
4904 DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t);
4905
4906 @@ -81,6 +82,7 @@ struct sched_poll {
4907 unsigned int nr_ports;
4908 uint64_t timeout;
4909 };
4910 +DEFINE_XEN_GUEST_HANDLE_STRUCT(sched_poll);
4911 typedef struct sched_poll sched_poll_t;
4912 DEFINE_XEN_GUEST_HANDLE(sched_poll_t);
4913
4914 --- sle11-2009-05-14.orig/include/xen/interface/version.h 2008-11-25 12:35:56.000000000 +0100
4915 +++ sle11-2009-05-14/include/xen/interface/version.h 2009-02-16 16:17:21.000000000 +0100
4916 @@ -36,6 +36,9 @@
4917 /* arg == xen_extraversion_t. */
4918 #define XENVER_extraversion 1
4919 typedef char xen_extraversion_t[16];
4920 +struct xen_extraversion {
4921 + xen_extraversion_t extraversion;
4922 +};
4923 #define XEN_EXTRAVERSION_LEN (sizeof(xen_extraversion_t))
4924
4925 /* arg == xen_compile_info_t. */
4926 @@ -50,10 +53,16 @@ typedef struct xen_compile_info xen_comp
4927
4928 #define XENVER_capabilities 3
4929 typedef char xen_capabilities_info_t[1024];
4930 +struct xen_capabilities_info {
4931 + xen_capabilities_info_t info;
4932 +};
4933 #define XEN_CAPABILITIES_INFO_LEN (sizeof(xen_capabilities_info_t))
4934
4935 #define XENVER_changeset 4
4936 typedef char xen_changeset_info_t[64];
4937 +struct xen_changeset_info {
4938 + xen_changeset_info_t info;
4939 +};
4940 #define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t))
4941
4942 #define XENVER_platform_parameters 5
4943 --- sle11-2009-05-14.orig/include/xen/interface/xen.h 2008-11-25 12:35:56.000000000 +0100
4944 +++ sle11-2009-05-14/include/xen/interface/xen.h 2009-05-14 11:17:48.000000000 +0200
4945 @@ -32,7 +32,9 @@
4946 #include <asm/pvclock-abi.h>
4947 #endif
4948
4949 -#if defined(__i386__) || defined(__x86_64__)
4950 +#if defined(CONFIG_PARAVIRT_XEN) && !defined(HAVE_XEN_PLATFORM_COMPAT_H)
4951 +#include <asm/xen/interface.h>
4952 +#elif defined(__i386__) || defined(__x86_64__)
4953 #include "arch-x86/xen.h"
4954 #elif defined(__ia64__)
4955 #include "arch-ia64.h"
4956 @@ -110,7 +112,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
4957 */
4958
4959 /* New sched_op hypercall introduced in 0x00030101. */
4960 -#if __XEN_INTERFACE_VERSION__ < 0x00030101
4961 +#if __XEN_INTERFACE_VERSION__ < 0x00030101 || (defined(CONFIG_PARAVIRT_XEN) && !defined(HAVE_XEN_PLATFORM_COMPAT_H))
4962 #undef __HYPERVISOR_sched_op
4963 #define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
4964 #else
4965 @@ -126,7 +128,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
4966 #endif
4967
4968 /* New platform_op hypercall introduced in 0x00030204. */
4969 -#if __XEN_INTERFACE_VERSION__ < 0x00030204
4970 +#if __XEN_INTERFACE_VERSION__ < 0x00030204 || (defined(CONFIG_PARAVIRT_XEN) && !defined(HAVE_XEN_PLATFORM_COMPAT_H))
4971 #define __HYPERVISOR_dom0_op __HYPERVISOR_platform_op
4972 #endif
4973
4974 @@ -285,6 +287,7 @@ struct mmuext_op {
4975 xen_pfn_t src_mfn;
4976 } arg2;
4977 };
4978 +DEFINE_XEN_GUEST_HANDLE_STRUCT(mmuext_op);
4979 typedef struct mmuext_op mmuext_op_t;
4980 DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
4981 #endif
4982 @@ -367,6 +370,7 @@ struct mmu_update {
4983 uint64_t ptr; /* Machine address of PTE. */
4984 uint64_t val; /* New contents of PTE. */
4985 };
4986 +DEFINE_XEN_GUEST_HANDLE_STRUCT(mmu_update);
4987 typedef struct mmu_update mmu_update_t;
4988 DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
4989
4990 @@ -375,9 +379,15 @@ DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
4991 * NB. The fields are natural register size for this architecture.
4992 */
4993 struct multicall_entry {
4994 - unsigned long op, result;
4995 + unsigned long op;
4996 +#if !defined(CONFIG_PARAVIRT_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
4997 + unsigned long result;
4998 +#else
4999 + long result;
5000 +#endif
5001 unsigned long args[6];
5002 };
5003 +DEFINE_XEN_GUEST_HANDLE_STRUCT(multicall_entry);
5004 typedef struct multicall_entry multicall_entry_t;
5005 DEFINE_XEN_GUEST_HANDLE(multicall_entry_t);
5006
5007 --- sle11-2009-05-14.orig/include/xen/xenbus.h 2009-03-04 11:25:55.000000000 +0100
5008 +++ sle11-2009-05-14/include/xen/xenbus.h 2009-02-16 16:17:21.000000000 +0100
5009 @@ -57,16 +57,20 @@ struct xenbus_watch
5010 void (*callback)(struct xenbus_watch *,
5011 const char **vec, unsigned int len);
5012
5013 +#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
5014 /* See XBWF_ definitions below. */
5015 unsigned long flags;
5016 +#endif
5017 };
5018
5019 +#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
5020 /*
5021 * Execute callback in its own kthread. Useful if the callback is long
5022 * running or heavily serialised, to avoid taking out the main xenwatch thread
5023 * for a long period of time (or even unwittingly causing a deadlock).
5024 */
5025 #define XBWF_new_thread 1
5026 +#endif
5027
5028 /* A xenbus device. */
5029 struct xenbus_device {
5030 @@ -214,6 +218,7 @@ int xenbus_watch_path(struct xenbus_devi
5031 const char **, unsigned int));
5032
5033
5034 +#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
5035 /**
5036 * Register a watch on the given path/path2, using the given xenbus_watch
5037 * structure for storage, and the given callback function as the callback.
5038 @@ -227,7 +232,13 @@ int xenbus_watch_path2(struct xenbus_dev
5039 const char *path2, struct xenbus_watch *watch,
5040 void (*callback)(struct xenbus_watch *,
5041 const char **, unsigned int));
5042 -
5043 +#else
5044 +int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch,
5045 + void (*callback)(struct xenbus_watch *,
5046 + const char **, unsigned int),
5047 + const char *pathfmt, ...)
5048 + __attribute__ ((format (printf, 4, 5)));
5049 +#endif
5050
5051 /**
5052 * Advertise in the store a change of the given driver to the given new_state.
5053 --- sle11-2009-05-14.orig/net/core/dev.c 2008-12-15 11:27:22.000000000 +0100
5054 +++ sle11-2009-05-14/net/core/dev.c 2009-02-16 16:17:21.000000000 +0100
5055 @@ -131,7 +131,7 @@
5056
5057 #include "net-sysfs.h"
5058
5059 -#ifdef CONFIG_XEN
5060 +#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN)
5061 #include <net/ip.h>
5062 #include <linux/tcp.h>
5063 #include <linux/udp.h>
5064 @@ -1740,42 +1740,54 @@ static struct netdev_queue *dev_pick_tx(
5065 return netdev_get_tx_queue(dev, queue_index);
5066 }
5067
5068 -#ifdef CONFIG_XEN
5069 +#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN)
5070 inline int skb_checksum_setup(struct sk_buff *skb)
5071 {
5072 - if (skb->proto_csum_blank) {
5073 - struct iphdr *iph;
5074 - unsigned char *th;
5075 + struct iphdr *iph;
5076 + unsigned char *th;
5077 + int err = -EPROTO;
5078
5079 - if (skb->protocol != htons(ETH_P_IP))
5080 - goto out;
5081 - iph = ip_hdr(skb);
5082 - th = skb_network_header(skb) + 4 * iph->ihl;
5083 - if (th >= skb_tail_pointer(skb))
5084 - goto out;
5085 - skb->csum_start = th - skb->head;
5086 - switch (iph->protocol) {
5087 - case IPPROTO_TCP:
5088 - skb->csum_offset = offsetof(struct tcphdr, check);
5089 - break;
5090 - case IPPROTO_UDP:
5091 - skb->csum_offset = offsetof(struct udphdr, check);
5092 - break;
5093 - default:
5094 - if (net_ratelimit())
5095 - printk(KERN_ERR "Attempting to checksum a non-"
5096 - "TCP/UDP packet, dropping a protocol"
5097 - " %d packet", iph->protocol);
5098 - goto out;
5099 - }
5100 - if ((th + skb->csum_offset + 2) > skb_tail_pointer(skb))
5101 - goto out;
5102 - skb->ip_summed = CHECKSUM_PARTIAL;
5103 - skb->proto_csum_blank = 0;
5104 +#ifdef CONFIG_XEN
5105 + if (!skb->proto_csum_blank)
5106 + return 0;
5107 +#endif
5108 +
5109 + if (skb->protocol != htons(ETH_P_IP))
5110 + goto out;
5111 +
5112 + iph = ip_hdr(skb);
5113 + th = skb_network_header(skb) + 4 * iph->ihl;
5114 + if (th >= skb_tail_pointer(skb))
5115 + goto out;
5116 +
5117 + skb->csum_start = th - skb->head;
5118 + switch (iph->protocol) {
5119 + case IPPROTO_TCP:
5120 + skb->csum_offset = offsetof(struct tcphdr, check);
5121 + break;
5122 + case IPPROTO_UDP:
5123 + skb->csum_offset = offsetof(struct udphdr, check);
5124 + break;
5125 + default:
5126 + if (net_ratelimit())
5127 + printk(KERN_ERR "Attempting to checksum a non-"
5128 + "TCP/UDP packet, dropping a protocol"
5129 + " %d packet", iph->protocol);
5130 + goto out;
5131 }
5132 - return 0;
5133 +
5134 + if ((th + skb->csum_offset + 2) > skb_tail_pointer(skb))
5135 + goto out;
5136 +
5137 +#ifdef CONFIG_XEN
5138 + skb->ip_summed = CHECKSUM_PARTIAL;
5139 + skb->proto_csum_blank = 0;
5140 +#endif
5141 +
5142 + err = 0;
5143 +
5144 out:
5145 - return -EPROTO;
5146 + return err;
5147 }
5148 EXPORT_SYMBOL(skb_checksum_setup);
5149 #endif