2 Subject: Update to 2.6.23
5 Automatically created from "patches.kernel.org/patch-2.6.23" by xen-port-patches.py
7 Acked-by: jbeulich@novell.com
9 Index: head-2008-12-01/arch/x86/Makefile
10 ===================================================================
11 --- head-2008-12-01.orig/arch/x86/Makefile 2008-12-01 11:11:08.000000000 +0100
12 +++ head-2008-12-01/arch/x86/Makefile 2008-12-01 11:36:47.000000000 +0100
13 @@ -148,7 +148,7 @@ libs-y += arch/x86/lib/
16 # Xen paravirtualization support
17 -core-$(CONFIG_XEN) += arch/x86/xen/
18 +core-$(CONFIG_PARAVIRT_XEN) += arch/x86/xen/
20 # lguest paravirtualization support
21 core-$(CONFIG_LGUEST_GUEST) += arch/x86/lguest/
22 Index: head-2008-12-01/arch/x86/kernel/acpi/sleep_32-xen.c
23 ===================================================================
24 --- head-2008-12-01.orig/arch/x86/kernel/acpi/sleep_32-xen.c 2008-04-15 09:29:41.000000000 +0200
25 +++ head-2008-12-01/arch/x86/kernel/acpi/sleep_32-xen.c 2008-12-01 11:36:47.000000000 +0100
27 #ifndef CONFIG_ACPI_PV_SLEEP
28 /* address in low memory of the wakeup routine. */
29 unsigned long acpi_wakeup_address = 0;
30 -unsigned long acpi_video_flags;
31 +unsigned long acpi_realmode_flags;
32 extern char wakeup_start, wakeup_end;
34 extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
35 @@ -74,9 +74,11 @@ static int __init acpi_sleep_setup(char
37 while ((str != NULL) && (*str != '\0')) {
38 if (strncmp(str, "s3_bios", 7) == 0)
39 - acpi_video_flags = 1;
40 + acpi_realmode_flags |= 1;
41 if (strncmp(str, "s3_mode", 7) == 0)
42 - acpi_video_flags |= 2;
43 + acpi_realmode_flags |= 2;
44 + if (strncmp(str, "s3_beep", 7) == 0)
45 + acpi_realmode_flags |= 4;
46 str = strchr(str, ',');
48 str += strspn(str, ", \t");
49 @@ -86,9 +88,11 @@ static int __init acpi_sleep_setup(char
51 __setup("acpi_sleep=", acpi_sleep_setup);
53 +/* Ouch, we want to delete this. We already have better version in userspace, in
54 + s2ram from suspend.sf.net project */
55 static __init int reset_videomode_after_s3(struct dmi_system_id *d)
57 - acpi_video_flags |= 2;
58 + acpi_realmode_flags |= 2;
62 Index: head-2008-12-01/arch/x86/kernel/asm-offsets_32.c
63 ===================================================================
64 --- head-2008-12-01.orig/arch/x86/kernel/asm-offsets_32.c 2008-12-01 11:36:13.000000000 +0100
65 +++ head-2008-12-01/arch/x86/kernel/asm-offsets_32.c 2008-12-01 11:36:47.000000000 +0100
67 #include <asm/bootparam.h>
70 +#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN)
71 #include <xen/interface/xen.h>
74 #include <linux/lguest.h>
75 #include "../../../drivers/lguest/lg.h"
76 @@ -121,7 +123,7 @@ void foo(void)
77 OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
81 +#ifdef CONFIG_PARAVIRT_XEN
83 OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
84 OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
85 Index: head-2008-12-01/arch/x86/kernel/cpu/common-xen.c
86 ===================================================================
87 --- head-2008-12-01.orig/arch/x86/kernel/cpu/common-xen.c 2008-12-01 11:36:13.000000000 +0100
88 +++ head-2008-12-01/arch/x86/kernel/cpu/common-xen.c 2008-12-01 11:36:47.000000000 +0100
89 @@ -360,6 +360,8 @@ static void __cpuinit generic_identify(s
90 if ( xlvl >= 0x80000004 )
91 get_model_name(c); /* Default name */
94 + init_scattered_cpuid_features(c);
97 early_intel_workaround(c);
98 @@ -611,7 +613,6 @@ extern int nsc_init_cpu(void);
99 extern int amd_init_cpu(void);
100 extern int centaur_init_cpu(void);
101 extern int transmeta_init_cpu(void);
102 -extern int rise_init_cpu(void);
103 extern int nexgen_init_cpu(void);
104 extern int umc_init_cpu(void);
106 @@ -623,7 +624,6 @@ void __init early_cpu_init(void)
109 transmeta_init_cpu();
114 Index: head-2008-12-01/arch/x86/kernel/cpu/mtrr/main-xen.c
115 ===================================================================
116 --- head-2008-12-01.orig/arch/x86/kernel/cpu/mtrr/main-xen.c 2008-12-01 11:36:13.000000000 +0100
117 +++ head-2008-12-01/arch/x86/kernel/cpu/mtrr/main-xen.c 2008-12-01 11:36:47.000000000 +0100
118 @@ -167,7 +167,7 @@ mtrr_del(int reg, unsigned long base, un
119 EXPORT_SYMBOL(mtrr_add);
120 EXPORT_SYMBOL(mtrr_del);
122 -__init void mtrr_bp_init(void)
123 +void __init mtrr_bp_init(void)
127 Index: head-2008-12-01/arch/x86/kernel/e820_32-xen.c
128 ===================================================================
129 --- head-2008-12-01.orig/arch/x86/kernel/e820_32-xen.c 2008-12-01 11:36:13.000000000 +0100
130 +++ head-2008-12-01/arch/x86/kernel/e820_32-xen.c 2008-12-01 11:36:47.000000000 +0100
132 #include <linux/efi.h>
133 #include <linux/pfn.h>
134 #include <linux/uaccess.h>
135 +#include <linux/suspend.h>
137 #include <asm/pgtable.h>
138 #include <asm/page.h>
139 @@ -343,6 +344,37 @@ static int __init request_standard_resou
141 subsys_initcall(request_standard_resources);
143 +#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
145 + * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
146 + * correspond to e820 RAM areas and mark the corresponding pages as nosave for
149 + * This function requires the e820 map to be sorted and without any
150 + * overlapping entries and assumes the first e820 area to be RAM.
152 +void __init e820_mark_nosave_regions(void)
157 + pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
158 + for (i = 1; i < e820.nr_map; i++) {
159 + struct e820entry *ei = &e820.map[i];
161 + if (pfn < PFN_UP(ei->addr))
162 + register_nosave_region(pfn, PFN_UP(ei->addr));
164 + pfn = PFN_DOWN(ei->addr + ei->size);
165 + if (ei->type != E820_RAM)
166 + register_nosave_region(PFN_UP(ei->addr), pfn);
168 + if (pfn >= max_low_pfn)
174 void __init add_memory_region(unsigned long long start,
175 unsigned long long size, int type)
177 @@ -804,7 +836,7 @@ void __init print_memory_map(char *who)
179 printk("(ACPI NVS)\n");
181 - default: printk("type %lu\n", e820.map[i].type);
182 + default: printk("type %u\n", e820.map[i].type);
186 Index: head-2008-12-01/arch/x86/kernel/entry_32.S
187 ===================================================================
188 --- head-2008-12-01.orig/arch/x86/kernel/entry_32.S 2008-12-01 11:21:02.000000000 +0100
189 +++ head-2008-12-01/arch/x86/kernel/entry_32.S 2008-12-01 11:36:47.000000000 +0100
190 @@ -1112,7 +1112,7 @@ ENTRY(kernel_thread_helper)
192 ENDPROC(kernel_thread_helper)
195 +#ifdef CONFIG_PARAVIRT_XEN
196 /* Xen doesn't set %esp to be precisely what the normal sysenter
197 entrypoint expects, so fix it up before using the normal path. */
198 ENTRY(xen_sysenter_target)
199 @@ -1205,7 +1205,7 @@ ENTRY(xen_failsafe_callback)
201 ENDPROC(xen_failsafe_callback)
203 -#endif /* CONFIG_XEN */
204 +#endif /* CONFIG_PARAVIRT_XEN */
207 #ifdef CONFIG_DYNAMIC_FTRACE
208 Index: head-2008-12-01/arch/x86/kernel/entry_32-xen.S
209 ===================================================================
210 --- head-2008-12-01.orig/arch/x86/kernel/entry_32-xen.S 2008-12-01 11:36:13.000000000 +0100
211 +++ head-2008-12-01/arch/x86/kernel/entry_32-xen.S 2008-12-01 11:36:47.000000000 +0100
212 @@ -452,9 +452,6 @@ restore_nocheck_notrace:
217 - ENABLE_INTERRUPTS(CLBR_NONE)
219 pushl $0 # no error code
222 Index: head-2008-12-01/arch/x86/kernel/head_32-xen.S
223 ===================================================================
224 --- head-2008-12-01.orig/arch/x86/kernel/head_32-xen.S 2008-12-01 11:36:13.000000000 +0100
225 +++ head-2008-12-01/arch/x86/kernel/head_32-xen.S 2008-12-01 11:36:47.000000000 +0100
226 @@ -86,7 +86,10 @@ ENTRY(_stext)
230 -.section ".bss.page_aligned","w"
231 +.section ".bss.page_aligned","wa"
232 + .align PAGE_SIZE_asm
233 +ENTRY(swapper_pg_pmd)
235 ENTRY(empty_zero_page)
238 @@ -136,25 +139,25 @@ ENTRY(empty_zero_page)
239 #endif /* CONFIG_XEN_COMPAT <= 0x030002 */
242 - ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux")
243 - ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6")
244 - ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0")
245 - ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long, __PAGE_OFFSET)
246 + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
247 + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
248 + ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")
249 + ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long __PAGE_OFFSET)
250 #if CONFIG_XEN_COMPAT <= 0x030002
251 - ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, __PAGE_OFFSET)
252 + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long __PAGE_OFFSET)
254 - ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, 0)
255 + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long 0)
257 - ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, startup_32)
258 - ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page)
259 - ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long, HYPERVISOR_VIRT_START)
260 - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
261 + ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long startup_32)
262 + ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long hypercall_page)
263 + ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long HYPERVISOR_VIRT_START)
264 + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
265 #ifdef CONFIG_X86_PAE
266 - ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes")
267 - ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT)
268 + ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes")
269 + ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad _PAGE_PRESENT, _PAGE_PRESENT)
271 - ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "no")
272 - ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .long, _PAGE_PRESENT,_PAGE_PRESENT)
273 + ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "no")
274 + ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .long _PAGE_PRESENT, _PAGE_PRESENT)
276 - ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic")
277 - ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1)
278 + ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
279 + ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
280 Index: head-2008-12-01/arch/x86/kernel/init_task-xen.c
281 ===================================================================
282 --- head-2008-12-01.orig/arch/x86/kernel/init_task-xen.c 2007-06-12 13:12:48.000000000 +0200
283 +++ head-2008-12-01/arch/x86/kernel/init_task-xen.c 2008-12-01 11:36:47.000000000 +0100
284 @@ -46,6 +46,6 @@ EXPORT_SYMBOL(init_task);
285 * per-CPU TSS segments. Threads are completely 'soft' on Linux,
286 * no more per-task TSS's.
288 -DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS;
289 +DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS;
292 Index: head-2008-12-01/arch/x86/kernel/io_apic_32-xen.c
293 ===================================================================
294 --- head-2008-12-01.orig/arch/x86/kernel/io_apic_32-xen.c 2008-12-01 11:36:13.000000000 +0100
295 +++ head-2008-12-01/arch/x86/kernel/io_apic_32-xen.c 2008-12-01 11:36:47.000000000 +0100
296 @@ -402,14 +402,6 @@ static void set_ioapic_affinity_irq(unsi
297 # include <linux/slab.h> /* kmalloc() */
298 # include <linux/timer.h> /* time_after() */
300 -#ifdef CONFIG_BALANCED_IRQ_DEBUG
301 -# define TDprintk(x...) do { printk("<%ld:%s:%d>: ", jiffies, __FILE__, __LINE__); printk(x); } while (0)
302 -# define Dprintk(x...) do { TDprintk(x); } while (0)
304 -# define TDprintk(x...)
305 -# define Dprintk(x...)
308 #define IRQBALANCE_CHECK_ARCH -999
309 #define MAX_BALANCED_IRQ_INTERVAL (5*HZ)
310 #define MIN_BALANCED_IRQ_INTERVAL (HZ/2)
311 @@ -492,7 +484,7 @@ static inline void balance_irq(int cpu,
312 static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold)
315 - Dprintk("Rotating IRQs among CPUs.\n");
317 for_each_online_cpu(i) {
318 for (j = 0; j < NR_IRQS; j++) {
319 if (!irq_desc[j].action)
320 @@ -609,19 +601,11 @@ tryanothercpu:
321 max_loaded = tmp_loaded; /* processor */
322 imbalance = (max_cpu_irq - min_cpu_irq) / 2;
324 - Dprintk("max_loaded cpu = %d\n", max_loaded);
325 - Dprintk("min_loaded cpu = %d\n", min_loaded);
326 - Dprintk("max_cpu_irq load = %ld\n", max_cpu_irq);
327 - Dprintk("min_cpu_irq load = %ld\n", min_cpu_irq);
328 - Dprintk("load imbalance = %lu\n", imbalance);
330 /* if imbalance is less than approx 10% of max load, then
331 * observe diminishing returns action. - quit
333 - if (imbalance < (max_cpu_irq >> 3)) {
334 - Dprintk("Imbalance too trivial\n");
335 + if (imbalance < (max_cpu_irq >> 3))
336 goto not_worth_the_effort;
340 /* if we select an IRQ to move that can't go where we want, then
341 @@ -678,9 +662,6 @@ tryanotherirq:
342 cpus_and(tmp, target_cpu_mask, allowed_mask);
344 if (!cpus_empty(tmp)) {
346 - Dprintk("irq = %d moved to cpu = %d\n",
347 - selected_irq, min_loaded);
348 /* mark for change destination */
349 set_pending_irq(selected_irq, cpumask_of_cpu(min_loaded));
351 @@ -700,7 +681,6 @@ not_worth_the_effort:
353 balanced_irq_interval = min((long)MAX_BALANCED_IRQ_INTERVAL,
354 balanced_irq_interval + BALANCED_IRQ_MORE_DELTA);
355 - Dprintk("IRQ worth rotating not found\n");
359 @@ -716,6 +696,7 @@ static int balanced_irq(void *unused)
360 set_pending_irq(i, cpumask_of_cpu(0));
365 time_remaining = schedule_timeout_interruptible(time_remaining);
367 @@ -825,14 +806,6 @@ static int pirq_entries [MAX_PIRQS];
368 static int pirqs_enabled;
369 int skip_ioapic_setup;
371 -static int __init ioapic_setup(char *str)
373 - skip_ioapic_setup = 1;
377 -__setup("noapic", ioapic_setup);
379 static int __init ioapic_pirq_setup(char *str)
382 @@ -1323,12 +1296,15 @@ static struct irq_chip ioapic_chip;
383 static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
385 if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
386 - trigger == IOAPIC_LEVEL)
387 + trigger == IOAPIC_LEVEL) {
388 + irq_desc[irq].status |= IRQ_LEVEL;
389 set_irq_chip_and_handler_name(irq, &ioapic_chip,
390 handle_fasteoi_irq, "fasteoi");
393 + irq_desc[irq].status &= ~IRQ_LEVEL;
394 set_irq_chip_and_handler_name(irq, &ioapic_chip,
395 handle_edge_irq, "edge");
397 set_intr_gate(vector, interrupt[irq]);
400 @@ -1957,7 +1933,7 @@ __setup("no_timer_check", notimercheck);
401 * - if this function detects that timer IRQs are defunct, then we fall
402 * back to ISA timer IRQs
404 -int __init timer_irq_works(void)
405 +static int __init timer_irq_works(void)
407 unsigned long t1 = jiffies;
409 Index: head-2008-12-01/arch/x86/kernel/irq_32-xen.c
410 ===================================================================
411 --- head-2008-12-01.orig/arch/x86/kernel/irq_32-xen.c 2008-12-01 11:36:13.000000000 +0100
412 +++ head-2008-12-01/arch/x86/kernel/irq_32-xen.c 2008-12-01 11:36:47.000000000 +0100
414 #include <asm/apic.h>
415 #include <asm/uaccess.h>
417 -DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_internodealigned_in_smp;
418 +DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
419 EXPORT_PER_CPU_SYMBOL(irq_stat);
421 DEFINE_PER_CPU(struct pt_regs *, irq_regs);
422 @@ -149,15 +149,11 @@ fastcall unsigned int do_IRQ(struct pt_r
424 #ifdef CONFIG_4KSTACKS
427 - * These should really be __section__(".bss.page_aligned") as well, but
428 - * gcc's 3.0 and earlier don't handle that correctly.
430 static char softirq_stack[NR_CPUS * THREAD_SIZE]
431 - __attribute__((__aligned__(THREAD_SIZE)));
432 + __attribute__((__section__(".bss.page_aligned")));
434 static char hardirq_stack[NR_CPUS * THREAD_SIZE]
435 - __attribute__((__aligned__(THREAD_SIZE)));
436 + __attribute__((__section__(".bss.page_aligned")));
439 * allocate per-cpu stacks for hardirq and for softirq processing
440 Index: head-2008-12-01/arch/x86/kernel/microcode-xen.c
441 ===================================================================
442 --- head-2008-12-01.orig/arch/x86/kernel/microcode-xen.c 2008-12-01 11:36:13.000000000 +0100
443 +++ head-2008-12-01/arch/x86/kernel/microcode-xen.c 2008-12-01 11:36:47.000000000 +0100
445 #include <linux/miscdevice.h>
446 #include <linux/spinlock.h>
447 #include <linux/mm.h>
448 +#include <linux/fs.h>
449 #include <linux/mutex.h>
450 #include <linux/cpu.h>
451 #include <linux/firmware.h>
452 Index: head-2008-12-01/arch/x86/kernel/pci-dma-xen.c
453 ===================================================================
454 --- head-2008-12-01.orig/arch/x86/kernel/pci-dma-xen.c 2008-12-01 11:36:13.000000000 +0100
455 +++ head-2008-12-01/arch/x86/kernel/pci-dma-xen.c 2008-12-01 11:36:47.000000000 +0100
460 -#include <asm/proto.h>
461 +#include <asm/iommu.h>
463 int iommu_merge __read_mostly = 0;
464 EXPORT_SYMBOL(iommu_merge);
465 Index: head-2008-12-01/arch/x86/kernel/process_32-xen.c
466 ===================================================================
467 --- head-2008-12-01.orig/arch/x86/kernel/process_32-xen.c 2008-12-01 11:36:13.000000000 +0100
468 +++ head-2008-12-01/arch/x86/kernel/process_32-xen.c 2008-12-01 11:36:47.000000000 +0100
469 @@ -241,6 +241,7 @@ early_param("idle", idle_setup);
470 void show_regs(struct pt_regs * regs)
472 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
473 + unsigned long d0, d1, d2, d3, d6, d7;
476 printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
477 @@ -265,6 +266,17 @@ void show_regs(struct pt_regs * regs)
479 cr4 = read_cr4_safe();
480 printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
482 + get_debugreg(d0, 0);
483 + get_debugreg(d1, 1);
484 + get_debugreg(d2, 2);
485 + get_debugreg(d3, 3);
486 + printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
488 + get_debugreg(d6, 6);
489 + get_debugreg(d7, 7);
490 + printk("DR6: %08lx DR7: %08lx\n", d6, d7);
492 show_trace(NULL, regs, ®s->esp);
495 @@ -473,7 +485,30 @@ int dump_task_regs(struct task_struct *t
499 -static noinline void __switch_to_xtra(struct task_struct *next_p)
500 +#ifdef CONFIG_SECCOMP
501 +void hard_disable_TSC(void)
503 + write_cr4(read_cr4() | X86_CR4_TSD);
505 +void disable_TSC(void)
508 + if (!test_and_set_thread_flag(TIF_NOTSC))
510 + * Must flip the CPU state synchronously with
511 + * TIF_NOTSC in the current running context.
513 + hard_disable_TSC();
516 +void hard_enable_TSC(void)
518 + write_cr4(read_cr4() & ~X86_CR4_TSD);
520 +#endif /* CONFIG_SECCOMP */
522 +static noinline void
523 +__switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p)
525 struct thread_struct *next;
527 @@ -488,33 +523,17 @@ static noinline void __switch_to_xtra(st
528 set_debugreg(next->debugreg[6], 6);
529 set_debugreg(next->debugreg[7], 7);
534 - * This function selects if the context switch from prev to next
535 - * has to tweak the TSC disable bit in the cr4.
537 -static inline void disable_tsc(struct task_struct *prev_p,
538 - struct task_struct *next_p)
540 - struct thread_info *prev, *next;
543 - * gcc should eliminate the ->thread_info dereference if
544 - * has_secure_computing returns 0 at compile time (SECCOMP=n).
546 - prev = task_thread_info(prev_p);
547 - next = task_thread_info(next_p);
549 - if (has_secure_computing(prev) || has_secure_computing(next)) {
550 - /* slow path here */
551 - if (has_secure_computing(prev) &&
552 - !has_secure_computing(next)) {
553 - write_cr4(read_cr4() & ~X86_CR4_TSD);
554 - } else if (!has_secure_computing(prev) &&
555 - has_secure_computing(next))
556 - write_cr4(read_cr4() | X86_CR4_TSD);
557 +#ifdef CONFIG_SECCOMP
558 + if (test_tsk_thread_flag(prev_p, TIF_NOTSC) ^
559 + test_tsk_thread_flag(next_p, TIF_NOTSC)) {
560 + /* prev and next are different */
561 + if (test_tsk_thread_flag(next_p, TIF_NOTSC))
562 + hard_disable_TSC();
570 @@ -649,10 +668,9 @@ struct task_struct fastcall * __switch_t
572 * Now maybe handle debug registers
574 - if (unlikely(task_thread_info(next_p)->flags & _TIF_WORK_CTXSW))
575 - __switch_to_xtra(next_p);
577 - disable_tsc(prev_p, next_p);
578 + if (unlikely(task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV ||
579 + task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT))
580 + __switch_to_xtra(prev_p, next_p);
583 * Leave lazy mode, flushing any hypercalls made here.
584 Index: head-2008-12-01/arch/x86/kernel/setup_32-xen.c
585 ===================================================================
586 --- head-2008-12-01.orig/arch/x86/kernel/setup_32-xen.c 2008-12-01 11:36:07.000000000 +0100
587 +++ head-2008-12-01/arch/x86/kernel/setup_32-xen.c 2008-12-01 11:36:47.000000000 +0100
588 @@ -114,19 +114,10 @@ static unsigned int highmem_pages = -1;
592 -struct drive_info_struct { char dummy[32]; } drive_info;
593 -#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || \
594 - defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
595 -EXPORT_SYMBOL(drive_info);
597 struct screen_info screen_info;
598 EXPORT_SYMBOL(screen_info);
599 struct apm_info apm_info;
600 EXPORT_SYMBOL(apm_info);
601 -struct sys_desc_table_struct {
602 - unsigned short length;
603 - unsigned char table[0];
605 struct edid_info edid_info;
606 EXPORT_SYMBOL_GPL(edid_info);
608 @@ -149,7 +140,7 @@ unsigned long saved_videomode;
610 static char __initdata command_line[COMMAND_LINE_SIZE];
612 -unsigned char __initdata boot_params[PARAM_SIZE];
613 +struct boot_params __initdata boot_params;
616 * Point at the empty zero page to start with. We map the real shared_info
617 @@ -316,18 +307,18 @@ unsigned long __init find_max_low_pfn(vo
618 printk(KERN_WARNING "Warning only %ldMB will be used.\n",
620 if (max_pfn > MAX_NONPAE_PFN)
621 - printk(KERN_WARNING "Use a PAE enabled kernel.\n");
622 + printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
624 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
625 max_pfn = MAXMEM_PFN;
626 #else /* !CONFIG_HIGHMEM */
627 -#ifndef CONFIG_X86_PAE
628 +#ifndef CONFIG_HIGHMEM64G
629 if (max_pfn > MAX_NONPAE_PFN) {
630 max_pfn = MAX_NONPAE_PFN;
631 printk(KERN_WARNING "Warning only 4GB will be used.\n");
632 - printk(KERN_WARNING "Use a PAE enabled kernel.\n");
633 + printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
635 -#endif /* !CONFIG_X86_PAE */
636 +#endif /* !CONFIG_HIGHMEM64G */
637 #endif /* !CONFIG_HIGHMEM */
639 if (highmem_pages == -1)
640 @@ -514,7 +505,7 @@ void __init setup_bootmem_allocator(void
642 * This should all compile down to nothing when NUMA is off.
644 -void __init remapped_pgdat_init(void)
645 +static void __init remapped_pgdat_init(void)
649 @@ -589,7 +580,6 @@ void __init setup_arch(char **cmdline_p)
650 properly. Setting ROOT_DEV to default to /dev/ram0 breaks initrd.
652 ROOT_DEV = MKDEV(UNNAMED_MAJOR,0);
653 - drive_info = DRIVE_INFO;
654 screen_info = SCREEN_INFO;
656 apm_info.bios = APM_BIOS_INFO;
657 @@ -767,6 +757,8 @@ void __init setup_arch(char **cmdline_p)
658 * NOTE: at this point the bootmem allocator is fully available.
661 + paravirt_post_allocator_init();
663 if (is_initial_xendomain())
666 @@ -814,6 +806,7 @@ void __init setup_arch(char **cmdline_p)
669 e820_register_memory();
670 + e820_mark_nosave_regions();
672 if (is_initial_xendomain()) {
674 Index: head-2008-12-01/arch/x86/kernel/smp_32-xen.c
675 ===================================================================
676 --- head-2008-12-01.orig/arch/x86/kernel/smp_32-xen.c 2008-12-01 11:36:13.000000000 +0100
677 +++ head-2008-12-01/arch/x86/kernel/smp_32-xen.c 2008-12-01 11:36:47.000000000 +0100
680 #include <asm/mtrr.h>
681 #include <asm/tlbflush.h>
682 +#include <asm/mmu_context.h>
684 #include <mach_apic.h>
686 @@ -217,13 +218,13 @@ static unsigned long flush_va;
687 static DEFINE_SPINLOCK(tlbstate_lock);
690 - * We cannot call mmdrop() because we are in interrupt context,
691 + * We cannot call mmdrop() because we are in interrupt context,
692 * instead update mm->cpu_vm_mask.
694 * We need to reload %cr3 since the page tables may be going
695 * away from under us..
697 -static inline void leave_mm (unsigned long cpu)
698 +void leave_mm(unsigned long cpu)
700 if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
702 Index: head-2008-12-01/arch/x86/kernel/time_32-xen.c
703 ===================================================================
704 --- head-2008-12-01.orig/arch/x86/kernel/time_32-xen.c 2008-12-01 11:36:13.000000000 +0100
705 +++ head-2008-12-01/arch/x86/kernel/time_32-xen.c 2008-12-01 11:36:47.000000000 +0100
707 #include <xen/evtchn.h>
708 #include <xen/interface/vcpu.h>
710 -#ifdef CONFIG_X86_32
711 #include <asm/i8253.h>
712 DEFINE_SPINLOCK(i8253_lock);
713 EXPORT_SYMBOL(i8253_lock);
716 +#ifdef CONFIG_X86_64
717 +#include <asm/vsyscall.h>
718 volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
721 @@ -758,56 +759,10 @@ unsigned long read_persistent_clock(void
725 -static void sync_cmos_clock(unsigned long dummy);
727 -static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0);
728 -int no_sync_cmos_clock;
730 -static void sync_cmos_clock(unsigned long dummy)
732 - struct timeval now, next;
736 - * If we have an externally synchronized Linux clock, then update
737 - * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
738 - * called as close as possible to 500 ms before the new second starts.
739 - * This code is run on a timer. If the clock is set, that timer
740 - * may not expire at the correct time. Thus, we adjust...
744 - * Not synced, exit, do not restart a timer (if one is
745 - * running, let it run out).
749 - do_gettimeofday(&now);
750 - if (now.tv_usec >= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 &&
751 - now.tv_usec <= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2)
752 - fail = set_rtc_mmss(now.tv_sec);
754 - next.tv_usec = USEC_AFTER - now.tv_usec;
755 - if (next.tv_usec <= 0)
756 - next.tv_usec += USEC_PER_SEC;
763 - if (next.tv_usec >= USEC_PER_SEC) {
765 - next.tv_usec -= USEC_PER_SEC;
767 - mod_timer(&sync_cmos_timer, jiffies + timeval_to_jiffies(&next));
770 -void notify_arch_cmos_timer(void)
771 +int update_persistent_clock(struct timespec now)
773 - if (!no_sync_cmos_clock)
774 - mod_timer(&sync_cmos_timer, jiffies + 1);
775 mod_timer(&sync_xen_wallclock_timer, jiffies + 1);
776 + return set_rtc_mmss(now.tv_sec);
779 extern void (*late_time_init)(void);
780 Index: head-2008-12-01/arch/x86/kernel/traps_32-xen.c
781 ===================================================================
782 --- head-2008-12-01.orig/arch/x86/kernel/traps_32-xen.c 2008-12-01 11:36:13.000000000 +0100
783 +++ head-2008-12-01/arch/x86/kernel/traps_32-xen.c 2008-12-01 11:36:47.000000000 +0100
785 #include <linux/mca.h>
788 +#if defined(CONFIG_EDAC)
789 +#include <linux/edac.h>
792 #include <asm/processor.h>
793 #include <asm/system.h>
795 @@ -102,36 +106,45 @@ asmlinkage void machine_check(void);
796 int kstack_depth_to_print = 24;
797 static unsigned int code_bytes = 64;
799 -static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
800 +static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size)
802 return p > (void *)tinfo &&
803 - p < (void *)tinfo + THREAD_SIZE - 3;
804 + p <= (void *)tinfo + THREAD_SIZE - size;
807 +/* The form of the top of the frame on the stack */
808 +struct stack_frame {
809 + struct stack_frame *next_frame;
810 + unsigned long return_address;
813 static inline unsigned long print_context_stack(struct thread_info *tinfo,
814 unsigned long *stack, unsigned long ebp,
815 struct stacktrace_ops *ops, void *data)
817 - unsigned long addr;
819 #ifdef CONFIG_FRAME_POINTER
820 - while (valid_stack_ptr(tinfo, (void *)ebp)) {
821 - unsigned long new_ebp;
822 - addr = *(unsigned long *)(ebp + 4);
823 + struct stack_frame *frame = (struct stack_frame *)ebp;
824 + while (valid_stack_ptr(tinfo, frame, sizeof(*frame))) {
825 + struct stack_frame *next;
826 + unsigned long addr;
828 + addr = frame->return_address;
829 ops->address(data, addr);
831 * break out of recursive entries (such as
832 * end_of_stack_stop_unwind_function). Also,
833 * we can never allow a frame pointer to
836 - new_ebp = *(unsigned long *)ebp;
837 - if (new_ebp <= ebp)
839 + next = frame->next_frame;
846 - while (valid_stack_ptr(tinfo, stack)) {
847 + while (valid_stack_ptr(tinfo, stack, sizeof(*stack))) {
848 + unsigned long addr;
851 if (__kernel_text_address(addr))
852 ops->address(data, addr);
853 @@ -154,7 +167,7 @@ void dump_trace(struct task_struct *task
857 - if (task && task != current)
858 + if (task != current)
859 stack = (unsigned long *)task->thread.esp;
862 @@ -213,6 +226,7 @@ static void print_trace_address(void *da
864 printk("%s [<%08lx>] ", (char *)data, addr);
865 print_symbol("%s\n", addr);
866 + touch_nmi_watchdog();
869 static struct stacktrace_ops print_trace_ops = {
870 @@ -396,7 +410,7 @@ void die(const char * str, struct pt_reg
874 - report_bug(regs->eip);
875 + report_bug(regs->eip, regs);
877 printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
878 #ifdef CONFIG_PREEMPT
879 @@ -439,6 +453,7 @@ void die(const char * str, struct pt_reg
883 + add_taint(TAINT_DIE);
884 spin_unlock_irqrestore(&die.lock, flags);
887 @@ -523,10 +538,12 @@ fastcall void do_##name(struct pt_regs *
888 do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \
891 -#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
892 +#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr, irq) \
893 fastcall void do_##name(struct pt_regs * regs, long error_code) \
897 + local_irq_enable(); \
898 info.si_signo = signr; \
900 info.si_code = sicode; \
901 @@ -566,13 +583,13 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3)
903 DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow)
904 DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds)
905 -DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip)
906 +DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip, 0)
907 DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
908 DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
909 DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
910 DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
911 -DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
912 -DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0)
913 +DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0)
914 +DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0, 1)
916 fastcall void __kprobes do_general_protection(struct pt_regs * regs,
918 @@ -585,6 +602,13 @@ fastcall void __kprobes do_general_prote
920 current->thread.error_code = error_code;
921 current->thread.trap_no = 13;
922 + if (show_unhandled_signals && unhandled_signal(current, SIGSEGV) &&
923 + printk_ratelimit())
925 + "%s[%d] general protection eip:%lx esp:%lx error:%lx\n",
926 + current->comm, current->pid,
927 + regs->eip, regs->esp, error_code);
929 force_sig(SIGSEGV, current);
932 @@ -610,6 +634,14 @@ mem_parity_error(unsigned char reason, s
933 printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on "
934 "CPU %d.\n", reason, smp_processor_id());
935 printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n");
937 +#if defined(CONFIG_EDAC)
938 + if(edac_handler_set()) {
939 + edac_atomic_assert_error();
944 if (panic_on_unrecovered_nmi)
945 panic("NMI: Not continuing");
947 @@ -720,6 +752,8 @@ static __kprobes void default_do_nmi(str
951 +static int ignore_nmis;
953 fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code)
956 @@ -730,11 +764,24 @@ fastcall __kprobes void do_nmi(struct pt
960 - default_do_nmi(regs);
962 + default_do_nmi(regs);
969 + acpi_nmi_disable();
973 +void restart_nmi(void)
979 #ifdef CONFIG_KPROBES
980 fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code)
982 @@ -1023,6 +1070,7 @@ asmlinkage void math_state_restore(void)
983 thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */
986 +EXPORT_SYMBOL_GPL(math_state_restore);
988 #ifndef CONFIG_MATH_EMULATION
990 Index: head-2008-12-01/arch/x86/mach-xen/setup.c
991 ===================================================================
992 --- head-2008-12-01.orig/arch/x86/mach-xen/setup.c 2008-12-01 11:29:05.000000000 +0100
993 +++ head-2008-12-01/arch/x86/mach-xen/setup.c 2008-12-01 11:36:47.000000000 +0100
995 #include <asm/e820.h>
996 #include <asm/setup.h>
997 #include <asm/fixmap.h>
998 +#include <asm/pgtable.h>
1000 #include <xen/interface/callback.h>
1001 #include <xen/interface/memory.h>
1002 @@ -101,7 +102,7 @@ void __init pre_setup_arch_hook(void)
1004 init_mm.pgd = swapper_pg_dir = (pgd_t *)xen_start_info->pt_base;
1006 - setup_xen_features();
1007 + xen_setup_features();
1009 if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) {
1010 hypervisor_virt_start = pp.virt_start;
1011 @@ -157,4 +158,18 @@ void __init machine_specific_arch_setup(
1012 HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
1016 + /* Do an early initialization of the fixmap area */
1018 + extern pte_t swapper_pg_pmd[PTRS_PER_PTE];
1019 + unsigned long addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE);
1020 + pgd_t *pgd = (pgd_t *)xen_start_info->pt_base;
1021 + pud_t *pud = pud_offset(pgd + pgd_index(addr), addr);
1022 + pmd_t *pmd = pmd_offset(pud, addr);
1024 + swapper_pg_dir = pgd;
1025 + init_mm.pgd = pgd;
1026 + make_lowmem_page_readonly(swapper_pg_pmd, XENFEAT_writable_page_tables);
1027 + set_pmd(pmd, __pmd(__pa_symbol(swapper_pg_pmd) | _PAGE_TABLE));
1030 Index: head-2008-12-01/arch/x86/mm/fault_32-xen.c
1031 ===================================================================
1032 --- head-2008-12-01.orig/arch/x86/mm/fault_32-xen.c 2008-12-01 11:36:13.000000000 +0100
1033 +++ head-2008-12-01/arch/x86/mm/fault_32-xen.c 2008-12-01 11:36:47.000000000 +0100
1034 @@ -346,7 +346,10 @@ static inline pmd_t *vmalloc_sync_one(pg
1035 pmd_k = pmd_offset(pud_k, address);
1036 if (!pmd_present(*pmd_k))
1038 - if (!pmd_present(*pmd))
1039 + if (!pmd_present(*pmd)) {
1040 + bool lazy = x86_read_percpu(xen_lazy_mmu);
1042 + x86_write_percpu(xen_lazy_mmu, false);
1043 #if CONFIG_XEN_COMPAT > 0x030002
1044 set_pmd(pmd, *pmd_k);
1046 @@ -356,7 +359,8 @@ static inline pmd_t *vmalloc_sync_one(pg
1048 set_pmd(pmd, __pmd(pmd_val(*pmd_k)));
1051 + x86_write_percpu(xen_lazy_mmu, lazy);
1053 BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k));
1056 @@ -388,6 +392,8 @@ static inline int vmalloc_fault(unsigned
1060 +int show_unhandled_signals = 1;
1063 * This routine handles page faults. It determines the address,
1064 * and the problem, and then passes it off to one of the appropriate
1065 @@ -408,6 +414,7 @@ fastcall void __kprobes do_page_fault(st
1066 struct vm_area_struct * vma;
1067 unsigned long address;
1071 /* get the address */
1072 address = read_cr2();
1073 @@ -541,20 +548,18 @@ good_area:
1074 * make sure we exit gracefully rather than endlessly redo
1077 - switch (handle_mm_fault(mm, vma, address, write)) {
1078 - case VM_FAULT_MINOR:
1081 - case VM_FAULT_MAJOR:
1084 - case VM_FAULT_SIGBUS:
1086 - case VM_FAULT_OOM:
1087 + fault = handle_mm_fault(mm, vma, address, write);
1088 + if (unlikely(fault & VM_FAULT_ERROR)) {
1089 + if (fault & VM_FAULT_OOM)
1093 + else if (fault & VM_FAULT_SIGBUS)
1097 + if (fault & VM_FAULT_MAJOR)
1103 * Did it hit the DOS screen memory VA from vm86 mode?
1104 @@ -589,6 +594,14 @@ bad_area_nosemaphore:
1105 if (is_prefetch(regs, address, error_code))
1108 + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
1109 + printk_ratelimit()) {
1110 + printk("%s%s[%d]: segfault at %08lx eip %08lx "
1111 + "esp %08lx error %lx\n",
1112 + tsk->pid > 1 ? KERN_INFO : KERN_EMERG,
1113 + tsk->comm, tsk->pid, address, regs->eip,
1114 + regs->esp, error_code);
1116 tsk->thread.cr2 = address;
1117 /* Kernel addresses are always protection faults */
1118 tsk->thread.error_code = error_code | (address >= TASK_SIZE);
1119 Index: head-2008-12-01/arch/x86/mm/highmem_32-xen.c
1120 ===================================================================
1121 --- head-2008-12-01.orig/arch/x86/mm/highmem_32-xen.c 2008-12-01 11:36:13.000000000 +0100
1122 +++ head-2008-12-01/arch/x86/mm/highmem_32-xen.c 2008-12-01 11:36:47.000000000 +0100
1123 @@ -34,17 +34,16 @@ void *kmap_atomic_prot(struct page *page
1124 /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
1125 pagefault_disable();
1127 - idx = type + KM_TYPE_NR*smp_processor_id();
1128 - BUG_ON(!pte_none(*(kmap_pte-idx)));
1130 if (!PageHighMem(page))
1131 return page_address(page);
1133 + idx = type + KM_TYPE_NR*smp_processor_id();
1134 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
1135 + BUG_ON(!pte_none(*(kmap_pte-idx)));
1136 set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
1137 /*arch_flush_lazy_mmu_mode();*/
1139 - return (void*) vaddr;
1140 + return (void *)vaddr;
1143 void *kmap_atomic(struct page *page, enum km_type type)
1144 Index: head-2008-12-01/arch/x86/mm/init_32-xen.c
1145 ===================================================================
1146 --- head-2008-12-01.orig/arch/x86/mm/init_32-xen.c 2008-12-01 11:36:13.000000000 +0100
1147 +++ head-2008-12-01/arch/x86/mm/init_32-xen.c 2008-12-01 11:36:47.000000000 +0100
1148 @@ -96,7 +96,7 @@ static pte_t * __init one_page_table_ini
1150 pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
1152 - paravirt_alloc_pt(__pa(page_table) >> PAGE_SHIFT);
1153 + paravirt_alloc_pt(&init_mm, __pa(page_table) >> PAGE_SHIFT);
1154 make_lowmem_page_readonly(page_table,
1155 XENFEAT_writable_page_tables);
1156 set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE));
1157 @@ -446,7 +446,7 @@ static void __init pagetable_init (void)
1158 xen_pagetable_setup_done(pgd_base);
1161 -#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI_SLEEP)
1162 +#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI)
1164 * Swap suspend & friends need this for resume because things like the intel-agp
1165 * driver might have split up a kernel 4MB mapping.
1166 @@ -485,9 +485,13 @@ void zap_low_mappings (void)
1170 +int nx_enabled = 0;
1172 +#ifdef CONFIG_X86_PAE
1174 static int disable_nx __initdata = 0;
1175 u64 __supported_pte_mask __read_mostly = ~_PAGE_NX;
1176 -EXPORT_SYMBOL(__supported_pte_mask);
1177 +EXPORT_SYMBOL_GPL(__supported_pte_mask);
1181 @@ -514,9 +518,6 @@ static int __init noexec_setup(char *str
1183 early_param("noexec", noexec_setup);
1185 -int nx_enabled = 0;
1186 -#ifdef CONFIG_X86_PAE
1188 static void __init set_nx(void)
1190 unsigned int v[4], l, h;
1191 @@ -764,7 +765,7 @@ void __init mem_init(void)
1195 - set_bit(PG_pinned, &virt_to_page(init_mm.pgd)->flags);
1196 + SetPagePinned(virt_to_page(init_mm.pgd));
1199 #ifdef CONFIG_MEMORY_HOTPLUG
1200 @@ -796,8 +797,7 @@ void __init pgtable_cache_init(void)
1201 PTRS_PER_PMD*sizeof(pmd_t),
1202 PTRS_PER_PMD*sizeof(pmd_t),
1207 if (!SHARED_KERNEL_PMD) {
1208 /* If we're in PAE mode and have a non-shared
1209 kernel pmd, then the pgd size must be a
1210 Index: head-2008-12-01/arch/x86/mm/ioremap_32-xen.c
1211 ===================================================================
1212 --- head-2008-12-01.orig/arch/x86/mm/ioremap_32-xen.c 2008-12-01 11:36:13.000000000 +0100
1213 +++ head-2008-12-01/arch/x86/mm/ioremap_32-xen.c 2008-12-01 11:36:47.000000000 +0100
1214 @@ -363,9 +363,8 @@ void iounmap(volatile void __iomem *addr
1216 /* Reset the direct mapping. Can block */
1217 if ((p->flags >> 20) && is_local_lowmem(p->phys_addr)) {
1218 - /* p->size includes the guard page, but cpa doesn't like that */
1219 change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)),
1220 - (p->size - PAGE_SIZE) >> PAGE_SHIFT,
1221 + get_vm_area_size(p) >> PAGE_SHIFT,
1225 Index: head-2008-12-01/arch/x86/mm/pgtable_32-xen.c
1226 ===================================================================
1227 --- head-2008-12-01.orig/arch/x86/mm/pgtable_32-xen.c 2008-12-01 11:36:13.000000000 +0100
1228 +++ head-2008-12-01/arch/x86/mm/pgtable_32-xen.c 2008-12-01 11:36:47.000000000 +0100
1229 @@ -198,7 +198,7 @@ void pte_free(struct page *pte)
1230 va, pfn_pte(pfn, PAGE_KERNEL), 0))
1233 - clear_bit(PG_pinned, &pte->flags);
1234 + ClearPagePinned(pte);
1236 ClearPageForeign(pte);
1237 init_page_count(pte);
1238 @@ -248,7 +248,7 @@ static inline void pgd_list_del(pgd_t *p
1240 #if (PTRS_PER_PMD == 1)
1241 /* Non-PAE pgd constructor */
1242 -void pgd_ctor(void *pgd)
1243 +static void pgd_ctor(void *pgd)
1245 unsigned long flags;
1247 @@ -271,7 +271,7 @@ void pgd_ctor(void *pgd)
1249 #else /* PTRS_PER_PMD > 1 */
1250 /* PAE pgd constructor */
1251 -void pgd_ctor(void *pgd)
1252 +static void pgd_ctor(void *pgd)
1254 /* PAE, kernel PMD may be shared */
1256 @@ -285,7 +285,7 @@ void pgd_ctor(void *pgd)
1258 #endif /* PTRS_PER_PMD */
1260 -void pgd_dtor(void *pgd)
1261 +static void pgd_dtor(void *pgd)
1263 unsigned long flags; /* can be called from interrupt context */
1265 @@ -637,9 +637,9 @@ static inline unsigned int pgd_walk_set_
1267 if (PageHighMem(page)) {
1268 if (pgprot_val(flags) & _PAGE_RW)
1269 - clear_bit(PG_pinned, &page->flags);
1270 + ClearPagePinned(page);
1272 - set_bit(PG_pinned, &page->flags);
1273 + SetPagePinned(page);
1275 MULTI_update_va_mapping(per_cpu(pb_mcl, cpu) + seq,
1276 (unsigned long)__va(pfn << PAGE_SHIFT),
1277 @@ -709,19 +709,19 @@ static void __pgd_pin(pgd_t *pgd)
1278 pgd_walk(pgd, PAGE_KERNEL_RO);
1279 kmap_flush_unused();
1280 xen_pgd_pin(__pa(pgd));
1281 - set_bit(PG_pinned, &virt_to_page(pgd)->flags);
1282 + SetPagePinned(virt_to_page(pgd));
1285 static void __pgd_unpin(pgd_t *pgd)
1287 xen_pgd_unpin(__pa(pgd));
1288 pgd_walk(pgd, PAGE_KERNEL);
1289 - clear_bit(PG_pinned, &virt_to_page(pgd)->flags);
1290 + ClearPagePinned(virt_to_page(pgd));
1293 static void pgd_test_and_unpin(pgd_t *pgd)
1295 - if (test_bit(PG_pinned, &virt_to_page(pgd)->flags))
1296 + if (PagePinned(virt_to_page(pgd)))
1300 @@ -759,7 +759,7 @@ void mm_pin_all(void)
1302 spin_lock_irqsave(&pgd_lock, flags);
1303 for (page = pgd_list; page; page = (struct page *)page->index) {
1304 - if (!test_bit(PG_pinned, &page->flags))
1305 + if (!PagePinned(page))
1306 __pgd_pin((pgd_t *)page_address(page));
1308 spin_unlock_irqrestore(&pgd_lock, flags);
1309 @@ -767,7 +767,7 @@ void mm_pin_all(void)
1311 void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
1313 - if (!test_bit(PG_pinned, &virt_to_page(mm->pgd)->flags))
1314 + if (!PagePinned(virt_to_page(mm->pgd)))
1318 @@ -793,7 +793,7 @@ void arch_exit_mmap(struct mm_struct *mm
1322 - if (test_bit(PG_pinned, &virt_to_page(mm->pgd)->flags) &&
1323 + if (PagePinned(virt_to_page(mm->pgd)) &&
1324 (atomic_read(&mm->mm_count) == 1) &&
1325 !mm->context.has_foreign_mappings)
1327 Index: head-2008-12-01/arch/x86/pci/irq-xen.c
1328 ===================================================================
1329 --- head-2008-12-01.orig/arch/x86/pci/irq-xen.c 2008-12-01 11:32:38.000000000 +0100
1330 +++ head-2008-12-01/arch/x86/pci/irq-xen.c 2008-12-01 11:36:47.000000000 +0100
1331 @@ -142,8 +142,9 @@ static void __init pirq_peer_trick(void)
1332 for(i = 1; i < 256; i++) {
1333 if (!busmap[i] || pci_find_bus(0, i))
1335 - if (pci_scan_bus(i, &pci_root_ops, NULL))
1336 - printk(KERN_INFO "PCI: Discovered primary peer bus %02x [IRQ]\n", i);
1337 + if (pci_scan_bus_with_sysdata(i))
1338 + printk(KERN_INFO "PCI: Discovered primary peer "
1339 + "bus %02x [IRQ]\n", i);
1341 pcibios_last_bus = -1;
1343 @@ -553,6 +554,7 @@ static __init int intel_router_probe(str
1344 case PCI_DEVICE_ID_INTEL_ICH9_3:
1345 case PCI_DEVICE_ID_INTEL_ICH9_4:
1346 case PCI_DEVICE_ID_INTEL_ICH9_5:
1347 + case PCI_DEVICE_ID_INTEL_TOLAPAI_0:
1348 r->name = "PIIX/ICH";
1349 r->get = pirq_piix_get;
1350 r->set = pirq_piix_set;
1351 Index: head-2008-12-01/arch/x86/xen/Kconfig
1352 ===================================================================
1353 --- head-2008-12-01.orig/arch/x86/xen/Kconfig 2008-12-01 10:53:14.000000000 +0100
1354 +++ head-2008-12-01/arch/x86/xen/Kconfig 2008-12-01 11:36:47.000000000 +0100
1356 # This Kconfig describes xen options
1360 +config PARAVIRT_XEN
1361 bool "Xen guest support"
1363 select PARAVIRT_CLOCK
1364 Index: head-2008-12-01/arch/x86/xen/xen-head.S
1365 ===================================================================
1366 --- head-2008-12-01.orig/arch/x86/xen/xen-head.S 2008-12-01 10:53:14.000000000 +0100
1367 +++ head-2008-12-01/arch/x86/xen/xen-head.S 2008-12-01 11:36:47.000000000 +0100
1369 /* Xen-specific pieces of head.S, intended to be included in the right
1373 +#ifdef CONFIG_PARAVIRT_XEN
1375 #include <linux/elfnote.h>
1376 #include <linux/init.h>
1377 @@ -52,4 +52,4 @@ ENTRY(hypercall_page)
1378 ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, _ASM_PTR __HYPERVISOR_VIRT_START)
1379 ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, _ASM_PTR 0)
1381 -#endif /*CONFIG_XEN */
1382 +#endif /* CONFIG_PARAVIRT_XEN */
1383 Index: head-2008-12-01/arch/x86/ia32/ia32entry-xen.S
1384 ===================================================================
1385 --- head-2008-12-01.orig/arch/x86/ia32/ia32entry-xen.S 2008-12-01 11:36:13.000000000 +0100
1386 +++ head-2008-12-01/arch/x86/ia32/ia32entry-xen.S 2008-12-01 11:36:47.000000000 +0100
1387 @@ -105,7 +105,7 @@ ENTRY(ia32_sysenter_target)
1388 movl $VSYSCALL32_SYSEXIT,8(%rsp)
1393 /* no need to do an access_ok check here because rbp has been
1394 32bit zero extended */
1396 @@ -244,7 +244,7 @@ ia32_badarg:
1400 - CFI_STARTPROC simple
1401 + CFI_STARTPROC32 simple
1403 CFI_DEF_CFA rsp,SS+8-RIP+16
1404 /*CFI_REL_OFFSET ss,SS-RIP+16*/
1405 @@ -280,6 +280,7 @@ ia32_sysret:
1410 movq $-ENOSYS,RAX(%rsp) /* really needed? */
1411 movq %rsp,%rdi /* &pt_regs -> arg1 */
1412 call syscall_trace_enter
1413 @@ -476,7 +477,7 @@ ia32_sys_call_table:
1414 .quad sys_init_module
1415 .quad sys_delete_module
1416 .quad quiet_ni_syscall /* 130 get_kernel_syms */
1417 - .quad sys_quotactl
1418 + .quad sys32_quotactl
1421 .quad quiet_ni_syscall /* bdflush */
1422 @@ -669,4 +670,5 @@ ia32_sys_call_table:
1423 .quad compat_sys_signalfd
1424 .quad compat_sys_timerfd
1426 + .quad sys32_fallocate
1428 Index: head-2008-12-01/arch/x86/kernel/acpi/sleep_64-xen.c
1429 ===================================================================
1430 --- head-2008-12-01.orig/arch/x86/kernel/acpi/sleep_64-xen.c 2008-12-01 11:36:13.000000000 +0100
1431 +++ head-2008-12-01/arch/x86/kernel/acpi/sleep_64-xen.c 2008-12-01 11:36:47.000000000 +0100
1433 Low-Level Sleep Support
1434 -------------------------------------------------------------------------- */
1436 -#ifdef CONFIG_ACPI_SLEEP
1438 #ifndef CONFIG_ACPI_PV_SLEEP
1439 /* address in low memory of the wakeup routine. */
1440 unsigned long acpi_wakeup_address = 0;
1441 -unsigned long acpi_video_flags;
1442 +unsigned long acpi_realmode_flags;
1443 extern char wakeup_start, wakeup_end;
1445 extern unsigned long acpi_copy_wakeup_routine(unsigned long);
1446 @@ -109,9 +107,11 @@ static int __init acpi_sleep_setup(char
1448 while ((str != NULL) && (*str != '\0')) {
1449 if (strncmp(str, "s3_bios", 7) == 0)
1450 - acpi_video_flags = 1;
1451 + acpi_realmode_flags |= 1;
1452 if (strncmp(str, "s3_mode", 7) == 0)
1453 - acpi_video_flags |= 2;
1454 + acpi_realmode_flags |= 2;
1455 + if (strncmp(str, "s3_beep", 7) == 0)
1456 + acpi_realmode_flags |= 4;
1457 str = strchr(str, ',');
1459 str += strspn(str, ", \t");
1460 @@ -123,8 +123,6 @@ static int __init acpi_sleep_setup(char
1461 __setup("acpi_sleep=", acpi_sleep_setup);
1462 #endif /* CONFIG_ACPI_PV_SLEEP */
1464 -#endif /*CONFIG_ACPI_SLEEP */
1466 void acpi_pci_link_exit(void)
1469 Index: head-2008-12-01/arch/x86/kernel/apic_64-xen.c
1470 ===================================================================
1471 --- head-2008-12-01.orig/arch/x86/kernel/apic_64-xen.c 2008-12-01 11:36:13.000000000 +0100
1472 +++ head-2008-12-01/arch/x86/kernel/apic_64-xen.c 2008-12-01 11:36:47.000000000 +0100
1473 @@ -50,7 +50,7 @@ void ack_bad_irq(unsigned int irq)
1474 * holds up an irq slot - in excessive cases (when multiple
1475 * unexpected vectors occur) that might lock up the APIC
1477 - * But don't ack when the APIC is disabled. -AK
1478 + * But don't ack when the APIC is disabled. -AK
1482 @@ -132,20 +132,6 @@ asmlinkage void smp_spurious_interrupt(v
1483 if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
1487 - static unsigned long last_warning;
1488 - static unsigned long skipped;
1490 - /* see sw-dev-man vol 3, chapter 7.4.13.5 */
1491 - if (time_before(last_warning+30*HZ,jiffies)) {
1492 - printk(KERN_INFO "spurious APIC interrupt on CPU#%d, %ld skipped.\n",
1493 - smp_processor_id(), skipped);
1494 - last_warning = jiffies;
1503 @@ -177,7 +163,7 @@ asmlinkage void smp_error_interrupt(void
1504 7: Illegal register address
1506 printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n",
1507 - smp_processor_id(), v , v1);
1508 + smp_processor_id(), v , v1);
1512 Index: head-2008-12-01/arch/x86/kernel/e820_64-xen.c
1513 ===================================================================
1514 --- head-2008-12-01.orig/arch/x86/kernel/e820_64-xen.c 2008-12-01 11:36:13.000000000 +0100
1515 +++ head-2008-12-01/arch/x86/kernel/e820_64-xen.c 2008-12-01 11:36:47.000000000 +0100
1516 @@ -222,37 +222,6 @@ unsigned long __init e820_end_of_ram(voi
1520 - * Find the hole size in the range.
1522 -unsigned long __init e820_hole_size(unsigned long start, unsigned long end)
1524 - unsigned long ram = 0;
1527 - for (i = 0; i < e820.nr_map; i++) {
1528 - struct e820entry *ei = &e820.map[i];
1529 - unsigned long last, addr;
1531 - if (ei->type != E820_RAM ||
1532 - ei->addr+ei->size <= start ||
1536 - addr = round_up(ei->addr, PAGE_SIZE);
1540 - last = round_down(ei->addr + ei->size, PAGE_SIZE);
1545 - ram += last - addr;
1547 - return ((end - start) - ram);
1551 * Mark e820 reserved areas as busy for the resource manager.
1553 void __init e820_reserve_resources(struct e820entry *e820, int nr_map)
1554 @@ -325,47 +294,61 @@ void __init e820_mark_nosave_regions(voi
1559 + * Finds an active region in the address range from start_pfn to end_pfn and
1560 + * returns its range in ei_startpfn and ei_endpfn for the e820 entry.
1562 +static int __init e820_find_active_region(const struct e820entry *ei,
1563 + unsigned long start_pfn,
1564 + unsigned long end_pfn,
1565 + unsigned long *ei_startpfn,
1566 + unsigned long *ei_endpfn)
1568 + *ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT;
1569 + *ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) >> PAGE_SHIFT;
1571 + /* Skip map entries smaller than a page */
1572 + if (*ei_startpfn >= *ei_endpfn)
1575 + /* Check if end_pfn_map should be updated */
1576 + if (ei->type != E820_RAM && *ei_endpfn > end_pfn_map)
1577 + end_pfn_map = *ei_endpfn;
1579 + /* Skip if map is outside the node */
1580 + if (ei->type != E820_RAM || *ei_endpfn <= start_pfn ||
1581 + *ei_startpfn >= end_pfn)
1584 + /* Check for overlaps */
1585 + if (*ei_startpfn < start_pfn)
1586 + *ei_startpfn = start_pfn;
1587 + if (*ei_endpfn > end_pfn)
1588 + *ei_endpfn = end_pfn;
1590 + /* Obey end_user_pfn to save on memmap */
1591 + if (*ei_startpfn >= end_user_pfn)
1593 + if (*ei_endpfn > end_user_pfn)
1594 + *ei_endpfn = end_user_pfn;
1599 /* Walk the e820 map and register active regions within a node */
1601 e820_register_active_regions(int nid, unsigned long start_pfn,
1602 unsigned long end_pfn)
1604 + unsigned long ei_startpfn;
1605 + unsigned long ei_endpfn;
1607 - unsigned long ei_startpfn, ei_endpfn;
1608 - for (i = 0; i < e820.nr_map; i++) {
1609 - struct e820entry *ei = &e820.map[i];
1610 - ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT;
1611 - ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE)
1614 - /* Skip map entries smaller than a page */
1615 - if (ei_startpfn >= ei_endpfn)
1618 - /* Check if end_pfn_map should be updated */
1619 - if (ei->type != E820_RAM && ei_endpfn > end_pfn_map)
1620 - end_pfn_map = ei_endpfn;
1622 - /* Skip if map is outside the node */
1623 - if (ei->type != E820_RAM ||
1624 - ei_endpfn <= start_pfn ||
1625 - ei_startpfn >= end_pfn)
1628 - /* Check for overlaps */
1629 - if (ei_startpfn < start_pfn)
1630 - ei_startpfn = start_pfn;
1631 - if (ei_endpfn > end_pfn)
1632 - ei_endpfn = end_pfn;
1634 - /* Obey end_user_pfn to save on memmap */
1635 - if (ei_startpfn >= end_user_pfn)
1637 - if (ei_endpfn > end_user_pfn)
1638 - ei_endpfn = end_user_pfn;
1640 - add_active_range(nid, ei_startpfn, ei_endpfn);
1642 + for (i = 0; i < e820.nr_map; i++)
1643 + if (e820_find_active_region(&e820.map[i],
1644 + start_pfn, end_pfn,
1645 + &ei_startpfn, &ei_endpfn))
1646 + add_active_range(nid, ei_startpfn, ei_endpfn);
1650 @@ -386,12 +369,35 @@ void __init add_memory_region(unsigned l
1655 + * Find the hole size (in bytes) in the memory range.
1656 + * @start: starting address of the memory range to scan
1657 + * @end: ending address of the memory range to scan
1659 +unsigned long __init e820_hole_size(unsigned long start, unsigned long end)
1661 + unsigned long start_pfn = start >> PAGE_SHIFT;
1662 + unsigned long end_pfn = end >> PAGE_SHIFT;
1663 + unsigned long ei_startpfn;
1664 + unsigned long ei_endpfn;
1665 + unsigned long ram = 0;
1668 + for (i = 0; i < e820.nr_map; i++) {
1669 + if (e820_find_active_region(&e820.map[i],
1670 + start_pfn, end_pfn,
1671 + &ei_startpfn, &ei_endpfn))
1672 + ram += ei_endpfn - ei_startpfn;
1674 + return end - start - (ram << PAGE_SHIFT);
1677 void __init e820_print_map(char *who)
1681 for (i = 0; i < e820.nr_map; i++) {
1682 - printk(" %s: %016Lx - %016Lx ", who,
1683 + printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
1684 (unsigned long long) e820.map[i].addr,
1685 (unsigned long long) (e820.map[i].addr + e820.map[i].size));
1686 switch (e820.map[i].type) {
1687 Index: head-2008-12-01/arch/x86/kernel/early_printk-xen.c
1688 ===================================================================
1689 --- head-2008-12-01.orig/arch/x86/kernel/early_printk-xen.c 2008-12-01 11:36:13.000000000 +0100
1690 +++ head-2008-12-01/arch/x86/kernel/early_printk-xen.c 2008-12-01 11:36:47.000000000 +0100
1691 @@ -174,6 +174,7 @@ static __init void early_serial_init(cha
1692 * mappings. Someone should fix this for domain 0. For now, use fake serial.
1694 #define early_vga_console early_serial_console
1695 +#define xenboot_console early_serial_console
1699 @@ -261,20 +262,22 @@ static int __init setup_early_printk(cha
1700 } else if (!strncmp(buf, "ttyS", 4)) {
1701 early_serial_init(buf);
1702 early_console = &early_serial_console;
1703 - } else if (!strncmp(buf, "vga", 3)
1704 + } else if (!strncmp(buf, "vga", 3)) {
1706 && SCREEN_INFO.orig_video_isVGA == 1) {
1707 max_xpos = SCREEN_INFO.orig_video_cols;
1708 max_ypos = SCREEN_INFO.orig_video_lines;
1709 current_ypos = SCREEN_INFO.orig_y;
1711 - || !strncmp(buf, "xen", 3)) {
1713 early_console = &early_vga_console;
1714 } else if (!strncmp(buf, "simnow", 6)) {
1715 simnow_init(buf + 6);
1716 early_console = &simnow_console;
1719 + } else if (!strncmp(buf, "xen", 3)) {
1720 + early_console = &xenboot_console;
1725 Index: head-2008-12-01/arch/x86/kernel/entry_64-xen.S
1726 ===================================================================
1727 --- head-2008-12-01.orig/arch/x86/kernel/entry_64-xen.S 2008-12-01 11:36:13.000000000 +0100
1728 +++ head-2008-12-01/arch/x86/kernel/entry_64-xen.S 2008-12-01 11:36:47.000000000 +0100
1729 @@ -310,7 +310,7 @@ sysret_signal:
1732 XEN_UNBLOCK_EVENTS(%rsi)
1733 - testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
1734 + testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
1737 /* Really a signal */
1738 @@ -409,7 +409,7 @@ int_very_careful:
1739 jmp int_restore_rest
1742 - testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP),%edx
1743 + testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
1745 movq %rsp,%rdi # &ptregs -> arg1
1746 xorl %esi,%esi # oldset -> arg2
1747 @@ -552,7 +552,7 @@ retint_careful:
1751 - testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
1752 + testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
1753 jz retint_restore_args
1755 XEN_UNBLOCK_EVENTS(%rsi)
1756 Index: head-2008-12-01/arch/x86/kernel/head_64-xen.S
1757 ===================================================================
1758 --- head-2008-12-01.orig/arch/x86/kernel/head_64-xen.S 2008-12-01 11:36:13.000000000 +0100
1759 +++ head-2008-12-01/arch/x86/kernel/head_64-xen.S 2008-12-01 11:36:47.000000000 +0100
1761 #include <asm/dwarf2.h>
1762 #include <xen/interface/elfnote.h>
1764 - .section .bootstrap.text, "ax", @progbits
1765 + .section .text.head, "ax", @progbits
1769 @@ -39,7 +39,7 @@ startup_64:
1771 #define NEXT_PAGE(name) \
1772 .balign PAGE_SIZE; \
1773 - phys_##name = . - .bootstrap.text; \
1774 + phys_##name = . - .text.head; \
1777 NEXT_PAGE(init_level4_pgt)
1778 @@ -66,6 +66,12 @@ NEXT_PAGE(level3_user_pgt)
1779 NEXT_PAGE(level2_kernel_pgt)
1782 +NEXT_PAGE(level2_fixmap_pgt)
1785 +NEXT_PAGE(level1_fixmap_pgt)
1788 NEXT_PAGE(hypercall_page)
1791 @@ -172,18 +178,18 @@ ENTRY(empty_zero_page)
1793 #endif /* CONFIG_XEN_COMPAT <= 0x030002 */
1795 - ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux")
1796 - ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6")
1797 - ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0")
1798 - ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad, __START_KERNEL_map)
1799 + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
1800 + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
1801 + ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")
1802 + ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad __START_KERNEL_map)
1803 #if CONFIG_XEN_COMPAT <= 0x030002
1804 - ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, __START_KERNEL_map)
1805 + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad __START_KERNEL_map)
1807 - ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, 0)
1808 + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad 0)
1810 - ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad, startup_64)
1811 - ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad, hypercall_page)
1812 - ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT)
1813 - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
1814 - ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic")
1815 - ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1)
1816 + ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad startup_64)
1817 + ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad hypercall_page)
1818 + ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad _PAGE_PRESENT, _PAGE_PRESENT)
1819 + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
1820 + ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
1821 + ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
1822 Index: head-2008-12-01/arch/x86/kernel/head64-xen.c
1823 ===================================================================
1824 --- head-2008-12-01.orig/arch/x86/kernel/head64-xen.c 2008-12-01 11:36:13.000000000 +0100
1825 +++ head-2008-12-01/arch/x86/kernel/head64-xen.c 2008-12-01 11:36:47.000000000 +0100
1826 @@ -90,7 +90,7 @@ void __init x86_64_start_kernel(char * r
1827 unsigned long machine_to_phys_nr_ents;
1830 - setup_xen_features();
1831 + xen_setup_features();
1833 xen_start_info = (struct start_info *)real_mode_data;
1834 if (!xen_feature(XENFEAT_auto_translated_physmap))
1835 Index: head-2008-12-01/arch/x86/kernel/io_apic_64-xen.c
1836 ===================================================================
1837 --- head-2008-12-01.orig/arch/x86/kernel/io_apic_64-xen.c 2008-12-01 11:36:13.000000000 +0100
1838 +++ head-2008-12-01/arch/x86/kernel/io_apic_64-xen.c 2008-12-01 11:36:47.000000000 +0100
1839 @@ -165,7 +165,9 @@ static inline void io_apic_write(unsigne
1845 +#define io_apic_modify io_apic_write
1848 * Re-write a value: to be used for read-modify-write
1849 * cycles where the read already set up the index register.
1850 @@ -175,8 +177,32 @@ static inline void io_apic_modify(unsign
1851 struct io_apic __iomem *io_apic = io_apic_base(apic);
1852 writel(value, &io_apic->data);
1855 -#define io_apic_modify io_apic_write
1857 +static int io_apic_level_ack_pending(unsigned int irq)
1859 + struct irq_pin_list *entry;
1860 + unsigned long flags;
1863 + spin_lock_irqsave(&ioapic_lock, flags);
1864 + entry = irq_2_pin + irq;
1872 + reg = io_apic_read(entry->apic, 0x10 + pin*2);
1873 + /* Is the remote IRR bit set? */
1874 + pending |= (reg >> 14) & 1;
1877 + entry = irq_2_pin + entry->next;
1879 + spin_unlock_irqrestore(&ioapic_lock, flags);
1885 @@ -406,14 +432,12 @@ static void clear_IO_APIC (void)
1886 int skip_ioapic_setup;
1889 -/* dummy parsing: see setup.c */
1891 -static int __init disable_ioapic_setup(char *str)
1892 +static int __init parse_noapic(char *str)
1894 - skip_ioapic_setup = 1;
1895 + disable_ioapic_setup();
1898 -early_param("noapic", disable_ioapic_setup);
1899 +early_param("noapic", parse_noapic);
1901 /* Actually the next is obsolete, but keep it for paranoid reasons -AK */
1902 static int __init disable_timer_pin_setup(char *arg)
1903 @@ -765,12 +789,15 @@ static struct irq_chip ioapic_chip;
1905 static void ioapic_register_intr(int irq, unsigned long trigger)
1909 + irq_desc[irq].status |= IRQ_LEVEL;
1910 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1911 handle_fasteoi_irq, "fasteoi");
1914 + irq_desc[irq].status &= ~IRQ_LEVEL;
1915 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1916 handle_edge_irq, "edge");
1920 #define ioapic_register_intr(irq, trigger) evtchn_register_pirq(irq)
1921 @@ -1419,9 +1446,37 @@ static void ack_apic_level(unsigned int
1924 /* Now we can move and renable the irq */
1925 - move_masked_irq(irq);
1926 - if (unlikely(do_unmask_irq))
1927 + if (unlikely(do_unmask_irq)) {
1928 + /* Only migrate the irq if the ack has been received.
1930 + * On rare occasions the broadcast level triggered ack gets
1931 + * delayed going to ioapics, and if we reprogram the
1932 + * vector while Remote IRR is still set the irq will never
1935 + * To prevent this scenario we read the Remote IRR bit
1936 + * of the ioapic. This has two effects.
1937 + * - On any sane system the read of the ioapic will
1938 + * flush writes (and acks) going to the ioapic from
1940 + * - We get to see if the ACK has actually been delivered.
1942 + * Based on failed experiments of reprogramming the
1943 + * ioapic entry from outside of irq context starting
1944 + * with masking the ioapic entry and then polling until
1945 + * Remote IRR was clear before reprogramming the
1946 + * ioapic I don't trust the Remote IRR bit to be
1947 + * completey accurate.
1949 + * However there appears to be no other way to plug
1950 + * this race, so if the Remote IRR bit is not
1951 + * accurate and is causing problems then it is a hardware bug
1952 + * and you can go talk to the chipset vendor about it.
1954 + if (!io_apic_level_ack_pending(irq))
1955 + move_masked_irq(irq);
1956 unmask_IO_APIC_irq(irq);
1960 static struct irq_chip ioapic_chip __read_mostly = {
1961 Index: head-2008-12-01/arch/x86/kernel/ldt_64-xen.c
1962 ===================================================================
1963 --- head-2008-12-01.orig/arch/x86/kernel/ldt_64-xen.c 2008-12-01 11:36:13.000000000 +0100
1964 +++ head-2008-12-01/arch/x86/kernel/ldt_64-xen.c 2008-12-01 11:36:47.000000000 +0100
1965 @@ -114,6 +114,8 @@ int init_new_context(struct task_struct
1966 memset(&mm->context, 0, sizeof(mm->context));
1967 init_MUTEX(&mm->context.sem);
1968 old_mm = current->mm;
1970 + mm->context.vdso = old_mm->context.vdso;
1971 if (old_mm && old_mm->context.size > 0) {
1972 down(&old_mm->context.sem);
1973 retval = copy_ldt(&mm->context, &old_mm->context);
1974 @@ -146,7 +148,7 @@ void destroy_context(struct mm_struct *m
1975 kfree(mm->context.ldt);
1976 mm->context.size = 0;
1978 - if (!mm->context.pinned) {
1979 + if (!PagePinned(virt_to_page(mm->pgd))) {
1980 spin_lock(&mm_unpinned_lock);
1981 list_del(&mm->context.unpinned);
1982 spin_unlock(&mm_unpinned_lock);
1983 Index: head-2008-12-01/arch/x86/kernel/mpparse_64-xen.c
1984 ===================================================================
1985 --- head-2008-12-01.orig/arch/x86/kernel/mpparse_64-xen.c 2008-12-01 11:36:13.000000000 +0100
1986 +++ head-2008-12-01/arch/x86/kernel/mpparse_64-xen.c 2008-12-01 11:36:47.000000000 +0100
1989 /* Have we found an MP table */
1990 int smp_found_config;
1991 -unsigned int __initdata maxcpus = NR_CPUS;
1994 * Various Linux-internal data structures created from the
1995 @@ -657,6 +656,20 @@ static int mp_find_ioapic(int gsi)
1999 +static u8 uniq_ioapic_id(u8 id)
2002 + DECLARE_BITMAP(used, 256);
2003 + bitmap_zero(used, 256);
2004 + for (i = 0; i < nr_ioapics; i++) {
2005 + struct mpc_config_ioapic *ia = &mp_ioapics[i];
2006 + __set_bit(ia->mpc_apicid, used);
2008 + if (!test_bit(id, used))
2010 + return find_first_zero_bit(used, 256);
2013 void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base)
2016 @@ -664,7 +677,7 @@ void __init mp_register_ioapic(u8 id, u3
2017 if (bad_ioapic(address))
2020 - idx = nr_ioapics++;
2023 mp_ioapics[idx].mpc_type = MP_IOAPIC;
2024 mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE;
2025 @@ -673,7 +686,7 @@ void __init mp_register_ioapic(u8 id, u3
2027 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
2029 - mp_ioapics[idx].mpc_apicid = id;
2030 + mp_ioapics[idx].mpc_apicid = uniq_ioapic_id(id);
2031 mp_ioapics[idx].mpc_apicver = 0;
2034 @@ -690,6 +703,8 @@ void __init mp_register_ioapic(u8 id, u3
2035 mp_ioapics[idx].mpc_apicaddr,
2036 mp_ioapic_routing[idx].gsi_start,
2037 mp_ioapic_routing[idx].gsi_end);
2043 Index: head-2008-12-01/arch/x86/kernel/process_64-xen.c
2044 ===================================================================
2045 --- head-2008-12-01.orig/arch/x86/kernel/process_64-xen.c 2008-12-01 11:36:13.000000000 +0100
2046 +++ head-2008-12-01/arch/x86/kernel/process_64-xen.c 2008-12-01 11:36:47.000000000 +0100
2048 #include <linux/sched.h>
2049 #include <linux/kernel.h>
2050 #include <linux/mm.h>
2051 +#include <linux/fs.h>
2052 #include <linux/elfcore.h>
2053 #include <linux/smp.h>
2054 #include <linux/slab.h>
2055 @@ -249,6 +250,7 @@ early_param("idle", idle_setup);
2056 void __show_regs(struct pt_regs * regs)
2058 unsigned long fs, gs, shadowgs;
2059 + unsigned long d0, d1, d2, d3, d6, d7;
2060 unsigned int fsindex,gsindex;
2061 unsigned int ds,cs,es;
2063 @@ -288,6 +290,14 @@ void __show_regs(struct pt_regs * regs)
2064 fs,fsindex,gs,gsindex,shadowgs);
2065 printk("CS: %04x DS: %04x ES: %04x\n", cs, ds, es);
2067 + get_debugreg(d0, 0);
2068 + get_debugreg(d1, 1);
2069 + get_debugreg(d2, 2);
2070 + printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
2071 + get_debugreg(d3, 3);
2072 + get_debugreg(d6, 6);
2073 + get_debugreg(d7, 7);
2074 + printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
2077 void show_regs(struct pt_regs *regs)
2078 Index: head-2008-12-01/arch/x86/kernel/setup_64-xen.c
2079 ===================================================================
2080 --- head-2008-12-01.orig/arch/x86/kernel/setup_64-xen.c 2008-12-01 11:36:13.000000000 +0100
2081 +++ head-2008-12-01/arch/x86/kernel/setup_64-xen.c 2008-12-01 11:36:47.000000000 +0100
2082 @@ -827,6 +827,8 @@ static void __cpuinit init_amd(struct cp
2083 level = cpuid_eax(1);
2084 if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58))
2085 set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
2086 + if (c->x86 == 0x10)
2087 + set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
2089 /* Enable workaround for FXSAVE leak */
2091 @@ -852,8 +854,14 @@ static void __cpuinit init_amd(struct cp
2092 if (c->extended_cpuid_level >= 0x80000008)
2095 - /* Fix cpuid4 emulation for more */
2096 - num_cache_leaves = 3;
2097 + if (c->extended_cpuid_level >= 0x80000006 &&
2098 + (cpuid_edx(0x80000006) & 0xf000))
2099 + num_cache_leaves = 4;
2101 + num_cache_leaves = 3;
2103 + if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x11)
2104 + set_bit(X86_FEATURE_K8, &c->x86_capability);
2106 /* RDTSC can be speculated around */
2107 clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
2108 @@ -1098,6 +1106,8 @@ void __cpuinit identify_cpu(struct cpuin
2109 c->x86_capability[2] = cpuid_edx(0x80860001);
2112 + init_scattered_cpuid_features(c);
2114 c->apicid = phys_pkg_id(0);
2117 @@ -1183,7 +1193,7 @@ static int show_cpuinfo(struct seq_file
2118 "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
2119 "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
2120 "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
2121 - "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
2122 + "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",
2125 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2126 @@ -1199,10 +1209,11 @@ static int show_cpuinfo(struct seq_file
2127 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2129 /* Other (Linux-defined) */
2130 - "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
2131 - "constant_tsc", NULL, NULL,
2132 - "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2133 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2134 + "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
2135 + NULL, NULL, NULL, NULL,
2136 + "constant_tsc", "up", NULL, "arch_perfmon",
2137 + "pebs", "bts", NULL, "sync_rdtsc",
2138 + "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2139 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2141 /* Intel-defined (#2) */
2142 @@ -1213,7 +1224,7 @@ static int show_cpuinfo(struct seq_file
2144 /* VIA/Cyrix/Centaur-defined */
2145 NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
2146 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2147 + "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL,
2148 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2149 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2151 @@ -1224,6 +1235,12 @@ static int show_cpuinfo(struct seq_file
2152 "osvw", "ibs", NULL, NULL, NULL, NULL,
2153 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2154 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2156 + /* Auxiliary (Linux-defined) */
2157 + "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2158 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2159 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2160 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2162 static char *x86_power_flags[] = {
2163 "ts", /* temperature sensor */
2164 Index: head-2008-12-01/arch/x86/kernel/setup64-xen.c
2165 ===================================================================
2166 --- head-2008-12-01.orig/arch/x86/kernel/setup64-xen.c 2008-12-01 11:36:13.000000000 +0100
2167 +++ head-2008-12-01/arch/x86/kernel/setup64-xen.c 2008-12-01 11:36:47.000000000 +0100
2168 @@ -125,11 +125,14 @@ void __init setup_per_cpu_areas(void)
2172 -static void switch_pt(void)
2173 +static void __init_refok switch_pt(int cpu)
2177 xen_pt_switch(__pa_symbol(init_level4_pgt));
2178 xen_new_user_pt(__pa_symbol(__user_pgd(init_level4_pgt)));
2180 +#define switch_pt() switch_pt(cpu)
2182 static void __cpuinit cpu_gdt_init(const struct desc_ptr *gdt_descr)
2184 @@ -185,9 +188,6 @@ void pda_init(int cpu)
2191 /* others are initialized in smpboot.c */
2192 pda->pcurrent = &init_task;
2193 pda->irqstackptr = boot_cpu_stack;
2194 Index: head-2008-12-01/arch/x86/kernel/smp_64-xen.c
2195 ===================================================================
2196 --- head-2008-12-01.orig/arch/x86/kernel/smp_64-xen.c 2008-12-01 11:36:13.000000000 +0100
2197 +++ head-2008-12-01/arch/x86/kernel/smp_64-xen.c 2008-12-01 11:36:47.000000000 +0100
2198 @@ -362,7 +362,7 @@ __smp_call_function_single(int cpu, void
2202 - * smp_call_function_single - Run a function on another CPU
2203 + * smp_call_function_single - Run a function on a specific CPU
2204 * @func: The function to run. This must be fast and non-blocking.
2205 * @info: An arbitrary pointer to pass to the function.
2206 * @nonatomic: Currently unused.
2207 @@ -379,17 +379,21 @@ int smp_call_function_single (int cpu, v
2209 /* prevent preemption and reschedule on another processor */
2212 + /* Can deadlock when called with interrupts disabled */
2213 + WARN_ON(irqs_disabled());
2216 + local_irq_disable();
2218 + local_irq_enable();
2223 - /* Can deadlock when called with interrupts disabled */
2224 - WARN_ON(irqs_disabled());
2226 - spin_lock_bh(&call_lock);
2227 + spin_lock(&call_lock);
2228 __smp_call_function_single(cpu, func, info, nonatomic, wait);
2229 - spin_unlock_bh(&call_lock);
2230 + spin_unlock(&call_lock);
2234 Index: head-2008-12-01/arch/x86/kernel/traps_64-xen.c
2235 ===================================================================
2236 --- head-2008-12-01.orig/arch/x86/kernel/traps_64-xen.c 2008-12-01 11:36:13.000000000 +0100
2237 +++ head-2008-12-01/arch/x86/kernel/traps_64-xen.c 2008-12-01 11:36:47.000000000 +0100
2239 #include <linux/bug.h>
2240 #include <linux/kdebug.h>
2242 +#if defined(CONFIG_EDAC)
2243 +#include <linux/edac.h>
2246 #include <asm/system.h>
2248 #include <asm/atomic.h>
2249 @@ -332,6 +336,7 @@ static int print_trace_stack(void *data,
2251 static void print_trace_address(void *data, unsigned long addr)
2253 + touch_nmi_watchdog();
2254 printk_address(addr);
2257 @@ -520,6 +525,7 @@ void __kprobes __die(const char * str, s
2259 notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV);
2260 show_registers(regs);
2261 + add_taint(TAINT_DIE);
2262 /* Executive summary in case the oops scrolled away */
2263 printk(KERN_ALERT "RIP ");
2264 printk_address(regs->rip);
2265 @@ -533,7 +539,7 @@ void die(const char * str, struct pt_reg
2266 unsigned long flags = oops_begin();
2268 if (!user_mode(regs))
2269 - report_bug(regs->rip);
2270 + report_bug(regs->rip, regs);
2272 __die(str, regs, err);
2274 @@ -582,7 +588,8 @@ static void __kprobes do_trap(int trapnr
2275 tsk->thread.error_code = error_code;
2276 tsk->thread.trap_no = trapnr;
2278 - if (exception_trace && unhandled_signal(tsk, signr))
2279 + if (show_unhandled_signals && unhandled_signal(tsk, signr) &&
2280 + printk_ratelimit())
2282 "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
2283 tsk->comm, tsk->pid, str,
2284 @@ -686,7 +693,8 @@ asmlinkage void __kprobes do_general_pro
2285 tsk->thread.error_code = error_code;
2286 tsk->thread.trap_no = 13;
2288 - if (exception_trace && unhandled_signal(tsk, SIGSEGV))
2289 + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
2290 + printk_ratelimit())
2292 "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
2293 tsk->comm, tsk->pid,
2294 @@ -721,6 +729,13 @@ mem_parity_error(unsigned char reason, s
2296 printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n");
2298 +#if defined(CONFIG_EDAC)
2299 + if(edac_handler_set()) {
2300 + edac_atomic_assert_error();
2305 if (panic_on_unrecovered_nmi)
2306 panic("NMI: Not continuing");
2308 Index: head-2008-12-01/arch/x86/kernel/vsyscall_64-xen.c
2309 ===================================================================
2310 --- head-2008-12-01.orig/arch/x86/kernel/vsyscall_64-xen.c 2008-12-01 11:36:13.000000000 +0100
2311 +++ head-2008-12-01/arch/x86/kernel/vsyscall_64-xen.c 2008-12-01 11:36:47.000000000 +0100
2313 #include <asm/segment.h>
2314 #include <asm/desc.h>
2315 #include <asm/topology.h>
2316 +#include <asm/vgtod.h>
2318 #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
2319 #define __syscall_clobber "r11","rcx","memory"
2321 * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64)
2322 * Try to keep this structure as small as possible to avoid cache line ping pongs
2324 -struct vsyscall_gtod_data_t {
2327 - /* open coded 'struct timespec' */
2328 - time_t wall_time_sec;
2329 - u32 wall_time_nsec;
2331 - int sysctl_enabled;
2332 - struct timezone sys_tz;
2333 - struct { /* extract of a clocksource struct */
2334 - cycle_t (*vread)(void);
2335 - cycle_t cycle_last;
2341 int __vgetcpu_mode __section_vgetcpu_mode;
2343 -struct vsyscall_gtod_data_t __vsyscall_gtod_data __section_vsyscall_gtod_data =
2344 +struct vsyscall_gtod_data __vsyscall_gtod_data __section_vsyscall_gtod_data =
2346 .lock = SEQLOCK_UNLOCKED,
2347 .sysctl_enabled = 1,
2348 @@ -96,6 +80,8 @@ void update_vsyscall(struct timespec *wa
2349 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec;
2350 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
2351 vsyscall_gtod_data.sys_tz = sys_tz;
2352 + vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
2353 + vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic;
2354 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
2357 Index: head-2008-12-01/arch/x86/mm/fault_64-xen.c
2358 ===================================================================
2359 --- head-2008-12-01.orig/arch/x86/mm/fault_64-xen.c 2008-12-01 11:36:13.000000000 +0100
2360 +++ head-2008-12-01/arch/x86/mm/fault_64-xen.c 2008-12-01 11:36:47.000000000 +0100
2361 @@ -159,7 +159,9 @@ void dump_pagetable(unsigned long addres
2365 - pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
2366 + pgd = (pgd_t *)read_cr3();
2368 + pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK);
2369 pgd += pgd_index(address);
2370 if (bad_address(pgd)) goto bad;
2371 printk("PGD %lx ", pgd_val(*pgd));
2372 @@ -219,16 +221,6 @@ static int is_errata93(struct pt_regs *r
2376 -int unhandled_signal(struct task_struct *tsk, int sig)
2380 - if (tsk->ptrace & PT_PTRACED)
2382 - return (tsk->sighand->action[sig-1].sa.sa_handler == SIG_IGN) ||
2383 - (tsk->sighand->action[sig-1].sa.sa_handler == SIG_DFL);
2386 static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs,
2387 unsigned long error_code)
2389 @@ -302,8 +294,8 @@ static int vmalloc_fault(unsigned long a
2393 -int page_fault_trace = 0;
2394 -int exception_trace = 1;
2395 +static int page_fault_trace;
2396 +int show_unhandled_signals = 1;
2399 #define MEM_VERBOSE 1
2400 @@ -372,7 +364,7 @@ asmlinkage void __kprobes do_page_fault(
2401 struct vm_area_struct * vma;
2402 unsigned long address;
2403 const struct exception_table_entry *fixup;
2406 unsigned long flags;
2409 @@ -384,7 +376,7 @@ asmlinkage void __kprobes do_page_fault(
2410 prefetchw(&mm->mmap_sem);
2412 /* get the address */
2413 - address = current_vcpu_info()->arch.cr2;
2414 + address = read_cr2();
2416 info.si_code = SEGV_MAPERR;
2418 @@ -445,6 +437,13 @@ asmlinkage void __kprobes do_page_fault(
2419 if (unlikely(in_atomic() || !mm))
2420 goto bad_area_nosemaphore;
2423 + * User-mode registers count as a user access even for any
2424 + * potential system fault or CPU buglet.
2426 + if (user_mode_vm(regs))
2427 + error_code |= PF_USER;
2430 /* When running in the kernel we expect faults to occur only to
2431 * addresses in user space. All other faults represent errors in the
2432 @@ -511,19 +510,18 @@ good_area:
2433 * make sure we exit gracefully rather than endlessly redo
2436 - switch (handle_mm_fault(mm, vma, address, write)) {
2437 - case VM_FAULT_MINOR:
2440 - case VM_FAULT_MAJOR:
2443 - case VM_FAULT_SIGBUS:
2446 - goto out_of_memory;
2447 + fault = handle_mm_fault(mm, vma, address, write);
2448 + if (unlikely(fault & VM_FAULT_ERROR)) {
2449 + if (fault & VM_FAULT_OOM)
2450 + goto out_of_memory;
2451 + else if (fault & VM_FAULT_SIGBUS)
2456 + if (fault & VM_FAULT_MAJOR)
2460 up_read(&mm->mmap_sem);
2463 @@ -556,7 +554,8 @@ bad_area_nosemaphore:
2467 - if (exception_trace && unhandled_signal(tsk, SIGSEGV)) {
2468 + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
2469 + printk_ratelimit()) {
2471 "%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n",
2472 tsk->pid > 1 ? KERN_INFO : KERN_EMERG,
2473 @@ -630,7 +629,7 @@ out_of_memory:
2475 printk("VM: killing process %s\n", tsk->comm);
2478 + do_group_exit(SIGKILL);
2482 Index: head-2008-12-01/arch/x86/mm/init_64-xen.c
2483 ===================================================================
2484 --- head-2008-12-01.orig/arch/x86/mm/init_64-xen.c 2008-12-01 11:36:13.000000000 +0100
2485 +++ head-2008-12-01/arch/x86/mm/init_64-xen.c 2008-12-01 11:36:47.000000000 +0100
2486 @@ -66,6 +66,9 @@ int after_bootmem;
2487 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
2488 extern unsigned long start_pfn;
2490 +extern pmd_t level2_fixmap_pgt[PTRS_PER_PMD];
2491 +extern pte_t level1_fixmap_pgt[PTRS_PER_PTE];
2494 * Use this until direct mapping is established, i.e. before __va() is
2495 * available in init_memory_mapping().
2496 @@ -362,6 +365,10 @@ __set_fixmap (enum fixed_addresses idx,
2497 set_pte_phys(address, phys, prot, 0);
2498 set_pte_phys(address, phys, prot, 1);
2500 + case FIX_EARLYCON_MEM_BASE:
2501 + xen_l1_entry_update(level1_fixmap_pgt + pte_index(address),
2502 + pfn_pte_ma(phys >> PAGE_SHIFT, prot));
2505 set_pte_phys_ma(address, phys, prot);
2507 @@ -594,6 +601,13 @@ void __init xen_init_pt(void)
2508 __user_pgd(init_level4_pgt)[pgd_index(VSYSCALL_START)] =
2509 __pgd(__pa_symbol(level3_user_pgt) | _PAGE_TABLE);
2511 + /* Do an early initialization of the fixmap area. */
2512 + addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE);
2513 + level3_kernel_pgt[pud_index(addr)] =
2514 + __pud(__pa_symbol(level2_fixmap_pgt) | _PAGE_TABLE);
2515 + level2_fixmap_pgt[pmd_index(addr)] =
2516 + __pmd(__pa_symbol(level1_fixmap_pgt) | _PAGE_TABLE);
2518 early_make_page_readonly(init_level4_pgt,
2519 XENFEAT_writable_page_tables);
2520 early_make_page_readonly(__user_pgd(init_level4_pgt),
2521 @@ -604,6 +618,10 @@ void __init xen_init_pt(void)
2522 XENFEAT_writable_page_tables);
2523 early_make_page_readonly(level2_kernel_pgt,
2524 XENFEAT_writable_page_tables);
2525 + early_make_page_readonly(level2_fixmap_pgt,
2526 + XENFEAT_writable_page_tables);
2527 + early_make_page_readonly(level1_fixmap_pgt,
2528 + XENFEAT_writable_page_tables);
2530 if (!xen_feature(XENFEAT_writable_page_tables)) {
2531 xen_pgd_pin(__pa_symbol(init_level4_pgt));
2532 @@ -807,7 +825,7 @@ void __init paging_init(void)
2534 free_area_init_nodes(max_zone_pfns);
2536 - init_mm.context.pinned = 1;
2537 + SetPagePinned(virt_to_page(init_mm.pgd));
2541 @@ -1120,41 +1138,6 @@ int kern_addr_valid(unsigned long addr)
2542 return pfn_valid(pte_pfn(*pte));
2545 -#ifdef CONFIG_SYSCTL
2546 -#include <linux/sysctl.h>
2548 -extern int exception_trace, page_fault_trace;
2550 -static ctl_table debug_table2[] = {
2553 - .procname = "exception-trace",
2554 - .data = &exception_trace,
2555 - .maxlen = sizeof(int),
2557 - .proc_handler = proc_dointvec
2562 -static ctl_table debug_root_table2[] = {
2564 - .ctl_name = CTL_DEBUG,
2565 - .procname = "debug",
2567 - .child = debug_table2
2572 -static __init int x8664_sysctl_init(void)
2574 - register_sysctl_table(debug_root_table2);
2577 -__initcall(x8664_sysctl_init);
2580 /* A pseudo VMA to allow ptrace access for the vsyscall page. This only
2581 covers the 64bit vsyscall page now. 32bit has a real VMA now and does
2582 not need special handling anymore. */
2583 @@ -1193,9 +1176,18 @@ int in_gate_area_no_task(unsigned long a
2587 -void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
2588 +void * __init alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
2590 return __alloc_bootmem_core(pgdat->bdata, size,
2591 SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0);
2595 +const char *arch_vma_name(struct vm_area_struct *vma)
2597 + if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
2599 + if (vma == &gate_vma)
2600 + return "[vsyscall]";
2603 Index: head-2008-12-01/arch/x86/mm/pageattr_64-xen.c
2604 ===================================================================
2605 --- head-2008-12-01.orig/arch/x86/mm/pageattr_64-xen.c 2008-12-01 11:36:13.000000000 +0100
2606 +++ head-2008-12-01/arch/x86/mm/pageattr_64-xen.c 2008-12-01 11:36:47.000000000 +0100
2607 @@ -171,7 +171,7 @@ void mm_pin(struct mm_struct *mm)
2608 mm_walk(mm, PAGE_KERNEL_RO);
2609 xen_pgd_pin(__pa(mm->pgd)); /* kernel */
2610 xen_pgd_pin(__pa(__user_pgd(mm->pgd))); /* user */
2611 - mm->context.pinned = 1;
2612 + SetPagePinned(virt_to_page(mm->pgd));
2613 spin_lock(&mm_unpinned_lock);
2614 list_del(&mm->context.unpinned);
2615 spin_unlock(&mm_unpinned_lock);
2616 @@ -189,7 +189,7 @@ void mm_unpin(struct mm_struct *mm)
2617 xen_pgd_unpin(__pa(mm->pgd));
2618 xen_pgd_unpin(__pa(__user_pgd(mm->pgd)));
2619 mm_walk(mm, PAGE_KERNEL);
2620 - mm->context.pinned = 0;
2621 + ClearPagePinned(virt_to_page(mm->pgd));
2622 spin_lock(&mm_unpinned_lock);
2623 list_add(&mm->context.unpinned, &mm_unpinned);
2624 spin_unlock(&mm_unpinned_lock);
2625 @@ -217,7 +217,7 @@ void mm_pin_all(void)
2627 void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
2629 - if (!mm->context.pinned)
2630 + if (!PagePinned(virt_to_page(mm->pgd)))
2634 @@ -243,8 +243,9 @@ void arch_exit_mmap(struct mm_struct *mm
2638 - if ( mm->context.pinned && (atomic_read(&mm->mm_count) == 1) &&
2639 - !mm->context.has_foreign_mappings )
2640 + if (PagePinned(virt_to_page(mm->pgd))
2641 + && (atomic_read(&mm->mm_count) == 1)
2642 + && !mm->context.has_foreign_mappings)
2646 @@ -343,14 +344,13 @@ static void flush_kernel_map(void *arg)
2649 /* When clflush is available always use it because it is
2650 - much cheaper than WBINVD. Disable clflush for now because
2651 - the high level code is not ready yet */
2652 + much cheaper than WBINVD. */
2653 + /* clflush is still broken. Disable for now. */
2654 if (1 || !cpu_has_clflush)
2655 asm volatile("wbinvd" ::: "memory");
2656 else list_for_each_entry(pg, l, lru) {
2657 void *adr = page_address(pg);
2658 - if (cpu_has_clflush)
2659 - cache_flush_page(adr);
2660 + cache_flush_page(adr);
2664 @@ -364,7 +364,8 @@ static LIST_HEAD(deferred_pages); /* pro
2666 static inline void save_page(struct page *fpage)
2668 - list_add(&fpage->lru, &deferred_pages);
2669 + if (!test_and_set_bit(PG_arch_1, &fpage->flags))
2670 + list_add(&fpage->lru, &deferred_pages);
2674 @@ -398,9 +399,12 @@ __change_page_attr(unsigned long address
2676 struct page *kpte_page;
2679 kpte = lookup_address(address);
2680 if (!kpte) return 0;
2681 kpte_page = virt_to_page(((unsigned long)kpte) & PAGE_MASK);
2682 + BUG_ON(PageLRU(kpte_page));
2683 + BUG_ON(PageCompound(kpte_page));
2684 if (pgprot_val(prot) != pgprot_val(ref_prot)) {
2685 if (!pte_huge(*kpte)) {
2686 set_pte(kpte, pfn_pte(pfn, prot));
2687 @@ -439,10 +443,9 @@ __change_page_attr(unsigned long address
2691 - if (page_private(kpte_page) == 0) {
2692 - save_page(kpte_page);
2693 + save_page(kpte_page);
2694 + if (page_private(kpte_page) == 0)
2695 revert_page(address, ref_prot);
2700 @@ -514,6 +517,10 @@ void global_flush_tlb(void)
2703 list_for_each_entry_safe(pg, next, &l, lru) {
2704 + list_del(&pg->lru);
2705 + clear_bit(PG_arch_1, &pg->flags);
2706 + if (page_private(pg) != 0)
2708 ClearPagePrivate(pg);
2711 Index: head-2008-12-01/arch/x86/vdso/vdso32/note.S
2712 ===================================================================
2713 --- head-2008-12-01.orig/arch/x86/vdso/vdso32/note.S 2008-12-01 10:53:14.000000000 +0100
2714 +++ head-2008-12-01/arch/x86/vdso/vdso32/note.S 2008-12-01 11:36:47.000000000 +0100
2715 @@ -13,7 +13,7 @@ ELFNOTE_START(Linux, 0, "a")
2716 .long LINUX_VERSION_CODE
2720 +#if defined(CONFIG_X86_XEN) || defined(CONFIG_PARAVIRT_XEN)
2722 * Add a special note telling glibc's dynamic linker a fake hardware
2723 * flavor that it will use to choose the search path for libraries in the
2724 @@ -37,8 +37,12 @@ ELFNOTE_END
2726 ELFNOTE_START(GNU, 2, "a")
2728 +#ifdef CONFIG_PARAVIRT_XEN
2729 VDSO32_NOTE_MASK: /* Symbol used by arch/x86/xen/setup.c */
2732 + .long 1 << VDSO_NOTE_NONEGSEG_BIT /* mask */
2734 .byte VDSO_NOTE_NONEGSEG_BIT; .asciz "nosegneg" /* bit, name */
2737 Index: head-2008-12-01/drivers/Makefile
2738 ===================================================================
2739 --- head-2008-12-01.orig/drivers/Makefile 2008-12-01 11:11:03.000000000 +0100
2740 +++ head-2008-12-01/drivers/Makefile 2008-12-01 11:36:47.000000000 +0100
2741 @@ -16,7 +16,7 @@ obj-$(CONFIG_ACPI) += acpi/
2742 obj-$(CONFIG_PNP) += pnp/
2743 obj-$(CONFIG_ARM_AMBA) += amba/
2745 -obj-$(CONFIG_XEN) += xen/
2746 +obj-$(CONFIG_PARAVIRT_XEN) += xen/
2748 # char/ comes before serial/ etc so that the VT console is the boot-time
2750 Index: head-2008-12-01/drivers/block/Kconfig
2751 ===================================================================
2752 --- head-2008-12-01.orig/drivers/block/Kconfig 2008-12-01 10:53:14.000000000 +0100
2753 +++ head-2008-12-01/drivers/block/Kconfig 2008-12-01 11:36:47.000000000 +0100
2754 @@ -423,9 +423,9 @@ config XILINX_SYSACE
2756 Include support for the Xilinx SystemACE CompactFlash interface
2758 -config XEN_BLKDEV_FRONTEND
2759 +config XEN_BLKFRONT
2760 tristate "Xen virtual block device support"
2762 + depends on PARAVIRT_XEN
2765 This driver implements the front-end of the Xen virtual
2766 Index: head-2008-12-01/drivers/block/Makefile
2767 ===================================================================
2768 --- head-2008-12-01.orig/drivers/block/Makefile 2008-12-01 10:53:14.000000000 +0100
2769 +++ head-2008-12-01/drivers/block/Makefile 2008-12-01 11:36:47.000000000 +0100
2770 @@ -31,4 +31,4 @@ obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
2771 obj-$(CONFIG_BLK_DEV_UB) += ub.o
2772 obj-$(CONFIG_BLK_DEV_HD) += hd.o
2774 -obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o
2775 +obj-$(CONFIG_XEN_BLKFRONT) += xen-blkfront.o
2776 Index: head-2008-12-01/drivers/block/xen-blkfront.c
2777 ===================================================================
2778 --- head-2008-12-01.orig/drivers/block/xen-blkfront.c 2008-12-01 10:53:14.000000000 +0100
2779 +++ head-2008-12-01/drivers/block/xen-blkfront.c 2008-12-01 11:36:47.000000000 +0100
2780 @@ -1021,7 +1021,6 @@ static struct xenbus_device_id blkfront_
2782 static struct xenbus_driver blkfront = {
2784 - .owner = THIS_MODULE,
2785 .ids = blkfront_ids,
2786 .probe = blkfront_probe,
2787 .remove = blkfront_remove,
2788 Index: head-2008-12-01/drivers/char/Kconfig
2789 ===================================================================
2790 --- head-2008-12-01.orig/drivers/char/Kconfig 2008-11-10 11:49:15.000000000 +0100
2791 +++ head-2008-12-01/drivers/char/Kconfig 2008-12-01 11:36:47.000000000 +0100
2792 @@ -624,7 +624,7 @@ config HVC_BEAT
2795 bool "Xen Hypervisor Console support"
2797 + depends on PARAVIRT_XEN
2801 Index: head-2008-12-01/drivers/net/Kconfig
2802 ===================================================================
2803 --- head-2008-12-01.orig/drivers/net/Kconfig 2008-12-01 10:53:14.000000000 +0100
2804 +++ head-2008-12-01/drivers/net/Kconfig 2008-12-01 11:36:47.000000000 +0100
2805 @@ -2535,9 +2535,9 @@ source "drivers/atm/Kconfig"
2807 source "drivers/s390/net/Kconfig"
2809 -config XEN_NETDEV_FRONTEND
2810 +config XEN_NETFRONT
2811 tristate "Xen network device frontend driver"
2813 + depends on PARAVIRT_XEN
2816 The network device frontend driver allows the kernel to
2817 Index: head-2008-12-01/drivers/net/Makefile
2818 ===================================================================
2819 --- head-2008-12-01.orig/drivers/net/Makefile 2008-12-01 10:53:14.000000000 +0100
2820 +++ head-2008-12-01/drivers/net/Makefile 2008-12-01 11:36:47.000000000 +0100
2821 @@ -142,7 +142,7 @@ obj-$(CONFIG_PPPOL2TP) += pppox.o pppol2
2822 obj-$(CONFIG_SLIP) += slip.o
2823 obj-$(CONFIG_SLHC) += slhc.o
2825 -obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o
2826 +obj-$(CONFIG_XEN_NETFRONT) += xen-netfront.o
2828 obj-$(CONFIG_DUMMY) += dummy.o
2829 obj-$(CONFIG_IFB) += ifb.o
2830 Index: head-2008-12-01/drivers/net/xen-netfront.c
2831 ===================================================================
2832 --- head-2008-12-01.orig/drivers/net/xen-netfront.c 2008-12-01 10:53:14.000000000 +0100
2833 +++ head-2008-12-01/drivers/net/xen-netfront.c 2008-12-01 11:36:47.000000000 +0100
2835 #include <linux/skbuff.h>
2836 #include <linux/ethtool.h>
2837 #include <linux/if_ether.h>
2838 -#include <linux/tcp.h>
2839 -#include <linux/udp.h>
2840 #include <linux/moduleparam.h>
2841 #include <linux/mm.h>
2843 @@ -765,45 +763,6 @@ static RING_IDX xennet_fill_frags(struct
2847 -static int skb_checksum_setup(struct sk_buff *skb)
2849 - struct iphdr *iph;
2850 - unsigned char *th;
2851 - int err = -EPROTO;
2853 - if (skb->protocol != htons(ETH_P_IP))
2856 - iph = (void *)skb->data;
2857 - th = skb->data + 4 * iph->ihl;
2858 - if (th >= skb_tail_pointer(skb))
2861 - skb->csum_start = th - skb->head;
2862 - switch (iph->protocol) {
2864 - skb->csum_offset = offsetof(struct tcphdr, check);
2867 - skb->csum_offset = offsetof(struct udphdr, check);
2870 - if (net_ratelimit())
2871 - printk(KERN_ERR "Attempting to checksum a non-"
2872 - "TCP/UDP packet, dropping a protocol"
2873 - " %d packet", iph->protocol);
2877 - if ((th + skb->csum_offset + 2) > skb_tail_pointer(skb))
2886 static int handle_incoming_queue(struct net_device *dev,
2887 struct sk_buff_head *rxq)
2889 @@ -1784,7 +1743,6 @@ static int __devexit xennet_remove(struc
2891 static struct xenbus_driver netfront = {
2893 - .owner = THIS_MODULE,
2894 .ids = netfront_ids,
2895 .probe = netfront_probe,
2896 .remove = __devexit_p(xennet_remove),
2897 Index: head-2008-12-01/drivers/xen/Makefile
2898 ===================================================================
2899 --- head-2008-12-01.orig/drivers/xen/Makefile 2008-12-01 11:22:58.000000000 +0100
2900 +++ head-2008-12-01/drivers/xen/Makefile 2008-12-01 11:36:47.000000000 +0100
2907 +obj-$(CONFIG_PARAVIRT_XEN) += grant-table.o
2910 +obj-$(CONFIG_XEN) += core/
2911 +obj-$(CONFIG_XEN) += console/
2912 +obj-$(CONFIG_XEN) += evtchn/
2914 +obj-$(CONFIG_XEN) += char/
2916 +obj-$(CONFIG_XEN) += util.o
2917 obj-$(CONFIG_XEN_BALLOON) += balloon/
2918 obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/
2919 obj-$(CONFIG_XEN_BLKDEV_TAP) += blktap/
2920 Index: head-2008-12-01/drivers/xen/blkback/blkback.c
2921 ===================================================================
2922 --- head-2008-12-01.orig/drivers/xen/blkback/blkback.c 2008-12-01 11:32:38.000000000 +0100
2923 +++ head-2008-12-01/drivers/xen/blkback/blkback.c 2008-12-01 11:36:47.000000000 +0100
2924 @@ -154,7 +154,7 @@ static void unplug_queue(blkif_t *blkif)
2926 static void plug_queue(blkif_t *blkif, struct block_device *bdev)
2928 - request_queue_t *q = bdev_get_queue(bdev);
2929 + struct request_queue *q = bdev_get_queue(bdev);
2931 if (q == blkif->plug)
2933 Index: head-2008-12-01/drivers/xen/blkback/common.h
2934 ===================================================================
2935 --- head-2008-12-01.orig/drivers/xen/blkback/common.h 2008-12-01 11:29:05.000000000 +0100
2936 +++ head-2008-12-01/drivers/xen/blkback/common.h 2008-12-01 11:36:47.000000000 +0100
2937 @@ -79,7 +79,7 @@ typedef struct blkif_st {
2938 wait_queue_head_t wq;
2939 struct task_struct *xenblkd;
2940 unsigned int waiting_reqs;
2941 - request_queue_t *plug;
2942 + struct request_queue *plug;
2945 unsigned long st_print;
2946 Index: head-2008-12-01/drivers/xen/blkback/interface.c
2947 ===================================================================
2948 --- head-2008-12-01.orig/drivers/xen/blkback/interface.c 2008-12-01 11:32:38.000000000 +0100
2949 +++ head-2008-12-01/drivers/xen/blkback/interface.c 2008-12-01 11:36:47.000000000 +0100
2950 @@ -177,5 +177,5 @@ void blkif_free(blkif_t *blkif)
2951 void __init blkif_interface_init(void)
2953 blkif_cachep = kmem_cache_create("blkif_cache", sizeof(blkif_t),
2954 - 0, 0, NULL, NULL);
2957 Index: head-2008-12-01/drivers/xen/blkfront/blkfront.c
2958 ===================================================================
2959 --- head-2008-12-01.orig/drivers/xen/blkfront/blkfront.c 2008-12-01 11:36:13.000000000 +0100
2960 +++ head-2008-12-01/drivers/xen/blkfront/blkfront.c 2008-12-01 11:36:47.000000000 +0100
2961 @@ -667,7 +667,7 @@ static int blkif_queue_request(struct re
2963 * read a block; request is in a request queue
2965 -void do_blkif_request(request_queue_t *rq)
2966 +void do_blkif_request(struct request_queue *rq)
2968 struct blkfront_info *info = NULL;
2969 struct request *req;
2970 Index: head-2008-12-01/drivers/xen/blkfront/block.h
2971 ===================================================================
2972 --- head-2008-12-01.orig/drivers/xen/blkfront/block.h 2008-08-07 12:44:36.000000000 +0200
2973 +++ head-2008-12-01/drivers/xen/blkfront/block.h 2008-12-01 11:36:47.000000000 +0100
2974 @@ -105,7 +105,7 @@ struct blkfront_info
2975 blkif_front_ring_t ring;
2977 struct xlbd_major_info *mi;
2978 - request_queue_t *rq;
2979 + struct request_queue *rq;
2980 struct work_struct work;
2981 struct gnttab_free_callback callback;
2982 struct blk_shadow shadow[BLK_RING_SIZE];
2983 @@ -129,7 +129,7 @@ extern int blkif_ioctl(struct inode *ino
2984 extern int blkif_getgeo(struct block_device *, struct hd_geometry *);
2985 extern int blkif_check(dev_t dev);
2986 extern int blkif_revalidate(dev_t dev);
2987 -extern void do_blkif_request (request_queue_t *rq);
2988 +extern void do_blkif_request (struct request_queue *rq);
2990 /* Virtual block-device subsystem. */
2991 /* Note that xlvbd_add doesn't call add_disk for you: you're expected
2992 Index: head-2008-12-01/drivers/xen/blkfront/vbd.c
2993 ===================================================================
2994 --- head-2008-12-01.orig/drivers/xen/blkfront/vbd.c 2008-08-07 12:44:36.000000000 +0200
2995 +++ head-2008-12-01/drivers/xen/blkfront/vbd.c 2008-12-01 11:36:47.000000000 +0100
2996 @@ -211,7 +211,7 @@ xlbd_put_major_info(struct xlbd_major_in
2998 xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size)
3000 - request_queue_t *rq;
3001 + struct request_queue *rq;
3003 rq = blk_init_queue(do_blkif_request, &blkif_io_lock);
3005 Index: head-2008-12-01/drivers/xen/blktap/common.h
3006 ===================================================================
3007 --- head-2008-12-01.orig/drivers/xen/blktap/common.h 2008-12-01 11:29:05.000000000 +0100
3008 +++ head-2008-12-01/drivers/xen/blktap/common.h 2008-12-01 11:36:47.000000000 +0100
3009 @@ -68,7 +68,7 @@ typedef struct blkif_st {
3010 wait_queue_head_t wq;
3011 struct task_struct *xenblkd;
3012 unsigned int waiting_reqs;
3013 - request_queue_t *plug;
3014 + struct request_queue *plug;
3017 unsigned long st_print;
3018 Index: head-2008-12-01/drivers/xen/blktap/interface.c
3019 ===================================================================
3020 --- head-2008-12-01.orig/drivers/xen/blktap/interface.c 2008-12-01 11:32:38.000000000 +0100
3021 +++ head-2008-12-01/drivers/xen/blktap/interface.c 2008-12-01 11:36:47.000000000 +0100
3022 @@ -177,5 +177,5 @@ void tap_blkif_kmem_cache_free(blkif_t *
3023 void __init tap_blkif_interface_init(void)
3025 blkif_cachep = kmem_cache_create("blktapif_cache", sizeof(blkif_t),
3026 - 0, 0, NULL, NULL);
3029 Index: head-2008-12-01/drivers/xen/core/features.c
3030 ===================================================================
3031 --- head-2008-12-01.orig/drivers/xen/core/features.c 2007-06-12 13:13:44.000000000 +0200
3032 +++ head-2008-12-01/drivers/xen/core/features.c 2008-12-01 11:36:47.000000000 +0100
3033 @@ -19,7 +19,7 @@ u8 xen_features[XENFEAT_NR_SUBMAPS * 32]
3034 /* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
3035 EXPORT_SYMBOL(xen_features);
3037 -void setup_xen_features(void)
3038 +void xen_setup_features(void)
3040 xen_feature_info_t fi;
3042 Index: head-2008-12-01/drivers/xen/core/reboot.c
3043 ===================================================================
3044 --- head-2008-12-01.orig/drivers/xen/core/reboot.c 2008-12-01 11:32:38.000000000 +0100
3045 +++ head-2008-12-01/drivers/xen/core/reboot.c 2008-12-01 11:36:47.000000000 +0100
3047 #include <linux/unistd.h>
3048 #include <linux/module.h>
3049 #include <linux/reboot.h>
3050 +#include <linux/sched.h>
3051 #include <linux/sysrq.h>
3052 #include <asm/hypervisor.h>
3053 #include <xen/xenbus.h>
3054 Index: head-2008-12-01/drivers/xen/scsiback/interface.c
3055 ===================================================================
3056 --- head-2008-12-01.orig/drivers/xen/scsiback/interface.c 2008-12-01 11:32:38.000000000 +0100
3057 +++ head-2008-12-01/drivers/xen/scsiback/interface.c 2008-12-01 11:36:47.000000000 +0100
3058 @@ -167,7 +167,7 @@ void scsiback_free(struct vscsibk_info *
3059 int __init scsiback_interface_init(void)
3061 scsiback_cachep = kmem_cache_create("vscsiif_cache",
3062 - sizeof(struct vscsibk_info), 0, 0, NULL, NULL);
3063 + sizeof(struct vscsibk_info), 0, 0, NULL);
3064 if (!scsiback_cachep) {
3065 printk(KERN_ERR "scsiback: can't init scsi cache\n");
3067 Index: head-2008-12-01/drivers/xen/scsifront/scsifront.c
3068 ===================================================================
3069 --- head-2008-12-01.orig/drivers/xen/scsifront/scsifront.c 2008-12-01 11:29:05.000000000 +0100
3070 +++ head-2008-12-01/drivers/xen/scsifront/scsifront.c 2008-12-01 11:36:47.000000000 +0100
3071 @@ -147,7 +147,7 @@ static void scsifront_cdb_cmd_done(struc
3072 add_id_to_freelist(info, id);
3074 sc->result = ring_res->rslt;
3075 - sc->resid = ring_res->residual_len;
3076 + scsi_set_resid(sc, ring_res->residual_len);
3078 if (ring_res->sense_len > VSCSIIF_SENSE_BUFFERSIZE)
3079 sense_len = VSCSIIF_SENSE_BUFFERSIZE;
3080 Index: head-2008-12-01/drivers/xen/tpmback/interface.c
3081 ===================================================================
3082 --- head-2008-12-01.orig/drivers/xen/tpmback/interface.c 2008-12-01 11:36:07.000000000 +0100
3083 +++ head-2008-12-01/drivers/xen/tpmback/interface.c 2008-12-01 11:36:47.000000000 +0100
3088 +#include <linux/err.h>
3089 #include <xen/balloon.h>
3090 #include <xen/gnttab.h>
3092 @@ -159,7 +160,7 @@ void tpmif_disconnect_complete(tpmif_t *
3093 int __init tpmif_interface_init(void)
3095 tpmif_cachep = kmem_cache_create("tpmif_cache", sizeof (tpmif_t),
3096 - 0, 0, NULL, NULL);
3098 return tpmif_cachep ? 0 : -ENOMEM;
3101 Index: head-2008-12-01/drivers/xen/util.c
3102 ===================================================================
3103 --- head-2008-12-01.orig/drivers/xen/util.c 2007-07-10 09:42:30.000000000 +0200
3104 +++ head-2008-12-01/drivers/xen/util.c 2008-12-01 11:36:47.000000000 +0100
3106 -#include <linux/mm.h>
3107 +#include <linux/err.h>
3108 #include <linux/module.h>
3109 -#include <linux/slab.h>
3110 -#include <linux/vmalloc.h>
3111 -#include <asm/uaccess.h>
3112 #include <xen/driver_util.h>
3114 struct class *get_xen_class(void)
3115 @@ -21,45 +18,3 @@ struct class *get_xen_class(void)
3118 EXPORT_SYMBOL_GPL(get_xen_class);
3121 -static int f(pte_t *pte, struct page *pmd_page, unsigned long addr, void *data)
3123 - /* apply_to_page_range() does all the hard work. */
3127 -struct vm_struct *alloc_vm_area(unsigned long size)
3129 - struct vm_struct *area;
3131 - area = get_vm_area(size, VM_IOREMAP);
3136 - * This ensures that page tables are constructed for this region
3137 - * of kernel virtual address space and mapped into init_mm.
3139 - if (apply_to_page_range(&init_mm, (unsigned long)area->addr,
3140 - area->size, f, NULL)) {
3141 - free_vm_area(area);
3145 - /* Map page directories into every address space. */
3146 - vmalloc_sync_all();
3150 -EXPORT_SYMBOL_GPL(alloc_vm_area);
3152 -void free_vm_area(struct vm_struct *area)
3154 - struct vm_struct *ret;
3155 - ret = remove_vm_area(area->addr);
3156 - BUG_ON(ret != area);
3159 -EXPORT_SYMBOL_GPL(free_vm_area);
3160 -#endif /* CONFIG_X86 */
3161 Index: head-2008-12-01/drivers/xen/xenbus/xenbus_client.c
3162 ===================================================================
3163 --- head-2008-12-01.orig/drivers/xen/xenbus/xenbus_client.c 2008-12-01 11:22:58.000000000 +0100
3164 +++ head-2008-12-01/drivers/xen/xenbus/xenbus_client.c 2008-12-01 11:36:47.000000000 +0100
3169 +#if defined(CONFIG_XEN) || defined(MODULE)
3170 #include <linux/slab.h>
3171 #include <xen/evtchn.h>
3172 #include <xen/gnttab.h>
3173 -#include <xen/xenbus.h>
3174 #include <xen/driver_util.h>
3176 +#include <linux/types.h>
3177 +#include <linux/vmalloc.h>
3178 +#include <asm/xen/hypervisor.h>
3179 +#include <xen/interface/xen.h>
3180 +#include <xen/interface/event_channel.h>
3181 +#include <xen/events.h>
3182 +#include <xen/grant_table.h>
3184 +#include <xen/xenbus.h>
3186 #ifdef HAVE_XEN_PLATFORM_COMPAT_H
3187 #include <xen/platform-compat.h>
3190 -#define DPRINTK(fmt, args...) \
3191 - pr_debug("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
3193 const char *xenbus_strstate(enum xenbus_state state)
3195 static const char *const name[] = {
3196 @@ -58,6 +65,20 @@ const char *xenbus_strstate(enum xenbus_
3198 EXPORT_SYMBOL_GPL(xenbus_strstate);
3201 + * xenbus_watch_path - register a watch
3202 + * @dev: xenbus device
3203 + * @path: path to watch
3204 + * @watch: watch to register
3205 + * @callback: callback to register
3207 + * Register a @watch on the given path, using the given xenbus_watch structure
3208 + * for storage, and the given @callback function as the callback. Return 0 on
3209 + * success, or -errno on error. On success, the given @path will be saved as
3210 + * @watch->node, and remains the caller's to free. On error, @watch->node will
3211 + * be NULL, the device will switch to %XenbusStateClosing, and the error will
3212 + * be saved in the store.
3214 int xenbus_watch_path(struct xenbus_device *dev, const char *path,
3215 struct xenbus_watch *watch,
3216 void (*callback)(struct xenbus_watch *,
3217 @@ -81,6 +102,7 @@ int xenbus_watch_path(struct xenbus_devi
3218 EXPORT_SYMBOL_GPL(xenbus_watch_path);
3221 +#if defined(CONFIG_XEN) || defined(MODULE)
3222 int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
3223 const char *path2, struct xenbus_watch *watch,
3224 void (*callback)(struct xenbus_watch *,
3225 @@ -99,8 +121,60 @@ int xenbus_watch_path2(struct xenbus_dev
3228 EXPORT_SYMBOL_GPL(xenbus_watch_path2);
3231 + * xenbus_watch_pathfmt - register a watch on a sprintf-formatted path
3232 + * @dev: xenbus device
3233 + * @watch: watch to register
3234 + * @callback: callback to register
3235 + * @pathfmt: format of path to watch
3237 + * Register a watch on the given @path, using the given xenbus_watch
3238 + * structure for storage, and the given @callback function as the callback.
3239 + * Return 0 on success, or -errno on error. On success, the watched path
3240 + * (@path/@path2) will be saved as @watch->node, and becomes the caller's to
3241 + * kfree(). On error, watch->node will be NULL, so the caller has nothing to
3242 + * free, the device will switch to %XenbusStateClosing, and the error will be
3243 + * saved in the store.
3245 +int xenbus_watch_pathfmt(struct xenbus_device *dev,
3246 + struct xenbus_watch *watch,
3247 + void (*callback)(struct xenbus_watch *,
3248 + const char **, unsigned int),
3249 + const char *pathfmt, ...)
3255 + va_start(ap, pathfmt);
3256 + path = kvasprintf(GFP_KERNEL, pathfmt, ap);
3260 + xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch");
3263 + err = xenbus_watch_path(dev, path, watch, callback);
3269 +EXPORT_SYMBOL_GPL(xenbus_watch_pathfmt);
3274 + * xenbus_switch_state
3275 + * @dev: xenbus device
3276 + * @xbt: transaction handle
3277 + * @state: new state
3279 + * Advertise in the store a change of the given driver to the given new_state.
3280 + * Return 0 on success, or -errno on error. On error, the device will switch
3281 + * to XenbusStateClosing, and the error will be saved in the store.
3283 int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state state)
3285 /* We check whether the state is currently set to the given value, and
3286 @@ -159,8 +233,8 @@ static char *error_path(struct xenbus_de
3290 -void _dev_error(struct xenbus_device *dev, int err, const char *fmt,
3292 +static void _dev_error(struct xenbus_device *dev, int err,
3293 + const char *fmt, va_list ap)
3297 @@ -181,14 +255,16 @@ void _dev_error(struct xenbus_device *de
3298 path_buffer = error_path(dev);
3300 if (path_buffer == NULL) {
3301 - printk("xenbus: failed to write error node for %s (%s)\n",
3302 - dev->nodename, printf_buffer);
3303 + dev_err(&dev->dev,
3304 + "xenbus: failed to write error node for %s (%s)\n",
3305 + dev->nodename, printf_buffer);
3309 if (xenbus_write(XBT_NIL, path_buffer, "error", printf_buffer) != 0) {
3310 - printk("xenbus: failed to write error node for %s (%s)\n",
3311 - dev->nodename, printf_buffer);
3312 + dev_err(&dev->dev,
3313 + "xenbus: failed to write error node for %s (%s)\n",
3314 + dev->nodename, printf_buffer);
3318 @@ -200,6 +276,15 @@ fail:
3323 + * xenbus_dev_error
3324 + * @dev: xenbus device
3325 + * @err: error to report
3326 + * @fmt: error message format
3328 + * Report the given negative errno into the store, along with the given
3329 + * formatted message.
3331 void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt,
3334 @@ -212,6 +297,16 @@ void xenbus_dev_error(struct xenbus_devi
3335 EXPORT_SYMBOL_GPL(xenbus_dev_error);
3339 + * xenbus_dev_fatal
3340 + * @dev: xenbus device
3341 + * @err: error to report
3342 + * @fmt: error message format
3344 + * Equivalent to xenbus_dev_error(dev, err, fmt, args), followed by
3345 + * xenbus_switch_state(dev, NULL, XenbusStateClosing) to schedule an orderly
3346 + * closedown of this driver and its peer.
3348 void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,
3351 @@ -226,6 +321,15 @@ void xenbus_dev_fatal(struct xenbus_devi
3352 EXPORT_SYMBOL_GPL(xenbus_dev_fatal);
3356 + * xenbus_grant_ring
3357 + * @dev: xenbus device
3358 + * @ring_mfn: mfn of ring to grant
3360 + * Grant access to the given @ring_mfn to the peer of the given device. Return
3361 + * 0 on success, or -errno on error. On error, the device will switch to
3362 + * XenbusStateClosing, and the error will be saved in the store.
3364 int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn)
3366 int err = gnttab_grant_foreign_access(dev->otherend_id, ring_mfn, 0);
3367 @@ -236,6 +340,12 @@ int xenbus_grant_ring(struct xenbus_devi
3368 EXPORT_SYMBOL_GPL(xenbus_grant_ring);
3372 + * Allocate an event channel for the given xenbus_device, assigning the newly
3373 + * created local port to *port. Return 0 on success, or -errno on error. On
3374 + * error, the device will switch to XenbusStateClosing, and the error will be
3375 + * saved in the store.
3377 int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port)
3379 struct evtchn_alloc_unbound alloc_unbound;
3380 @@ -256,6 +366,38 @@ int xenbus_alloc_evtchn(struct xenbus_de
3381 EXPORT_SYMBOL_GPL(xenbus_alloc_evtchn);
3384 +#if 0 /* !defined(CONFIG_XEN) && !defined(MODULE) */
3386 + * Bind to an existing interdomain event channel in another domain. Returns 0
3387 + * on success and stores the local port in *port. On error, returns -errno,
3388 + * switches the device to XenbusStateClosing, and saves the error in XenStore.
3390 +int xenbus_bind_evtchn(struct xenbus_device *dev, int remote_port, int *port)
3392 + struct evtchn_bind_interdomain bind_interdomain;
3395 + bind_interdomain.remote_dom = dev->otherend_id;
3396 + bind_interdomain.remote_port = remote_port;
3398 + err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
3399 + &bind_interdomain);
3401 + xenbus_dev_fatal(dev, err,
3402 + "binding to event channel %d from domain %d",
3403 + remote_port, dev->otherend_id);
3405 + *port = bind_interdomain.local_port;
3409 +EXPORT_SYMBOL_GPL(xenbus_bind_evtchn);
3414 + * Free an existing event channel. Returns 0 on success or -errno on error.
3416 int xenbus_free_evtchn(struct xenbus_device *dev, int port)
3418 struct evtchn_close close;
3419 @@ -272,6 +414,191 @@ int xenbus_free_evtchn(struct xenbus_dev
3420 EXPORT_SYMBOL_GPL(xenbus_free_evtchn);
3423 +#if 0 /* !defined(CONFIG_XEN) && !defined(MODULE) */
3425 + * xenbus_map_ring_valloc
3426 + * @dev: xenbus device
3427 + * @gnt_ref: grant reference
3428 + * @vaddr: pointer to address to be filled out by mapping
3430 + * Based on Rusty Russell's skeleton driver's map_page.
3431 + * Map a page of memory into this domain from another domain's grant table.
3432 + * xenbus_map_ring_valloc allocates a page of virtual address space, maps the
3433 + * page to that address, and sets *vaddr to that address.
3434 + * Returns 0 on success, and GNTST_* (see xen/include/interface/grant_table.h)
3435 + * or -ENOMEM on error. If an error is returned, device will switch to
3436 + * XenbusStateClosing and the error message will be saved in XenStore.
3438 +int xenbus_map_ring_valloc(struct xenbus_device *dev, int gnt_ref, void **vaddr)
3440 + struct gnttab_map_grant_ref op = {
3441 + .flags = GNTMAP_host_map,
3443 + .dom = dev->otherend_id,
3445 + struct vm_struct *area;
3449 + area = alloc_vm_area(PAGE_SIZE);
3453 + op.host_addr = (unsigned long)area->addr;
3455 + if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1))
3458 + if (op.status != GNTST_okay) {
3459 + free_vm_area(area);
3460 + xenbus_dev_fatal(dev, op.status,
3461 + "mapping in shared page %d from domain %d",
3462 + gnt_ref, dev->otherend_id);
3466 + /* Stuff the handle in an unused field */
3467 + area->phys_addr = (unsigned long)op.handle;
3469 + *vaddr = area->addr;
3472 +EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc);
3477 + * @dev: xenbus device
3478 + * @gnt_ref: grant reference
3479 + * @handle: pointer to grant handle to be filled
3480 + * @vaddr: address to be mapped to
3482 + * Map a page of memory into this domain from another domain's grant table.
3483 + * xenbus_map_ring does not allocate the virtual address space (you must do
3484 + * this yourself!). It only maps in the page to the specified address.
3485 + * Returns 0 on success, and GNTST_* (see xen/include/interface/grant_table.h)
3486 + * or -ENOMEM on error. If an error is returned, device will switch to
3487 + * XenbusStateClosing and the error message will be saved in XenStore.
3489 +int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
3490 + grant_handle_t *handle, void *vaddr)
3492 + struct gnttab_map_grant_ref op = {
3493 + .host_addr = (unsigned long)vaddr,
3494 + .flags = GNTMAP_host_map,
3496 + .dom = dev->otherend_id,
3499 + if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1))
3502 + if (op.status != GNTST_okay) {
3503 + xenbus_dev_fatal(dev, op.status,
3504 + "mapping in shared page %d from domain %d",
3505 + gnt_ref, dev->otherend_id);
3507 + *handle = op.handle;
3511 +EXPORT_SYMBOL_GPL(xenbus_map_ring);
3515 + * xenbus_unmap_ring_vfree
3516 + * @dev: xenbus device
3517 + * @vaddr: addr to unmap
3519 + * Based on Rusty Russell's skeleton driver's unmap_page.
3520 + * Unmap a page of memory in this domain that was imported from another domain.
3521 + * Use xenbus_unmap_ring_vfree if you mapped in your memory with
3522 + * xenbus_map_ring_valloc (it will free the virtual address space).
3523 + * Returns 0 on success and returns GNTST_* on error
3524 + * (see xen/include/interface/grant_table.h).
3526 +int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr)
3528 + struct vm_struct *area;
3529 + struct gnttab_unmap_grant_ref op = {
3530 + .host_addr = (unsigned long)vaddr,
3533 + /* It'd be nice if linux/vmalloc.h provided a find_vm_area(void *addr)
3534 + * method so that we don't have to muck with vmalloc internals here.
3535 + * We could force the user to hang on to their struct vm_struct from
3536 + * xenbus_map_ring_valloc, but these 6 lines considerably simplify
3539 + read_lock(&vmlist_lock);
3540 + for (area = vmlist; area != NULL; area = area->next) {
3541 + if (area->addr == vaddr)
3544 + read_unlock(&vmlist_lock);
3547 + xenbus_dev_error(dev, -ENOENT,
3548 + "can't find mapped virtual address %p", vaddr);
3549 + return GNTST_bad_virt_addr;
3552 + op.handle = (grant_handle_t)area->phys_addr;
3554 + if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
3557 + if (op.status == GNTST_okay)
3558 + free_vm_area(area);
3560 + xenbus_dev_error(dev, op.status,
3561 + "unmapping page at handle %d error %d",
3562 + (int16_t)area->phys_addr, op.status);
3566 +EXPORT_SYMBOL_GPL(xenbus_unmap_ring_vfree);
3570 + * xenbus_unmap_ring
3571 + * @dev: xenbus device
3572 + * @handle: grant handle
3573 + * @vaddr: addr to unmap
3575 + * Unmap a page of memory in this domain that was imported from another domain.
3576 + * Returns 0 on success and returns GNTST_* on error
3577 + * (see xen/include/interface/grant_table.h).
3579 +int xenbus_unmap_ring(struct xenbus_device *dev,
3580 + grant_handle_t handle, void *vaddr)
3582 + struct gnttab_unmap_grant_ref op = {
3583 + .host_addr = (unsigned long)vaddr,
3587 + if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
3590 + if (op.status != GNTST_okay)
3591 + xenbus_dev_error(dev, op.status,
3592 + "unmapping page at handle %d error %d",
3593 + handle, op.status);
3597 +EXPORT_SYMBOL_GPL(xenbus_unmap_ring);
3602 + * xenbus_read_driver_state
3603 + * @path: path for driver
3605 + * Return the state of the driver rooted at the given store path, or
3606 + * XenbusStateUnknown if no state can be read.
3608 enum xenbus_state xenbus_read_driver_state(const char *path)
3610 enum xenbus_state result;
3611 Index: head-2008-12-01/drivers/xen/xenbus/xenbus_comms.c
3612 ===================================================================
3613 --- head-2008-12-01.orig/drivers/xen/xenbus/xenbus_comms.c 2008-12-01 11:32:38.000000000 +0100
3614 +++ head-2008-12-01/drivers/xen/xenbus/xenbus_comms.c 2008-12-01 11:36:47.000000000 +0100
3616 #include <linux/interrupt.h>
3617 #include <linux/sched.h>
3618 #include <linux/err.h>
3619 -#include <linux/ptrace.h>
3620 -#include <linux/workqueue.h>
3621 -#include <xen/evtchn.h>
3622 #include <xen/xenbus.h>
3624 +#if defined(CONFIG_XEN) || defined(MODULE)
3625 +#include <xen/evtchn.h>
3626 #include <asm/hypervisor.h>
3628 +#include <asm/xen/hypervisor.h>
3629 +#include <xen/events.h>
3630 +#include <xen/page.h>
3633 #include "xenbus_comms.h"
3635 @@ -91,6 +94,13 @@ static const void *get_input_chunk(XENST
3636 return buf + MASK_XENSTORE_IDX(cons);
3640 + * xb_write - low level write
3641 + * @data: buffer to send
3642 + * @len: length of buffer
3644 + * Returns 0 on success, error otherwise.
3646 int xb_write(const void *data, unsigned len)
3648 struct xenstore_domain_interface *intf = xen_store_interface;
3649 @@ -199,7 +209,9 @@ int xb_read(void *data, unsigned len)
3653 -/* Set up interrupt handler off store event channel. */
3655 + * xb_init_comms - Set up interrupt handler off store event channel.
3657 int xb_init_comms(void)
3659 struct xenstore_domain_interface *intf = xen_store_interface;
3660 @@ -219,7 +231,11 @@ int xb_init_comms(void)
3662 unbind_from_irqhandler(xenbus_irq, &xb_waitq);
3664 +#if defined(CONFIG_XEN) || defined(MODULE)
3665 err = bind_caller_port_to_irqhandler(
3667 + err = bind_evtchn_to_irqhandler(
3669 xen_store_evtchn, wake_waiting,
3670 0, "xenbus", &xb_waitq);
3672 Index: head-2008-12-01/drivers/xen/xenbus/xenbus_probe.c
3673 ===================================================================
3674 --- head-2008-12-01.orig/drivers/xen/xenbus/xenbus_probe.c 2008-12-01 11:36:07.000000000 +0100
3675 +++ head-2008-12-01/drivers/xen/xenbus/xenbus_probe.c 2008-12-01 11:36:47.000000000 +0100
3677 #include <linux/mm.h>
3678 #include <linux/notifier.h>
3679 #include <linux/mutex.h>
3680 -#include <linux/module.h>
3681 +#include <linux/io.h>
3683 -#include <asm/io.h>
3684 #include <asm/page.h>
3685 -#include <asm/maddr.h>
3686 #include <asm/pgtable.h>
3687 +#if defined(CONFIG_XEN) || defined(MODULE)
3688 #include <asm/hypervisor.h>
3689 #include <xen/xenbus.h>
3690 #include <xen/xen_proc.h>
3693 #include <xen/hvm.h>
3696 +#include <asm/xen/hypervisor.h>
3697 +#include <xen/xenbus.h>
3698 +#include <xen/events.h>
3699 +#include <xen/page.h>
3702 #include "xenbus_comms.h"
3703 #include "xenbus_probe.h"
3704 @@ -168,7 +173,7 @@ static int read_backend_details(struct x
3705 return read_otherend_details(xendev, "backend-id", "backend");
3708 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
3709 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && (defined(CONFIG_XEN) || defined(MODULE))
3710 static int xenbus_uevent_frontend(struct device *dev, char **envp,
3711 int num_envp, char *buffer, int buffer_size)
3713 @@ -207,12 +212,16 @@ static struct xen_bus_type xenbus_fronte
3714 .probe = xenbus_dev_probe,
3715 .remove = xenbus_dev_remove,
3716 .shutdown = xenbus_dev_shutdown,
3717 +#if defined(CONFIG_XEN) || defined(MODULE)
3718 .uevent = xenbus_uevent_frontend,
3722 +#if defined(CONFIG_XEN) || defined(MODULE)
3729 static void otherend_changed(struct xenbus_watch *watch,
3730 @@ -228,14 +237,15 @@ static void otherend_changed(struct xenb
3731 if (!dev->otherend ||
3732 strncmp(dev->otherend, vec[XS_WATCH_PATH],
3733 strlen(dev->otherend))) {
3734 - DPRINTK("Ignoring watch at %s", vec[XS_WATCH_PATH]);
3735 + dev_dbg(&dev->dev, "Ignoring watch at %s", vec[XS_WATCH_PATH]);
3739 state = xenbus_read_driver_state(dev->otherend);
3741 - DPRINTK("state is %d (%s), %s, %s", state, xenbus_strstate(state),
3742 - dev->otherend_watch.node, vec[XS_WATCH_PATH]);
3743 + dev_dbg(&dev->dev, "state is %d (%s), %s, %s",
3744 + state, xenbus_strstate(state), dev->otherend_watch.node,
3745 + vec[XS_WATCH_PATH]);
3747 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
3749 @@ -271,8 +281,13 @@ static int talk_to_otherend(struct xenbu
3751 static int watch_otherend(struct xenbus_device *dev)
3753 +#if defined(CONFIG_XEN) || defined(MODULE)
3754 return xenbus_watch_path2(dev, dev->otherend, "state",
3755 &dev->otherend_watch, otherend_changed);
3757 + return xenbus_watch_pathfmt(dev, &dev->otherend_watch, otherend_changed,
3758 + "%s/%s", dev->otherend, "state");
3763 @@ -298,9 +313,9 @@ int xenbus_dev_probe(struct device *_dev
3765 err = talk_to_otherend(dev);
3767 - printk(KERN_WARNING
3768 - "xenbus_probe: talk_to_otherend on %s failed.\n",
3770 + dev_warn(&dev->dev,
3771 + "xenbus_probe: talk_to_otherend on %s failed.\n",
3776 @@ -310,9 +325,9 @@ int xenbus_dev_probe(struct device *_dev
3778 err = watch_otherend(dev);
3780 - printk(KERN_WARNING
3781 - "xenbus_probe: watch_otherend on %s failed.\n",
3783 + dev_warn(&dev->dev,
3784 + "xenbus_probe: watch_otherend on %s failed.\n",
3789 @@ -352,14 +367,15 @@ static void xenbus_dev_shutdown(struct d
3791 get_device(&dev->dev);
3792 if (dev->state != XenbusStateConnected) {
3793 - printk("%s: %s: %s != Connected, skipping\n", __FUNCTION__,
3794 - dev->nodename, xenbus_strstate(dev->state));
3795 + dev_info(&dev->dev, "%s: %s: %s != Connected, skipping\n", __FUNCTION__,
3796 + dev->nodename, xenbus_strstate(dev->state));
3799 xenbus_switch_state(dev, XenbusStateClosing);
3800 timeout = wait_for_completion_timeout(&dev->down, timeout);
3802 - printk("%s: %s timeout closing device\n", __FUNCTION__, dev->nodename);
3803 + dev_info(&dev->dev, "%s: %s timeout closing device\n",
3804 + __FUNCTION__, dev->nodename);
3806 put_device(&dev->dev);
3808 @@ -547,7 +563,9 @@ int xenbus_probe_node(struct xen_bus_typ
3809 xendev->devicetype = tmpstring;
3810 init_completion(&xendev->down);
3812 +#if defined(CONFIG_XEN) || defined(MODULE)
3813 xendev->dev.parent = &bus->dev;
3815 xendev->dev.bus = &bus->bus;
3816 xendev->dev.release = xenbus_dev_release;
3818 @@ -562,15 +580,16 @@ int xenbus_probe_node(struct xen_bus_typ
3820 err = device_create_file(&xendev->dev, &dev_attr_nodename);
3823 + goto fail_unregister;
3825 err = device_create_file(&xendev->dev, &dev_attr_devtype);
3828 + goto fail_remove_file;
3833 device_remove_file(&xendev->dev, &dev_attr_nodename);
3834 - device_remove_file(&xendev->dev, &dev_attr_devtype);
3836 device_unregister(&xendev->dev);
3839 @@ -583,7 +602,8 @@ static int xenbus_probe_frontend(const c
3843 - nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", xenbus_frontend.root, type, name);
3844 + nodename = kasprintf(GFP_KERNEL, "%s/%s/%s",
3845 + xenbus_frontend.root, type, name);
3849 @@ -659,7 +679,7 @@ static int strsep_len(const char *str, c
3850 return (len == 0) ? i : -ERANGE;
3853 -void dev_changed(const char *node, struct xen_bus_type *bus)
3854 +void xenbus_dev_changed(const char *node, struct xen_bus_type *bus)
3856 int exists, rootlen;
3857 struct xenbus_device *dev;
3858 @@ -667,7 +687,7 @@ void dev_changed(const char *node, struc
3859 const char *p, *root;
3861 if (bus->error || char_count(node, '/') < 2)
3865 exists = xenbus_exists(XBT_NIL, node, "");
3867 @@ -701,7 +721,7 @@ static void frontend_changed(struct xenb
3871 - dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend);
3872 + xenbus_dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend);
3875 /* We watch for devices appearing and vanishing. */
3876 @@ -904,10 +924,16 @@ static int xsd_port_read(char *page, cha
3880 -static int xenbus_probe_init(void)
3882 +static int __init xenbus_probe_init(void)
3884 +static int __devinit xenbus_probe_init(void)
3888 +#if defined(CONFIG_XEN) || defined(MODULE)
3889 unsigned long page = 0;
3894 @@ -926,6 +952,7 @@ static int xenbus_probe_init(void)
3895 * Domain0 doesn't have a store_evtchn or store_mfn yet.
3897 if (is_initial_xendomain()) {
3898 +#if defined(CONFIG_XEN) || defined(MODULE)
3899 struct evtchn_alloc_unbound alloc_unbound;
3901 /* Allocate page. */
3902 @@ -963,10 +990,13 @@ static int xenbus_probe_init(void)
3904 xsd_port_intf->read_proc = xsd_port_read;
3907 + /* dom0 not yet supported */
3909 xen_store_interface = mfn_to_virt(xen_store_mfn);
3911 xenstored_ready = 1;
3914 xen_store_evtchn = xen_start_info->store_evtchn;
3915 xen_store_mfn = xen_start_info->store_mfn;
3916 xen_store_interface = mfn_to_virt(xen_store_mfn);
3917 @@ -979,7 +1009,9 @@ static int xenbus_probe_init(void)
3921 +#if defined(CONFIG_XEN) || defined(MODULE)
3925 /* Initialize the interface to xenstore. */
3927 @@ -989,6 +1021,7 @@ static int xenbus_probe_init(void)
3931 +#if defined(CONFIG_XEN) || defined(MODULE)
3932 /* Register ourselves with the kernel device subsystem */
3933 if (!xenbus_frontend.error) {
3934 xenbus_frontend.error = device_register(&xenbus_frontend.dev);
3935 @@ -999,6 +1032,7 @@ static int xenbus_probe_init(void)
3936 xenbus_frontend.error);
3940 xenbus_backend_device_register();
3942 if (!is_initial_xendomain())
3943 @@ -1007,8 +1041,10 @@ static int xenbus_probe_init(void)
3947 +#if defined(CONFIG_XEN) || defined(MODULE)
3953 * Do not unregister the xenbus front/backend buses here. The buses
3954 @@ -1019,11 +1055,15 @@ static int xenbus_probe_init(void)
3960 postcore_initcall(xenbus_probe_init);
3962 MODULE_LICENSE("Dual BSD/GPL");
3964 -int xenbus_init(void)
3965 +MODULE_LICENSE("GPL");
3968 +int __devinit xenbus_init(void)
3970 return xenbus_probe_init();
3972 Index: head-2008-12-01/drivers/xen/xenbus/xenbus_probe.h
3973 ===================================================================
3974 --- head-2008-12-01.orig/drivers/xen/xenbus/xenbus_probe.h 2008-12-01 11:36:07.000000000 +0100
3975 +++ head-2008-12-01/drivers/xen/xenbus/xenbus_probe.h 2008-12-01 11:36:47.000000000 +0100
3976 @@ -56,7 +56,9 @@ struct xen_bus_type
3977 int (*get_bus_id)(char bus_id[BUS_ID_SIZE], const char *nodename);
3978 int (*probe)(const char *type, const char *dir);
3979 struct bus_type bus;
3980 +#if defined(CONFIG_XEN) || defined(MODULE)
3985 extern int xenbus_match(struct device *_dev, struct device_driver *_drv);
3986 @@ -71,7 +73,7 @@ extern int xenbus_probe_node(struct xen_
3987 const char *nodename);
3988 extern int xenbus_probe_devices(struct xen_bus_type *bus);
3990 -extern void dev_changed(const char *node, struct xen_bus_type *bus);
3991 +extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);
3995 Index: head-2008-12-01/drivers/xen/xenbus/xenbus_probe_backend.c
3996 ===================================================================
3997 --- head-2008-12-01.orig/drivers/xen/xenbus/xenbus_probe_backend.c 2008-12-01 11:36:07.000000000 +0100
3998 +++ head-2008-12-01/drivers/xen/xenbus/xenbus_probe_backend.c 2008-12-01 11:36:47.000000000 +0100
3999 @@ -236,7 +236,7 @@ static void backend_changed(struct xenbu
4003 - dev_changed(vec[XS_WATCH_PATH], &xenbus_backend);
4004 + xenbus_dev_changed(vec[XS_WATCH_PATH], &xenbus_backend);
4007 static struct xenbus_watch be_watch = {
4008 Index: head-2008-12-01/drivers/xen/xenbus/xenbus_xs.c
4009 ===================================================================
4010 --- head-2008-12-01.orig/drivers/xen/xenbus/xenbus_xs.c 2008-12-01 11:22:58.000000000 +0100
4011 +++ head-2008-12-01/drivers/xen/xenbus/xenbus_xs.c 2008-12-01 11:36:47.000000000 +0100
4012 @@ -221,7 +221,7 @@ static void *xs_talkv(struct xenbus_tran
4015 for (i = 0; i < num_vecs; i++) {
4016 - err = xb_write(iovec[i].iov_base, iovec[i].iov_len);;
4017 + err = xb_write(iovec[i].iov_base, iovec[i].iov_len);
4019 mutex_unlock(&xs_state.request_mutex);
4020 return ERR_PTR(err);
4021 @@ -630,7 +630,9 @@ void unregister_xenbus_watch(struct xenb
4022 char token[sizeof(watch) * 2 + 1];
4025 +#if defined(CONFIG_XEN) || defined(MODULE)
4026 BUG_ON(watch->flags & XBWF_new_thread);
4029 sprintf(token, "%lX", (long)watch);
4031 @@ -649,6 +651,11 @@ void unregister_xenbus_watch(struct xenb
4033 up_read(&xs_state.watch_mutex);
4035 + /* Make sure there are no callbacks running currently (unless
4037 + if (current->pid != xenwatch_pid)
4038 + mutex_lock(&xenwatch_mutex);
4040 /* Cancel pending watch events. */
4041 spin_lock(&watch_events_lock);
4042 list_for_each_entry_safe(msg, tmp, &watch_events, list) {
4043 @@ -660,11 +667,8 @@ void unregister_xenbus_watch(struct xenb
4045 spin_unlock(&watch_events_lock);
4047 - /* Flush any currently-executing callback, unless we are it. :-) */
4048 - if (current->pid != xenwatch_pid) {
4049 - mutex_lock(&xenwatch_mutex);
4050 + if (current->pid != xenwatch_pid)
4051 mutex_unlock(&xenwatch_mutex);
4054 EXPORT_SYMBOL_GPL(unregister_xenbus_watch);
4056 @@ -702,6 +706,7 @@ void xs_suspend_cancel(void)
4057 up_write(&xs_state.transaction_mutex);
4060 +#if defined(CONFIG_XEN) || defined(MODULE)
4061 static int xenwatch_handle_callback(void *data)
4063 struct xs_stored_msg *msg = data;
4064 @@ -719,6 +724,7 @@ static int xenwatch_handle_callback(void
4070 static int xenwatch_thread(void *unused)
4072 @@ -748,6 +754,7 @@ static int xenwatch_thread(void *unused)
4074 msg = list_entry(ent, struct xs_stored_msg, list);
4076 +#if defined(CONFIG_XEN) || defined(MODULE)
4078 * Unlock the mutex before running an XBWF_new_thread
4079 * handler. kthread_run can block which can deadlock
4080 @@ -764,6 +771,15 @@ static int xenwatch_thread(void *unused)
4081 xenwatch_handle_callback(msg);
4082 mutex_unlock(&xenwatch_mutex);
4085 + msg->u.watch.handle->callback(
4086 + msg->u.watch.handle,
4087 + (const char **)msg->u.watch.vec,
4088 + msg->u.watch.vec_size);
4089 + mutex_unlock(&xenwatch_mutex);
4090 + kfree(msg->u.watch.vec);
4096 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/fixmap_32.h
4097 ===================================================================
4098 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/fixmap_32.h 2008-12-01 11:36:13.000000000 +0100
4099 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/fixmap_32.h 2008-12-01 11:36:47.000000000 +0100
4100 @@ -53,6 +53,8 @@ extern unsigned long __FIXADDR_TOP;
4101 enum fixed_addresses {
4105 + FIX_EARLYCON_MEM_BASE,
4106 #ifdef CONFIG_X86_LOCAL_APIC
4107 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
4109 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/highmem.h
4110 ===================================================================
4111 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/highmem.h 2008-12-01 11:36:13.000000000 +0100
4112 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/highmem.h 2008-12-01 11:36:47.000000000 +0100
4113 @@ -76,8 +76,7 @@ struct page *kmap_atomic_to_page(void *p
4115 #define kmap_atomic_pte(page, type) \
4116 kmap_atomic_prot(page, type, \
4117 - test_bit(PG_pinned, &(page)->flags) \
4118 - ? PAGE_KERNEL_RO : kmap_prot)
4119 + PagePinned(page) ? PAGE_KERNEL_RO : kmap_prot)
4121 #define flush_cache_kmaps() do { } while (0)
4123 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/io_32.h
4124 ===================================================================
4125 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/io_32.h 2008-12-01 11:36:13.000000000 +0100
4126 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/io_32.h 2008-12-01 11:36:47.000000000 +0100
4127 @@ -125,6 +125,9 @@ extern void __iomem * __ioremap(unsigned
4128 * writew/writel functions and the other mmio helpers. The returned
4129 * address is not guaranteed to be usable directly as a virtual
4132 + * If the area you are trying to map is a PCI BAR you should have a
4133 + * look at pci_iomap().
4136 static inline void __iomem * ioremap(unsigned long offset, unsigned long size)
4137 @@ -142,6 +145,7 @@ extern void iounmap(volatile void __iome
4139 extern void *bt_ioremap(unsigned long offset, unsigned long size);
4140 extern void bt_iounmap(void *addr, unsigned long size);
4141 +extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
4143 /* Use early IO mappings for DMI because it's initialized early */
4144 #define dmi_ioremap bt_ioremap
4145 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/maddr_32.h
4146 ===================================================================
4147 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/maddr_32.h 2008-04-02 12:34:02.000000000 +0200
4148 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/maddr_32.h 2008-12-01 11:36:47.000000000 +0100
4149 @@ -155,6 +155,7 @@ static inline paddr_t pte_machine_to_phy
4151 #ifdef CONFIG_X86_PAE
4152 #define __pte_ma(x) ((pte_t) { (x), (maddr_t)(x) >> 32 } )
4153 +extern unsigned long long __supported_pte_mask;
4154 static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot)
4157 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/mmu_context_32.h
4158 ===================================================================
4159 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/mmu_context_32.h 2008-12-01 11:36:13.000000000 +0100
4160 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/mmu_context_32.h 2008-12-01 11:36:47.000000000 +0100
4161 @@ -16,7 +16,7 @@ void mm_pin_all(void);
4162 static inline void xen_activate_mm(struct mm_struct *prev,
4163 struct mm_struct *next)
4165 - if (!test_bit(PG_pinned, &virt_to_page(next->pgd)->flags))
4166 + if (!PagePinned(virt_to_page(next->pgd)))
4170 @@ -51,6 +51,8 @@ static inline void __prepare_arch_switch
4174 +void leave_mm(unsigned long cpu);
4176 static inline void switch_mm(struct mm_struct *prev,
4177 struct mm_struct *next,
4178 struct task_struct *tsk)
4179 @@ -60,7 +62,7 @@ static inline void switch_mm(struct mm_s
4181 if (likely(prev != next)) {
4182 BUG_ON(!xen_feature(XENFEAT_writable_page_tables) &&
4183 - !test_bit(PG_pinned, &virt_to_page(next->pgd)->flags));
4184 + !PagePinned(virt_to_page(next->pgd)));
4186 /* stop flush ipis for the previous mm */
4187 cpu_clear(cpu, prev->cpu_vm_mask);
4188 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pci_32.h
4189 ===================================================================
4190 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pci_32.h 2007-09-14 11:14:51.000000000 +0200
4191 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/pci_32.h 2008-12-01 11:36:47.000000000 +0100
4197 +struct pci_sysdata {
4198 + int node; /* NUMA node */
4201 +/* scan a bus after allocating a pci_sysdata for it */
4202 +extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
4204 #include <linux/mm.h> /* for struct page */
4206 /* Can be used to override the logic in pci_scan_bus for skipping
4207 @@ -81,48 +89,11 @@ struct pci_dev;
4211 -/* This is always fine. */
4212 -#define pci_dac_dma_supported(pci_dev, mask) (1)
4214 -static inline dma64_addr_t
4215 -pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
4217 - return ((dma64_addr_t) page_to_phys(page) +
4218 - (dma64_addr_t) offset);
4221 -static inline struct page *
4222 -pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
4224 - return pfn_to_page(dma_addr >> PAGE_SHIFT);
4227 -static inline unsigned long
4228 -pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
4230 - return (dma_addr & ~PAGE_MASK);
4234 -pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
4239 -pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
4241 - flush_write_buffers();
4244 #define HAVE_PCI_MMAP
4245 extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
4246 enum pci_mmap_state mmap_state, int write_combine);
4249 -static inline void pcibios_add_platform_entries(struct pci_dev *dev)
4254 static inline void pci_dma_burst_advice(struct pci_dev *pdev,
4255 enum pci_dma_burst_strategy *strat,
4256 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgalloc_32.h
4257 ===================================================================
4258 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgalloc_32.h 2008-12-01 11:36:13.000000000 +0100
4259 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgalloc_32.h 2008-12-01 11:36:47.000000000 +0100
4261 #include <linux/mm.h> /* for struct page */
4262 #include <asm/io.h> /* for phys_to_virt and page_to_pseudophys */
4264 -#define paravirt_alloc_pt(pfn) do { } while (0)
4265 +#define paravirt_alloc_pt(mm, pfn) do { } while (0)
4266 #define paravirt_alloc_pd(pfn) do { } while (0)
4267 #define paravirt_alloc_pd(pfn) do { } while (0)
4268 #define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
4271 #define pmd_populate_kernel(mm, pmd, pte) \
4273 - paravirt_alloc_pt(__pa(pte) >> PAGE_SHIFT); \
4274 + paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); \
4275 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \
4278 #define pmd_populate(mm, pmd, pte) \
4280 unsigned long pfn = page_to_pfn(pte); \
4281 - paravirt_alloc_pt(pfn); \
4282 - if (test_bit(PG_pinned, &virt_to_page((mm)->pgd)->flags)) { \
4283 + paravirt_alloc_pt(mm, pfn); \
4284 + if (PagePinned(virt_to_page((mm)->pgd))) { \
4285 if (!PageHighMem(pte)) \
4286 BUG_ON(HYPERVISOR_update_va_mapping( \
4287 (unsigned long)__va(pfn << PAGE_SHIFT), \
4288 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_32.h
4289 ===================================================================
4290 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgtable_32.h 2008-12-01 11:36:13.000000000 +0100
4291 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_32.h 2008-12-01 11:36:47.000000000 +0100
4293 #include <linux/spinlock.h>
4294 #include <linux/sched.h>
4296 -/* Is this pagetable pinned? */
4297 -#define PG_pinned PG_arch_1
4299 struct vm_area_struct;
4302 @@ -82,7 +79,7 @@ void paging_init(void);
4303 * area for the same reason. ;)
4305 #define VMALLOC_OFFSET (8*1024*1024)
4306 -#define VMALLOC_START (((unsigned long) high_memory + vmalloc_earlyreserve + \
4307 +#define VMALLOC_START (((unsigned long) high_memory + \
4308 2*VMALLOC_OFFSET-1) & ~(VMALLOC_OFFSET-1))
4309 #ifdef CONFIG_HIGHMEM
4310 # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
4311 @@ -231,8 +228,6 @@ extern unsigned long pg0[];
4312 * The following only work if pte_present() is true.
4313 * Undefined behaviour if not..
4315 -static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
4316 -static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
4317 static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; }
4318 static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; }
4319 static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; }
4320 @@ -243,13 +238,9 @@ static inline int pte_huge(pte_t pte) {
4322 static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; }
4324 -static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
4325 -static inline pte_t pte_exprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
4326 static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; }
4327 static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; }
4328 static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; }
4329 -static inline pte_t pte_mkread(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
4330 -static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
4331 static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; }
4332 static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
4333 static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
4334 @@ -295,22 +286,20 @@ static inline pte_t xen_local_ptep_get_a
4335 #define ptep_set_access_flags(vma, address, ptep, entry, dirty) \
4337 int __changed = !pte_same(*(ptep), entry); \
4338 - if (__changed && (dirty)) \
4339 - ptep_establish(vma, address, ptep, entry); \
4340 + if (__changed && (dirty)) { \
4341 + if ( likely((vma)->vm_mm == current->mm) ) { \
4342 + BUG_ON(HYPERVISOR_update_va_mapping(address, \
4344 + (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \
4345 + UVMF_INVLPG|UVMF_MULTI)); \
4347 + xen_l1_entry_update(ptep, entry); \
4348 + flush_tlb_page(vma, address); \
4354 -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
4355 -#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \
4357 - if (pte_dirty(*(ptep))) \
4358 - __ret = test_and_clear_bit(_PAGE_BIT_DIRTY, \
4359 - &(ptep)->pte_low); \
4361 - pte_update((vma)->vm_mm, addr, ptep); \
4365 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
4366 #define ptep_test_and_clear_young(vma, addr, ptep) ({ \
4368 @@ -322,44 +311,13 @@ static inline pte_t xen_local_ptep_get_a
4373 - * Rules for using ptep_establish: the pte MUST be a user pte, and
4374 - * must be a present->present transition.
4376 -#define __HAVE_ARCH_PTEP_ESTABLISH
4377 -#define ptep_establish(vma, address, ptep, pteval) \
4379 - if ( likely((vma)->vm_mm == current->mm) ) { \
4380 - BUG_ON(HYPERVISOR_update_va_mapping(address, \
4382 - (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \
4383 - UVMF_INVLPG|UVMF_MULTI)); \
4385 - xen_l1_entry_update(ptep, pteval); \
4386 - flush_tlb_page(vma, address); \
4390 -#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
4391 -#define ptep_clear_flush_dirty(vma, address, ptep) \
4393 - pte_t __pte = *(ptep); \
4394 - int __dirty = pte_dirty(__pte); \
4395 - __pte = pte_mkclean(__pte); \
4396 - if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \
4397 - (void)ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \
4398 - else if (__dirty) \
4399 - (ptep)->pte_low = __pte.pte_low; \
4403 #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
4404 #define ptep_clear_flush_young(vma, address, ptep) \
4406 pte_t __pte = *(ptep); \
4407 int __young = pte_young(__pte); \
4408 __pte = pte_mkold(__pte); \
4409 - if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \
4410 + if (PagePinned(virt_to_page((vma)->vm_mm->pgd))) \
4411 (void)ptep_set_access_flags(vma, address, ptep, __pte, __young); \
4413 (ptep)->pte_low = __pte.pte_low; \
4414 @@ -383,7 +341,7 @@ static inline pte_t ptep_get_and_clear(s
4415 #define ptep_get_and_clear_full(mm, addr, ptep, full) \
4417 pte_t __res = *(ptep); \
4418 - if (test_bit(PG_pinned, &virt_to_page((mm)->pgd)->flags)) \
4419 + if (PagePinned(virt_to_page((mm)->pgd))) \
4420 xen_l1_entry_update(ptep, __pte(0)); \
4422 *(ptep) = __pte(0); \
4423 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable-3level.h
4424 ===================================================================
4425 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgtable-3level.h 2008-12-01 11:36:13.000000000 +0100
4426 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable-3level.h 2008-12-01 11:36:47.000000000 +0100
4428 #define pud_present(pud) 1
4431 - * Is the pte executable?
4433 -static inline int pte_x(pte_t pte)
4435 - return !(__pte_val(pte) & _PAGE_NX);
4439 - * All present user-pages with !NX bit are user-executable:
4441 -static inline int pte_exec(pte_t pte)
4443 - return pte_user(pte) && pte_x(pte);
4446 * All present pages with !NX bit are kernel-executable:
4448 static inline int pte_exec_kernel(pte_t pte)
4450 - return pte_x(pte);
4451 + return !(__pte_val(pte) & _PAGE_NX);
4454 /* Rules for using set_pte: the pte being assigned *must* be
4455 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/processor_32.h
4456 ===================================================================
4457 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/processor_32.h 2008-12-01 11:36:13.000000000 +0100
4458 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/processor_32.h 2008-12-01 11:36:47.000000000 +0100
4459 @@ -89,7 +89,6 @@ struct cpuinfo_x86 {
4460 #define X86_VENDOR_UMC 3
4461 #define X86_VENDOR_NEXGEN 4
4462 #define X86_VENDOR_CENTAUR 5
4463 -#define X86_VENDOR_RISE 6
4464 #define X86_VENDOR_TRANSMETA 7
4465 #define X86_VENDOR_NSC 8
4466 #define X86_VENDOR_NUM 9
4467 @@ -122,6 +121,7 @@ void __init cpu_detect(struct cpuinfo_x8
4468 extern void identify_boot_cpu(void);
4469 extern void identify_secondary_cpu(struct cpuinfo_x86 *);
4470 extern void print_cpu_info(struct cpuinfo_x86 *);
4471 +extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
4472 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
4473 extern unsigned short num_cache_leaves;
4475 @@ -171,17 +171,6 @@ static inline void clear_in_cr4 (unsigne
4480 - * NSC/Cyrix CPU indexed register access macros
4483 -#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); })
4485 -#define setCx86(reg, data) do { \
4486 - outb((reg), 0x22); \
4487 - outb((data), 0x23); \
4490 /* Stop speculative execution */
4491 static inline void sync_core(void)
4493 @@ -230,6 +219,10 @@ extern int bootloader_type;
4495 #define HAVE_ARCH_PICK_MMAP_LAYOUT
4497 +extern void hard_disable_TSC(void);
4498 +extern void disable_TSC(void);
4499 +extern void hard_enable_TSC(void);
4502 * Size of io_bitmap.
4504 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/system_32.h
4505 ===================================================================
4506 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/system_32.h 2008-12-01 11:36:13.000000000 +0100
4507 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/system_32.h 2008-12-01 11:36:47.000000000 +0100
4508 @@ -205,11 +205,6 @@ static inline unsigned long get_limit(un
4513 - * Actually only lfence would be needed for mb() because all stores done
4514 - * by the kernel should be already ordered. But keep a full barrier for now.
4517 #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)
4518 #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)
4520 @@ -301,15 +296,6 @@ void enable_hlt(void);
4521 extern int es7000_plat;
4522 void cpu_idle_wait(void);
4525 - * On SMP systems, when the scheduler does migration-cost autodetection,
4526 - * it needs a way to flush as much of the CPU's caches as possible:
4528 -static inline void sched_cacheflush(void)
4533 extern unsigned long arch_align_stack(unsigned long sp);
4534 extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
4536 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/tlbflush_32.h
4537 ===================================================================
4538 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/tlbflush_32.h 2008-12-01 11:36:13.000000000 +0100
4539 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/tlbflush_32.h 2008-12-01 11:36:47.000000000 +0100
4540 @@ -91,7 +91,11 @@ struct tlb_state
4541 DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate);
4544 -#define flush_tlb_kernel_range(start, end) flush_tlb_all()
4545 +static inline void flush_tlb_kernel_range(unsigned long start,
4546 + unsigned long end)
4551 static inline void flush_tlb_pgtables(struct mm_struct *mm,
4552 unsigned long start, unsigned long end)
4553 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/fixmap_64.h
4554 ===================================================================
4555 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/fixmap_64.h 2008-12-01 11:36:13.000000000 +0100
4556 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/fixmap_64.h 2008-12-01 11:36:47.000000000 +0100
4558 * compile time, but to set the physical address only
4559 * in the boot process.
4561 - * these 'compile-time allocated' memory buffers are
4562 - * fixed-size 4k pages. (or larger if used with an increment
4563 - * highger than 1) use fixmap_set(idx,phys) to associate
4564 + * These 'compile-time allocated' memory buffers are
4565 + * fixed-size 4k pages (or larger if used with an increment
4566 + * higher than 1). Use set_fixmap(idx,phys) to associate
4567 * physical memory with fixmap indices.
4569 * TLB entries of such buffers will not be flushed across
4570 @@ -36,6 +36,8 @@ enum fixed_addresses {
4572 VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
4575 + FIX_EARLYCON_MEM_BASE,
4577 #ifdef CONFIG_X86_LOCAL_APIC
4578 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
4579 @@ -105,7 +107,7 @@ static __always_inline unsigned long fix
4580 if (idx >= __end_of_fixed_addresses)
4581 __this_fixmap_does_not_exist();
4583 - return __fix_to_virt(idx);
4584 + return __fix_to_virt(idx);
4588 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/io_64.h
4589 ===================================================================
4590 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/io_64.h 2008-12-01 11:36:07.000000000 +0100
4591 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/io_64.h 2008-12-01 11:36:47.000000000 +0100
4592 @@ -162,6 +162,7 @@ extern void bt_iounmap(void *addr, unsig
4594 extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
4595 extern void iounmap(volatile void __iomem *addr);
4596 +extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
4599 * ISA I/O bus memory addresses are 1:1 with the physical address.
4600 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/mmu_context_64.h
4601 ===================================================================
4602 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/mmu_context_64.h 2008-12-01 11:36:13.000000000 +0100
4603 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/mmu_context_64.h 2008-12-01 11:36:47.000000000 +0100
4604 @@ -76,7 +76,7 @@ static inline void switch_mm(struct mm_s
4606 if (likely(prev != next)) {
4607 BUG_ON(!xen_feature(XENFEAT_writable_page_tables) &&
4608 - !next->context.pinned);
4609 + !PagePinned(virt_to_page(next->pgd)));
4611 /* stop flush ipis for the previous mm */
4612 cpu_clear(cpu, prev->cpu_vm_mask);
4613 @@ -131,7 +131,7 @@ static inline void switch_mm(struct mm_s
4615 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
4617 - if (!next->context.pinned)
4618 + if (!PagePinned(virt_to_page(next->pgd)))
4620 switch_mm(prev, next, NULL);
4622 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/page_64.h
4623 ===================================================================
4624 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/page_64.h 2008-12-01 11:36:13.000000000 +0100
4625 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/page_64.h 2008-12-01 11:36:47.000000000 +0100
4626 @@ -72,7 +72,8 @@ void copy_page(void *, void *);
4627 #define clear_user_page(page, vaddr, pg) clear_page(page)
4628 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
4630 -#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr)
4631 +#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
4632 + alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
4633 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
4636 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pci_64.h
4637 ===================================================================
4638 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pci_64.h 2007-09-14 11:14:51.000000000 +0200
4639 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/pci_64.h 2008-12-01 11:36:47.000000000 +0100
4644 +struct pci_sysdata {
4645 + int node; /* NUMA node */
4646 + void* iommu; /* IOMMU private data */
4649 +extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
4651 +#ifdef CONFIG_CALGARY_IOMMU
4652 +static inline void* pci_iommu(struct pci_bus *bus)
4654 + struct pci_sysdata *sd = bus->sysdata;
4658 +static inline void set_pci_iommu(struct pci_bus *bus, void *val)
4660 + struct pci_sysdata *sd = bus->sysdata;
4663 +#endif /* CONFIG_CALGARY_IOMMU */
4665 #include <linux/mm.h> /* for struct page */
4667 /* Can be used to override the logic in pci_scan_bus for skipping
4668 @@ -56,14 +77,6 @@ extern int iommu_setup(char *opt);
4670 #if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
4673 - * x86-64 always supports DAC, but sometimes it is useful to force
4674 - * devices through the IOMMU to get automatic sg list merging.
4675 - * Optional right now.
4677 -extern int iommu_sac_force;
4678 -#define pci_dac_dma_supported(pci_dev, mask) (!iommu_sac_force)
4680 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
4681 dma_addr_t ADDR_NAME;
4682 #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
4683 @@ -97,8 +110,6 @@ extern int iommu_sac_force;
4687 -#define pci_dac_dma_supported(pci_dev, mask) 1
4689 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
4690 #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
4691 #define pci_unmap_addr(PTR, ADDR_NAME) (0)
4692 @@ -110,36 +121,6 @@ extern int iommu_sac_force;
4694 #include <asm-generic/pci-dma-compat.h>
4696 -static inline dma64_addr_t
4697 -pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
4699 - return ((dma64_addr_t) page_to_phys(page) +
4700 - (dma64_addr_t) offset);
4703 -static inline struct page *
4704 -pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
4706 - return virt_to_page(__va(dma_addr));
4709 -static inline unsigned long
4710 -pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
4712 - return (dma_addr & ~PAGE_MASK);
4716 -pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
4721 -pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
4723 - flush_write_buffers();
4727 static inline void pci_dma_burst_advice(struct pci_dev *pdev,
4728 enum pci_dma_burst_strategy *strat,
4729 @@ -154,10 +135,6 @@ static inline void pci_dma_burst_advice(
4730 extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
4731 enum pci_mmap_state mmap_state, int write_combine);
4733 -static inline void pcibios_add_platform_entries(struct pci_dev *dev)
4737 #endif /* __KERNEL__ */
4739 /* generic pci stuff */
4740 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgalloc_64.h
4741 ===================================================================
4742 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgalloc_64.h 2008-12-01 11:36:13.000000000 +0100
4743 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgalloc_64.h 2008-12-01 11:36:47.000000000 +0100
4744 @@ -21,7 +21,7 @@ static inline void pmd_populate_kernel(s
4746 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
4748 - if (unlikely((mm)->context.pinned)) {
4749 + if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) {
4750 BUG_ON(HYPERVISOR_update_va_mapping(
4751 (unsigned long)__va(page_to_pfn(pte) << PAGE_SHIFT),
4752 pfn_pte(page_to_pfn(pte), PAGE_KERNEL_RO), 0));
4753 @@ -33,7 +33,7 @@ static inline void pmd_populate(struct m
4755 static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
4757 - if (unlikely((mm)->context.pinned)) {
4758 + if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) {
4759 BUG_ON(HYPERVISOR_update_va_mapping(
4761 pfn_pte(virt_to_phys(pmd)>>PAGE_SHIFT,
4762 @@ -50,7 +50,7 @@ static inline void pud_populate(struct m
4764 static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
4766 - if (unlikely((mm)->context.pinned)) {
4767 + if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) {
4768 BUG_ON(HYPERVISOR_update_va_mapping(
4770 pfn_pte(virt_to_phys(pud)>>PAGE_SHIFT,
4771 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_64.h
4772 ===================================================================
4773 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-01 11:36:13.000000000 +0100
4774 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-01 11:36:47.000000000 +0100
4775 @@ -302,7 +302,7 @@ static inline pte_t ptep_get_and_clear_f
4779 - if (mm->context.pinned)
4780 + if (PagePinned(virt_to_page(mm->pgd)))
4781 xen_l1_entry_update(ptep, __pte(0));
4784 @@ -331,21 +331,15 @@ static inline pte_t ptep_get_and_clear_f
4785 * Undefined behaviour if not..
4787 #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
4788 -static inline int pte_user(pte_t pte) { return __pte_val(pte) & _PAGE_USER; }
4789 -static inline int pte_read(pte_t pte) { return __pte_val(pte) & _PAGE_USER; }
4790 -static inline int pte_exec(pte_t pte) { return !(__pte_val(pte) & _PAGE_NX); }
4791 static inline int pte_dirty(pte_t pte) { return __pte_val(pte) & _PAGE_DIRTY; }
4792 static inline int pte_young(pte_t pte) { return __pte_val(pte) & _PAGE_ACCESSED; }
4793 static inline int pte_write(pte_t pte) { return __pte_val(pte) & _PAGE_RW; }
4794 static inline int pte_file(pte_t pte) { return __pte_val(pte) & _PAGE_FILE; }
4795 static inline int pte_huge(pte_t pte) { return __pte_val(pte) & _PAGE_PSE; }
4797 -static inline pte_t pte_rdprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_USER; return pte; }
4798 -static inline pte_t pte_exprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_USER; return pte; }
4799 static inline pte_t pte_mkclean(pte_t pte) { __pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
4800 static inline pte_t pte_mkold(pte_t pte) { __pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
4801 static inline pte_t pte_wrprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_RW; return pte; }
4802 -static inline pte_t pte_mkread(pte_t pte) { __pte_val(pte) |= _PAGE_USER; return pte; }
4803 static inline pte_t pte_mkexec(pte_t pte) { __pte_val(pte) &= ~_PAGE_NX; return pte; }
4804 static inline pte_t pte_mkdirty(pte_t pte) { __pte_val(pte) |= _PAGE_DIRTY; return pte; }
4805 static inline pte_t pte_mkyoung(pte_t pte) { __pte_val(pte) |= _PAGE_ACCESSED; return pte; }
4806 @@ -353,13 +347,6 @@ static inline pte_t pte_mkwrite(pte_t pt
4807 static inline pte_t pte_mkhuge(pte_t pte) { __pte_val(pte) |= _PAGE_PSE; return pte; }
4808 static inline pte_t pte_clrhuge(pte_t pte) { __pte_val(pte) &= ~_PAGE_PSE; return pte; }
4810 -static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
4812 - if (!pte_dirty(*ptep))
4814 - return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte);
4817 static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
4819 if (!pte_young(*ptep))
4820 @@ -498,26 +485,13 @@ static inline pte_t pte_modify(pte_t pte
4824 -#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
4825 -#define ptep_clear_flush_dirty(vma, address, ptep) \
4827 - pte_t __pte = *(ptep); \
4828 - int __dirty = pte_dirty(__pte); \
4829 - __pte = pte_mkclean(__pte); \
4830 - if ((vma)->vm_mm->context.pinned) \
4831 - (void)ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \
4832 - else if (__dirty) \
4833 - set_pte(ptep, __pte); \
4837 #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
4838 #define ptep_clear_flush_young(vma, address, ptep) \
4840 pte_t __pte = *(ptep); \
4841 int __young = pte_young(__pte); \
4842 __pte = pte_mkold(__pte); \
4843 - if ((vma)->vm_mm->context.pinned) \
4844 + if (PagePinned(virt_to_page((vma)->vm_mm->pgd))) \
4845 (void)ptep_set_access_flags(vma, address, ptep, __pte, __young); \
4847 set_pte(ptep, __pte); \
4848 @@ -568,6 +542,8 @@ int xen_change_pte_range(struct mm_struc
4849 #define arch_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) \
4850 xen_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable)
4852 +pte_t *lookup_address(unsigned long addr);
4854 #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
4855 direct_remap_pfn_range(vma,vaddr,pfn,size,prot,DOMID_IO)
4857 @@ -585,7 +561,6 @@ int xen_change_pte_range(struct mm_struc
4858 (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o))
4860 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
4861 -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
4862 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
4863 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
4864 #define __HAVE_ARCH_PTEP_CLEAR_FLUSH
4865 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/processor_64.h
4866 ===================================================================
4867 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/processor_64.h 2008-12-01 11:36:13.000000000 +0100
4868 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/processor_64.h 2008-12-01 11:36:47.000000000 +0100
4869 @@ -83,7 +83,6 @@ struct cpuinfo_x86 {
4870 #define X86_VENDOR_UMC 3
4871 #define X86_VENDOR_NEXGEN 4
4872 #define X86_VENDOR_CENTAUR 5
4873 -#define X86_VENDOR_RISE 6
4874 #define X86_VENDOR_TRANSMETA 7
4875 #define X86_VENDOR_NUM 8
4876 #define X86_VENDOR_UNKNOWN 0xff
4877 @@ -100,6 +99,7 @@ extern char ignore_irq13;
4879 extern void identify_cpu(struct cpuinfo_x86 *);
4880 extern void print_cpu_info(struct cpuinfo_x86 *);
4881 +extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
4882 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
4883 extern unsigned short num_cache_leaves;
4885 @@ -377,12 +377,10 @@ static inline void sync_core(void)
4886 asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
4889 -#define cpu_has_fpu 1
4891 #define ARCH_HAS_PREFETCH
4892 static inline void prefetch(void *x)
4894 - asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x));
4895 + asm volatile("prefetcht0 (%0)" :: "r" (x));
4898 #define ARCH_HAS_PREFETCHW 1
4899 @@ -400,17 +398,6 @@ static inline void prefetchw(void *x)
4901 #define cpu_relax() rep_nop()
4904 - * NSC/Cyrix CPU indexed register access macros
4907 -#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); })
4909 -#define setCx86(reg, data) do { \
4910 - outb((reg), 0x22); \
4911 - outb((data), 0x23); \
4914 static inline void serialize_cpu(void)
4916 __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
4917 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/system_64.h
4918 ===================================================================
4919 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/system_64.h 2008-12-01 11:36:13.000000000 +0100
4920 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/system_64.h 2008-12-01 11:36:47.000000000 +0100
4921 @@ -79,12 +79,16 @@ static inline unsigned long read_cr0(voi
4923 asm volatile("movq %%cr0,%0" : "=r" (cr0));
4928 static inline void write_cr0(unsigned long val)
4930 asm volatile("movq %0,%%cr0" :: "r" (val));
4934 +#define read_cr2() current_vcpu_info()->arch.cr2
4936 +#define write_cr2(val) ((void)(current_vcpu_info()->arch.cr2 = (val)))
4938 #define read_cr3() ({ \
4939 unsigned long __dummy; \
4940 @@ -103,27 +107,28 @@ static inline unsigned long read_cr4(voi
4942 asm("movq %%cr4,%0" : "=r" (cr4));
4947 static inline void write_cr4(unsigned long val)
4949 asm volatile("movq %0,%%cr4" :: "r" (val) : "memory");
4952 -#define stts() (HYPERVISOR_fpu_taskswitch(1))
4956 - __asm__ __volatile__ ("wbinvd": : :"memory");
4957 +static inline unsigned long read_cr8(void)
4963 - * On SMP systems, when the scheduler does migration-cost autodetection,
4964 - * it needs a way to flush as much of the CPU's caches as possible.
4966 -static inline void sched_cacheflush(void)
4967 +static inline void write_cr8(unsigned long val)
4973 +#define stts() (HYPERVISOR_fpu_taskswitch(1))
4976 + __asm__ __volatile__ ("wbinvd": : :"memory")
4978 #endif /* __KERNEL__ */
4980 #define nop() __asm__ __volatile__ ("nop")
4981 Index: head-2008-12-01/include/asm-x86/mach-xen/asm/tlbflush_64.h
4982 ===================================================================
4983 --- head-2008-12-01.orig/include/asm-x86/mach-xen/asm/tlbflush_64.h 2008-12-01 11:36:13.000000000 +0100
4984 +++ head-2008-12-01/include/asm-x86/mach-xen/asm/tlbflush_64.h 2008-12-01 11:36:47.000000000 +0100
4985 @@ -89,7 +89,11 @@ static inline void flush_tlb_range(struc
4989 -#define flush_tlb_kernel_range(start, end) flush_tlb_all()
4990 +static inline void flush_tlb_kernel_range(unsigned long start,
4991 + unsigned long end)
4996 static inline void flush_tlb_pgtables(struct mm_struct *mm,
4997 unsigned long start, unsigned long end)
4998 Index: head-2008-12-01/include/asm-x86/thread_info.h
4999 ===================================================================
5000 --- head-2008-12-01.orig/include/asm-x86/thread_info.h 2008-12-01 11:28:55.000000000 +0100
5001 +++ head-2008-12-01/include/asm-x86/thread_info.h 2008-12-01 11:36:47.000000000 +0100
5002 @@ -150,7 +150,8 @@ struct thread_info {
5003 #define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW
5004 #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
5006 -#define _TIF_WORK_CTXSW _TIF_DEBUG
5007 +#define _TIF_WORK_CTXSW_NEXT (_TIF_NOTSC | _TIF_DEBUG)
5008 +#define _TIF_WORK_CTXSW_PREV (_TIF_NOTSC)
5011 #define PREEMPT_ACTIVE 0x10000000
5012 Index: head-2008-12-01/include/asm-x86/xen/interface.h
5013 ===================================================================
5014 --- head-2008-12-01.orig/include/asm-x86/xen/interface.h 2008-12-01 10:53:14.000000000 +0100
5015 +++ head-2008-12-01/include/asm-x86/xen/interface.h 2008-12-01 11:36:47.000000000 +0100
5017 #define __ASM_X86_XEN_INTERFACE_H
5020 -#define __DEFINE_GUEST_HANDLE(name, type) \
5021 +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
5022 typedef struct { type *p; } __guest_handle_ ## name
5024 -#define __DEFINE_GUEST_HANDLE(name, type) \
5025 +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
5026 typedef type * __guest_handle_ ## name
5029 -#define DEFINE_GUEST_HANDLE_STRUCT(name) \
5030 - __DEFINE_GUEST_HANDLE(name, struct name)
5031 -#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
5032 -#define GUEST_HANDLE(name) __guest_handle_ ## name
5033 +#define DEFINE_XEN_GUEST_HANDLE_STRUCT(name) \
5034 + __DEFINE_XEN_GUEST_HANDLE(name, struct name)
5035 +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
5036 +#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
5039 #if defined(__i386__)
5043 #ifndef __ASSEMBLY__
5044 -/* Guest handles for primitive C types. */
5045 -__DEFINE_GUEST_HANDLE(uchar, unsigned char);
5046 -__DEFINE_GUEST_HANDLE(uint, unsigned int);
5047 -__DEFINE_GUEST_HANDLE(ulong, unsigned long);
5048 -DEFINE_GUEST_HANDLE(char);
5049 -DEFINE_GUEST_HANDLE(int);
5050 -DEFINE_GUEST_HANDLE(long);
5051 -DEFINE_GUEST_HANDLE(void);
5052 +typedef unsigned long xen_pfn_t;
5053 +typedef unsigned long xen_ulong_t;
5056 #ifndef HYPERVISOR_VIRT_START
5057 @@ -103,7 +97,7 @@ struct trap_info {
5058 uint16_t cs; /* code selector */
5059 unsigned long address; /* code offset */
5061 -DEFINE_GUEST_HANDLE_STRUCT(trap_info);
5062 +DEFINE_XEN_GUEST_HANDLE_STRUCT(trap_info);
5064 struct arch_shared_info {
5065 unsigned long max_pfn; /* max pfn that appears in table */
5066 @@ -157,7 +151,7 @@ struct vcpu_guest_context {
5067 uint64_t gs_base_user;
5070 -DEFINE_GUEST_HANDLE_STRUCT(vcpu_guest_context);
5071 +DEFINE_XEN_GUEST_HANDLE_STRUCT(vcpu_guest_context);
5072 #endif /* !__ASSEMBLY__ */
5075 Index: head-2008-12-01/include/asm-x86/xen/interface_32.h
5076 ===================================================================
5077 --- head-2008-12-01.orig/include/asm-x86/xen/interface_32.h 2008-12-01 10:53:14.000000000 +0100
5078 +++ head-2008-12-01/include/asm-x86/xen/interface_32.h 2008-12-01 11:36:47.000000000 +0100
5079 @@ -62,7 +62,7 @@ struct cpu_user_regs {
5083 -DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
5084 +DEFINE_XEN_GUEST_HANDLE_STRUCT(cpu_user_regs);
5086 typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
5088 Index: head-2008-12-01/include/linux/elfnote.h
5089 ===================================================================
5090 --- head-2008-12-01.orig/include/linux/elfnote.h 2008-12-01 10:53:14.000000000 +0100
5091 +++ head-2008-12-01/include/linux/elfnote.h 2008-12-01 11:36:47.000000000 +0100
5096 -#define ELFNOTE(name, type, desc) \
5097 +#define ELFNOTE(name, type, desc...) \
5098 ELFNOTE_START(name, type, "") \
5101 Index: head-2008-12-01/include/linux/page-flags.h
5102 ===================================================================
5103 --- head-2008-12-01.orig/include/linux/page-flags.h 2008-12-01 11:25:57.000000000 +0100
5104 +++ head-2008-12-01/include/linux/page-flags.h 2008-12-01 11:36:47.000000000 +0100
5105 @@ -99,6 +99,10 @@ enum pageflags {
5108 PG_foreign, /* Page is owned by foreign allocator. */
5109 + PG_pinned, /* Cannot alias with PG_owner_priv_1 since
5110 + * bad_page() checks include this bit.
5111 + * Also cannot use PG_arch_1 since that now
5112 + * has a different purpose on x86. */
5116 Index: head-2008-12-01/include/linux/skbuff.h
5117 ===================================================================
5118 --- head-2008-12-01.orig/include/linux/skbuff.h 2008-12-01 11:29:05.000000000 +0100
5119 +++ head-2008-12-01/include/linux/skbuff.h 2008-12-01 11:36:47.000000000 +0100
5120 @@ -1772,7 +1772,7 @@ static inline void skb_forward_csum(stru
5122 bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
5125 +#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN)
5126 int skb_checksum_setup(struct sk_buff *skb);
5128 static inline int skb_checksum_setup(struct sk_buff *skb) { return 0; }
5129 Index: head-2008-12-01/include/xen/driver_util.h
5130 ===================================================================
5131 --- head-2008-12-01.orig/include/xen/driver_util.h 2007-06-12 13:14:19.000000000 +0200
5132 +++ head-2008-12-01/include/xen/driver_util.h 2008-12-01 11:36:47.000000000 +0100
5134 #include <linux/vmalloc.h>
5135 #include <linux/device.h>
5137 -/* Allocate/destroy a 'vmalloc' VM area. */
5138 -extern struct vm_struct *alloc_vm_area(unsigned long size);
5139 -extern void free_vm_area(struct vm_struct *area);
5141 extern struct class *get_xen_class(void);
5143 #endif /* __ASM_XEN_DRIVER_UTIL_H__ */
5144 Index: head-2008-12-01/include/xen/features.h
5145 ===================================================================
5146 --- head-2008-12-01.orig/include/xen/features.h 2008-12-01 10:53:14.000000000 +0100
5147 +++ head-2008-12-01/include/xen/features.h 2008-12-01 11:36:47.000000000 +0100
5149 #define __XEN_FEATURES_H__
5151 #include <xen/interface/features.h>
5152 +#include <xen/interface/version.h>
5154 void xen_setup_features(void);
5156 @@ -20,4 +21,4 @@ static inline int xen_feature(int flag)
5157 return xen_features[flag];
5160 -#endif /* __ASM_XEN_FEATURES_H__ */
5161 +#endif /* __XEN_FEATURES_H__ */
5162 Index: head-2008-12-01/include/xen/interface/arch-x86/xen.h
5163 ===================================================================
5164 --- head-2008-12-01.orig/include/xen/interface/arch-x86/xen.h 2008-09-01 12:07:31.000000000 +0200
5165 +++ head-2008-12-01/include/xen/interface/arch-x86/xen.h 2008-12-01 11:36:47.000000000 +0100
5167 #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
5170 +/* Allow co-existing Linux 2.6.23+ Xen interface definitions. */
5171 +#define DEFINE_XEN_GUEST_HANDLE_STRUCT(name) struct name
5173 #if defined(__i386__)
5174 #include "xen-x86_32.h"
5175 #elif defined(__x86_64__)
5176 Index: head-2008-12-01/include/xen/interface/event_channel.h
5177 ===================================================================
5178 --- head-2008-12-01.orig/include/xen/interface/event_channel.h 2008-12-01 11:22:58.000000000 +0100
5179 +++ head-2008-12-01/include/xen/interface/event_channel.h 2008-12-01 11:36:47.000000000 +0100
5180 @@ -248,6 +248,7 @@ struct evtchn_op {
5181 struct evtchn_unmask unmask;
5184 +DEFINE_XEN_GUEST_HANDLE_STRUCT(evtchn_op);
5185 typedef struct evtchn_op evtchn_op_t;
5186 DEFINE_XEN_GUEST_HANDLE(evtchn_op_t);
5188 Index: head-2008-12-01/include/xen/interface/io/netif.h
5189 ===================================================================
5190 --- head-2008-12-01.orig/include/xen/interface/io/netif.h 2008-12-01 11:22:58.000000000 +0100
5191 +++ head-2008-12-01/include/xen/interface/io/netif.h 2008-12-01 11:36:47.000000000 +0100
5192 @@ -183,8 +183,22 @@ typedef struct netif_rx_response netif_r
5193 * Generate netif ring structures and types.
5196 +#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
5197 DEFINE_RING_TYPES(netif_tx, struct netif_tx_request, struct netif_tx_response);
5198 DEFINE_RING_TYPES(netif_rx, struct netif_rx_request, struct netif_rx_response);
5200 +#define xen_netif_tx_request netif_tx_request
5201 +#define xen_netif_rx_request netif_rx_request
5202 +#define xen_netif_tx_response netif_tx_response
5203 +#define xen_netif_rx_response netif_rx_response
5204 +DEFINE_RING_TYPES(xen_netif_tx,
5205 + struct xen_netif_tx_request,
5206 + struct xen_netif_tx_response);
5207 +DEFINE_RING_TYPES(xen_netif_rx,
5208 + struct xen_netif_rx_request,
5209 + struct xen_netif_rx_response);
5210 +#define xen_netif_extra_info netif_extra_info
5213 #define NETIF_RSP_DROPPED -2
5214 #define NETIF_RSP_ERROR -1
5215 Index: head-2008-12-01/include/xen/interface/memory.h
5216 ===================================================================
5217 --- head-2008-12-01.orig/include/xen/interface/memory.h 2008-12-01 11:22:59.000000000 +0100
5218 +++ head-2008-12-01/include/xen/interface/memory.h 2008-12-01 11:36:47.000000000 +0100
5219 @@ -82,6 +82,7 @@ struct xen_memory_reservation {
5223 +DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_memory_reservation);
5224 typedef struct xen_memory_reservation xen_memory_reservation_t;
5225 DEFINE_XEN_GUEST_HANDLE(xen_memory_reservation_t);
5227 @@ -175,6 +176,7 @@ struct xen_machphys_mfn_list {
5229 unsigned int nr_extents;
5231 +DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
5232 typedef struct xen_machphys_mfn_list xen_machphys_mfn_list_t;
5233 DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn_list_t);
5235 @@ -214,6 +216,7 @@ struct xen_add_to_physmap {
5236 /* GPFN where the source mapping page should appear. */
5239 +DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
5240 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
5241 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
5243 @@ -254,6 +257,7 @@ struct xen_translate_gpfn_list {
5245 XEN_GUEST_HANDLE(xen_pfn_t) mfn_list;
5247 +DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
5248 typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t;
5249 DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t);
5251 Index: head-2008-12-01/include/xen/interface/sched.h
5252 ===================================================================
5253 --- head-2008-12-01.orig/include/xen/interface/sched.h 2008-12-01 11:22:59.000000000 +0100
5254 +++ head-2008-12-01/include/xen/interface/sched.h 2008-12-01 11:36:47.000000000 +0100
5256 struct sched_shutdown {
5257 unsigned int reason; /* SHUTDOWN_* */
5259 +DEFINE_XEN_GUEST_HANDLE_STRUCT(sched_shutdown);
5260 typedef struct sched_shutdown sched_shutdown_t;
5261 DEFINE_XEN_GUEST_HANDLE(sched_shutdown_t);
5263 @@ -81,6 +82,7 @@ struct sched_poll {
5264 unsigned int nr_ports;
5267 +DEFINE_XEN_GUEST_HANDLE_STRUCT(sched_poll);
5268 typedef struct sched_poll sched_poll_t;
5269 DEFINE_XEN_GUEST_HANDLE(sched_poll_t);
5271 Index: head-2008-12-01/include/xen/interface/version.h
5272 ===================================================================
5273 --- head-2008-12-01.orig/include/xen/interface/version.h 2008-12-01 11:22:59.000000000 +0100
5274 +++ head-2008-12-01/include/xen/interface/version.h 2008-12-01 11:36:47.000000000 +0100
5276 /* arg == xen_extraversion_t. */
5277 #define XENVER_extraversion 1
5278 typedef char xen_extraversion_t[16];
5279 +struct xen_extraversion {
5280 + xen_extraversion_t extraversion;
5282 #define XEN_EXTRAVERSION_LEN (sizeof(xen_extraversion_t))
5284 /* arg == xen_compile_info_t. */
5285 @@ -50,10 +53,16 @@ typedef struct xen_compile_info xen_comp
5287 #define XENVER_capabilities 3
5288 typedef char xen_capabilities_info_t[1024];
5289 +struct xen_capabilities_info {
5290 + xen_capabilities_info_t info;
5292 #define XEN_CAPABILITIES_INFO_LEN (sizeof(xen_capabilities_info_t))
5294 #define XENVER_changeset 4
5295 typedef char xen_changeset_info_t[64];
5296 +struct xen_changeset_info {
5297 + xen_changeset_info_t info;
5299 #define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t))
5301 #define XENVER_platform_parameters 5
5302 Index: head-2008-12-01/include/xen/interface/xen.h
5303 ===================================================================
5304 --- head-2008-12-01.orig/include/xen/interface/xen.h 2008-12-01 11:22:59.000000000 +0100
5305 +++ head-2008-12-01/include/xen/interface/xen.h 2008-12-01 11:36:47.000000000 +0100
5307 #include <asm/pvclock-abi.h>
5310 -#if defined(__i386__) || defined(__x86_64__)
5311 +#if defined(CONFIG_PARAVIRT_XEN) && !defined(HAVE_XEN_PLATFORM_COMPAT_H)
5312 +#include <asm/xen/interface.h>
5313 +#elif defined(__i386__) || defined(__x86_64__)
5314 #include "arch-x86/xen.h"
5315 #elif defined(__ia64__)
5316 #include "arch-ia64.h"
5317 @@ -110,7 +112,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
5320 /* New sched_op hypercall introduced in 0x00030101. */
5321 -#if __XEN_INTERFACE_VERSION__ < 0x00030101
5322 +#if __XEN_INTERFACE_VERSION__ < 0x00030101 || (defined(CONFIG_PARAVIRT_XEN) && !defined(HAVE_XEN_PLATFORM_COMPAT_H))
5323 #undef __HYPERVISOR_sched_op
5324 #define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
5326 @@ -124,7 +126,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
5329 /* New platform_op hypercall introduced in 0x00030204. */
5330 -#if __XEN_INTERFACE_VERSION__ < 0x00030204
5331 +#if __XEN_INTERFACE_VERSION__ < 0x00030204 || (defined(CONFIG_PARAVIRT_XEN) && !defined(HAVE_XEN_PLATFORM_COMPAT_H))
5332 #define __HYPERVISOR_dom0_op __HYPERVISOR_platform_op
5335 @@ -283,6 +285,7 @@ struct mmuext_op {
5339 +DEFINE_XEN_GUEST_HANDLE_STRUCT(mmuext_op);
5340 typedef struct mmuext_op mmuext_op_t;
5341 DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
5343 @@ -365,6 +368,7 @@ struct mmu_update {
5344 uint64_t ptr; /* Machine address of PTE. */
5345 uint64_t val; /* New contents of PTE. */
5347 +DEFINE_XEN_GUEST_HANDLE_STRUCT(mmu_update);
5348 typedef struct mmu_update mmu_update_t;
5349 DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
5351 @@ -373,9 +377,15 @@ DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
5352 * NB. The fields are natural register size for this architecture.
5354 struct multicall_entry {
5355 - unsigned long op, result;
5357 +#if !defined(CONFIG_PARAVIRT_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
5358 + unsigned long result;
5362 unsigned long args[6];
5364 +DEFINE_XEN_GUEST_HANDLE_STRUCT(multicall_entry);
5365 typedef struct multicall_entry multicall_entry_t;
5366 DEFINE_XEN_GUEST_HANDLE(multicall_entry_t);
5368 Index: head-2008-12-01/include/xen/xenbus.h
5369 ===================================================================
5370 --- head-2008-12-01.orig/include/xen/xenbus.h 2008-12-01 11:36:07.000000000 +0100
5371 +++ head-2008-12-01/include/xen/xenbus.h 2008-12-01 11:36:47.000000000 +0100
5372 @@ -57,16 +57,20 @@ struct xenbus_watch
5373 void (*callback)(struct xenbus_watch *,
5374 const char **vec, unsigned int len);
5376 +#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
5377 /* See XBWF_ definitions below. */
5378 unsigned long flags;
5382 +#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
5384 * Execute callback in its own kthread. Useful if the callback is long
5385 * running or heavily serialised, to avoid taking out the main xenwatch thread
5386 * for a long period of time (or even unwittingly causing a deadlock).
5388 #define XBWF_new_thread 1
5391 /* A xenbus device. */
5392 struct xenbus_device {
5393 @@ -214,6 +218,7 @@ int xenbus_watch_path(struct xenbus_devi
5394 const char **, unsigned int));
5397 +#if defined(CONFIG_XEN) || defined(HAVE_XEN_PLATFORM_COMPAT_H)
5399 * Register a watch on the given path/path2, using the given xenbus_watch
5400 * structure for storage, and the given callback function as the callback.
5401 @@ -227,7 +232,13 @@ int xenbus_watch_path2(struct xenbus_dev
5402 const char *path2, struct xenbus_watch *watch,
5403 void (*callback)(struct xenbus_watch *,
5404 const char **, unsigned int));
5407 +int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch,
5408 + void (*callback)(struct xenbus_watch *,
5409 + const char **, unsigned int),
5410 + const char *pathfmt, ...)
5411 + __attribute__ ((format (printf, 4, 5)));
5415 * Advertise in the store a change of the given driver to the given new_state.
5416 Index: head-2008-12-01/net/core/dev.c
5417 ===================================================================
5418 --- head-2008-12-01.orig/net/core/dev.c 2008-12-01 11:36:13.000000000 +0100
5419 +++ head-2008-12-01/net/core/dev.c 2008-12-01 11:36:47.000000000 +0100
5422 #include "net-sysfs.h"
5425 +#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN)
5427 #include <linux/tcp.h>
5428 #include <linux/udp.h>
5429 @@ -1740,42 +1740,54 @@ static struct netdev_queue *dev_pick_tx(
5430 return netdev_get_tx_queue(dev, queue_index);
5434 +#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN)
5435 inline int skb_checksum_setup(struct sk_buff *skb)
5437 - if (skb->proto_csum_blank) {
5438 - struct iphdr *iph;
5439 - unsigned char *th;
5440 + struct iphdr *iph;
5441 + unsigned char *th;
5442 + int err = -EPROTO;
5444 - if (skb->protocol != htons(ETH_P_IP))
5446 - iph = ip_hdr(skb);
5447 - th = skb_network_header(skb) + 4 * iph->ihl;
5448 - if (th >= skb_tail_pointer(skb))
5450 - skb->csum_start = th - skb->head;
5451 - switch (iph->protocol) {
5453 - skb->csum_offset = offsetof(struct tcphdr, check);
5456 - skb->csum_offset = offsetof(struct udphdr, check);
5459 - if (net_ratelimit())
5460 - printk(KERN_ERR "Attempting to checksum a non-"
5461 - "TCP/UDP packet, dropping a protocol"
5462 - " %d packet", iph->protocol);
5465 - if ((th + skb->csum_offset + 2) > skb_tail_pointer(skb))
5467 - skb->ip_summed = CHECKSUM_PARTIAL;
5468 - skb->proto_csum_blank = 0;
5470 + if (!skb->proto_csum_blank)
5474 + if (skb->protocol != htons(ETH_P_IP))
5477 + iph = ip_hdr(skb);
5478 + th = skb_network_header(skb) + 4 * iph->ihl;
5479 + if (th >= skb_tail_pointer(skb))
5482 + skb->csum_start = th - skb->head;
5483 + switch (iph->protocol) {
5485 + skb->csum_offset = offsetof(struct tcphdr, check);
5488 + skb->csum_offset = offsetof(struct udphdr, check);
5491 + if (net_ratelimit())
5492 + printk(KERN_ERR "Attempting to checksum a non-"
5493 + "TCP/UDP packet, dropping a protocol"
5494 + " %d packet", iph->protocol);
5499 + if ((th + skb->csum_offset + 2) > skb_tail_pointer(skb))
5503 + skb->ip_summed = CHECKSUM_PARTIAL;
5504 + skb->proto_csum_blank = 0;
5513 EXPORT_SYMBOL(skb_checksum_setup);