5 Automatically created from "patches.kernel.org/patch-2.6.21" by xen-port-patches.py
7 Acked-by: jbeulich@novell.com
11 arch/x86/ia32/ia32entry-xen.S | 5
12 arch/x86/kernel/Makefile | 4
13 arch/x86/kernel/acpi/sleep_64-xen.c | 6
14 arch/x86/kernel/apic_32-xen.c | 65 ----
15 arch/x86/kernel/cpu/common-xen.c | 14
16 arch/x86/kernel/e820_32-xen.c | 18 -
17 arch/x86/kernel/e820_64-xen.c | 40 ++
18 arch/x86/kernel/entry_32-xen.S | 80 +++--
19 arch/x86/kernel/entry_64-xen.S | 3
20 arch/x86/kernel/genapic_64-xen.c | 4
21 arch/x86/kernel/head64-xen.c | 8
22 arch/x86/kernel/head_32-xen.S | 9
23 arch/x86/kernel/io_apic_32-xen.c | 43 +-
24 arch/x86/kernel/io_apic_64-xen.c | 414 +++++++++++++-------------
25 arch/x86/kernel/irq_32-xen.c | 22 +
26 arch/x86/kernel/irq_64-xen.c | 13
27 arch/x86/kernel/microcode-xen.c | 2
28 arch/x86/kernel/mpparse_32-xen.c | 4
29 arch/x86/kernel/mpparse_64-xen.c | 6
30 arch/x86/kernel/pci-dma-xen.c | 2
31 arch/x86/kernel/pcspeaker.c | 5
32 arch/x86/kernel/process_32-xen.c | 42 +-
33 arch/x86/kernel/process_64-xen.c | 13
34 arch/x86/kernel/setup_32-xen.c | 46 --
35 arch/x86/kernel/setup_64-xen.c | 184 +----------
36 arch/x86/kernel/smp_32-xen.c | 5
37 arch/x86/kernel/time_32-xen.c | 279 +----------------
38 arch/x86/kernel/traps_32-xen.c | 27 +
39 arch/x86/kernel/vsyscall_64-xen.c | 127 ++++---
40 arch/x86/mm/fault_32-xen.c | 44 --
41 arch/x86/mm/fault_64-xen.c | 39 --
42 arch/x86/mm/highmem_32-xen.c | 9
43 arch/x86/mm/init_32-xen.c | 2
44 arch/x86/mm/init_64-xen.c | 24 +
45 arch/x86/mm/pageattr_64-xen.c | 6
46 arch/x86/mm/pgtable_32-xen.c | 28 +
47 drivers/acpi/processor_extcntl.c | 18 -
48 drivers/char/tpm/tpm_xen.c | 5
49 drivers/pci/msi-xen.c | 196 +++---------
50 drivers/xen/balloon/sysfs.c | 1
51 drivers/xen/blkback/xenbus.c | 4
52 drivers/xen/blkfront/blkfront.c | 1
53 drivers/xen/blktap/xenbus.c | 4
54 drivers/xen/core/evtchn.c | 4
55 drivers/xen/core/smpboot.c | 22 -
56 drivers/xen/fbfront/xenfb.c | 1
57 drivers/xen/fbfront/xenkbd.c | 1
58 drivers/xen/netback/xenbus.c | 4
59 drivers/xen/netfront/netfront.c | 49 +--
60 drivers/xen/pciback/xenbus.c | 1
61 drivers/xen/pcifront/xenbus.c | 1
62 drivers/xen/scsiback/xenbus.c | 1
63 drivers/xen/scsifront/xenbus.c | 1
64 drivers/xen/tpmback/common.h | 4
65 drivers/xen/tpmback/interface.c | 5
66 drivers/xen/tpmback/tpmback.c | 16 -
67 drivers/xen/tpmback/xenbus.c | 5
68 drivers/xen/xenbus/xenbus_probe.c | 17 -
69 drivers/xen/xenbus/xenbus_probe.h | 4
70 drivers/xen/xenbus/xenbus_probe_backend.c | 8
71 drivers/xen/xenoprof/xenoprofile.c | 2
72 include/asm-x86/i8253.h | 4
73 include/asm-x86/mach-xen/asm/desc_32.h | 2
74 include/asm-x86/mach-xen/asm/dma-mapping_64.h | 4
75 include/asm-x86/mach-xen/asm/hypervisor.h | 15
76 include/asm-x86/mach-xen/asm/io_32.h | 6
77 include/asm-x86/mach-xen/asm/io_64.h | 8
78 include/asm-x86/mach-xen/asm/mmu_context_32.h | 10
79 include/asm-x86/mach-xen/asm/pgalloc_32.h | 21 +
80 include/asm-x86/mach-xen/asm/pgtable_32.h | 25 +
81 include/asm-x86/mach-xen/asm/pgtable_64.h | 9
82 include/asm-x86/mach-xen/asm/processor_32.h | 6
83 include/asm-x86/mach-xen/asm/segment_32.h | 23 +
84 include/asm-x86/mach-xen/asm/smp_32.h | 5
85 include/asm-x86/mach-xen/asm/smp_64.h | 3
86 include/xen/xenbus.h | 24 +
87 lib/swiotlb-xen.c | 19 -
88 78 files changed, 946 insertions(+), 1259 deletions(-)
90 --- a/arch/x86/ia32/ia32entry-xen.S
91 +++ b/arch/x86/ia32/ia32entry-xen.S
92 @@ -465,7 +465,7 @@ ia32_sys_call_table:
93 .quad sys32_vm86_warning /* vm86old */
94 .quad compat_sys_wait4
95 .quad sys_swapoff /* 115 */
97 + .quad compat_sys_sysinfo
100 .quad stub32_sigreturn
101 @@ -510,7 +510,7 @@ ia32_sys_call_table:
102 .quad sys_sched_yield
103 .quad sys_sched_get_priority_max
104 .quad sys_sched_get_priority_min /* 160 */
105 - .quad sys_sched_rr_get_interval
106 + .quad sys32_sched_rr_get_interval
107 .quad compat_sys_nanosleep
109 .quad sys_setresuid16
110 @@ -668,4 +668,5 @@ ia32_sys_call_table:
111 .quad compat_sys_vmsplice
112 .quad compat_sys_move_pages
114 + .quad sys_epoll_pwait
116 --- a/arch/x86/Kconfig
117 +++ b/arch/x86/Kconfig
118 @@ -50,13 +50,15 @@ config GENERIC_CMOS_UPDATE
120 config CLOCKSOURCE_WATCHDOG
122 + depends on !X86_XEN
124 config GENERIC_CLOCKEVENTS
126 + depends on !X86_XEN
128 config GENERIC_CLOCKEVENTS_BROADCAST
130 - depends on X86_64 || (X86_32 && X86_LOCAL_APIC)
131 + depends on X86_64 || (X86_32 && X86_LOCAL_APIC && !X86_XEN)
133 config LOCKDEP_SUPPORT
135 --- a/arch/x86/kernel/acpi/sleep_64-xen.c
136 +++ b/arch/x86/kernel/acpi/sleep_64-xen.c
137 @@ -59,7 +59,7 @@ unsigned long acpi_wakeup_address = 0;
138 unsigned long acpi_video_flags;
139 extern char wakeup_start, wakeup_end;
141 -extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
142 +extern unsigned long acpi_copy_wakeup_routine(unsigned long);
144 static pgd_t low_ptr;
146 @@ -67,8 +67,10 @@ static void init_low_mapping(void)
148 pgd_t *slot0 = pgd_offset(current->mm, 0UL);
150 + /* FIXME: We're playing with the current task's page tables here, which
151 + * is potentially dangerous on SMP systems.
153 set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET));
154 - WARN_ON(num_online_cpus() != 1);
158 --- a/arch/x86/kernel/apic_32-xen.c
159 +++ b/arch/x86/kernel/apic_32-xen.c
161 #include <linux/kernel_stat.h>
162 #include <linux/sysdev.h>
163 #include <linux/cpu.h>
164 +#include <linux/clockchips.h>
165 +#include <linux/acpi_pmtmr.h>
166 #include <linux/module.h>
168 #include <asm/atomic.h>
169 @@ -56,83 +58,26 @@ static cpumask_t timer_bcast_ipi;
174 + * Debug level, exported for io_apic.c
179 static int modern_apic(void)
181 - unsigned int lvr, version;
182 /* AMD systems use old APIC versions, so check the CPU */
183 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
184 - boot_cpu_data.x86 >= 0xf)
185 + boot_cpu_data.x86 >= 0xf)
187 - lvr = apic_read(APIC_LVR);
188 - version = GET_APIC_VERSION(lvr);
189 - return version >= 0x14;
190 + return lapic_get_version() >= 0x14;
192 #endif /* !CONFIG_XEN */
195 - * 'what should we do if we get a hw irq event on an illegal vector'.
196 - * each architecture has to answer this themselves.
198 -void ack_bad_irq(unsigned int irq)
200 - printk("unexpected IRQ trap at vector %02x\n", irq);
202 - * Currently unexpected vectors happen only on SMP and APIC.
203 - * We _must_ ack these because every local APIC has only N
204 - * irq slots per priority level, and a 'hanging, unacked' IRQ
205 - * holds up an irq slot - in excessive cases (when multiple
206 - * unexpected vectors occur) that might lock up the APIC
208 - * But only ack when the APIC is enabled -AK
214 int get_physical_broadcast(void)
221 -static void up_apic_timer_interrupt_call(void)
223 - int cpu = smp_processor_id();
226 - * the NMI deadlock-detector uses this.
228 - per_cpu(irq_stat, cpu).apic_timer_irqs++;
230 - smp_local_timer_interrupt();
234 -void smp_send_timer_broadcast_ipi(void)
238 - cpus_and(mask, cpu_online_map, timer_bcast_ipi);
239 - if (!cpus_empty(mask)) {
241 - send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
244 - * We can directly call the apic timer interrupt handler
245 - * in UP case. Minus all irq related functions
247 - up_apic_timer_interrupt_call();
253 int setup_profiling_timer(unsigned int multiplier)
256 --- a/arch/x86/kernel/cpu/common-xen.c
257 +++ b/arch/x86/kernel/cpu/common-xen.c
258 @@ -610,7 +610,7 @@ void __init early_cpu_init(void)
259 struct pt_regs * __devinit idle_regs(struct pt_regs *regs)
261 memset(regs, 0, sizeof(struct pt_regs));
262 - regs->xgs = __KERNEL_PDA;
263 + regs->xfs = __KERNEL_PDA;
267 @@ -667,12 +667,12 @@ struct i386_pda boot_pda = {
268 .pcurrent = &init_task,
271 -static inline void set_kernel_gs(void)
272 +static inline void set_kernel_fs(void)
274 - /* Set %gs for this CPU's PDA. Memory clobber is to create a
275 + /* Set %fs for this CPU's PDA. Memory clobber is to create a
276 barrier with respect to any PDA operations, so the compiler
277 doesn't move any before here. */
278 - asm volatile ("mov %0, %%gs" : : "r" (__KERNEL_PDA) : "memory");
279 + asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_PDA) : "memory");
282 /* Initialize the CPU's GDT and PDA. The boot CPU does this for
283 @@ -730,7 +730,7 @@ void __cpuinit cpu_set_gdt(int cpu)
285 BUG_ON(HYPERVISOR_set_gdt(frames, (cpu_gdt_descr->size + 1) / 8));
291 /* Common CPU init for both boot and secondary CPUs */
292 @@ -775,8 +775,8 @@ static void __cpuinit _cpu_init(int cpu,
293 __set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss);
297 - asm volatile ("mov %0, %%fs" : : "r" (0));
299 + asm volatile ("mov %0, %%gs" : : "r" (0));
301 /* Clear all 6 debug registers: */
303 --- a/arch/x86/kernel/e820_32-xen.c
304 +++ b/arch/x86/kernel/e820_32-xen.c
306 #include <asm/pgtable.h>
307 #include <asm/page.h>
308 #include <asm/e820.h>
309 +#include <asm/setup.h>
310 #include <xen/interface/memory.h>
313 @@ -157,21 +158,22 @@ static struct resource standard_io_resou
314 .flags = IORESOURCE_BUSY | IORESOURCE_IO
317 -static int romsignature(const unsigned char *x)
318 +#define ROMSIGNATURE 0xaa55
320 +static int __init romsignature(const unsigned char *rom)
324 - if (probe_kernel_address((const unsigned short *)x, sig) == 0)
325 - ret = (sig == 0xaa55);
328 + return probe_kernel_address((const unsigned short *)rom, sig) == 0 &&
329 + sig == ROMSIGNATURE;
332 static int __init romchecksum(unsigned char *rom, unsigned long length)
334 - unsigned char *p, sum = 0;
337 - for (p = rom; p < rom + length; p++)
339 + for (sum = 0; length; length--)
344 --- a/arch/x86/kernel/e820_64-xen.c
345 +++ b/arch/x86/kernel/e820_64-xen.c
346 @@ -88,6 +88,13 @@ static inline int bad_addr(unsigned long
351 + /* NUMA memory to node map */
352 + if (last >= nodemap_addr && addr < nodemap_addr + nodemap_size) {
353 + *addrp = nodemap_addr + nodemap_size;
357 /* XXX ramdisk image here? */
359 if (last < (table_end<<PAGE_SHIFT)) {
360 @@ -213,6 +220,37 @@ unsigned long __init e820_end_of_ram(voi
364 + * Find the hole size in the range.
366 +unsigned long __init e820_hole_size(unsigned long start, unsigned long end)
368 + unsigned long ram = 0;
371 + for (i = 0; i < e820.nr_map; i++) {
372 + struct e820entry *ei = &e820.map[i];
373 + unsigned long last, addr;
375 + if (ei->type != E820_RAM ||
376 + ei->addr+ei->size <= start ||
380 + addr = round_up(ei->addr, PAGE_SIZE);
384 + last = round_down(ei->addr + ei->size, PAGE_SIZE);
389 + ram += last - addr;
391 + return ((end - start) - ram);
395 * Mark e820 reserved areas as busy for the resource manager.
397 void __init e820_reserve_resources(struct e820entry *e820, int nr_map)
398 @@ -738,7 +776,7 @@ static int __init parse_memmap_opt(char
400 early_param("memmap", parse_memmap_opt);
402 -void finish_e820_parsing(void)
403 +void __init finish_e820_parsing(void)
406 printk(KERN_INFO "user-defined physical RAM map:\n");
407 --- a/arch/x86/kernel/entry_32-xen.S
408 +++ b/arch/x86/kernel/entry_32-xen.S
415 * 28(%esp) - orig_eax
418 @@ -102,9 +102,9 @@ NMI_MASK = 0x80000000
424 CFI_ADJUST_CFA_OFFSET 4;\
425 - /*CFI_REL_OFFSET gs, 0;*/\
426 + /*CFI_REL_OFFSET fs, 0;*/\
428 CFI_ADJUST_CFA_OFFSET 4;\
429 /*CFI_REL_OFFSET es, 0;*/\
430 @@ -136,7 +136,7 @@ NMI_MASK = 0x80000000
433 movl $(__KERNEL_PDA), %edx; \
437 #define RESTORE_INT_REGS \
439 @@ -169,9 +169,9 @@ NMI_MASK = 0x80000000
441 CFI_ADJUST_CFA_OFFSET -4;\
445 CFI_ADJUST_CFA_OFFSET -4;\
446 - /*CFI_RESTORE gs;*/\
447 + /*CFI_RESTORE fs;*/\
448 .pushsection .fixup,"ax"; \
451 @@ -230,6 +230,7 @@ ENTRY(ret_from_fork)
452 CFI_ADJUST_CFA_OFFSET -4
458 * Return to user mode is not as complex as all this looks,
459 @@ -261,6 +262,7 @@ ENTRY(resume_userspace)
460 # int/exception return?
463 +END(ret_from_exception)
465 #ifdef CONFIG_PREEMPT
467 @@ -275,6 +277,7 @@ need_resched:
469 call preempt_schedule_irq
475 @@ -352,16 +355,17 @@ sysenter_past_esp:
476 movl PT_OLDESP(%esp), %ecx
479 -1: mov PT_GS(%esp), %gs
480 +1: mov PT_FS(%esp), %fs
481 ENABLE_INTERRUPTS_SYSEXIT
483 .pushsection .fixup,"ax"
484 -2: movl $0,PT_GS(%esp)
485 +2: movl $0,PT_FS(%esp)
487 .section __ex_table,"a"
491 +ENDPROC(sysenter_entry)
493 # pv sysenter call handler stub
494 ENTRY(sysenter_entry_pv)
495 @@ -533,6 +537,7 @@ hypervisor_iret:
496 jmp hypercall_page + (__HYPERVISOR_iret * 32)
499 +ENDPROC(system_call)
501 # perform work that needs to be done immediately before resumption
503 @@ -578,6 +583,7 @@ work_notifysig_v86:
505 call do_notify_resume
506 jmp resume_userspace_sig
509 # perform syscall exit tracing
511 @@ -593,6 +599,7 @@ syscall_trace_entry:
512 cmpl $(nr_syscalls), %eax
515 +END(syscall_trace_entry)
517 # perform syscall exit tracing
519 @@ -606,6 +613,7 @@ syscall_exit_work:
521 call do_syscall_trace
523 +END(syscall_exit_work)
526 RING0_INT_FRAME # can't unwind into user space anyway
527 @@ -616,16 +624,18 @@ syscall_fault:
528 GET_THREAD_INFO(%ebp)
529 movl $-EFAULT,PT_EAX(%esp)
534 movl $-ENOSYS,PT_EAX(%esp)
540 #define FIXUP_ESPFIX_STACK \
541 /* since we are on a wrong stack, we cant make it a C code :( */ \
542 - movl %gs:PDA_cpu, %ebx; \
543 + movl %fs:PDA_cpu, %ebx; \
544 PER_CPU(cpu_gdt_descr, %ebx); \
545 movl GDS_address(%ebx), %ebx; \
546 GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \
547 @@ -656,9 +666,9 @@ syscall_badsys:
552 ENTRY(irq_entries_start)
558 @@ -667,11 +677,16 @@ ENTRY(irq_entries_start)
560 CFI_ADJUST_CFA_OFFSET 4
569 +END(irq_entries_start)
576 * the CPU automatically disables interrupts when executing an IRQ vector,
577 @@ -684,6 +699,7 @@ common_interrupt:
581 +ENDPROC(common_interrupt)
584 #define BUILD_INTERRUPT(name, nr) \
585 @@ -696,10 +712,16 @@ ENTRY(name) \
593 /* The include is where all of the SMP etc. interrupts come from */
594 #include "entry_arch.h"
596 +/* This alternate entry is needed because we hijack the apic LVTT */
597 +#if defined(CONFIG_VMI) && defined(CONFIG_X86_LOCAL_APIC)
598 +BUILD_INTERRUPT(apic_vmi_timer_interrupt,LOCAL_TIMER_VECTOR)
601 #define UNWIND_ESPFIX_STACK
603 @@ -710,7 +732,7 @@ KPROBE_ENTRY(page_fault)
604 CFI_ADJUST_CFA_OFFSET 4
607 - /* the function address is in %gs's slot on the stack */
608 + /* the function address is in %fs's slot on the stack */
610 CFI_ADJUST_CFA_OFFSET 4
611 /*CFI_REL_OFFSET es, 0*/
612 @@ -739,20 +761,20 @@ error_code:
613 CFI_ADJUST_CFA_OFFSET 4
614 CFI_REL_OFFSET ebx, 0
618 CFI_ADJUST_CFA_OFFSET 4
619 - /*CFI_REL_OFFSET gs, 0*/
620 + /*CFI_REL_OFFSET fs, 0*/
621 movl $(__KERNEL_PDA), %ecx
626 CFI_ADJUST_CFA_OFFSET -4
627 /*CFI_REGISTER es, ecx*/
628 - movl PT_GS(%esp), %edi # get the function address
629 + movl PT_FS(%esp), %edi # get the function address
630 movl PT_ORIG_EAX(%esp), %edx # get the error code
631 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
632 - mov %ecx, PT_GS(%esp)
633 - /*CFI_REL_OFFSET gs, ES*/
634 + mov %ecx, PT_FS(%esp)
635 + /*CFI_REL_OFFSET fs, ES*/
636 movl $(__USER_DS), %ecx
639 @@ -839,7 +861,7 @@ critical_fixup_table:
640 .byte 0x18 # pop %eax
643 - .byte 0x24,0x24 # pop %gs
644 + .byte 0x24,0x24 # pop %fs
645 .byte 0x28,0x28,0x28 # add $4,%esp
647 .byte 0xff,0xff,0xff,0xff # movb $1,1(%esi)
648 @@ -905,6 +927,7 @@ ENTRY(coprocessor_error)
649 CFI_ADJUST_CFA_OFFSET 4
652 +END(coprocessor_error)
654 ENTRY(simd_coprocessor_error)
656 @@ -914,6 +937,7 @@ ENTRY(simd_coprocessor_error)
657 CFI_ADJUST_CFA_OFFSET 4
660 +END(simd_coprocessor_error)
662 ENTRY(device_not_available)
664 @@ -936,6 +960,7 @@ device_available_emulate:
665 call math_state_restore
666 jmp ret_from_exception
668 +END(device_not_available)
672 @@ -1097,10 +1122,12 @@ ENTRY(native_iret)
678 ENTRY(native_irq_enable_sysexit)
681 +END(native_irq_enable_sysexit)
685 @@ -1123,6 +1150,7 @@ ENTRY(overflow)
686 CFI_ADJUST_CFA_OFFSET 4
693 @@ -1132,6 +1160,7 @@ ENTRY(bounds)
694 CFI_ADJUST_CFA_OFFSET 4
701 @@ -1141,6 +1170,7 @@ ENTRY(invalid_op)
702 CFI_ADJUST_CFA_OFFSET 4
707 ENTRY(coprocessor_segment_overrun)
709 @@ -1150,6 +1180,7 @@ ENTRY(coprocessor_segment_overrun)
710 CFI_ADJUST_CFA_OFFSET 4
713 +END(coprocessor_segment_overrun)
717 @@ -1157,6 +1188,7 @@ ENTRY(invalid_TSS)
718 CFI_ADJUST_CFA_OFFSET 4
723 ENTRY(segment_not_present)
725 @@ -1164,6 +1196,7 @@ ENTRY(segment_not_present)
726 CFI_ADJUST_CFA_OFFSET 4
729 +END(segment_not_present)
733 @@ -1171,6 +1204,7 @@ ENTRY(stack_segment)
734 CFI_ADJUST_CFA_OFFSET 4
739 KPROBE_ENTRY(general_protection)
741 @@ -1186,6 +1220,7 @@ ENTRY(alignment_check)
742 CFI_ADJUST_CFA_OFFSET 4
745 +END(alignment_check)
749 @@ -1195,6 +1230,7 @@ ENTRY(divide_error)
750 CFI_ADJUST_CFA_OFFSET 4
755 #ifdef CONFIG_X86_MCE
757 @@ -1205,6 +1241,7 @@ ENTRY(machine_check)
758 CFI_ADJUST_CFA_OFFSET 4
765 @@ -1224,6 +1261,7 @@ ENTRY(fixup_4gb_segment)
766 CFI_ADJUST_CFA_OFFSET 4
769 +END(spurious_interrupt_bug)
771 ENTRY(kernel_thread_helper)
772 pushl $0 # fake return address for unwinder
773 --- a/arch/x86/kernel/entry_64-xen.S
774 +++ b/arch/x86/kernel/entry_64-xen.S
775 @@ -629,6 +629,9 @@ END(invalidate_interrupt\num)
776 ENTRY(call_function_interrupt)
777 apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt
778 END(call_function_interrupt)
779 +ENTRY(irq_move_cleanup_interrupt)
780 + apicinterrupt IRQ_MOVE_CLEANUP_VECTOR,smp_irq_move_cleanup_interrupt
781 +END(irq_move_cleanup_interrupt)
784 ENTRY(apic_timer_interrupt)
785 --- a/arch/x86/kernel/genapic_64-xen.c
786 +++ b/arch/x86/kernel/genapic_64-xen.c
787 @@ -65,8 +65,8 @@ void __init clustered_apic_check(void)
788 * Some x86_64 machines use physical APIC mode regardless of how many
789 * procs/clusters are present (x86_64 ES7000 is an example).
791 - if (acpi_fadt.revision > FADT2_REVISION_ID)
792 - if (acpi_fadt.force_apic_physical_destination_mode) {
793 + if (acpi_gbl_FADT.header.revision > FADT2_REVISION_ID)
794 + if (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL) {
795 genapic = &apic_cluster;
798 --- a/arch/x86/kernel/head_32-xen.S
799 +++ b/arch/x86/kernel/head_32-xen.S
801 #define X86_CAPABILITY new_cpu_data+CPUINFO_x86_capability
802 #define X86_VENDOR_ID new_cpu_data+CPUINFO_x86_vendor_id
804 +.section .text.head,"ax",@progbits
805 #define VIRT_ENTRY_OFFSET 0x0
806 .org VIRT_ENTRY_OFFSET
808 @@ -60,11 +61,11 @@ ENTRY(startup_32)
810 movb $1,X86_HARD_MATH
812 - xorl %eax,%eax # Clear FS
814 + xorl %eax,%eax # Clear GS
817 movl $(__KERNEL_PDA),%eax
821 cld # gcc2 wants the direction flag cleared at all times
823 @@ -75,7 +76,7 @@ ENTRY(startup_32)
824 * Point the GDT at this CPU's PDA. This will be
825 * cpu_gdt_table and boot_pda.
829 /* get the PDA pointer */
832 --- a/arch/x86/kernel/head64-xen.c
833 +++ b/arch/x86/kernel/head64-xen.c
834 @@ -45,8 +45,6 @@ static void __init clear_bss(void)
835 #define OLD_CL_BASE_ADDR 0x90000
836 #define OLD_CL_OFFSET 0x90022
838 -extern char saved_command_line[];
840 static void __init copy_bootdata(char *real_mode_data)
843 @@ -62,14 +60,14 @@ static void __init copy_bootdata(char *r
844 new_data = OLD_CL_BASE_ADDR + * (u16 *) OLD_CL_OFFSET;
846 command_line = (char *) ((u64)(new_data));
847 - memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
848 + memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
852 if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE)
853 max_cmdline = COMMAND_LINE_SIZE;
854 - memcpy(saved_command_line, xen_start_info->cmd_line, max_cmdline);
855 - saved_command_line[max_cmdline-1] = '\0';
856 + memcpy(boot_command_line, xen_start_info->cmd_line, max_cmdline);
857 + boot_command_line[max_cmdline-1] = '\0';
861 --- a/arch/x86/kernel/io_apic_32-xen.c
862 +++ b/arch/x86/kernel/io_apic_32-xen.c
863 @@ -167,7 +167,7 @@ static inline void io_apic_write(unsigne
865 static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value)
867 - volatile struct io_apic *io_apic = io_apic_base(apic);
868 + volatile struct io_apic __iomem *io_apic = io_apic_base(apic);
870 writel(reg, &io_apic->index);
871 writel(value, &io_apic->data);
872 @@ -392,7 +392,7 @@ static void set_ioapic_affinity_irq(unsi
874 entry = irq_2_pin + entry->next;
876 - set_native_irq_info(irq, cpumask);
877 + irq_desc[irq].affinity = cpumask;
878 spin_unlock_irqrestore(&ioapic_lock, flags);
881 @@ -531,8 +531,8 @@ static void do_irq_balance(void)
882 package_index = CPU_TO_PACKAGEINDEX(i);
883 for (j = 0; j < NR_IRQS; j++) {
884 unsigned long value_now, delta;
885 - /* Is this an active IRQ? */
886 - if (!irq_desc[j].action)
887 + /* Is this an active IRQ or balancing disabled ? */
888 + if (!irq_desc[j].action || irq_balancing_disabled(j))
890 if ( package_index == i )
891 IRQ_DELTA(package_index,j) = 0;
892 @@ -785,7 +785,7 @@ failed:
896 -int __init irqbalance_disable(char *str)
897 +int __devinit irqbalance_disable(char *str)
899 irqbalance_disabled = 1;
901 @@ -1329,11 +1329,9 @@ static void ioapic_register_intr(int irq
902 trigger == IOAPIC_LEVEL)
903 set_irq_chip_and_handler_name(irq, &ioapic_chip,
904 handle_fasteoi_irq, "fasteoi");
906 - irq_desc[irq].status |= IRQ_DELAYED_DISABLE;
908 set_irq_chip_and_handler_name(irq, &ioapic_chip,
909 handle_edge_irq, "edge");
911 set_intr_gate(vector, interrupt[irq]);
914 @@ -1407,7 +1405,6 @@ static void __init setup_IO_APIC_irqs(vo
916 spin_lock_irqsave(&ioapic_lock, flags);
917 __ioapic_write_entry(apic, pin, entry);
918 - set_native_irq_info(irq, TARGET_CPUS);
919 spin_unlock_irqrestore(&ioapic_lock, flags);
922 @@ -1638,7 +1635,7 @@ void /*__init*/ print_local_APIC(void *
923 v = apic_read(APIC_LVR);
924 printk(KERN_INFO "... APIC VERSION: %08x\n", v);
925 ver = GET_APIC_VERSION(v);
926 - maxlvt = get_maxlvt();
927 + maxlvt = lapic_get_maxlvt();
929 v = apic_read(APIC_TASKPRI);
930 printk(KERN_DEBUG "... APIC TASKPRI: %08x (%02x)\n", v, v & APIC_TPRI_MASK);
931 @@ -1976,7 +1973,7 @@ static void __init setup_ioapic_ids_from
935 -static int no_timer_check __initdata;
936 +int no_timer_check __initdata;
938 static int __init notimercheck(char *s)
940 @@ -2369,7 +2366,7 @@ static inline void __init check_timer(vo
942 disable_8259A_irq(0);
943 set_irq_chip_and_handler_name(0, &lapic_chip, handle_fasteoi_irq,
946 apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */
949 @@ -2662,7 +2659,7 @@ static void set_msi_irq_affinity(unsigne
950 msg.address_lo |= MSI_ADDR_DEST_ID(dest);
952 write_msi_msg(irq, &msg);
953 - set_native_irq_info(irq, mask);
954 + irq_desc[irq].affinity = mask;
956 #endif /* CONFIG_SMP */
958 @@ -2681,25 +2678,32 @@ static struct irq_chip msi_chip = {
959 .retrigger = ioapic_retrigger_irq,
962 -int arch_setup_msi_irq(unsigned int irq, struct pci_dev *dev)
963 +int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
968 + irq = create_irq();
972 + set_irq_msi(irq, desc);
973 ret = msi_compose_msg(dev, irq, &msg);
980 write_msi_msg(irq, &msg);
982 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq,
989 void arch_teardown_msi_irq(unsigned int irq)
995 #endif /* CONFIG_PCI_MSI */
996 @@ -2739,7 +2743,7 @@ static void set_ht_irq_affinity(unsigned
997 dest = cpu_mask_to_apicid(mask);
999 target_ht_irq(irq, dest);
1000 - set_native_irq_info(irq, mask);
1001 + irq_desc[irq].affinity = mask;
1005 @@ -2947,7 +2951,6 @@ int io_apic_set_pci_routing (int ioapic,
1007 spin_lock_irqsave(&ioapic_lock, flags);
1008 __ioapic_write_entry(ioapic, pin, entry);
1009 - set_native_irq_info(irq, TARGET_CPUS);
1010 spin_unlock_irqrestore(&ioapic_lock, flags);
1013 --- a/arch/x86/kernel/io_apic_64-xen.c
1014 +++ b/arch/x86/kernel/io_apic_64-xen.c
1016 #include <acpi/acpi_bus.h>
1019 +#include <asm/idle.h>
1021 #include <asm/smp.h>
1022 #include <asm/desc.h>
1024 #include <asm/msidef.h>
1025 #include <asm/hypertransport.h>
1027 -static int assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result);
1031 + cpumask_t old_domain;
1033 + unsigned move_cleanup_count;
1035 + u8 move_in_progress : 1;
1038 +/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
1039 +struct irq_cfg irq_cfg[NR_IRQS] __read_mostly;
1041 +static int assign_irq_vector(int irq, cpumask_t mask);
1043 #define __apicdebuginit __init
1045 @@ -89,7 +103,7 @@ int nr_ioapic_registers[MAX_IO_APICS];
1046 * Rough estimation of how many shared IRQs there are, can
1047 * be changed anytime.
1049 -#define MAX_PLUS_SHARED_IRQS NR_IRQ_VECTORS
1050 +#define MAX_PLUS_SHARED_IRQS NR_IRQS
1051 #define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS)
1054 @@ -262,21 +276,19 @@ static void __target_IO_APIC_irq(unsigne
1056 static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
1058 + struct irq_cfg *cfg = irq_cfg + irq;
1059 unsigned long flags;
1064 cpus_and(tmp, mask, cpu_online_map);
1065 if (cpus_empty(tmp))
1066 - tmp = TARGET_CPUS;
1068 - cpus_and(mask, tmp, CPU_MASK_ALL);
1071 - vector = assign_irq_vector(irq, mask, &tmp);
1073 + if (assign_irq_vector(irq, mask))
1076 + cpus_and(tmp, cfg->domain, mask);
1077 dest = cpu_mask_to_apicid(tmp);
1080 @@ -285,8 +297,8 @@ static void set_ioapic_affinity_irq(unsi
1081 dest = SET_APIC_LOGICAL_ID(dest);
1083 spin_lock_irqsave(&ioapic_lock, flags);
1084 - __target_IO_APIC_irq(irq, dest, vector);
1085 - set_native_irq_info(irq, mask);
1086 + __target_IO_APIC_irq(irq, dest, cfg->vector);
1087 + irq_desc[irq].affinity = mask;
1088 spin_unlock_irqrestore(&ioapic_lock, flags);
1091 @@ -332,11 +344,11 @@ static void add_pin_to_irq(unsigned int
1092 reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \
1094 io_apic_modify(entry->apic, reg); \
1098 entry = irq_2_pin + entry->next; \
1103 #define DO_ACTION(name,R,ACTION, FINAL) \
1104 @@ -669,77 +681,62 @@ static int pin_2_irq(int idx, int apic,
1108 -static inline int IO_APIC_irq_trigger(int irq)
1110 - int apic, idx, pin;
1112 - for (apic = 0; apic < nr_ioapics; apic++) {
1113 - for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
1114 - idx = find_irq_entry(apic,pin,mp_INT);
1115 - if ((idx != -1) && (irq == pin_2_irq(idx,apic,pin)))
1116 - return irq_trigger(idx);
1120 - * nonexistent IRQs are edge default
1125 -/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
1126 -static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly;
1128 -static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
1129 +static int __assign_irq_vector(int irq, cpumask_t mask)
1132 struct physdev_irq irq_op;
1133 + struct irq_cfg *cfg;
1135 - BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
1136 + BUG_ON((unsigned)irq >= NR_IRQS);
1138 if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS)
1141 - cpus_and(*result, mask, cpu_online_map);
1142 + cfg = &irq_cfg[irq];
1144 + if ((cfg->move_in_progress) || cfg->move_cleanup_count)
1147 - if (irq_vector[irq] > 0)
1148 - return irq_vector[irq];
1153 if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
1156 - vector = irq_op.vector;
1157 - irq_vector[irq] = vector;
1158 + cfg->vector = irq_op.vector;
1164 -static int assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
1165 +static int assign_irq_vector(int irq, cpumask_t mask)
1169 unsigned long flags;
1171 spin_lock_irqsave(&vector_lock, flags);
1172 - vector = __assign_irq_vector(irq, mask, result);
1173 + err = __assign_irq_vector(irq, mask);
1174 spin_unlock_irqrestore(&vector_lock, flags);
1180 static void __clear_irq_vector(int irq)
1182 + struct irq_cfg *cfg;
1186 - BUG_ON(!irq_vector[irq]);
1187 + BUG_ON((unsigned)irq >= NR_IRQS);
1188 + cfg = &irq_cfg[irq];
1189 + BUG_ON(!cfg->vector);
1191 - vector = irq_vector[irq];
1192 - cpus_and(mask, irq_domain[irq], cpu_online_map);
1193 + vector = cfg->vector;
1194 + cpus_and(mask, cfg->domain, cpu_online_map);
1195 for_each_cpu_mask(cpu, mask)
1196 per_cpu(vector_irq, cpu)[vector] = -1;
1198 - irq_vector[irq] = 0;
1199 - irq_domain[irq] = CPU_MASK_NONE;
1201 + cfg->domain = CPU_MASK_NONE;
1204 void __setup_vector_irq(int cpu)
1205 @@ -749,10 +746,10 @@ void __setup_vector_irq(int cpu)
1208 /* Mark the inuse vectors */
1209 - for (irq = 0; irq < NR_IRQ_VECTORS; ++irq) {
1210 - if (!cpu_isset(cpu, irq_domain[irq]))
1211 + for (irq = 0; irq < NR_IRQS; ++irq) {
1212 + if (!cpu_isset(cpu, irq_cfg[irq].domain))
1214 - vector = irq_vector[irq];
1215 + vector = irq_cfg[irq].vector;
1216 per_cpu(vector_irq, cpu)[vector] = irq;
1218 /* Mark the free vectors */
1219 @@ -760,41 +757,49 @@ void __setup_vector_irq(int cpu)
1220 irq = per_cpu(vector_irq, cpu)[vector];
1223 - if (!cpu_isset(cpu, irq_domain[irq]))
1224 + if (!cpu_isset(cpu, irq_cfg[irq].domain))
1225 per_cpu(vector_irq, cpu)[vector] = -1;
1229 -extern void (*interrupt[NR_IRQS])(void);
1231 static struct irq_chip ioapic_chip;
1233 -#define IOAPIC_AUTO -1
1234 -#define IOAPIC_EDGE 0
1235 -#define IOAPIC_LEVEL 1
1237 -static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
1238 +static void ioapic_register_intr(int irq, unsigned long trigger)
1240 - if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
1241 - trigger == IOAPIC_LEVEL)
1243 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1244 handle_fasteoi_irq, "fasteoi");
1246 - irq_desc[irq].status |= IRQ_DELAYED_DISABLE;
1248 set_irq_chip_and_handler_name(irq, &ioapic_chip,
1249 handle_edge_irq, "edge");
1253 -#define ioapic_register_intr(irq, vector, trigger) evtchn_register_pirq(irq)
1254 +#define ioapic_register_intr(irq, trigger) evtchn_register_pirq(irq)
1255 #endif /* !CONFIG_XEN */
1257 -static void __init setup_IO_APIC_irq(int apic, int pin, int idx, int irq)
1258 +static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
1259 + int trigger, int polarity)
1261 + struct irq_cfg *cfg = irq_cfg + irq;
1262 struct IO_APIC_route_entry entry;
1264 - unsigned long flags;
1267 + if (!IO_APIC_IRQ(irq))
1270 + mask = TARGET_CPUS;
1271 + if (assign_irq_vector(irq, mask))
1275 + cpus_and(mask, cfg->domain, mask);
1278 + apic_printk(APIC_VERBOSE,KERN_DEBUG
1279 + "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
1280 + "IRQ %d Mode:%i Active:%i)\n",
1281 + apic, mp_ioapics[apic].mpc_apicid, pin, cfg->vector,
1282 + irq, trigger, polarity);
1285 * add it to the IO-APIC irq-routing table:
1286 @@ -803,41 +808,23 @@ static void __init setup_IO_APIC_irq(int
1288 entry.delivery_mode = INT_DELIVERY_MODE;
1289 entry.dest_mode = INT_DEST_MODE;
1290 + entry.dest = cpu_mask_to_apicid(mask);
1291 entry.mask = 0; /* enable IRQ */
1292 - entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
1294 - entry.trigger = irq_trigger(idx);
1295 - entry.polarity = irq_polarity(idx);
1296 + entry.trigger = trigger;
1297 + entry.polarity = polarity;
1298 + entry.vector = cfg->vector;
1300 - if (irq_trigger(idx)) {
1301 - entry.trigger = 1;
1302 + /* Mask level triggered irqs.
1303 + * Use IRQ_DELAYED_DISABLE for edge triggered irqs.
1307 - entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
1310 - if (/* !apic && */ !IO_APIC_IRQ(irq))
1313 - if (IO_APIC_IRQ(irq)) {
1315 - vector = assign_irq_vector(irq, TARGET_CPUS, &mask);
1319 - entry.dest.logical.logical_dest = cpu_mask_to_apicid(mask);
1320 - entry.vector = vector;
1322 - ioapic_register_intr(irq, vector, IOAPIC_AUTO);
1323 - if (!apic && (irq < 16))
1324 - disable_8259A_irq(irq);
1326 + ioapic_register_intr(irq, trigger);
1328 + disable_8259A_irq(irq);
1330 ioapic_write_entry(apic, pin, entry);
1332 - spin_lock_irqsave(&ioapic_lock, flags);
1333 - set_native_irq_info(irq, TARGET_CPUS);
1334 - spin_unlock_irqrestore(&ioapic_lock, flags);
1338 static void __init setup_IO_APIC_irqs(void)
1339 @@ -862,8 +849,8 @@ static void __init setup_IO_APIC_irqs(vo
1340 irq = pin_2_irq(idx, apic, pin);
1341 add_pin_to_irq(irq, apic, pin);
1343 - setup_IO_APIC_irq(apic, pin, idx, irq);
1345 + setup_IO_APIC_irq(apic, pin, irq,
1346 + irq_trigger(idx), irq_polarity(idx));
1350 @@ -894,7 +881,7 @@ static void __init setup_ExtINT_IRQ0_pin
1352 entry.dest_mode = INT_DEST_MODE;
1353 entry.mask = 0; /* unmask IRQ now */
1354 - entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
1355 + entry.dest = cpu_mask_to_apicid(TARGET_CPUS);
1356 entry.delivery_mode = INT_DELIVERY_MODE;
1359 @@ -994,18 +981,17 @@ void __apicdebuginit print_IO_APIC(void)
1361 printk(KERN_DEBUG ".... IRQ redirection table:\n");
1363 - printk(KERN_DEBUG " NR Log Phy Mask Trig IRR Pol"
1364 - " Stat Dest Deli Vect: \n");
1365 + printk(KERN_DEBUG " NR Dst Mask Trig IRR Pol"
1366 + " Stat Dmod Deli Vect: \n");
1368 for (i = 0; i <= reg_01.bits.entries; i++) {
1369 struct IO_APIC_route_entry entry;
1371 entry = ioapic_read_entry(apic, i);
1373 - printk(KERN_DEBUG " %02x %03X %02X ",
1374 + printk(KERN_DEBUG " %02x %03X ",
1376 - entry.dest.logical.logical_dest,
1377 - entry.dest.physical.physical_dest
1381 printk("%1d %1d %1d %1d %1d %1d %1d %02X\n",
1382 @@ -1269,8 +1255,7 @@ void disable_IO_APIC(void)
1383 entry.dest_mode = 0; /* Physical */
1384 entry.delivery_mode = dest_ExtINT; /* ExtInt */
1386 - entry.dest.physical.physical_dest =
1387 - GET_APIC_ID(apic_read(APIC_ID));
1388 + entry.dest = GET_APIC_ID(apic_read(APIC_ID));
1391 * Add it to the IO-APIC irq-routing table:
1392 @@ -1355,16 +1340,15 @@ static unsigned int startup_ioapic_irq(u
1394 static int ioapic_retrigger_irq(unsigned int irq)
1396 + struct irq_cfg *cfg = &irq_cfg[irq];
1399 unsigned long flags;
1401 spin_lock_irqsave(&vector_lock, flags);
1402 - vector = irq_vector[irq];
1404 - cpu_set(first_cpu(irq_domain[irq]), mask);
1405 + cpu_set(first_cpu(cfg->domain), mask);
1407 - send_IPI_mask(mask, vector);
1408 + send_IPI_mask(mask, cfg->vector);
1409 spin_unlock_irqrestore(&vector_lock, flags);
1412 @@ -1379,8 +1363,68 @@ static int ioapic_retrigger_irq(unsigned
1417 +asmlinkage void smp_irq_move_cleanup_interrupt(void)
1419 + unsigned vector, me;
1424 + me = smp_processor_id();
1425 + for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
1427 + struct irq_desc *desc;
1428 + struct irq_cfg *cfg;
1429 + irq = __get_cpu_var(vector_irq)[vector];
1430 + if (irq >= NR_IRQS)
1433 + desc = irq_desc + irq;
1434 + cfg = irq_cfg + irq;
1435 + spin_lock(&desc->lock);
1436 + if (!cfg->move_cleanup_count)
1439 + if ((vector == cfg->vector) && cpu_isset(me, cfg->domain))
1442 + __get_cpu_var(vector_irq)[vector] = -1;
1443 + cfg->move_cleanup_count--;
1445 + spin_unlock(&desc->lock);
1451 +static void irq_complete_move(unsigned int irq)
1453 + struct irq_cfg *cfg = irq_cfg + irq;
1454 + unsigned vector, me;
1456 + if (likely(!cfg->move_in_progress))
1459 + vector = ~get_irq_regs()->orig_rax;
1460 + me = smp_processor_id();
1461 + if ((vector == cfg->vector) &&
1462 + cpu_isset(smp_processor_id(), cfg->domain)) {
1463 + cpumask_t cleanup_mask;
1465 + cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map);
1466 + cfg->move_cleanup_count = cpus_weight(cleanup_mask);
1467 + send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
1468 + cfg->move_in_progress = 0;
1472 +static inline void irq_complete_move(unsigned int irq) {}
1475 static void ack_apic_edge(unsigned int irq)
1477 + irq_complete_move(irq);
1478 move_native_irq(irq);
1481 @@ -1389,6 +1433,7 @@ static void ack_apic_level(unsigned int
1483 int do_unmask_irq = 0;
1485 + irq_complete_move(irq);
1486 #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
1487 /* If we are moving the irq we need to mask it */
1488 if (unlikely(irq_desc[irq].status & IRQ_MOVE_PENDING)) {
1489 @@ -1440,7 +1485,7 @@ static inline void init_IO_APIC_traps(vo
1491 for (irq = 0; irq < NR_IRQS ; irq++) {
1493 - if (IO_APIC_IRQ(tmp) && !irq_vector[tmp]) {
1494 + if (IO_APIC_IRQ(tmp) && !irq_cfg[tmp].vector) {
1496 * Hmm.. We don't have an entry for this,
1497 * so default to an old-fashioned 8259
1498 @@ -1538,7 +1583,7 @@ static inline void unlock_ExtINT_logic(v
1500 entry1.dest_mode = 0; /* physical delivery */
1501 entry1.mask = 0; /* unmask IRQ now */
1502 - entry1.dest.physical.physical_dest = hard_smp_processor_id();
1503 + entry1.dest = hard_smp_processor_id();
1504 entry1.delivery_mode = dest_ExtINT;
1505 entry1.polarity = entry0.polarity;
1507 @@ -1582,15 +1627,14 @@ static inline void unlock_ExtINT_logic(v
1509 static inline void check_timer(void)
1511 + struct irq_cfg *cfg = irq_cfg + 0;
1512 int apic1, pin1, apic2, pin2;
1517 * get/set the timer IRQ vector:
1519 disable_8259A_irq(0);
1520 - vector = assign_irq_vector(0, TARGET_CPUS, &mask);
1521 + assign_irq_vector(0, TARGET_CPUS);
1524 * Subtle, code in do_timer_interrupt() expects an AEOI
1525 @@ -1610,7 +1654,7 @@ static inline void check_timer(void)
1526 apic2 = ioapic_i8259.apic;
1528 apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
1529 - vector, apic1, pin1, apic2, pin2);
1530 + cfg->vector, apic1, pin1, apic2, pin2);
1534 @@ -1641,7 +1685,7 @@ static inline void check_timer(void)
1536 * legacy devices should be connected to IO APIC #0
1538 - setup_ExtINT_IRQ0_pin(apic2, pin2, vector);
1539 + setup_ExtINT_IRQ0_pin(apic2, pin2, cfg->vector);
1540 if (timer_irq_works()) {
1541 apic_printk(APIC_VERBOSE," works.\n");
1542 nmi_watchdog_default();
1543 @@ -1666,14 +1710,14 @@ static inline void check_timer(void)
1545 disable_8259A_irq(0);
1546 irq_desc[0].chip = &lapic_irq_type;
1547 - apic_write(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */
1548 + apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */
1549 enable_8259A_irq(0);
1551 if (timer_irq_works()) {
1552 apic_printk(APIC_VERBOSE," works.\n");
1555 - apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
1556 + apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
1557 apic_printk(APIC_VERBOSE," failed.\n");
1559 apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ...");
1560 @@ -1828,19 +1872,16 @@ int create_irq(void)
1561 /* Allocate an unused irq */
1565 unsigned long flags;
1569 spin_lock_irqsave(&vector_lock, flags);
1570 for (new = (NR_IRQS - 1); new >= 0; new--) {
1571 if (platform_legacy_irq(new))
1573 - if (irq_vector[new] != 0)
1574 + if (irq_cfg[new].vector != 0)
1576 - vector = __assign_irq_vector(new, TARGET_CPUS, &mask);
1577 - if (likely(vector > 0))
1578 + if (__assign_irq_vector(new, TARGET_CPUS) == 0)
1582 @@ -1871,12 +1912,15 @@ void destroy_irq(unsigned int irq)
1583 #if defined(CONFIG_PCI_MSI) && !defined(CONFIG_XEN)
1584 static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)
1587 + struct irq_cfg *cfg = irq_cfg + irq;
1592 - vector = assign_irq_vector(irq, TARGET_CPUS, &tmp);
1593 - if (vector >= 0) {
1594 + tmp = TARGET_CPUS;
1595 + err = assign_irq_vector(irq, tmp);
1597 + cpus_and(tmp, cfg->domain, tmp);
1598 dest = cpu_mask_to_apicid(tmp);
1600 msg->address_hi = MSI_ADDR_BASE_HI;
1601 @@ -1896,40 +1940,38 @@ static int msi_compose_msg(struct pci_de
1602 ((INT_DELIVERY_MODE != dest_LowestPrio) ?
1603 MSI_DATA_DELIVERY_FIXED:
1604 MSI_DATA_DELIVERY_LOWPRI) |
1605 - MSI_DATA_VECTOR(vector);
1606 + MSI_DATA_VECTOR(cfg->vector);
1613 static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
1615 + struct irq_cfg *cfg = irq_cfg + irq;
1621 cpus_and(tmp, mask, cpu_online_map);
1622 if (cpus_empty(tmp))
1623 - tmp = TARGET_CPUS;
1625 - cpus_and(mask, tmp, CPU_MASK_ALL);
1628 - vector = assign_irq_vector(irq, mask, &tmp);
1630 + if (assign_irq_vector(irq, mask))
1633 + cpus_and(tmp, cfg->domain, mask);
1634 dest = cpu_mask_to_apicid(tmp);
1636 read_msi_msg(irq, &msg);
1638 msg.data &= ~MSI_DATA_VECTOR_MASK;
1639 - msg.data |= MSI_DATA_VECTOR(vector);
1640 + msg.data |= MSI_DATA_VECTOR(cfg->vector);
1641 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
1642 msg.address_lo |= MSI_ADDR_DEST_ID(dest);
1644 write_msi_msg(irq, &msg);
1645 - set_native_irq_info(irq, mask);
1646 + irq_desc[irq].affinity = mask;
1648 #endif /* CONFIG_SMP */
1650 @@ -1948,24 +1990,31 @@ static struct irq_chip msi_chip = {
1651 .retrigger = ioapic_retrigger_irq,
1654 -int arch_setup_msi_irq(unsigned int irq, struct pci_dev *dev)
1655 +int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
1660 + irq = create_irq();
1664 + set_irq_msi(irq, desc);
1665 ret = msi_compose_msg(dev, irq, &msg);
1672 write_msi_msg(irq, &msg);
1674 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge");
1680 void arch_teardown_msi_irq(unsigned int irq)
1686 #endif /* CONFIG_PCI_MSI */
1687 @@ -1993,24 +2042,22 @@ static void target_ht_irq(unsigned int i
1689 static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
1691 + struct irq_cfg *cfg = irq_cfg + irq;
1696 cpus_and(tmp, mask, cpu_online_map);
1697 if (cpus_empty(tmp))
1698 - tmp = TARGET_CPUS;
1700 - cpus_and(mask, tmp, CPU_MASK_ALL);
1703 - vector = assign_irq_vector(irq, mask, &tmp);
1705 + if (assign_irq_vector(irq, mask))
1708 + cpus_and(tmp, cfg->domain, mask);
1709 dest = cpu_mask_to_apicid(tmp);
1711 - target_ht_irq(irq, dest, vector);
1712 - set_native_irq_info(irq, mask);
1713 + target_ht_irq(irq, dest, cfg->vector);
1714 + irq_desc[irq].affinity = mask;
1718 @@ -2027,14 +2074,17 @@ static struct irq_chip ht_irq_chip = {
1720 int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
1723 + struct irq_cfg *cfg = irq_cfg + irq;
1727 - vector = assign_irq_vector(irq, TARGET_CPUS, &tmp);
1728 - if (vector >= 0) {
1729 + tmp = TARGET_CPUS;
1730 + err = assign_irq_vector(irq, tmp);
1732 struct ht_irq_msg msg;
1735 + cpus_and(tmp, cfg->domain, tmp);
1736 dest = cpu_mask_to_apicid(tmp);
1738 msg.address_hi = HT_IRQ_HIGH_DEST_ID(dest);
1739 @@ -2042,7 +2092,7 @@ int arch_setup_ht_irq(unsigned int irq,
1742 HT_IRQ_LOW_DEST_ID(dest) |
1743 - HT_IRQ_LOW_VECTOR(vector) |
1744 + HT_IRQ_LOW_VECTOR(cfg->vector) |
1745 ((INT_DEST_MODE == 0) ?
1746 HT_IRQ_LOW_DM_PHYSICAL :
1747 HT_IRQ_LOW_DM_LOGICAL) |
1748 @@ -2057,7 +2107,7 @@ int arch_setup_ht_irq(unsigned int irq,
1749 set_irq_chip_and_handler_name(irq, &ht_irq_chip,
1750 handle_edge_irq, "edge");
1755 #endif /* CONFIG_HT_IRQ */
1757 @@ -2082,13 +2132,8 @@ int __init io_apic_get_redir_entries (in
1761 -int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low)
1762 +int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
1764 - struct IO_APIC_route_entry entry;
1765 - unsigned long flags;
1769 if (!IO_APIC_IRQ(irq)) {
1770 apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
1772 @@ -2101,42 +2146,7 @@ int io_apic_set_pci_routing (int ioapic,
1774 add_pin_to_irq(irq, ioapic, pin);
1777 - vector = assign_irq_vector(irq, TARGET_CPUS, &mask);
1782 - * Generate a PCI IRQ routing entry and program the IOAPIC accordingly.
1783 - * Note that we mask (disable) IRQs now -- these get enabled when the
1784 - * corresponding device driver registers for this IRQ.
1787 - memset(&entry,0,sizeof(entry));
1789 - entry.delivery_mode = INT_DELIVERY_MODE;
1790 - entry.dest_mode = INT_DEST_MODE;
1791 - entry.dest.logical.logical_dest = cpu_mask_to_apicid(mask);
1792 - entry.trigger = edge_level;
1793 - entry.polarity = active_high_low;
1794 - entry.mask = 1; /* Disabled (masked) */
1795 - entry.vector = vector & 0xff;
1797 - apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> "
1798 - "IRQ %d Mode:%i Active:%i)\n", ioapic,
1799 - mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq,
1800 - edge_level, active_high_low);
1802 - ioapic_register_intr(irq, entry.vector, edge_level);
1804 - if (!ioapic && (irq < 16))
1805 - disable_8259A_irq(irq);
1807 - ioapic_write_entry(ioapic, pin, entry);
1809 - spin_lock_irqsave(&ioapic_lock, flags);
1810 - set_native_irq_info(irq, TARGET_CPUS);
1811 - spin_unlock_irqrestore(&ioapic_lock, flags);
1812 + setup_IO_APIC_irq(ioapic, pin, irq, triggering, polarity);
1816 @@ -2169,8 +2179,10 @@ void __init setup_ioapic_dest(void)
1817 * when you have too many devices, because at that time only boot
1820 - if(!irq_vector[irq])
1821 - setup_IO_APIC_irq(ioapic, pin, irq_entry, irq);
1822 + if (!irq_cfg[irq].vector)
1823 + setup_IO_APIC_irq(ioapic, pin, irq,
1824 + irq_trigger(irq_entry),
1825 + irq_polarity(irq_entry));
1827 set_ioapic_affinity_irq(irq, TARGET_CPUS);
1829 --- a/arch/x86/kernel/irq_32-xen.c
1830 +++ b/arch/x86/kernel/irq_32-xen.c
1835 -#include <asm/uaccess.h>
1836 #include <linux/module.h>
1837 #include <linux/seq_file.h>
1838 #include <linux/interrupt.h>
1840 #include <linux/cpu.h>
1841 #include <linux/delay.h>
1843 +#include <asm/apic.h>
1844 +#include <asm/uaccess.h>
1846 DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_internodealigned_in_smp;
1847 EXPORT_PER_CPU_SYMBOL(irq_stat);
1849 -#ifndef CONFIG_X86_LOCAL_APIC
1851 * 'what should we do if we get a hw irq event on an illegal vector'.
1852 * each architecture has to answer this themselves.
1854 void ack_bad_irq(unsigned int irq)
1856 - printk("unexpected IRQ trap at vector %02x\n", irq);
1858 + printk(KERN_ERR "unexpected IRQ trap at vector %02x\n", irq);
1860 +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
1862 + * Currently unexpected vectors happen only on SMP and APIC.
1863 + * We _must_ ack these because every local APIC has only N
1864 + * irq slots per priority level, and a 'hanging, unacked' IRQ
1865 + * holds up an irq slot - in excessive cases (when multiple
1866 + * unexpected vectors occur) that might lock up the APIC
1868 + * But only ack when the APIC is enabled -AK
1875 #ifdef CONFIG_4KSTACKS
1877 --- a/arch/x86/kernel/irq_64-xen.c
1878 +++ b/arch/x86/kernel/irq_64-xen.c
1880 #include <asm/uaccess.h>
1881 #include <asm/io_apic.h>
1882 #include <asm/idle.h>
1883 +#include <asm/smp.h>
1885 atomic_t irq_err_count;
1887 @@ -120,9 +121,15 @@ asmlinkage unsigned int do_IRQ(struct pt
1889 if (likely(irq < NR_IRQS))
1890 generic_handle_irq(irq);
1891 - else if (printk_ratelimit())
1892 - printk(KERN_EMERG "%s: %d.%d No irq handler for irq\n",
1893 - __func__, smp_processor_id(), irq);
1896 + if (!disable_apic)
1899 + if (printk_ratelimit())
1900 + printk(KERN_EMERG "%s: %d.%d No irq handler for irq\n",
1901 + __func__, smp_processor_id(), irq);
1906 --- a/arch/x86/kernel/Makefile
1907 +++ b/arch/x86/kernel/Makefile
1908 @@ -124,7 +124,7 @@ ifeq ($(CONFIG_X86_64),y)
1909 pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o
1912 -disabled-obj-$(CONFIG_XEN) := early-quirks.o i8253.o i8259_$(BITS).o reboot.o \
1913 - smpboot_$(BITS).o tsc_$(BITS).o
1914 +disabled-obj-$(CONFIG_XEN) := early-quirks.o hpet.o i8253.o i8259_$(BITS).o reboot.o \
1915 + smpboot_$(BITS).o tsc_$(BITS).o tsc_sync.o
1916 disabled-obj-$(CONFIG_XEN_UNPRIVILEGED_GUEST) += mpparse_64.o
1917 %/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) :=
1918 --- a/arch/x86/kernel/microcode-xen.c
1919 +++ b/arch/x86/kernel/microcode-xen.c
1920 @@ -108,7 +108,7 @@ static ssize_t microcode_write (struct f
1924 -static struct file_operations microcode_fops = {
1925 +static const struct file_operations microcode_fops = {
1926 .owner = THIS_MODULE,
1927 .write = microcode_write,
1928 .open = microcode_open,
1929 --- a/arch/x86/kernel/mpparse_32-xen.c
1930 +++ b/arch/x86/kernel/mpparse_32-xen.c
1931 @@ -1079,7 +1079,7 @@ int mp_register_gsi(u32 gsi, int trigger
1932 static int gsi_to_irq[MAX_GSI_NUM];
1934 /* Don't set up the ACPI SCI because it's already set up */
1935 - if (acpi_fadt.sci_int == gsi)
1936 + if (acpi_gbl_FADT.sci_interrupt == gsi)
1939 ioapic = mp_find_ioapic(gsi);
1940 @@ -1136,7 +1136,7 @@ int mp_register_gsi(u32 gsi, int trigger
1942 * Don't assign IRQ used by ACPI SCI
1944 - if (gsi == acpi_fadt.sci_int)
1945 + if (gsi == acpi_gbl_FADT.sci_interrupt)
1947 gsi_to_irq[irq] = gsi;
1949 --- a/arch/x86/kernel/mpparse_64-xen.c
1950 +++ b/arch/x86/kernel/mpparse_64-xen.c
1951 @@ -60,9 +60,9 @@ unsigned long mp_lapic_addr = 0;
1952 /* Processor that is doing the boot up */
1953 unsigned int boot_cpu_id = -1U;
1954 /* Internal processor count */
1955 -unsigned int num_processors __initdata = 0;
1956 +unsigned int num_processors __cpuinitdata = 0;
1958 -unsigned disabled_cpus __initdata;
1959 +unsigned disabled_cpus __cpuinitdata;
1961 /* Bitmask of physically existing CPUs */
1962 physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE;
1963 @@ -808,7 +808,7 @@ int mp_register_gsi(u32 gsi, int trigger
1966 /* Don't set up the ACPI SCI because it's already set up */
1967 - if (acpi_fadt.sci_int == gsi)
1968 + if (acpi_gbl_FADT.sci_interrupt == gsi)
1971 ioapic = mp_find_ioapic(gsi);
1972 --- a/arch/x86/kernel/pci-dma-xen.c
1973 +++ b/arch/x86/kernel/pci-dma-xen.c
1974 @@ -311,7 +311,7 @@ int dma_declare_coherent_memory(struct d
1975 return DMA_MEMORY_IO;
1978 - kfree(dev->dma_mem->bitmap);
1979 + kfree(dev->dma_mem);
1983 --- a/arch/x86/kernel/pcspeaker.c
1984 +++ b/arch/x86/kernel/pcspeaker.c
1985 @@ -7,6 +7,11 @@ static __init int add_pcspkr(void)
1986 struct platform_device *pd;
1990 + if (!is_initial_xendomain())
1994 pd = platform_device_alloc("pcspkr", -1);
1997 --- a/arch/x86/kernel/process_32-xen.c
1998 +++ b/arch/x86/kernel/process_32-xen.c
2000 #include <linux/ptrace.h>
2001 #include <linux/random.h>
2002 #include <linux/personality.h>
2003 +#include <linux/tick.h>
2005 #include <asm/uaccess.h>
2006 #include <asm/pgtable.h>
2007 @@ -160,6 +161,7 @@ void cpu_idle(void)
2009 /* endless idle loop with no priority at all */
2011 + tick_nohz_stop_sched_tick();
2012 while (!need_resched()) {
2015 @@ -175,6 +177,7 @@ void cpu_idle(void)
2016 __get_cpu_var(irq_stat).idle_timestamp = jiffies;
2019 + tick_nohz_restart_sched_tick();
2020 preempt_enable_no_resched();
2023 @@ -247,8 +250,8 @@ void show_regs(struct pt_regs * regs)
2024 regs->eax,regs->ebx,regs->ecx,regs->edx);
2025 printk("ESI: %08lx EDI: %08lx EBP: %08lx",
2026 regs->esi, regs->edi, regs->ebp);
2027 - printk(" DS: %04x ES: %04x GS: %04x\n",
2028 - 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xgs);
2029 + printk(" DS: %04x ES: %04x FS: %04x\n",
2030 + 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs);
2034 @@ -279,7 +282,7 @@ int kernel_thread(int (*fn)(void *), voi
2036 regs.xds = __USER_DS;
2037 regs.xes = __USER_DS;
2038 - regs.xgs = __KERNEL_PDA;
2039 + regs.xfs = __KERNEL_PDA;
2041 regs.eip = (unsigned long) kernel_thread_helper;
2042 regs.xcs = __KERNEL_CS | get_kernel_rpl();
2043 @@ -356,7 +359,7 @@ int copy_thread(int nr, unsigned long cl
2045 p->thread.eip = (unsigned long) ret_from_fork;
2047 - savesegment(fs,p->thread.fs);
2048 + savesegment(gs,p->thread.gs);
2051 if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
2052 @@ -434,8 +437,8 @@ void dump_thread(struct pt_regs * regs,
2053 dump->regs.eax = regs->eax;
2054 dump->regs.ds = regs->xds;
2055 dump->regs.es = regs->xes;
2056 - savesegment(fs,dump->regs.fs);
2057 - dump->regs.gs = regs->xgs;
2058 + dump->regs.fs = regs->xfs;
2059 + savesegment(gs,dump->regs.gs);
2060 dump->regs.orig_eax = regs->orig_eax;
2061 dump->regs.eip = regs->eip;
2062 dump->regs.cs = regs->xcs;
2063 @@ -637,16 +640,6 @@ struct task_struct fastcall * __switch_t
2064 prefetch(&next->i387.fxsave);
2067 - * Restore %fs if needed.
2069 - * Glibc normally makes %fs be zero.
2071 - if (unlikely(next->fs))
2072 - loadsegment(fs, next->fs);
2074 - write_pda(pcurrent, next_p);
2077 * Now maybe handle debug registers
2079 if (unlikely(task_thread_info(next_p)->flags & _TIF_WORK_CTXSW))
2080 @@ -654,6 +647,15 @@ struct task_struct fastcall * __switch_t
2082 disable_tsc(prev_p, next_p);
2085 + * Leave lazy mode, flushing any hypercalls made here.
2086 + * This must be done before restoring TLS segments so
2087 + * the GDT and LDT are properly updated, and must be
2088 + * done before math_state_restore, so the TS bit is up
2091 + arch_leave_lazy_cpu_mode();
2093 /* If the task has used fpu the last 5 timeslices, just do a full
2094 * restore of the math state immediately to avoid the trap; the
2095 * chances of needing FPU soon are obviously high now
2096 @@ -661,6 +663,14 @@ struct task_struct fastcall * __switch_t
2097 if (next_p->fpu_counter > 5)
2098 math_state_restore();
2101 + * Restore %gs if needed (which is common)
2103 + if (prev->gs | next->gs)
2104 + loadsegment(gs, next->gs);
2106 + write_pda(pcurrent, next_p);
2111 --- a/arch/x86/kernel/process_64-xen.c
2112 +++ b/arch/x86/kernel/process_64-xen.c
2113 @@ -338,14 +338,17 @@ void load_gs_index(unsigned gs)
2114 void flush_thread(void)
2116 struct task_struct *tsk = current;
2117 - struct thread_info *t = current_thread_info();
2119 - if (t->flags & _TIF_ABI_PENDING) {
2120 - t->flags ^= (_TIF_ABI_PENDING | _TIF_IA32);
2121 - if (t->flags & _TIF_IA32)
2122 + if (test_tsk_thread_flag(tsk, TIF_ABI_PENDING)) {
2123 + clear_tsk_thread_flag(tsk, TIF_ABI_PENDING);
2124 + if (test_tsk_thread_flag(tsk, TIF_IA32)) {
2125 + clear_tsk_thread_flag(tsk, TIF_IA32);
2127 + set_tsk_thread_flag(tsk, TIF_IA32);
2128 current_thread_info()->status |= TS_COMPAT;
2131 - t->flags &= ~_TIF_DEBUG;
2132 + clear_tsk_thread_flag(tsk, TIF_DEBUG);
2134 tsk->thread.debugreg0 = 0;
2135 tsk->thread.debugreg1 = 0;
2136 --- a/arch/x86/kernel/setup_32-xen.c
2137 +++ b/arch/x86/kernel/setup_32-xen.c
2139 #include <linux/initrd.h>
2140 #include <linux/bootmem.h>
2141 #include <linux/seq_file.h>
2142 -#include <linux/platform_device.h>
2143 #include <linux/console.h>
2144 #include <linux/mca.h>
2145 #include <linux/root_dev.h>
2146 @@ -148,7 +147,7 @@ unsigned long saved_videomode;
2147 #define RAMDISK_PROMPT_FLAG 0x8000
2148 #define RAMDISK_LOAD_FLAG 0x4000
2150 -static char command_line[COMMAND_LINE_SIZE];
2151 +static char __initdata command_line[COMMAND_LINE_SIZE];
2153 unsigned char __initdata boot_params[PARAM_SIZE];
2155 @@ -647,8 +646,8 @@ void __init setup_arch(char **cmdline_p)
2157 if ((i = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE)
2158 i = COMMAND_LINE_SIZE;
2159 - memcpy(saved_command_line, xen_start_info->cmd_line, i);
2160 - saved_command_line[i - 1] = '\0';
2161 + memcpy(boot_command_line, xen_start_info->cmd_line, i);
2162 + boot_command_line[i - 1] = '\0';
2163 parse_early_param();
2165 if (user_defined_memmap) {
2166 @@ -656,11 +655,19 @@ void __init setup_arch(char **cmdline_p)
2167 print_memory_map("user");
2170 - strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE);
2171 + strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
2172 *cmdline_p = command_line;
2174 max_low_pfn = setup_memory();
2178 + * Must be after max_low_pfn is determined, and before kernel
2179 + * pagetables are setup.
2185 * NOTE: before this point _nobody_ is allowed to allocate
2186 * any memory using the bootmem allocator. Although the
2187 @@ -823,7 +830,6 @@ void __init setup_arch(char **cmdline_p)
2188 conswitchp = &dummy_con;
2195 @@ -833,31 +839,3 @@ xen_panic_event(struct notifier_block *t
2196 /* we're never actually going to get here... */
2200 -static __init int add_pcspkr(void)
2202 - struct platform_device *pd;
2205 - if (!is_initial_xendomain())
2208 - pd = platform_device_alloc("pcspkr", -1);
2212 - ret = platform_device_add(pd);
2214 - platform_device_put(pd);
2218 -device_initcall(add_pcspkr);
2221 - * Local Variables:
2223 - * c-file-style:"k&r"
2224 - * c-basic-offset:8
2227 --- a/arch/x86/kernel/setup_64-xen.c
2228 +++ b/arch/x86/kernel/setup_64-xen.c
2229 @@ -141,7 +141,7 @@ EXPORT_SYMBOL_GPL(edid_info);
2231 extern int root_mountflags;
2233 -char command_line[COMMAND_LINE_SIZE];
2234 +char __initdata command_line[COMMAND_LINE_SIZE];
2236 struct resource standard_io_resources[] = {
2237 { .name = "dma1", .start = 0x00, .end = 0x1f,
2238 @@ -179,134 +179,6 @@ struct resource code_resource = {
2239 .flags = IORESOURCE_RAM,
2242 -#define IORESOURCE_ROM (IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM)
2244 -static struct resource system_rom_resource = {
2245 - .name = "System ROM",
2248 - .flags = IORESOURCE_ROM,
2251 -static struct resource extension_rom_resource = {
2252 - .name = "Extension ROM",
2255 - .flags = IORESOURCE_ROM,
2258 -static struct resource adapter_rom_resources[] = {
2259 - { .name = "Adapter ROM", .start = 0xc8000, .end = 0,
2260 - .flags = IORESOURCE_ROM },
2261 - { .name = "Adapter ROM", .start = 0, .end = 0,
2262 - .flags = IORESOURCE_ROM },
2263 - { .name = "Adapter ROM", .start = 0, .end = 0,
2264 - .flags = IORESOURCE_ROM },
2265 - { .name = "Adapter ROM", .start = 0, .end = 0,
2266 - .flags = IORESOURCE_ROM },
2267 - { .name = "Adapter ROM", .start = 0, .end = 0,
2268 - .flags = IORESOURCE_ROM },
2269 - { .name = "Adapter ROM", .start = 0, .end = 0,
2270 - .flags = IORESOURCE_ROM }
2273 -static struct resource video_rom_resource = {
2274 - .name = "Video ROM",
2277 - .flags = IORESOURCE_ROM,
2280 -static struct resource video_ram_resource = {
2281 - .name = "Video RAM area",
2284 - .flags = IORESOURCE_RAM,
2287 -#define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
2289 -static int __init romchecksum(unsigned char *rom, unsigned long length)
2291 - unsigned char *p, sum = 0;
2293 - for (p = rom; p < rom + length; p++)
2298 -static void __init probe_roms(void)
2300 - unsigned long start, length, upper;
2301 - unsigned char *rom;
2305 - /* Nothing to do if not running in dom0. */
2306 - if (!is_initial_xendomain())
2311 - upper = adapter_rom_resources[0].start;
2312 - for (start = video_rom_resource.start; start < upper; start += 2048) {
2313 - rom = isa_bus_to_virt(start);
2314 - if (!romsignature(rom))
2317 - video_rom_resource.start = start;
2319 - /* 0 < length <= 0x7f * 512, historically */
2320 - length = rom[2] * 512;
2322 - /* if checksum okay, trust length byte */
2323 - if (length && romchecksum(rom, length))
2324 - video_rom_resource.end = start + length - 1;
2326 - request_resource(&iomem_resource, &video_rom_resource);
2330 - start = (video_rom_resource.end + 1 + 2047) & ~2047UL;
2331 - if (start < upper)
2335 - request_resource(&iomem_resource, &system_rom_resource);
2336 - upper = system_rom_resource.start;
2338 - /* check for extension rom (ignore length byte!) */
2339 - rom = isa_bus_to_virt(extension_rom_resource.start);
2340 - if (romsignature(rom)) {
2341 - length = extension_rom_resource.end - extension_rom_resource.start + 1;
2342 - if (romchecksum(rom, length)) {
2343 - request_resource(&iomem_resource, &extension_rom_resource);
2344 - upper = extension_rom_resource.start;
2348 - /* check for adapter roms on 2k boundaries */
2349 - for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper;
2351 - rom = isa_bus_to_virt(start);
2352 - if (!romsignature(rom))
2355 - /* 0 < length <= 0x7f * 512, historically */
2356 - length = rom[2] * 512;
2358 - /* but accept any length that fits if checksum okay */
2359 - if (!length || start + length > upper || !romchecksum(rom, length))
2362 - adapter_rom_resources[i].start = start;
2363 - adapter_rom_resources[i].end = start + length - 1;
2364 - request_resource(&iomem_resource, &adapter_rom_resources[i]);
2366 - start = adapter_rom_resources[i++].end & ~2047UL;
2370 #ifdef CONFIG_PROC_VMCORE
2371 /* elfcorehdr= specifies the location of elf core header
2372 * stored by the crashed kernel. This option will be passed
2373 @@ -403,7 +275,7 @@ void __init setup_arch(char **cmdline_p)
2375 extern struct e820map machine_e820;
2377 - printk(KERN_INFO "Command line: %s\n", saved_command_line);
2378 + printk(KERN_INFO "Command line: %s\n", boot_command_line);
2380 /* Register a call for panic conditions. */
2381 atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
2382 @@ -430,7 +302,7 @@ void __init setup_arch(char **cmdline_p)
2386 - printk(KERN_INFO "Command line: %s\n", saved_command_line);
2387 + printk(KERN_INFO "Command line: %s\n", boot_command_line);
2389 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
2390 screen_info = SCREEN_INFO;
2391 @@ -461,7 +333,7 @@ void __init setup_arch(char **cmdline_p)
2393 early_identify_cpu(&boot_cpu_data);
2395 - strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE);
2396 + strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
2397 *cmdline_p = command_line;
2399 parse_early_param();
2400 @@ -531,6 +403,11 @@ void __init setup_arch(char **cmdline_p)
2401 /* reserve ebda region */
2403 reserve_bootmem_generic(ebda_addr, ebda_size);
2405 + /* reserve nodemap region */
2407 + reserve_bootmem_generic(nodemap_addr, nodemap_size);
2412 @@ -731,10 +608,8 @@ void __init setup_arch(char **cmdline_p)
2416 - * Request address space for all standard RAM and ROM resources
2417 - * and also for regions reported as reserved by the e820.
2418 + * We trust e820 completely. No explicit ROM probing in memory.
2422 if (is_initial_xendomain())
2423 e820_reserve_resources(machine_e820.map, machine_e820.nr_map);
2424 @@ -743,8 +618,6 @@ void __init setup_arch(char **cmdline_p)
2425 e820_mark_nosave_regions();
2428 - request_resource(&iomem_resource, &video_ram_resource);
2432 /* request I/O space for devices used on all i[345]86 PCs */
2433 @@ -1321,7 +1194,8 @@ static int show_cpuinfo(struct seq_file
2434 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2435 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
2436 NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL,
2437 - NULL, "fxsr_opt", NULL, "rdtscp", NULL, "lm", "3dnowext", "3dnow",
2438 + NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm",
2439 + "3dnowext", "3dnow",
2441 /* Transmeta-defined */
2442 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
2443 @@ -1339,7 +1213,7 @@ static int show_cpuinfo(struct seq_file
2444 /* Intel-defined (#2) */
2445 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
2446 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
2447 - NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL,
2448 + NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt",
2449 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2451 /* VIA/Cyrix/Centaur-defined */
2452 @@ -1349,8 +1223,10 @@ static int show_cpuinfo(struct seq_file
2453 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2455 /* AMD-defined (#2) */
2456 - "lahf_lm", "cmp_legacy", "svm", NULL, "cr8_legacy", NULL, NULL, NULL,
2457 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2458 + "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy",
2459 + "altmovcr8", "abm", "sse4a",
2460 + "misalignsse", "3dnowprefetch",
2461 + "osvw", "ibs", NULL, NULL, NULL, NULL,
2462 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2463 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2465 @@ -1361,6 +1237,9 @@ static int show_cpuinfo(struct seq_file
2466 "ttp", /* thermal trip */
2471 + NULL, /* tsc invariant mapped to constant_tsc */
2473 /* nothing */ /* constant_tsc - moved to flags */
2475 @@ -1477,26 +1356,3 @@ struct seq_operations cpuinfo_op = {
2477 .show = show_cpuinfo,
2480 -#if defined(CONFIG_INPUT_PCSPKR) || defined(CONFIG_INPUT_PCSPKR_MODULE)
2481 -#include <linux/platform_device.h>
2482 -static __init int add_pcspkr(void)
2484 - struct platform_device *pd;
2487 - if (!is_initial_xendomain())
2490 - pd = platform_device_alloc("pcspkr", -1);
2494 - ret = platform_device_add(pd);
2496 - platform_device_put(pd);
2500 -device_initcall(add_pcspkr);
2502 --- a/arch/x86/kernel/smp_32-xen.c
2503 +++ b/arch/x86/kernel/smp_32-xen.c
2504 @@ -335,8 +335,7 @@ static void flush_tlb_others(cpumask_t c
2506 * i'm not happy about this global shared spinlock in the
2507 * MM hot path, but we'll see how contended it is.
2508 - * Temporarily this turns IRQs off, so that lockups are
2509 - * detected by the NMI watchdog.
2510 + * AK: x86-64 has a faster method that could be ported.
2512 spin_lock(&tlbstate_lock);
2514 @@ -361,7 +360,7 @@ static void flush_tlb_others(cpumask_t c
2516 while (!cpus_empty(flush_cpumask))
2517 /* nothing. lockup detection does not belong here */
2523 --- a/arch/x86/kernel/time_32-xen.c
2524 +++ b/arch/x86/kernel/time_32-xen.c
2526 #include <linux/kernel_stat.h>
2527 #include <linux/posix-timers.h>
2528 #include <linux/cpufreq.h>
2529 +#include <linux/clocksource.h>
2532 #include <asm/smp.h>
2534 #include <xen/evtchn.h>
2535 #include <xen/interface/vcpu.h>
2537 -#if defined (__i386__)
2538 -#include <asm/i8259.h>
2539 +#ifdef CONFIG_X86_32
2540 #include <asm/i8253.h>
2541 DEFINE_SPINLOCK(i8253_lock);
2542 EXPORT_SYMBOL(i8253_lock);
2545 -#define XEN_SHIFT 22
2547 int pit_latch_buggy; /* extern */
2549 -#if defined(__x86_64__)
2550 -unsigned long vxtime_hz = PIT_TICK_RATE;
2551 -struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */
2553 volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
2554 -struct timespec __xtime __section_xtime;
2555 -struct timezone __sys_tz __section_sys_tz;
2558 +#define XEN_SHIFT 22
2560 unsigned int cpu_khz; /* Detected as we calibrate the TSC */
2561 EXPORT_SYMBOL(cpu_khz);
2563 @@ -113,9 +106,6 @@ static DEFINE_PER_CPU(struct shadow_time
2564 static struct timespec shadow_tv;
2565 static u32 shadow_tv_version;
2567 -static struct timeval monotonic_tv;
2568 -static spinlock_t monotonic_lock = SPIN_LOCK_UNLOCKED;
2570 /* Keep track of last time we did processing/updating of jiffies and xtime. */
2571 static u64 processed_system_time; /* System time (ns) at last processing. */
2572 static DEFINE_PER_CPU(u64, processed_system_time);
2573 @@ -228,7 +218,7 @@ static inline u64 scale_delta(u64 delta,
2577 -void init_cpu_khz(void)
2578 +static void init_cpu_khz(void)
2580 u64 __cpu_khz = 1000000ULL << 32;
2581 struct vcpu_time_info *info = &vcpu_info(0)->time;
2582 @@ -247,16 +237,6 @@ static u64 get_nsec_offset(struct shadow
2583 return scale_delta(delta, shadow->tsc_to_nsec_mul, shadow->tsc_shift);
2586 -#ifdef CONFIG_X86_64
2587 -static unsigned long get_usec_offset(struct shadow_time_info *shadow)
2591 - delta = now - shadow->tsc_timestamp;
2592 - return scale_delta(delta, shadow->tsc_to_usec_mul, shadow->tsc_shift);
2596 static void __update_wallclock(time_t sec, long nsec)
2598 long wtm_nsec, xtime_nsec;
2599 @@ -371,138 +351,6 @@ void rtc_cmos_write(unsigned char val, u
2601 EXPORT_SYMBOL(rtc_cmos_write);
2603 -#ifdef CONFIG_X86_64
2606 - * This version of gettimeofday has microsecond resolution
2607 - * and better than microsecond precision on fast x86 machines with TSC.
2609 -void do_gettimeofday(struct timeval *tv)
2611 - unsigned long seq;
2612 - unsigned long usec, sec;
2613 - unsigned long flags;
2616 - struct shadow_time_info *shadow;
2617 - u32 local_time_version;
2620 - shadow = &per_cpu(shadow_time, cpu);
2623 - local_time_version = shadow->version;
2624 - seq = read_seqbegin(&xtime_lock);
2626 - usec = get_usec_offset(shadow);
2628 - sec = xtime.tv_sec;
2629 - usec += (xtime.tv_nsec / NSEC_PER_USEC);
2631 - nsec = shadow->system_timestamp - processed_system_time;
2632 - __normalize_time(&sec, &nsec);
2633 - usec += (long)nsec / NSEC_PER_USEC;
2635 - if (unlikely(!time_values_up_to_date(cpu))) {
2637 - * We may have blocked for a long time,
2638 - * rendering our calculations invalid
2639 - * (e.g. the time delta may have
2640 - * overflowed). Detect that and recalculate
2641 - * with fresh values.
2643 - get_time_values_from_xen(cpu);
2646 - } while (read_seqretry(&xtime_lock, seq) ||
2647 - (local_time_version != shadow->version));
2651 - while (usec >= USEC_PER_SEC) {
2652 - usec -= USEC_PER_SEC;
2656 - spin_lock_irqsave(&monotonic_lock, flags);
2657 - if ((sec > monotonic_tv.tv_sec) ||
2658 - ((sec == monotonic_tv.tv_sec) && (usec > monotonic_tv.tv_usec)))
2660 - monotonic_tv.tv_sec = sec;
2661 - monotonic_tv.tv_usec = usec;
2663 - sec = monotonic_tv.tv_sec;
2664 - usec = monotonic_tv.tv_usec;
2666 - spin_unlock_irqrestore(&monotonic_lock, flags);
2669 - tv->tv_usec = usec;
2672 -EXPORT_SYMBOL(do_gettimeofday);
2674 -int do_settimeofday(struct timespec *tv)
2679 - struct shadow_time_info *shadow;
2680 - struct xen_platform_op op;
2682 - if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
2686 - shadow = &per_cpu(shadow_time, cpu);
2688 - write_seqlock_irq(&xtime_lock);
2691 - * Ensure we don't get blocked for a long time so that our time delta
2692 - * overflows. If that were to happen then our shadow time values would
2693 - * be stale, so we can retry with fresh ones.
2696 - nsec = tv->tv_nsec - get_nsec_offset(shadow);
2697 - if (time_values_up_to_date(cpu))
2699 - get_time_values_from_xen(cpu);
2702 - __normalize_time(&sec, &nsec);
2704 - if (is_initial_xendomain() && !independent_wallclock) {
2705 - op.cmd = XENPF_settime;
2706 - op.u.settime.secs = sec;
2707 - op.u.settime.nsecs = nsec;
2708 - op.u.settime.system_time = shadow->system_timestamp;
2709 - WARN_ON(HYPERVISOR_platform_op(&op));
2710 - update_wallclock();
2711 - } else if (independent_wallclock) {
2712 - nsec -= shadow->system_timestamp;
2713 - __normalize_time(&sec, &nsec);
2714 - __update_wallclock(sec, nsec);
2717 - /* Reset monotonic gettimeofday() timeval. */
2718 - spin_lock(&monotonic_lock);
2719 - monotonic_tv.tv_sec = 0;
2720 - monotonic_tv.tv_usec = 0;
2721 - spin_unlock(&monotonic_lock);
2723 - write_sequnlock_irq(&xtime_lock);
2731 -EXPORT_SYMBOL(do_settimeofday);
2735 static void sync_xen_wallclock(unsigned long dummy);
2736 static DEFINE_TIMER(sync_xen_wallclock_timer, sync_xen_wallclock, 0, 0);
2737 static void sync_xen_wallclock(unsigned long dummy)
2738 @@ -551,15 +399,7 @@ static int set_rtc_mmss(unsigned long no
2742 -#ifdef CONFIG_X86_64
2743 -/* monotonic_clock(): returns # of nanoseconds passed since time_init()
2744 - * Note: This function is required to return accurate
2745 - * time even in the absence of multiple timer ticks.
2747 -unsigned long long monotonic_clock(void)
2749 unsigned long long sched_clock(void)
2752 unsigned int cpu = get_cpu();
2753 struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu);
2754 @@ -579,21 +419,18 @@ unsigned long long sched_clock(void)
2758 -#ifdef CONFIG_X86_64
2759 -EXPORT_SYMBOL(monotonic_clock);
2761 -unsigned long long sched_clock(void)
2763 - return monotonic_clock();
2767 unsigned long profile_pc(struct pt_regs *regs)
2769 unsigned long pc = instruction_pointer(regs);
2771 #if defined(CONFIG_SMP) || defined(__x86_64__)
2772 - if (!user_mode_vm(regs) && in_lock_functions(pc)) {
2774 + if (!v8086_mode(regs) && SEGMENT_IS_KERNEL_CODE(regs->xcs)
2776 + if (!user_mode(regs)
2778 + && in_lock_functions(pc)) {
2779 # ifdef CONFIG_FRAME_POINTER
2781 return ((unsigned long *)regs->ebp)[1];
2782 @@ -602,14 +439,11 @@ unsigned long profile_pc(struct pt_regs
2786 - unsigned long *sp;
2787 - if ((regs->xcs & 2) == 0)
2788 - sp = (unsigned long *)®s->esp;
2790 - sp = (unsigned long *)regs->esp;
2791 + unsigned long *sp = (unsigned long *)®s->esp;
2793 unsigned long *sp = (unsigned long *)regs->rsp;
2796 /* Return address is either directly at stack pointer
2797 or above a saved eflags. Eflags has bits 22-31 zero,
2798 kernel addresses don't. */
2799 @@ -762,19 +596,6 @@ irqreturn_t timer_interrupt(int irq, voi
2803 -#ifndef CONFIG_X86_64
2805 -void tsc_init(void)
2808 - printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
2809 - cpu_khz / 1000, cpu_khz % 1000);
2814 -#include <linux/clocksource.h>
2816 void mark_tsc_unstable(void)
2818 #ifndef CONFIG_XEN /* XXX Should tell the hypervisor about this fact. */
2819 @@ -830,21 +651,9 @@ static struct clocksource clocksource_xe
2820 .mask = CLOCKSOURCE_MASK(64),
2821 .mult = 1 << XEN_SHIFT, /* time directly in nanoseconds */
2823 - .is_continuous = 1,
2824 + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
2827 -static int __init init_xen_clocksource(void)
2829 - clocksource_xen.mult = clocksource_khz2mult(cpu_khz,
2830 - clocksource_xen.shift);
2832 - return clocksource_register(&clocksource_xen);
2835 -module_init(init_xen_clocksource);
2839 static void init_missing_ticks_accounting(unsigned int cpu)
2841 struct vcpu_register_runstate_memory_area area;
2842 @@ -865,7 +674,7 @@ static void init_missing_ticks_accountin
2845 /* not static: needed by APM */
2846 -unsigned long get_cmos_time(void)
2847 +unsigned long read_persistent_clock(void)
2849 unsigned long retval;
2850 unsigned long flags;
2851 @@ -878,11 +687,11 @@ unsigned long get_cmos_time(void)
2855 -EXPORT_SYMBOL(get_cmos_time);
2857 static void sync_cmos_clock(unsigned long dummy);
2859 static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0);
2860 +int no_sync_cmos_clock;
2862 static void sync_cmos_clock(unsigned long dummy)
2864 @@ -926,7 +735,8 @@ static void sync_cmos_clock(unsigned lon
2866 void notify_arch_cmos_timer(void)
2868 - mod_timer(&sync_cmos_timer, jiffies + 1);
2869 + if (!no_sync_cmos_clock)
2870 + mod_timer(&sync_cmos_timer, jiffies + 1);
2871 mod_timer(&sync_xen_wallclock_timer, jiffies + 1);
2874 @@ -959,29 +769,11 @@ static int time_init_device(void)
2876 device_initcall(time_init_device);
2878 -#ifdef CONFIG_HPET_TIMER
2879 extern void (*late_time_init)(void);
2880 -/* Duplicate of time_init() below, with hpet_enable part added */
2881 -static void __init hpet_time_init(void)
2883 - struct timespec ts;
2884 - ts.tv_sec = get_cmos_time();
2885 - ts.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
2887 - do_settimeofday(&ts);
2889 - if ((hpet_enable() >= 0) && hpet_use_timer) {
2890 - printk("Using HPET for base-timer\n");
2897 /* Dynamically-mapped IRQ. */
2898 DEFINE_PER_CPU(int, timer_irq);
2900 -extern void (*late_time_init)(void);
2901 static void setup_cpu0_timer_irq(void)
2903 per_cpu(timer_irq, 0) =
2904 @@ -989,7 +781,7 @@ static void setup_cpu0_timer_irq(void)
2909 + IRQF_DISABLED|IRQF_NOBALANCING,
2912 BUG_ON(per_cpu(timer_irq, 0) < 0);
2913 @@ -1001,16 +793,9 @@ static struct vcpu_set_periodic_timer xe
2915 void __init time_init(void)
2917 -#ifdef CONFIG_HPET_TIMER
2918 - if (is_hpet_capable()) {
2920 - * HPET initialization needs to do memory-mapped io. So, let
2921 - * us do a late initialization after mem_init().
2923 - late_time_init = hpet_time_init;
2928 + printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
2929 + cpu_khz / 1000, cpu_khz % 1000);
2931 switch (HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, 0,
2932 &xen_set_periodic_tick)) {
2933 @@ -1029,18 +814,12 @@ void __init time_init(void)
2934 per_cpu(processed_system_time, 0) = processed_system_time;
2935 init_missing_ticks_accounting(0);
2937 - update_wallclock();
2938 + clocksource_register(&clocksource_xen);
2940 -#ifdef CONFIG_X86_64
2942 - printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
2943 - cpu_khz / 1000, cpu_khz % 1000);
2944 + update_wallclock();
2946 - vxtime.mode = VXTIME_TSC;
2947 - vxtime.quot = (1000000L << 32) / vxtime_hz;
2948 - vxtime.tsc_quot = (1000L << 32) / cpu_khz;
2950 - rdtscll(vxtime.last_tsc);
2951 +#ifndef CONFIG_X86_64
2955 /* Cannot request_irq() until kmem is initialised. */
2956 @@ -1197,7 +976,7 @@ int __cpuinit local_setup_timer(unsigned
2957 irq = bind_virq_to_irqhandler(VIRQ_TIMER,
2961 + IRQF_DISABLED|IRQF_NOBALANCING,
2965 @@ -1286,7 +1065,7 @@ static ctl_table xen_table[] = {
2967 static int __init xen_sysctl_init(void)
2969 - (void)register_sysctl_table(xen_table, 0);
2970 + (void)register_sysctl_table(xen_table);
2973 __initcall(xen_sysctl_init);
2974 --- a/arch/x86/kernel/traps_32-xen.c
2975 +++ b/arch/x86/kernel/traps_32-xen.c
2976 @@ -100,6 +100,7 @@ asmlinkage void fixup_4gb_segment(void);
2977 asmlinkage void machine_check(void);
2979 int kstack_depth_to_print = 24;
2980 +static unsigned int code_bytes = 64;
2981 ATOMIC_NOTIFIER_HEAD(i386die_chain);
2983 int register_die_notifier(struct notifier_block *nb)
2984 @@ -297,10 +298,11 @@ void show_registers(struct pt_regs *regs
2988 - unsigned short ss;
2989 + unsigned short ss, gs;
2991 esp = (unsigned long) (®s->esp);
2992 savesegment(ss, ss);
2993 + savesegment(gs, gs);
2994 if (user_mode_vm(regs)) {
2997 @@ -319,8 +321,8 @@ void show_registers(struct pt_regs *regs
2998 regs->eax, regs->ebx, regs->ecx, regs->edx);
2999 printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
3000 regs->esi, regs->edi, regs->ebp, esp);
3001 - printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n",
3002 - regs->xds & 0xffff, regs->xes & 0xffff, ss);
3003 + printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n",
3004 + regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss);
3005 printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)",
3006 TASK_COMM_LEN, current->comm, current->pid,
3007 current_thread_info(), current, current->thread_info);
3008 @@ -330,7 +332,8 @@ void show_registers(struct pt_regs *regs
3012 - int code_bytes = 64;
3013 + unsigned int code_prologue = code_bytes * 43 / 64;
3014 + unsigned int code_len = code_bytes;
3017 printk("\n" KERN_EMERG "Stack: ");
3018 @@ -338,14 +341,14 @@ void show_registers(struct pt_regs *regs
3020 printk(KERN_EMERG "Code: ");
3022 - eip = (u8 *)regs->eip - 43;
3023 + eip = (u8 *)regs->eip - code_prologue;
3024 if (eip < (u8 *)PAGE_OFFSET ||
3025 probe_kernel_address(eip, c)) {
3026 /* try starting at EIP */
3027 eip = (u8 *)regs->eip;
3029 + code_len = code_len - code_prologue + 1;
3031 - for (i = 0; i < code_bytes; i++, eip++) {
3032 + for (i = 0; i < code_len; i++, eip++) {
3033 if (eip < (u8 *)PAGE_OFFSET ||
3034 probe_kernel_address(eip, c)) {
3035 printk(" Bad EIP value.");
3036 @@ -1134,3 +1137,13 @@ static int __init kstack_setup(char *s)
3039 __setup("kstack=", kstack_setup);
3041 +static int __init code_bytes_setup(char *s)
3043 + code_bytes = simple_strtoul(s, NULL, 0);
3044 + if (code_bytes > 8192)
3045 + code_bytes = 8192;
3049 +__setup("code_bytes=", code_bytes_setup);
3050 --- a/arch/x86/kernel/vsyscall_64-xen.c
3051 +++ b/arch/x86/kernel/vsyscall_64-xen.c
3053 #include <linux/seqlock.h>
3054 #include <linux/jiffies.h>
3055 #include <linux/sysctl.h>
3056 +#include <linux/clocksource.h>
3057 #include <linux/getcpu.h>
3058 #include <linux/cpu.h>
3059 #include <linux/smp.h>
3061 #include <asm/vsyscall.h>
3062 #include <asm/pgtable.h>
3063 #include <asm/page.h>
3064 +#include <asm/unistd.h>
3065 #include <asm/fixmap.h>
3066 #include <asm/errno.h>
3069 #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
3070 #define __syscall_clobber "r11","rcx","memory"
3072 -int __sysctl_vsyscall __section_sysctl_vsyscall = 1;
3073 -seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED;
3074 +struct vsyscall_gtod_data_t {
3076 + int sysctl_enabled;
3077 + struct timeval wall_time_tv;
3078 + struct timezone sys_tz;
3079 + cycle_t offset_base;
3080 + struct clocksource clock;
3082 int __vgetcpu_mode __section_vgetcpu_mode;
3084 -#include <asm/unistd.h>
3086 -static __always_inline void timeval_normalize(struct timeval * tv)
3087 +struct vsyscall_gtod_data_t __vsyscall_gtod_data __section_vsyscall_gtod_data =
3091 - __sec = tv->tv_usec / 1000000;
3093 - tv->tv_usec %= 1000000;
3094 - tv->tv_sec += __sec;
3097 + .lock = SEQLOCK_UNLOCKED,
3098 + .sysctl_enabled = 1,
3101 -static __always_inline void do_vgettimeofday(struct timeval * tv)
3102 +void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
3105 - unsigned long sec, usec;
3106 + unsigned long flags;
3109 - sequence = read_seqbegin(&__xtime_lock);
3111 - sec = __xtime.tv_sec;
3112 - usec = __xtime.tv_nsec / 1000;
3114 - if (__vxtime.mode != VXTIME_HPET) {
3115 - t = get_cycles_sync();
3116 - if (t < __vxtime.last_tsc)
3117 - t = __vxtime.last_tsc;
3118 - usec += ((t - __vxtime.last_tsc) *
3119 - __vxtime.tsc_quot) >> 32;
3120 - /* See comment in x86_64 do_gettimeofday. */
3122 - usec += ((readl((void __iomem *)
3123 - fix_to_virt(VSYSCALL_HPET) + 0xf0) -
3124 - __vxtime.last) * __vxtime.quot) >> 32;
3126 - } while (read_seqretry(&__xtime_lock, sequence));
3128 - tv->tv_sec = sec + usec / 1000000;
3129 - tv->tv_usec = usec % 1000000;
3130 + write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags);
3131 + /* copy vsyscall data */
3132 + vsyscall_gtod_data.clock = *clock;
3133 + vsyscall_gtod_data.wall_time_tv.tv_sec = wall_time->tv_sec;
3134 + vsyscall_gtod_data.wall_time_tv.tv_usec = wall_time->tv_nsec/1000;
3135 + vsyscall_gtod_data.sys_tz = sys_tz;
3136 + write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
3139 -/* RED-PEN may want to readd seq locking, but then the variable should be write-once. */
3140 +/* RED-PEN may want to readd seq locking, but then the variable should be
3143 static __always_inline void do_get_tz(struct timezone * tz)
3146 + *tz = __vsyscall_gtod_data.sys_tz;
3149 static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
3150 @@ -101,7 +88,8 @@ static __always_inline int gettimeofday(
3152 asm volatile("vsysc2: syscall"
3154 - : "0" (__NR_gettimeofday),"D" (tv),"S" (tz) : __syscall_clobber );
3155 + : "0" (__NR_gettimeofday),"D" (tv),"S" (tz)
3156 + : __syscall_clobber );
3160 @@ -114,10 +102,44 @@ static __always_inline long time_syscall
3164 +static __always_inline void do_vgettimeofday(struct timeval * tv)
3166 + cycle_t now, base, mask, cycle_delta;
3167 + unsigned long seq, mult, shift, nsec_delta;
3168 + cycle_t (*vread)(void);
3170 + seq = read_seqbegin(&__vsyscall_gtod_data.lock);
3172 + vread = __vsyscall_gtod_data.clock.vread;
3173 + if (unlikely(!__vsyscall_gtod_data.sysctl_enabled || !vread)) {
3174 + gettimeofday(tv,NULL);
3178 + base = __vsyscall_gtod_data.clock.cycle_last;
3179 + mask = __vsyscall_gtod_data.clock.mask;
3180 + mult = __vsyscall_gtod_data.clock.mult;
3181 + shift = __vsyscall_gtod_data.clock.shift;
3183 + *tv = __vsyscall_gtod_data.wall_time_tv;
3185 + } while (read_seqretry(&__vsyscall_gtod_data.lock, seq));
3187 + /* calculate interval: */
3188 + cycle_delta = (now - base) & mask;
3189 + /* convert to nsecs: */
3190 + nsec_delta = (cycle_delta * mult) >> shift;
3192 + /* convert to usecs and add to timespec: */
3193 + tv->tv_usec += nsec_delta / NSEC_PER_USEC;
3194 + while (tv->tv_usec > USEC_PER_SEC) {
3196 + tv->tv_usec -= USEC_PER_SEC;
3200 int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz)
3202 - if (!__sysctl_vsyscall)
3203 - return gettimeofday(tv,tz);
3205 do_vgettimeofday(tv);
3207 @@ -129,11 +151,11 @@ int __vsyscall(0) vgettimeofday(struct t
3209 time_t __vsyscall(1) vtime(time_t *t)
3211 - if (!__sysctl_vsyscall)
3212 + if (unlikely(!__vsyscall_gtod_data.sysctl_enabled))
3213 return time_syscall(t);
3215 - *t = __xtime.tv_sec;
3216 - return __xtime.tv_sec;
3217 + *t = __vsyscall_gtod_data.wall_time_tv.tv_sec;
3218 + return __vsyscall_gtod_data.wall_time_tv.tv_sec;
3221 /* Fast way to get current CPU and node.
3222 @@ -210,7 +232,7 @@ static int vsyscall_sysctl_change(ctl_ta
3226 - if (!sysctl_vsyscall) {
3227 + if (!vsyscall_gtod_data.sysctl_enabled) {
3228 writew(SYSCALL, map1);
3229 writew(SYSCALL, map2);
3231 @@ -232,16 +254,17 @@ static int vsyscall_sysctl_nostrat(ctl_t
3233 static ctl_table kernel_table2[] = {
3234 { .ctl_name = 99, .procname = "vsyscall64",
3235 - .data = &sysctl_vsyscall, .maxlen = sizeof(int), .mode = 0644,
3236 + .data = &vsyscall_gtod_data.sysctl_enabled, .maxlen = sizeof(int),
3238 .strategy = vsyscall_sysctl_nostrat,
3239 .proc_handler = vsyscall_sysctl_change },
3244 static ctl_table kernel_root_table2[] = {
3245 { .ctl_name = CTL_KERN, .procname = "kernel", .mode = 0555,
3246 .child = kernel_table2 },
3252 @@ -304,14 +327,14 @@ static int __init vsyscall_init(void)
3253 BUG_ON((unsigned long) &vgetcpu != VSYSCALL_ADDR(__NR_vgetcpu));
3256 - sysctl_vsyscall = 0; /* disable vgettimeofay() */
3257 + vsyscall_gtod_data.sysctl_enabled = 0; /* disable vgettimeofay() */
3258 if (boot_cpu_has(X86_FEATURE_RDTSCP))
3259 vgetcpu_mode = VGETCPU_RDTSCP;
3261 vgetcpu_mode = VGETCPU_LSL;
3263 #ifdef CONFIG_SYSCTL
3264 - register_sysctl_table(kernel_root_table2, 0);
3265 + register_sysctl_table(kernel_root_table2);
3267 on_each_cpu(cpu_vsyscall_init, NULL, 0, 1);
3268 hotcpu_notifier(cpu_vsyscall_notifier, 0);
3269 --- a/arch/x86/mm/fault_32-xen.c
3270 +++ b/arch/x86/mm/fault_32-xen.c
3271 @@ -46,43 +46,17 @@ int unregister_page_fault_notifier(struc
3273 EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
3275 -static inline int notify_page_fault(enum die_val val, const char *str,
3276 - struct pt_regs *regs, long err, int trap, int sig)
3277 +static inline int notify_page_fault(struct pt_regs *regs, long err)
3279 struct die_args args = {
3282 + .str = "page fault",
3289 - return atomic_notifier_call_chain(¬ify_page_fault_chain, val, &args);
3293 - * Unlock any spinlocks which will prevent us from getting the
3296 -void bust_spinlocks(int yes)
3298 - int loglevel_save = console_loglevel;
3301 - oops_in_progress = 1;
3307 - oops_in_progress = 0;
3309 - * OK, the message is on the console. Now we call printk()
3310 - * without oops_in_progress set so that printk will give klogd
3311 - * a poke. Hold onto your hats...
3313 - console_loglevel = 15; /* NMI oopser may have shut the console up */
3315 - console_loglevel = loglevel_save;
3316 + return atomic_notifier_call_chain(¬ify_page_fault_chain,
3317 + DIE_PAGE_FAULT, &args);
3321 @@ -476,8 +450,7 @@ fastcall void __kprobes do_page_fault(st
3322 /* Can take a spurious fault if mapping changes R/O -> R/W. */
3323 if (spurious_fault(regs, address, error_code))
3325 - if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
3326 - SIGSEGV) == NOTIFY_STOP)
3327 + if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
3330 * Don't take the mm semaphore here. If we fixup a prefetch
3331 @@ -486,8 +459,7 @@ fastcall void __kprobes do_page_fault(st
3332 goto bad_area_nosemaphore;
3335 - if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
3336 - SIGSEGV) == NOTIFY_STOP)
3337 + if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
3340 /* It's safe to allow irq's after cr2 has been saved and the vmalloc
3341 --- a/arch/x86/mm/fault_64-xen.c
3342 +++ b/arch/x86/mm/fault_64-xen.c
3343 @@ -56,38 +56,17 @@ int unregister_page_fault_notifier(struc
3345 EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
3347 -static inline int notify_page_fault(enum die_val val, const char *str,
3348 - struct pt_regs *regs, long err, int trap, int sig)
3349 +static inline int notify_page_fault(struct pt_regs *regs, long err)
3351 struct die_args args = {
3354 + .str = "page fault",
3361 - return atomic_notifier_call_chain(¬ify_page_fault_chain, val, &args);
3364 -void bust_spinlocks(int yes)
3366 - int loglevel_save = console_loglevel;
3368 - oops_in_progress = 1;
3373 - oops_in_progress = 0;
3375 - * OK, the message is on the console. Now we call printk()
3376 - * without oops_in_progress set so that printk will give klogd
3377 - * a poke. Hold onto your hats...
3379 - console_loglevel = 15; /* NMI oopser may have shut the console up */
3381 - console_loglevel = loglevel_save;
3383 + return atomic_notifier_call_chain(¬ify_page_fault_chain,
3384 + DIE_PAGE_FAULT, &args);
3387 /* Sometimes the CPU reports invalid exceptions on prefetch.
3388 @@ -437,8 +416,7 @@ asmlinkage void __kprobes do_page_fault(
3389 /* Can take a spurious fault if mapping changes R/O -> R/W. */
3390 if (spurious_fault(regs, address, error_code))
3392 - if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
3393 - SIGSEGV) == NOTIFY_STOP)
3394 + if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
3397 * Don't take the mm semaphore here. If we fixup a prefetch
3398 @@ -447,8 +425,7 @@ asmlinkage void __kprobes do_page_fault(
3399 goto bad_area_nosemaphore;
3402 - if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
3403 - SIGSEGV) == NOTIFY_STOP)
3404 + if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
3407 if (likely(regs->eflags & X86_EFLAGS_IF))
3408 --- a/arch/x86/mm/highmem_32-xen.c
3409 +++ b/arch/x86/mm/highmem_32-xen.c
3410 @@ -33,14 +33,16 @@ static void *__kmap_atomic(struct page *
3412 /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
3413 pagefault_disable();
3415 + idx = type + KM_TYPE_NR*smp_processor_id();
3416 + BUG_ON(!pte_none(*(kmap_pte-idx)));
3418 if (!PageHighMem(page))
3419 return page_address(page);
3421 - idx = type + KM_TYPE_NR*smp_processor_id();
3422 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
3423 - if (!pte_none(*(kmap_pte-idx)))
3425 set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
3426 + /*arch_flush_lazy_mmu_mode();*/
3428 return (void*) vaddr;
3430 @@ -94,6 +96,7 @@ void *kmap_atomic_pfn(unsigned long pfn,
3431 idx = type + KM_TYPE_NR*smp_processor_id();
3432 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
3433 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
3434 + /*arch_flush_lazy_mmu_mode();*/
3436 return (void*) vaddr;
3438 --- a/arch/x86/mm/init_32-xen.c
3439 +++ b/arch/x86/mm/init_32-xen.c
3440 @@ -66,6 +66,7 @@ static pmd_t * __init one_md_table_init(
3442 #ifdef CONFIG_X86_PAE
3443 pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
3444 + paravirt_alloc_pd(__pa(pmd_table) >> PAGE_SHIFT);
3445 make_lowmem_page_readonly(pmd_table, XENFEAT_writable_page_tables);
3446 set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
3447 pud = pud_offset(pgd, 0);
3448 @@ -87,6 +88,7 @@ static pte_t * __init one_page_table_ini
3450 if (pmd_none(*pmd)) {
3451 pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
3452 + paravirt_alloc_pt(__pa(page_table) >> PAGE_SHIFT);
3453 make_lowmem_page_readonly(page_table,
3454 XENFEAT_writable_page_tables);
3455 set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE));
3456 --- a/arch/x86/mm/init_64-xen.c
3457 +++ b/arch/x86/mm/init_64-xen.c
3458 @@ -1110,20 +1110,30 @@ int kern_addr_valid(unsigned long addr)
3459 extern int exception_trace, page_fault_trace;
3461 static ctl_table debug_table2[] = {
3462 - { 99, "exception-trace", &exception_trace, sizeof(int), 0644, NULL,
3467 + .procname = "exception-trace",
3468 + .data = &exception_trace,
3469 + .maxlen = sizeof(int),
3471 + .proc_handler = proc_dointvec
3476 static ctl_table debug_root_table2[] = {
3477 - { .ctl_name = CTL_DEBUG, .procname = "debug", .mode = 0555,
3478 - .child = debug_table2 },
3481 + .ctl_name = CTL_DEBUG,
3482 + .procname = "debug",
3484 + .child = debug_table2
3489 static __init int x8664_sysctl_init(void)
3491 - register_sysctl_table(debug_root_table2, 1);
3492 + register_sysctl_table(debug_root_table2);
3495 __initcall(x8664_sysctl_init);
3496 --- a/arch/x86/mm/pageattr_64-xen.c
3497 +++ b/arch/x86/mm/pageattr_64-xen.c
3498 @@ -350,8 +350,8 @@ static void flush_kernel_map(void *arg)
3499 void *adr = page_address(pg);
3500 if (cpu_has_clflush)
3501 cache_flush_page(adr);
3502 - __flush_tlb_one(adr);
3504 + __flush_tlb_all();
3507 static inline void flush_map(struct list_head *l)
3508 @@ -376,6 +376,7 @@ static void revert_page(unsigned long ad
3512 + unsigned long pfn;
3514 pgd = pgd_offset_k(address);
3515 BUG_ON(pgd_none(*pgd));
3516 @@ -383,7 +384,8 @@ static void revert_page(unsigned long ad
3517 BUG_ON(pud_none(*pud));
3518 pmd = pmd_offset(pud, address);
3519 BUG_ON(__pmd_val(*pmd) & _PAGE_PSE);
3520 - large_pte = mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, ref_prot);
3521 + pfn = (__pa(address) & LARGE_PAGE_MASK) >> PAGE_SHIFT;
3522 + large_pte = pfn_pte(pfn, ref_prot);
3523 large_pte = pte_mkhuge(large_pte);
3524 set_pte((pte_t *)pmd, large_pte);
3526 --- a/arch/x86/mm/pgtable_32-xen.c
3527 +++ b/arch/x86/mm/pgtable_32-xen.c
3528 @@ -149,6 +149,8 @@ void __set_fixmap (enum fixed_addresses
3529 void __init reserve_top_address(unsigned long reserve)
3531 BUG_ON(fixmaps > 0);
3532 + printk(KERN_INFO "Reserving virtual address space above 0x%08x\n",
3534 __FIXADDR_TOP = -reserve - PAGE_SIZE;
3535 __VMALLOC_RESERVE += reserve;
3537 @@ -258,6 +260,12 @@ void pgd_ctor(void *pgd, struct kmem_cac
3538 swapper_pg_dir + USER_PTRS_PER_PGD,
3540 memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t));
3542 + /* must happen under lock */
3543 + paravirt_alloc_pd_clone(__pa(pgd) >> PAGE_SHIFT,
3544 + __pa(swapper_pg_dir) >> PAGE_SHIFT,
3545 + USER_PTRS_PER_PGD, PTRS_PER_PGD - USER_PTRS_PER_PGD);
3548 spin_unlock_irqrestore(&pgd_lock, flags);
3550 @@ -268,6 +276,7 @@ void pgd_dtor(void *pgd, struct kmem_cac
3552 unsigned long flags; /* can be called from interrupt context */
3554 + paravirt_release_pd(__pa(pgd) >> PAGE_SHIFT);
3555 spin_lock_irqsave(&pgd_lock, flags);
3557 spin_unlock_irqrestore(&pgd_lock, flags);
3558 @@ -292,6 +301,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
3559 pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
3562 + paravirt_alloc_pd(__pa(pmd) >> PAGE_SHIFT);
3563 set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
3566 @@ -314,6 +324,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
3567 pmd[i] = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
3570 + paravirt_alloc_pd(__pa(pmd) >> PAGE_SHIFT);
3573 spin_lock_irqsave(&pgd_lock, flags);
3574 @@ -354,12 +365,17 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
3577 if (HAVE_SHARED_KERNEL_PMD) {
3578 - for (i--; i >= 0; i--)
3579 - kmem_cache_free(pmd_cache,
3580 - (void *)__va(pgd_val(pgd[i])-1));
3581 + for (i--; i >= 0; i--) {
3582 + pgd_t pgdent = pgd[i];
3583 + void* pmd = (void *)__va(pgd_val(pgdent)-1);
3584 + paravirt_release_pd(__pa(pmd) >> PAGE_SHIFT);
3585 + kmem_cache_free(pmd_cache, pmd);
3588 - for (i--; i >= 0; i--)
3589 + for (i--; i >= 0; i--) {
3590 + paravirt_release_pd(__pa(pmd[i]) >> PAGE_SHIFT);
3591 kmem_cache_free(pmd_cache, pmd[i]);
3595 kmem_cache_free(pgd_cache, pgd);
3596 @@ -383,7 +399,9 @@ void pgd_free(pgd_t *pgd)
3597 /* in the PAE case user pgd entries are overwritten before usage */
3598 if (PTRS_PER_PMD > 1) {
3599 for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
3600 - pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
3601 + pgd_t pgdent = pgd[i];
3602 + void* pmd = (void *)__va(pgd_val(pgdent)-1);
3603 + paravirt_release_pd(__pa(pmd) >> PAGE_SHIFT);
3604 kmem_cache_free(pmd_cache, pmd);
3607 --- a/drivers/acpi/processor_extcntl.c
3608 +++ b/drivers/acpi/processor_extcntl.c
3611 #define ACPI_PROCESSOR_COMPONENT 0x01000000
3612 #define ACPI_PROCESSOR_CLASS "processor"
3613 -#define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver"
3614 #define _COMPONENT ACPI_PROCESSOR_COMPONENT
3615 -ACPI_MODULE_NAME("acpi_processor")
3616 +ACPI_MODULE_NAME("processor_extcntl")
3618 static int processor_extcntl_parse_csd(struct acpi_processor *pr);
3619 static int processor_extcntl_get_performance(struct acpi_processor *pr);
3620 @@ -56,24 +55,17 @@ static int processor_notify_smm(void)
3623 /* Can't write pstate_cnt to smi_cmd if either value is zero */
3624 - if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) {
3625 + if (!acpi_gbl_FADT.smi_command || !acpi_gbl_FADT.pstate_control) {
3626 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"No SMI port or pstate_cnt\n"));
3630 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
3631 "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n",
3632 - acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd));
3633 + acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command));
3635 - /* FADT v1 doesn't support pstate_cnt, many BIOS vendors use
3636 - * it anyway, so we need to support it... */
3637 - if (acpi_fadt_is_v1) {
3638 - ACPI_DEBUG_PRINT((ACPI_DB_INFO,
3639 - "Using v1.0 FADT reserved value for pstate_cnt\n"));
3642 - status = acpi_os_write_port(acpi_fadt.smi_cmd,
3643 - (u32) acpi_fadt.pstate_cnt, 8);
3644 + status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
3645 + acpi_gbl_FADT.pstate_control, 8);
3646 if (ACPI_FAILURE(status))
3649 --- a/drivers/char/tpm/tpm_xen.c
3650 +++ b/drivers/char/tpm/tpm_xen.c
3651 @@ -481,7 +481,6 @@ static struct xenbus_device_id tpmfront_
3653 static struct xenbus_driver tpmfront = {
3655 - .owner = THIS_MODULE,
3656 .ids = tpmfront_ids,
3657 .probe = tpmfront_probe,
3658 .remove = tpmfront_remove,
3659 @@ -491,9 +490,9 @@ static struct xenbus_driver tpmfront = {
3660 .suspend_cancel = tpmfront_suspend_cancel,
3663 -static void __init init_tpm_xenbus(void)
3664 +static int __init init_tpm_xenbus(void)
3666 - xenbus_register_frontend(&tpmfront);
3667 + return xenbus_register_frontend(&tpmfront);
3670 static int tpmif_allocate_tx_buffers(struct tpm_private *tp)
3671 --- a/drivers/pci/msi-xen.c
3672 +++ b/drivers/pci/msi-xen.c
3673 @@ -44,6 +44,36 @@ struct msi_pirq_entry {
3677 +static void msi_set_enable(struct pci_dev *dev, int enable)
3682 + pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
3684 + pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control);
3685 + control &= ~PCI_MSI_FLAGS_ENABLE;
3687 + control |= PCI_MSI_FLAGS_ENABLE;
3688 + pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control);
3692 +static void msix_set_enable(struct pci_dev *dev, int enable)
3697 + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
3699 + pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control);
3700 + control &= ~PCI_MSIX_FLAGS_ENABLE;
3702 + control |= PCI_MSIX_FLAGS_ENABLE;
3703 + pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control);
3707 static struct msi_dev_list *get_msi_dev_pirq_list(struct pci_dev *dev)
3709 struct msi_dev_list *msi_dev_list, *ret = NULL;
3710 @@ -235,85 +265,13 @@ static int msi_map_vector(struct pci_dev
3712 static int msi_init(void)
3714 - static int status = 0;
3716 - if (pci_msi_quirk) {
3717 - pci_msi_enable = 0;
3718 - printk(KERN_WARNING "PCI: MSI quirk detected. MSI disabled.\n");
3725 -void pci_scan_msi_device(struct pci_dev *dev) { }
3727 -void disable_msi_mode(struct pci_dev *dev, int pos, int type)
3731 - pci_read_config_word(dev, msi_control_reg(pos), &control);
3732 - if (type == PCI_CAP_ID_MSI) {
3733 - /* Set enabled bits to single MSI & enable MSI_enable bit */
3734 - msi_disable(control);
3735 - pci_write_config_word(dev, msi_control_reg(pos), control);
3736 - dev->msi_enabled = 0;
3738 - msix_disable(control);
3739 - pci_write_config_word(dev, msi_control_reg(pos), control);
3740 - dev->msix_enabled = 0;
3743 - pci_intx(dev, 1); /* enable intx */
3746 -static void enable_msi_mode(struct pci_dev *dev, int pos, int type)
3750 - pci_read_config_word(dev, msi_control_reg(pos), &control);
3751 - if (type == PCI_CAP_ID_MSI) {
3752 - /* Set enabled bits to single MSI & enable MSI_enable bit */
3753 - msi_enable(control, 1);
3754 - pci_write_config_word(dev, msi_control_reg(pos), control);
3755 - dev->msi_enabled = 1;
3757 - msix_enable(control);
3758 - pci_write_config_word(dev, msi_control_reg(pos), control);
3759 - dev->msix_enabled = 1;
3762 - pci_intx(dev, 0); /* disable intx */
3766 -int pci_save_msi_state(struct pci_dev *dev)
3770 - pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
3771 - if (pos <= 0 || dev->no_msi)
3774 - if (!dev->msi_enabled)
3777 - /* Restore dev->irq to its default pin-assertion vector */
3778 - msi_unmap_pirq(dev, dev->irq);
3779 - /* Disable MSI mode */
3780 - disable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
3781 - /* Set the flags for use of restore */
3782 - dev->msi_enabled = 1;
3786 -void pci_restore_msi_state(struct pci_dev *dev)
3788 +static void __pci_restore_msi_state(struct pci_dev *dev)
3792 - pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
3797 if (!dev->msi_enabled)
3799 @@ -321,40 +279,12 @@ void pci_restore_msi_state(struct pci_de
3800 pirq = msi_map_pirq_to_vector(dev, dev->irq, 0, 0);
3803 - enable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
3806 -int pci_save_msix_state(struct pci_dev *dev)
3809 - unsigned long flags;
3810 - struct msi_dev_list *msi_dev_entry;
3811 - struct msi_pirq_entry *pirq_entry, *tmp;
3813 - pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
3814 - if (pos <= 0 || dev->no_msi)
3817 - /* save the capability */
3818 - if (!dev->msix_enabled)
3821 - msi_dev_entry = get_msi_dev_pirq_list(dev);
3823 - spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags);
3824 - list_for_each_entry_safe(pirq_entry, tmp,
3825 - &msi_dev_entry->pirq_list_head, list)
3826 - msi_unmap_pirq(dev, pirq_entry->pirq);
3827 - spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags);
3829 - disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
3830 - /* Set the flags for use of restore */
3831 - dev->msix_enabled = 1;
3834 + pci_intx(dev, 0); /* disable intx */
3835 + msi_set_enable(dev, 0);
3838 -void pci_restore_msix_state(struct pci_dev *dev)
3839 +static void __pci_restore_msix_state(struct pci_dev *dev)
3842 unsigned long flags;
3843 @@ -387,9 +317,16 @@ void pci_restore_msix_state(struct pci_d
3845 spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags);
3847 - enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
3848 + pci_intx(dev, 0); /* disable intx */
3849 + msix_set_enable(dev, 0);
3853 +void pci_restore_msi_state(struct pci_dev *dev)
3855 + __pci_restore_msi_state(dev);
3856 + __pci_restore_msix_state(dev);
3858 +#endif /* CONFIG_PM */
3861 * msi_capability_init - configure device's MSI capability structure
3862 @@ -405,6 +342,8 @@ static int msi_capability_init(struct pc
3866 + msi_set_enable(dev, 0); /* Ensure msi is disabled as I set it up */
3868 pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
3869 pci_read_config_word(dev, msi_control_reg(pos), &control);
3871 @@ -413,7 +352,8 @@ static int msi_capability_init(struct pc
3874 /* Set MSI enabled bits */
3875 - enable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
3876 + pci_intx(dev, 0); /* disable intx */
3877 + msi_set_enable(dev, 1);
3878 dev->msi_enabled = 1;
3881 @@ -441,6 +381,8 @@ static int msix_capability_init(struct p
3885 + msix_set_enable(dev, 0);/* Ensure msix is disabled as I set it up */
3887 pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
3888 table_base = find_table_base(dev, pos);
3890 @@ -484,7 +426,8 @@ static int msix_capability_init(struct p
3894 - enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
3895 + pci_intx(dev, 0); /* disable intx */
3896 + msix_set_enable(dev, 1);
3897 dev->msix_enabled = 1;
3900 @@ -572,17 +515,14 @@ int pci_enable_msi(struct pci_dev* dev)
3901 /* Check whether driver already requested for MSI-X irqs */
3902 if (dev->msix_enabled) {
3903 printk(KERN_INFO "PCI: %s: Can't enable MSI. "
3904 - "Device already has MSI-X irq assigned\n",
3907 + "Device already has MSI-X enabled\n",
3912 status = msi_capability_init(dev);
3914 dev->irq_old = temp;
3920 @@ -590,7 +530,6 @@ int pci_enable_msi(struct pci_dev* dev)
3921 extern void pci_frontend_disable_msi(struct pci_dev* dev);
3922 void pci_disable_msi(struct pci_dev* dev)
3927 if (!pci_msi_enable)
3928 @@ -607,8 +546,7 @@ void pci_disable_msi(struct pci_dev* dev
3932 - pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
3934 + if (!dev->msi_enabled)
3938 @@ -617,7 +555,9 @@ void pci_disable_msi(struct pci_dev* dev
3939 msi_unmap_pirq(dev, pirq);
3941 /* Disable MSI mode */
3942 - disable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
3943 + msi_set_enable(dev, 0);
3944 + pci_intx(dev, 1); /* enable intx */
3945 + dev->msi_enabled = 0;
3949 @@ -710,7 +650,6 @@ int pci_enable_msix(struct pci_dev* dev,
3950 printk(KERN_INFO "PCI: %s: Can't enable MSI-X. "
3951 "Device already has an MSI irq assigned\n",
3957 @@ -718,8 +657,6 @@ int pci_enable_msix(struct pci_dev* dev,
3960 dev->irq_old = temp;
3966 @@ -727,10 +664,6 @@ int pci_enable_msix(struct pci_dev* dev,
3967 extern void pci_frontend_disable_msix(struct pci_dev* dev);
3968 void pci_disable_msix(struct pci_dev* dev)
3974 if (!pci_msi_enable)
3977 @@ -756,18 +689,15 @@ void pci_disable_msix(struct pci_dev* de
3981 - pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
3985 - pci_read_config_word(dev, msi_control_reg(pos), &control);
3986 - if (!(control & PCI_MSIX_FLAGS_ENABLE))
3987 + if (!dev->msix_enabled)
3990 msi_remove_pci_irq_vectors(dev);
3992 /* Disable MSI mode */
3993 - disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
3994 + msix_set_enable(dev, 0);
3995 + pci_intx(dev, 1); /* enable intx */
3996 + dev->msix_enabled = 0;
4000 --- a/drivers/xen/balloon/sysfs.c
4001 +++ b/drivers/xen/balloon/sysfs.c
4003 #include <linux/stat.h>
4004 #include <linux/string.h>
4005 #include <linux/sysdev.h>
4006 +#include <linux/module.h>
4009 #ifdef HAVE_XEN_PLATFORM_COMPAT_H
4010 --- a/drivers/xen/blkback/xenbus.c
4011 +++ b/drivers/xen/blkback/xenbus.c
4012 @@ -527,7 +527,6 @@ static const struct xenbus_device_id blk
4014 static struct xenbus_driver blkback = {
4016 - .owner = THIS_MODULE,
4018 .probe = blkback_probe,
4019 .remove = blkback_remove,
4020 @@ -537,5 +536,6 @@ static struct xenbus_driver blkback = {
4022 void blkif_xenbus_init(void)
4024 - xenbus_register_backend(&blkback);
4025 + if (xenbus_register_backend(&blkback))
4028 --- a/drivers/xen/blkfront/blkfront.c
4029 +++ b/drivers/xen/blkfront/blkfront.c
4030 @@ -907,7 +907,6 @@ MODULE_ALIAS("xen:vbd");
4032 static struct xenbus_driver blkfront = {
4034 - .owner = THIS_MODULE,
4035 .ids = blkfront_ids,
4036 .probe = blkfront_probe,
4037 .remove = blkfront_remove,
4038 --- a/drivers/xen/blktap/xenbus.c
4039 +++ b/drivers/xen/blktap/xenbus.c
4040 @@ -465,7 +465,6 @@ static const struct xenbus_device_id blk
4042 static struct xenbus_driver blktap = {
4044 - .owner = THIS_MODULE,
4046 .probe = blktap_probe,
4047 .remove = blktap_remove,
4048 @@ -475,5 +474,6 @@ static struct xenbus_driver blktap = {
4050 void tap_blkif_xenbus_init(void)
4052 - xenbus_register_backend(&blktap);
4053 + if (xenbus_register_backend(&blktap))
4056 --- a/drivers/xen/core/evtchn.c
4057 +++ b/drivers/xen/core/evtchn.c
4058 @@ -144,7 +144,7 @@ static void bind_evtchn_to_cpu(unsigned
4059 BUG_ON(!test_bit(chn, s->evtchn_mask));
4062 - set_native_irq_info(irq, cpumask_of_cpu(cpu));
4063 + irq_desc[irq].affinity = cpumask_of_cpu(cpu);
4065 clear_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu_evtchn[chn]]);
4066 set_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu]);
4067 @@ -157,7 +157,7 @@ static void init_evtchn_cpu_bindings(voi
4069 /* By default all event channels notify CPU#0. */
4070 for (i = 0; i < NR_IRQS; i++)
4071 - set_native_irq_info(i, cpumask_of_cpu(0));
4072 + irq_desc[i].affinity = cpumask_of_cpu(0);
4074 memset(cpu_evtchn, 0, sizeof(cpu_evtchn));
4075 memset(cpu_evtchn_mask[0], ~0, sizeof(cpu_evtchn_mask[0]));
4076 --- a/drivers/xen/core/smpboot.c
4077 +++ b/drivers/xen/core/smpboot.c
4078 @@ -121,7 +121,7 @@ static int __cpuinit xen_smp_intr_init(u
4079 rc = bind_ipi_to_irqhandler(RESCHEDULE_VECTOR,
4081 smp_reschedule_interrupt,
4083 + IRQF_DISABLED|IRQF_NOBALANCING,
4087 @@ -132,7 +132,7 @@ static int __cpuinit xen_smp_intr_init(u
4088 rc = bind_ipi_to_irqhandler(CALL_FUNCTION_VECTOR,
4090 smp_call_function_interrupt,
4092 + IRQF_DISABLED|IRQF_NOBALANCING,
4096 @@ -261,7 +261,7 @@ void __init smp_prepare_cpus(unsigned in
4099 struct task_struct *idle;
4100 - int apicid, acpiid;
4102 struct vcpu_get_physid cpu_id;
4104 struct desc_ptr *gdt_descr;
4105 @@ -270,14 +270,8 @@ void __init smp_prepare_cpus(unsigned in
4109 - if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, 0, &cpu_id) == 0) {
4110 + if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, 0, &cpu_id) == 0)
4111 apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id);
4112 - acpiid = xen_vcpu_physid_to_x86_acpiid(cpu_id.phys_id);
4114 - if (acpiid != 0xff)
4115 - x86_acpiid_to_apicid[acpiid] = apicid;
4118 boot_cpu_data.apicid = apicid;
4119 cpu_data[0] = boot_cpu_data;
4121 @@ -333,14 +327,8 @@ void __init smp_prepare_cpus(unsigned in
4122 XENFEAT_writable_descriptor_tables);
4125 - if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, cpu, &cpu_id) == 0) {
4126 + if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, cpu, &cpu_id) == 0)
4127 apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id);
4128 - acpiid = xen_vcpu_physid_to_x86_acpiid(cpu_id.phys_id);
4130 - if (acpiid != 0xff)
4131 - x86_acpiid_to_apicid[acpiid] = apicid;
4134 cpu_data[cpu] = boot_cpu_data;
4135 cpu_data[cpu].apicid = apicid;
4137 --- a/drivers/xen/fbfront/xenfb.c
4138 +++ b/drivers/xen/fbfront/xenfb.c
4139 @@ -856,7 +856,6 @@ MODULE_ALIAS("xen:vfb");
4141 static struct xenbus_driver xenfb_driver = {
4143 - .owner = THIS_MODULE,
4145 .probe = xenfb_probe,
4146 .remove = xenfb_remove,
4147 --- a/drivers/xen/fbfront/xenkbd.c
4148 +++ b/drivers/xen/fbfront/xenkbd.c
4149 @@ -323,7 +323,6 @@ MODULE_ALIAS("xen:vkbd");
4151 static struct xenbus_driver xenkbd_driver = {
4153 - .owner = THIS_MODULE,
4155 .probe = xenkbd_probe,
4156 .remove = xenkbd_remove,
4157 --- a/drivers/xen/netback/xenbus.c
4158 +++ b/drivers/xen/netback/xenbus.c
4159 @@ -439,7 +439,6 @@ static const struct xenbus_device_id net
4161 static struct xenbus_driver netback = {
4163 - .owner = THIS_MODULE,
4165 .probe = netback_probe,
4166 .remove = netback_remove,
4167 @@ -450,5 +449,6 @@ static struct xenbus_driver netback = {
4169 void netif_xenbus_init(void)
4171 - xenbus_register_backend(&netback);
4172 + if (xenbus_register_backend(&netback))
4175 --- a/drivers/xen/netfront/netfront.c
4176 +++ b/drivers/xen/netfront/netfront.c
4177 @@ -1892,20 +1892,19 @@ static struct ethtool_ops network_ethtoo
4181 -static ssize_t show_rxbuf_min(struct class_device *cd, char *buf)
4182 +static ssize_t show_rxbuf_min(struct device *dev,
4183 + struct device_attribute *attr, char *buf)
4185 - struct net_device *netdev = container_of(cd, struct net_device,
4187 - struct netfront_info *info = netdev_priv(netdev);
4188 + struct netfront_info *info = netdev_priv(to_net_dev(dev));
4190 return sprintf(buf, "%u\n", info->rx_min_target);
4193 -static ssize_t store_rxbuf_min(struct class_device *cd,
4194 +static ssize_t store_rxbuf_min(struct device *dev,
4195 + struct device_attribute *attr,
4196 const char *buf, size_t len)
4198 - struct net_device *netdev = container_of(cd, struct net_device,
4200 + struct net_device *netdev = to_net_dev(dev);
4201 struct netfront_info *np = netdev_priv(netdev);
4203 unsigned long target;
4204 @@ -1935,20 +1934,19 @@ static ssize_t store_rxbuf_min(struct cl
4208 -static ssize_t show_rxbuf_max(struct class_device *cd, char *buf)
4209 +static ssize_t show_rxbuf_max(struct device *dev,
4210 + struct device_attribute *attr, char *buf)
4212 - struct net_device *netdev = container_of(cd, struct net_device,
4214 - struct netfront_info *info = netdev_priv(netdev);
4215 + struct netfront_info *info = netdev_priv(to_net_dev(dev));
4217 return sprintf(buf, "%u\n", info->rx_max_target);
4220 -static ssize_t store_rxbuf_max(struct class_device *cd,
4221 +static ssize_t store_rxbuf_max(struct device *dev,
4222 + struct device_attribute *attr,
4223 const char *buf, size_t len)
4225 - struct net_device *netdev = container_of(cd, struct net_device,
4227 + struct net_device *netdev = to_net_dev(dev);
4228 struct netfront_info *np = netdev_priv(netdev);
4230 unsigned long target;
4231 @@ -1978,16 +1976,15 @@ static ssize_t store_rxbuf_max(struct cl
4235 -static ssize_t show_rxbuf_cur(struct class_device *cd, char *buf)
4236 +static ssize_t show_rxbuf_cur(struct device *dev,
4237 + struct device_attribute *attr, char *buf)
4239 - struct net_device *netdev = container_of(cd, struct net_device,
4241 - struct netfront_info *info = netdev_priv(netdev);
4242 + struct netfront_info *info = netdev_priv(to_net_dev(dev));
4244 return sprintf(buf, "%u\n", info->rx_target);
4247 -static const struct class_device_attribute xennet_attrs[] = {
4248 +static struct device_attribute xennet_attrs[] = {
4249 __ATTR(rxbuf_min, S_IRUGO|S_IWUSR, show_rxbuf_min, store_rxbuf_min),
4250 __ATTR(rxbuf_max, S_IRUGO|S_IWUSR, show_rxbuf_max, store_rxbuf_max),
4251 __ATTR(rxbuf_cur, S_IRUGO, show_rxbuf_cur, NULL),
4252 @@ -1999,8 +1996,8 @@ static int xennet_sysfs_addif(struct net
4255 for (i = 0; i < ARRAY_SIZE(xennet_attrs); i++) {
4256 - error = class_device_create_file(&netdev->class_dev,
4257 - &xennet_attrs[i]);
4258 + error = device_create_file(&netdev->dev,
4259 + &xennet_attrs[i]);
4263 @@ -2008,8 +2005,7 @@ static int xennet_sysfs_addif(struct net
4267 - class_device_remove_file(&netdev->class_dev,
4268 - &xennet_attrs[i]);
4269 + device_remove_file(&netdev->dev, &xennet_attrs[i]);
4273 @@ -2017,10 +2013,8 @@ static void xennet_sysfs_delif(struct ne
4277 - for (i = 0; i < ARRAY_SIZE(xennet_attrs); i++) {
4278 - class_device_remove_file(&netdev->class_dev,
4279 - &xennet_attrs[i]);
4281 + for (i = 0; i < ARRAY_SIZE(xennet_attrs); i++)
4282 + device_remove_file(&netdev->dev, &xennet_attrs[i]);
4285 #endif /* CONFIG_SYSFS */
4286 @@ -2186,7 +2180,6 @@ MODULE_ALIAS("xen:vif");
4288 static struct xenbus_driver netfront_driver = {
4290 - .owner = THIS_MODULE,
4291 .ids = netfront_ids,
4292 .probe = netfront_probe,
4293 .remove = __devexit_p(netfront_remove),
4294 --- a/drivers/xen/pciback/xenbus.c
4295 +++ b/drivers/xen/pciback/xenbus.c
4296 @@ -682,7 +682,6 @@ static const struct xenbus_device_id xen
4298 static struct xenbus_driver xenbus_pciback_driver = {
4300 - .owner = THIS_MODULE,
4302 .probe = pciback_xenbus_probe,
4303 .remove = pciback_xenbus_remove,
4304 --- a/drivers/xen/pcifront/xenbus.c
4305 +++ b/drivers/xen/pcifront/xenbus.c
4306 @@ -436,7 +436,6 @@ MODULE_ALIAS("xen:pci");
4308 static struct xenbus_driver xenbus_pcifront_driver = {
4310 - .owner = THIS_MODULE,
4312 .probe = pcifront_xenbus_probe,
4313 .remove = pcifront_xenbus_remove,
4314 --- a/drivers/xen/scsiback/xenbus.c
4315 +++ b/drivers/xen/scsiback/xenbus.c
4316 @@ -350,7 +350,6 @@ static struct xenbus_device_id scsiback_
4318 static struct xenbus_driver scsiback = {
4320 - .owner = THIS_MODULE,
4321 .ids = scsiback_ids,
4322 .probe = scsiback_probe,
4323 .remove = scsiback_remove,
4324 --- a/drivers/xen/scsifront/xenbus.c
4325 +++ b/drivers/xen/scsifront/xenbus.c
4326 @@ -401,7 +401,6 @@ static struct xenbus_device_id scsifront
4328 static struct xenbus_driver scsifront_driver = {
4330 - .owner = THIS_MODULE,
4331 .ids = scsifront_ids,
4332 .probe = scsifront_probe,
4333 .remove = scsifront_remove,
4334 --- a/drivers/xen/tpmback/common.h
4335 +++ b/drivers/xen/tpmback/common.h
4336 @@ -54,11 +54,11 @@ typedef struct tpmif_st {
4338 void tpmif_disconnect_complete(tpmif_t * tpmif);
4339 tpmif_t *tpmif_find(domid_t domid, struct backend_info *bi);
4340 -void tpmif_interface_init(void);
4341 +int tpmif_interface_init(void);
4342 void tpmif_interface_exit(void);
4343 void tpmif_schedule_work(tpmif_t * tpmif);
4344 void tpmif_deschedule_work(tpmif_t * tpmif);
4345 -void tpmif_xenbus_init(void);
4346 +int tpmif_xenbus_init(void);
4347 void tpmif_xenbus_exit(void);
4348 int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn);
4349 irqreturn_t tpmif_be_int(int irq, void *dev_id);
4350 --- a/drivers/xen/tpmback/interface.c
4351 +++ b/drivers/xen/tpmback/interface.c
4352 @@ -156,13 +156,14 @@ void tpmif_disconnect_complete(tpmif_t *
4356 -void __init tpmif_interface_init(void)
4357 +int __init tpmif_interface_init(void)
4359 tpmif_cachep = kmem_cache_create("tpmif_cache", sizeof (tpmif_t),
4361 + return tpmif_cachep ? 0 : -ENOMEM;
4364 -void __exit tpmif_interface_exit(void)
4365 +void tpmif_interface_exit(void)
4367 kmem_cache_destroy(tpmif_cachep);
4369 --- a/drivers/xen/tpmback/tpmback.c
4370 +++ b/drivers/xen/tpmback/tpmback.c
4371 @@ -923,22 +923,30 @@ static int __init tpmback_init(void)
4372 spin_lock_init(&tpm_schedule_list_lock);
4373 INIT_LIST_HEAD(&tpm_schedule_list);
4375 - tpmif_interface_init();
4376 - tpmif_xenbus_init();
4377 + rc = tpmif_interface_init();
4379 + rc = tpmif_xenbus_init();
4381 + tpmif_interface_exit();
4384 + misc_deregister(&vtpms_miscdevice);
4388 printk(KERN_ALERT "Successfully initialized TPM backend driver.\n");
4393 module_init(tpmback_init);
4395 -void __exit tpmback_exit(void)
4396 +static void __exit tpmback_exit(void)
4398 vtpm_release_packets(NULL, 0);
4399 tpmif_xenbus_exit();
4400 tpmif_interface_exit();
4401 misc_deregister(&vtpms_miscdevice);
4403 +module_exit(tpmback_exit)
4405 MODULE_LICENSE("Dual BSD/GPL");
4406 --- a/drivers/xen/tpmback/xenbus.c
4407 +++ b/drivers/xen/tpmback/xenbus.c
4408 @@ -270,7 +270,6 @@ static const struct xenbus_device_id tpm
4410 static struct xenbus_driver tpmback = {
4412 - .owner = THIS_MODULE,
4414 .probe = tpmback_probe,
4415 .remove = tpmback_remove,
4416 @@ -278,9 +277,9 @@ static struct xenbus_driver tpmback = {
4420 -void tpmif_xenbus_init(void)
4421 +int tpmif_xenbus_init(void)
4423 - xenbus_register_backend(&tpmback);
4424 + return xenbus_register_backend(&tpmback);
4427 void tpmif_xenbus_exit(void)
4428 --- a/drivers/xen/xenbus/xenbus_probe_backend.c
4429 +++ b/drivers/xen/xenbus/xenbus_probe_backend.c
4430 @@ -172,13 +172,15 @@ static int xenbus_uevent_backend(struct
4434 -int xenbus_register_backend(struct xenbus_driver *drv)
4435 +int __xenbus_register_backend(struct xenbus_driver *drv,
4436 + struct module *owner, const char *mod_name)
4438 drv->read_otherend_details = read_frontend_details;
4440 - return xenbus_register_driver_common(drv, &xenbus_backend);
4441 + return xenbus_register_driver_common(drv, &xenbus_backend,
4444 -EXPORT_SYMBOL_GPL(xenbus_register_backend);
4445 +EXPORT_SYMBOL_GPL(__xenbus_register_backend);
4447 /* backend/<typename>/<frontend-uuid>/<name> */
4448 static int xenbus_probe_backend_unit(const char *dir,
4449 --- a/drivers/xen/xenbus/xenbus_probe.c
4450 +++ b/drivers/xen/xenbus/xenbus_probe.c
4451 @@ -365,7 +365,9 @@ static void xenbus_dev_shutdown(struct d
4454 int xenbus_register_driver_common(struct xenbus_driver *drv,
4455 - struct xen_bus_type *bus)
4456 + struct xen_bus_type *bus,
4457 + struct module *owner,
4458 + const char *mod_name)
4462 @@ -375,7 +377,10 @@ int xenbus_register_driver_common(struct
4463 drv->driver.name = drv->name;
4464 drv->driver.bus = &bus->bus;
4465 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
4466 - drv->driver.owner = drv->owner;
4467 + drv->driver.owner = owner;
4469 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
4470 + drv->driver.mod_name = mod_name;
4472 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
4473 drv->driver.probe = xenbus_dev_probe;
4474 @@ -389,13 +394,15 @@ int xenbus_register_driver_common(struct
4478 -int xenbus_register_frontend(struct xenbus_driver *drv)
4479 +int __xenbus_register_frontend(struct xenbus_driver *drv,
4480 + struct module *owner, const char *mod_name)
4484 drv->read_otherend_details = read_backend_details;
4486 - ret = xenbus_register_driver_common(drv, &xenbus_frontend);
4487 + ret = xenbus_register_driver_common(drv, &xenbus_frontend,
4492 @@ -404,7 +411,7 @@ int xenbus_register_frontend(struct xenb
4496 -EXPORT_SYMBOL_GPL(xenbus_register_frontend);
4497 +EXPORT_SYMBOL_GPL(__xenbus_register_frontend);
4499 void xenbus_unregister_driver(struct xenbus_driver *drv)
4501 --- a/drivers/xen/xenbus/xenbus_probe.h
4502 +++ b/drivers/xen/xenbus/xenbus_probe.h
4503 @@ -63,7 +63,9 @@ extern int xenbus_match(struct device *_
4504 extern int xenbus_dev_probe(struct device *_dev);
4505 extern int xenbus_dev_remove(struct device *_dev);
4506 extern int xenbus_register_driver_common(struct xenbus_driver *drv,
4507 - struct xen_bus_type *bus);
4508 + struct xen_bus_type *bus,
4509 + struct module *owner,
4510 + const char *mod_name);
4511 extern int xenbus_probe_node(struct xen_bus_type *bus,
4513 const char *nodename);
4514 --- a/drivers/xen/xenoprof/xenoprofile.c
4515 +++ b/drivers/xen/xenoprof/xenoprofile.c
4516 @@ -235,7 +235,7 @@ static int bind_virq(void)
4517 result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
4519 xenoprof_ovf_interrupt,
4521 + IRQF_DISABLED|IRQF_NOBALANCING,
4525 --- a/include/asm-x86/i8253.h
4526 +++ b/include/asm-x86/i8253.h
4529 extern spinlock_t i8253_lock;
4531 +#ifdef CONFIG_GENERIC_CLOCKEVENTS
4533 extern struct clock_event_device *global_clock_event;
4535 extern void setup_pit_timer(void);
4539 #define inb_pit inb_p
4540 #define outb_pit outb_p
4542 --- a/include/asm-x86/mach-xen/asm/desc_32.h
4543 +++ b/include/asm-x86/mach-xen/asm/desc_32.h
4544 @@ -21,7 +21,7 @@ struct Xgt_desc_struct {
4546 extern struct Xgt_desc_struct idt_descr;
4547 DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr);
4549 +extern struct Xgt_desc_struct early_gdt_descr;
4551 static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
4553 --- a/include/asm-x86/mach-xen/asm/dma-mapping_64.h
4554 +++ b/include/asm-x86/mach-xen/asm/dma-mapping_64.h
4557 #include <asm/scatterlist.h>
4559 -#include <asm/swiotlb.h>
4561 struct dma_mapping_ops {
4562 int (*mapping_error)(dma_addr_t dma_addr);
4563 @@ -67,6 +66,9 @@ static inline int dma_mapping_error(dma_
4564 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
4565 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
4567 +#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
4568 +#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
4570 extern void *dma_alloc_coherent(struct device *dev, size_t size,
4571 dma_addr_t *dma_handle, gfp_t gfp);
4572 extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
4573 --- a/include/asm-x86/mach-xen/asm/hypervisor.h
4574 +++ b/include/asm-x86/mach-xen/asm/hypervisor.h
4575 @@ -158,6 +158,19 @@ static inline void arch_leave_lazy_mmu_m
4576 #define arch_use_lazy_mmu_mode() unlikely(__get_cpu_var(xen_lazy_mmu))
4579 +#if 0 /* All uses are in places potentially called asynchronously, but
4580 + * asynchronous code should rather not make use of lazy mode at all.
4581 + * Therefore, all uses of this function get commented out, proper
4582 + * detection of asynchronous invocations is added whereever needed,
4583 + * and this function is disabled to catch any new (improper) uses.
4585 +static inline void arch_flush_lazy_mmu_mode(void)
4587 + if (arch_use_lazy_mmu_mode())
4588 + xen_multicall_flush(false);
4592 #else /* CONFIG_XEN */
4594 static inline void xen_multicall_flush(bool ignore) {}
4595 @@ -215,7 +228,7 @@ HYPERVISOR_block(
4599 -static inline void /*__noreturn*/
4600 +static inline void __noreturn
4601 HYPERVISOR_shutdown(
4602 unsigned int reason)
4604 --- a/include/asm-x86/mach-xen/asm/io_32.h
4605 +++ b/include/asm-x86/mach-xen/asm/io_32.h
4606 @@ -232,12 +232,6 @@ static inline void memcpy_toio(volatile
4607 #define __ISA_IO_base ((char __iomem *)(fix_to_virt(FIX_ISAMAP_BEGIN)))
4610 - * Again, i386 does not require mem IO specific function.
4613 -#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d))
4618 * This needed for two cases
4619 --- a/include/asm-x86/mach-xen/asm/io_64.h
4620 +++ b/include/asm-x86/mach-xen/asm/io_64.h
4621 @@ -101,7 +101,7 @@ __OUTS(l)
4623 #define IO_SPACE_LIMIT 0xffff
4625 -#if defined(__KERNEL__) && __x86_64__
4626 +#if defined(__KERNEL__) && defined(__x86_64__)
4628 #include <linux/vmalloc.h>
4630 @@ -267,12 +267,6 @@ void memset_io(volatile void __iomem *a,
4632 #define __ISA_IO_base ((char __iomem *)(fix_to_virt(FIX_ISAMAP_BEGIN)))
4635 - * Again, x86-64 does not require mem IO specific function.
4638 -#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d))
4642 #define dma_cache_inv(_start,_size) do { } while (0)
4643 --- a/include/asm-x86/mach-xen/asm/mmu_context_32.h
4644 +++ b/include/asm-x86/mach-xen/asm/mmu_context_32.h
4645 @@ -27,13 +27,13 @@ static inline void enter_lazy_tlb(struct
4646 static inline void __prepare_arch_switch(void)
4649 - * Save away %fs. No need to save %gs, as it was saved on the
4650 + * Save away %gs. No need to save %fs, as it was saved on the
4651 * stack on entry. No need to save %es and %ds, as those are
4652 * always kernel segments while inside the kernel.
4654 - asm volatile ( "mov %%fs,%0"
4655 - : "=m" (current->thread.fs));
4656 - asm volatile ( "movl %0,%%fs"
4657 + asm volatile ( "mov %%gs,%0"
4658 + : "=m" (current->thread.gs));
4659 + asm volatile ( "movl %0,%%gs"
4663 @@ -95,7 +95,7 @@ static inline void switch_mm(struct mm_s
4666 #define deactivate_mm(tsk, mm) \
4667 - asm("movl %0,%%fs": :"r" (0));
4668 + asm("movl %0,%%gs": :"r" (0));
4670 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
4672 --- a/include/asm-x86/mach-xen/asm/pgalloc_32.h
4673 +++ b/include/asm-x86/mach-xen/asm/pgalloc_32.h
4675 #include <linux/mm.h> /* for struct page */
4676 #include <asm/io.h> /* for phys_to_virt and page_to_pseudophys */
4678 -#define pmd_populate_kernel(mm, pmd, pte) \
4679 - set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte)))
4680 +#define paravirt_alloc_pt(pfn) do { } while (0)
4681 +#define paravirt_alloc_pd(pfn) do { } while (0)
4682 +#define paravirt_alloc_pd(pfn) do { } while (0)
4683 +#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
4684 +#define paravirt_release_pt(pfn) do { } while (0)
4685 +#define paravirt_release_pd(pfn) do { } while (0)
4687 +#define pmd_populate_kernel(mm, pmd, pte) \
4689 + paravirt_alloc_pt(__pa(pte) >> PAGE_SHIFT); \
4690 + set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \
4693 #define pmd_populate(mm, pmd, pte) \
4695 unsigned long pfn = page_to_pfn(pte); \
4696 + paravirt_alloc_pt(pfn); \
4697 if (test_bit(PG_pinned, &virt_to_page((mm)->pgd)->flags)) { \
4698 if (!PageHighMem(pte)) \
4699 BUG_ON(HYPERVISOR_update_va_mapping( \
4700 @@ -42,7 +53,11 @@ static inline void pte_free_kernel(pte_t
4702 extern void pte_free(struct page *pte);
4704 -#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
4705 +#define __pte_free_tlb(tlb,pte) \
4707 + paravirt_release_pt(page_to_pfn(pte)); \
4708 + tlb_remove_page((tlb),(pte)); \
4711 #ifdef CONFIG_X86_PAE
4713 --- a/include/asm-x86/mach-xen/asm/pgtable_32.h
4714 +++ b/include/asm-x86/mach-xen/asm/pgtable_32.h
4715 @@ -275,6 +275,7 @@ static inline pte_t pte_mkhuge(pte_t pte
4717 #define pte_update(mm, addr, ptep) do { } while (0)
4718 #define pte_update_defer(mm, addr, ptep) do { } while (0)
4719 +#define paravirt_map_pt_hook(slot, va, pfn) do { } while (0)
4722 * We only update the dirty/accessed state if we set
4723 @@ -490,12 +491,24 @@ extern pte_t *lookup_address(unsigned lo
4726 #if defined(CONFIG_HIGHPTE)
4727 -#define pte_offset_map(dir, address) \
4728 - ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE0) + \
4729 - pte_index(address))
4730 -#define pte_offset_map_nested(dir, address) \
4731 - ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE1) + \
4732 - pte_index(address))
4733 +#define pte_offset_map(dir, address) \
4736 + unsigned pfn = pmd_val(*(dir)) >> PAGE_SHIFT; \
4737 + __ptep = (pte_t *)kmap_atomic_pte(pfn_to_page(pfn),KM_PTE0); \
4738 + paravirt_map_pt_hook(KM_PTE0,__ptep, pfn); \
4739 + __ptep = __ptep + pte_index(address); \
4742 +#define pte_offset_map_nested(dir, address) \
4745 + unsigned pfn = pmd_val(*(dir)) >> PAGE_SHIFT; \
4746 + __ptep = (pte_t *)kmap_atomic_pte(pfn_to_page(pfn),KM_PTE1); \
4747 + paravirt_map_pt_hook(KM_PTE1,__ptep, pfn); \
4748 + __ptep = __ptep + pte_index(address); \
4751 #define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
4752 #define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
4754 --- a/include/asm-x86/mach-xen/asm/pgtable_64.h
4755 +++ b/include/asm-x86/mach-xen/asm/pgtable_64.h
4756 @@ -414,15 +414,6 @@ static inline int pmd_large(pmd_t pte) {
4757 #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
4758 #define mk_pte_huge(entry) (__pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE)
4760 -/* physical address -> PTE */
4761 -static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
4763 - unsigned long pteval;
4764 - pteval = physpage | pgprot_val(pgprot);
4765 - pteval &= __supported_pte_mask;
4766 - return __pte(pteval);
4769 /* Change flags of a PTE */
4770 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
4772 --- a/include/asm-x86/mach-xen/asm/processor_32.h
4773 +++ b/include/asm-x86/mach-xen/asm/processor_32.h
4774 @@ -431,7 +431,7 @@ struct thread_struct {
4775 .vm86_info = NULL, \
4776 .sysenter_cs = __KERNEL_CS, \
4777 .io_bitmap_ptr = NULL, \
4778 - .gs = __KERNEL_PDA, \
4779 + .fs = __KERNEL_PDA, \
4783 @@ -449,8 +449,8 @@ struct thread_struct {
4786 #define start_thread(regs, new_eip, new_esp) do { \
4787 - __asm__("movl %0,%%fs": :"r" (0)); \
4789 + __asm__("movl %0,%%gs": :"r" (0)); \
4792 regs->xds = __USER_DS; \
4793 regs->xes = __USER_DS; \
4794 --- a/include/asm-x86/mach-xen/asm/segment_32.h
4795 +++ b/include/asm-x86/mach-xen/asm/segment_32.h
4797 * The GDT has 32 entries
4799 #define GDT_ENTRIES 32
4801 #define GDT_SIZE (GDT_ENTRIES * 8)
4803 -/* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */
4804 -#define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8)
4805 -/* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */
4806 -#define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8)
4808 /* Simple and small GDT entries for booting only */
4810 #define GDT_ENTRY_BOOT_CS 2
4811 @@ -132,4 +126,21 @@
4812 #define SEGMENT_GDT 0x0
4814 #define get_kernel_rpl() (xen_feature(XENFEAT_supervisor_mode_kernel)?0:1)
4817 + * Matching rules for certain types of segments.
4820 +/* Matches only __KERNEL_CS, ignoring PnP / USER / APM segments */
4821 +#define SEGMENT_IS_KERNEL_CODE(x) (((x) & ~3) == GDT_ENTRY_KERNEL_CS * 8 \
4822 + || ((x) & ~3) == (FLAT_KERNEL_CS & ~3))
4824 +/* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */
4825 +#define SEGMENT_IS_FLAT_CODE(x) (((x) & ~0x13) == GDT_ENTRY_KERNEL_CS * 8 \
4826 + || ((x) & ~3) == (FLAT_KERNEL_CS & ~3) \
4827 + || ((x) & ~3) == (FLAT_USER_CS & ~3))
4829 +/* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */
4830 +#define SEGMENT_IS_PNP_CODE(x) (((x) & ~0x0b) == GDT_ENTRY_PNPBIOS_BASE * 8)
4833 --- a/include/asm-x86/mach-xen/asm/smp_32.h
4834 +++ b/include/asm-x86/mach-xen/asm/smp_32.h
4835 @@ -52,6 +52,11 @@ extern void cpu_exit_clear(void);
4836 extern void cpu_uninit(void);
4839 +#ifndef CONFIG_PARAVIRT
4840 +#define startup_ipi_hook(phys_apicid, start_eip, start_esp) \
4845 * This function is needed by all SMP systems. It must _always_ be valid
4846 * from the initial startup. We map APIC_BASE very early in page_setup(),
4847 --- a/include/asm-x86/mach-xen/asm/smp_64.h
4848 +++ b/include/asm-x86/mach-xen/asm/smp_64.h
4850 #include <linux/threads.h>
4851 #include <linux/cpumask.h>
4852 #include <linux/bitops.h>
4853 +#include <linux/init.h>
4854 extern int disable_apic;
4856 #ifdef CONFIG_X86_LOCAL_APIC
4857 @@ -73,7 +74,7 @@ extern int __cpu_disable(void);
4858 extern void __cpu_die(unsigned int cpu);
4859 extern void prefill_possible_map(void);
4860 extern unsigned num_processors;
4861 -extern unsigned disabled_cpus;
4862 +extern unsigned __cpuinitdata disabled_cpus;
4864 #define NO_PROC_ID 0xFF /* No processor magic marker */
4866 --- a/include/xen/xenbus.h
4867 +++ b/include/xen/xenbus.h
4868 @@ -93,8 +93,7 @@ struct xenbus_device_id
4870 /* A xenbus driver. */
4871 struct xenbus_driver {
4873 - struct module *owner;
4875 const struct xenbus_device_id *ids;
4876 int (*probe)(struct xenbus_device *dev,
4877 const struct xenbus_device_id *id);
4878 @@ -115,8 +114,25 @@ static inline struct xenbus_driver *to_x
4879 return container_of(drv, struct xenbus_driver, driver);
4882 -int xenbus_register_frontend(struct xenbus_driver *drv);
4883 -int xenbus_register_backend(struct xenbus_driver *drv);
4884 +int __must_check __xenbus_register_frontend(struct xenbus_driver *drv,
4885 + struct module *owner,
4886 + const char *mod_name);
4888 +static inline int __must_check
4889 +xenbus_register_frontend(struct xenbus_driver *drv)
4891 + return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME);
4894 +int __must_check __xenbus_register_backend(struct xenbus_driver *drv,
4895 + struct module *owner,
4896 + const char *mod_name);
4897 +static inline int __must_check
4898 +xenbus_register_backend(struct xenbus_driver *drv)
4900 + return __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME);
4903 void xenbus_unregister_driver(struct xenbus_driver *drv);
4905 struct xenbus_transaction
4906 --- a/lib/swiotlb-xen.c
4907 +++ b/lib/swiotlb-xen.c
4908 @@ -135,8 +135,8 @@ __setup("swiotlb=", setup_io_tlb_npages)
4909 * Statically reserve bounce buffer space and initialize bounce buffer data
4910 * structures for the software IO TLB used to implement the PCI DMA API.
4913 -swiotlb_init_with_default_size (size_t default_size)
4915 +swiotlb_init_with_default_size(size_t default_size)
4917 unsigned long i, bytes;
4919 @@ -221,7 +221,7 @@ swiotlb_init_with_default_size (size_t d
4928 @@ -457,7 +457,7 @@ swiotlb_full(struct device *dev, size_t
4929 * When the mapping is small enough return a static buffer to limit
4930 * the damage, or panic when the transfer is too big.
4932 - printk(KERN_ERR "PCI-DMA: Out of SW-IOMMU space for %lu bytes at "
4933 + printk(KERN_ERR "PCI-DMA: Out of SW-IOMMU space for %zu bytes at "
4934 "device %s\n", (unsigned long)size, dev ? dev->bus_id : "?");
4936 if (size > io_tlb_overflow && do_panic) {
4937 @@ -602,7 +602,7 @@ swiotlb_map_sg(struct device *hwdev, str
4938 sg[0].dma_length = 0;
4941 - sg->dma_address = (dma_addr_t)virt_to_bus(map);
4942 + sg->dma_address = virt_to_bus(map);
4944 sg->dma_address = dev_addr;
4945 sg->dma_length = sg->length;
4946 @@ -624,8 +624,7 @@ swiotlb_unmap_sg(struct device *hwdev, s
4948 for (i = 0; i < nelems; i++, sg++)
4949 if (in_swiotlb_aperture(sg->dma_address))
4950 - unmap_single(hwdev,
4951 - (void *)bus_to_virt(sg->dma_address),
4952 + unmap_single(hwdev, bus_to_virt(sg->dma_address),
4953 sg->dma_length, dir);
4955 gnttab_dma_unmap_page(sg->dma_address);
4956 @@ -648,8 +647,7 @@ swiotlb_sync_sg_for_cpu(struct device *h
4958 for (i = 0; i < nelems; i++, sg++)
4959 if (in_swiotlb_aperture(sg->dma_address))
4960 - sync_single(hwdev,
4961 - (void *)bus_to_virt(sg->dma_address),
4962 + sync_single(hwdev, bus_to_virt(sg->dma_address),
4963 sg->dma_length, dir);
4966 @@ -663,8 +661,7 @@ swiotlb_sync_sg_for_device(struct device
4968 for (i = 0; i < nelems; i++, sg++)
4969 if (in_swiotlb_aperture(sg->dma_address))
4970 - sync_single(hwdev,
4971 - (void *)bus_to_virt(sg->dma_address),
4972 + sync_single(hwdev, bus_to_virt(sg->dma_address),
4973 sg->dma_length, dir);