diff options
author | Arnd Bergmann <arnd@arndb.de> | 2009-06-12 03:53:47 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2009-06-12 05:32:58 -0400 |
commit | 5b02ee3d219f9e01b6e9146e25613822cfc2e5ce (patch) | |
tree | 7ce9126738c3cf4b37d67170d0e4b34818c057a9 /arch/x86/xen | |
parent | 26a28fa4fea5b8c65713aa50c124f76a88c7924d (diff) | |
parent | 8ebf975608aaebd7feb33d77f07ba21a6380e086 (diff) |
asm-generic: merge branch 'master' of torvalds/linux-2.6
Fixes a merge conflict against the x86 tree caused by a fix to
atomic.h which I renamed to atomic_long.h.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/x86/xen')
-rw-r--r-- | arch/x86/xen/enlighten.c | 65 | ||||
-rw-r--r-- | arch/x86/xen/mmu.c | 23 | ||||
-rw-r--r-- | arch/x86/xen/setup.c | 6 | ||||
-rw-r--r-- | arch/x86/xen/xen-ops.h | 1 |
4 files changed, 71 insertions, 24 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index f09e8c36ee80..0a1700a2be9c 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/start_kernel.h> | 21 | #include <linux/start_kernel.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/kprobes.h> | ||
23 | #include <linux/bootmem.h> | 24 | #include <linux/bootmem.h> |
24 | #include <linux/module.h> | 25 | #include <linux/module.h> |
25 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
@@ -44,6 +45,7 @@ | |||
44 | #include <asm/processor.h> | 45 | #include <asm/processor.h> |
45 | #include <asm/proto.h> | 46 | #include <asm/proto.h> |
46 | #include <asm/msr-index.h> | 47 | #include <asm/msr-index.h> |
48 | #include <asm/traps.h> | ||
47 | #include <asm/setup.h> | 49 | #include <asm/setup.h> |
48 | #include <asm/desc.h> | 50 | #include <asm/desc.h> |
49 | #include <asm/pgtable.h> | 51 | #include <asm/pgtable.h> |
@@ -240,10 +242,10 @@ static unsigned long xen_get_debugreg(int reg) | |||
240 | return HYPERVISOR_get_debugreg(reg); | 242 | return HYPERVISOR_get_debugreg(reg); |
241 | } | 243 | } |
242 | 244 | ||
243 | void xen_leave_lazy(void) | 245 | static void xen_end_context_switch(struct task_struct *next) |
244 | { | 246 | { |
245 | paravirt_leave_lazy(paravirt_get_lazy_mode()); | ||
246 | xen_mc_flush(); | 247 | xen_mc_flush(); |
248 | paravirt_end_context_switch(next); | ||
247 | } | 249 | } |
248 | 250 | ||
249 | static unsigned long xen_store_tr(void) | 251 | static unsigned long xen_store_tr(void) |
@@ -428,11 +430,44 @@ static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum, | |||
428 | static int cvt_gate_to_trap(int vector, const gate_desc *val, | 430 | static int cvt_gate_to_trap(int vector, const gate_desc *val, |
429 | struct trap_info *info) | 431 | struct trap_info *info) |
430 | { | 432 | { |
433 | unsigned long addr; | ||
434 | |||
431 | if (val->type != GATE_TRAP && val->type != GATE_INTERRUPT) | 435 | if (val->type != GATE_TRAP && val->type != GATE_INTERRUPT) |
432 | return 0; | 436 | return 0; |
433 | 437 | ||
434 | info->vector = vector; | 438 | info->vector = vector; |
435 | info->address = gate_offset(*val); | 439 | |
440 | addr = gate_offset(*val); | ||
441 | #ifdef CONFIG_X86_64 | ||
442 | /* | ||
443 | * Look for known traps using IST, and substitute them | ||
444 | * appropriately. The debugger ones are the only ones we care | ||
445 | * about. Xen will handle faults like double_fault and | ||
446 | * machine_check, so we should never see them. Warn if | ||
447 | * there's an unexpected IST-using fault handler. | ||
448 | */ | ||
449 | if (addr == (unsigned long)debug) | ||
450 | addr = (unsigned long)xen_debug; | ||
451 | else if (addr == (unsigned long)int3) | ||
452 | addr = (unsigned long)xen_int3; | ||
453 | else if (addr == (unsigned long)stack_segment) | ||
454 | addr = (unsigned long)xen_stack_segment; | ||
455 | else if (addr == (unsigned long)double_fault || | ||
456 | addr == (unsigned long)nmi) { | ||
457 | /* Don't need to handle these */ | ||
458 | return 0; | ||
459 | #ifdef CONFIG_X86_MCE | ||
460 | } else if (addr == (unsigned long)machine_check) { | ||
461 | return 0; | ||
462 | #endif | ||
463 | } else { | ||
464 | /* Some other trap using IST? */ | ||
465 | if (WARN_ON(val->ist != 0)) | ||
466 | return 0; | ||
467 | } | ||
468 | #endif /* CONFIG_X86_64 */ | ||
469 | info->address = addr; | ||
470 | |||
436 | info->cs = gate_segment(*val); | 471 | info->cs = gate_segment(*val); |
437 | info->flags = val->dpl; | 472 | info->flags = val->dpl; |
438 | /* interrupt gates clear IF */ | 473 | /* interrupt gates clear IF */ |
@@ -623,10 +658,26 @@ static void xen_clts(void) | |||
623 | xen_mc_issue(PARAVIRT_LAZY_CPU); | 658 | xen_mc_issue(PARAVIRT_LAZY_CPU); |
624 | } | 659 | } |
625 | 660 | ||
661 | static DEFINE_PER_CPU(unsigned long, xen_cr0_value); | ||
662 | |||
663 | static unsigned long xen_read_cr0(void) | ||
664 | { | ||
665 | unsigned long cr0 = percpu_read(xen_cr0_value); | ||
666 | |||
667 | if (unlikely(cr0 == 0)) { | ||
668 | cr0 = native_read_cr0(); | ||
669 | percpu_write(xen_cr0_value, cr0); | ||
670 | } | ||
671 | |||
672 | return cr0; | ||
673 | } | ||
674 | |||
626 | static void xen_write_cr0(unsigned long cr0) | 675 | static void xen_write_cr0(unsigned long cr0) |
627 | { | 676 | { |
628 | struct multicall_space mcs; | 677 | struct multicall_space mcs; |
629 | 678 | ||
679 | percpu_write(xen_cr0_value, cr0); | ||
680 | |||
630 | /* Only pay attention to cr0.TS; everything else is | 681 | /* Only pay attention to cr0.TS; everything else is |
631 | ignored. */ | 682 | ignored. */ |
632 | mcs = xen_mc_entry(0); | 683 | mcs = xen_mc_entry(0); |
@@ -812,7 +863,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = { | |||
812 | 863 | ||
813 | .clts = xen_clts, | 864 | .clts = xen_clts, |
814 | 865 | ||
815 | .read_cr0 = native_read_cr0, | 866 | .read_cr0 = xen_read_cr0, |
816 | .write_cr0 = xen_write_cr0, | 867 | .write_cr0 = xen_write_cr0, |
817 | 868 | ||
818 | .read_cr4 = native_read_cr4, | 869 | .read_cr4 = native_read_cr4, |
@@ -860,10 +911,8 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = { | |||
860 | /* Xen takes care of %gs when switching to usermode for us */ | 911 | /* Xen takes care of %gs when switching to usermode for us */ |
861 | .swapgs = paravirt_nop, | 912 | .swapgs = paravirt_nop, |
862 | 913 | ||
863 | .lazy_mode = { | 914 | .start_context_switch = paravirt_start_context_switch, |
864 | .enter = paravirt_enter_lazy_cpu, | 915 | .end_context_switch = xen_end_context_switch, |
865 | .leave = xen_leave_lazy, | ||
866 | }, | ||
867 | }; | 916 | }; |
868 | 917 | ||
869 | static const struct pv_apic_ops xen_apic_ops __initdata = { | 918 | static const struct pv_apic_ops xen_apic_ops __initdata = { |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index fba55b1a4021..4ceb28581652 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -452,10 +452,6 @@ void set_pte_mfn(unsigned long vaddr, unsigned long mfn, pgprot_t flags) | |||
452 | void xen_set_pte_at(struct mm_struct *mm, unsigned long addr, | 452 | void xen_set_pte_at(struct mm_struct *mm, unsigned long addr, |
453 | pte_t *ptep, pte_t pteval) | 453 | pte_t *ptep, pte_t pteval) |
454 | { | 454 | { |
455 | /* updates to init_mm may be done without lock */ | ||
456 | if (mm == &init_mm) | ||
457 | preempt_disable(); | ||
458 | |||
459 | ADD_STATS(set_pte_at, 1); | 455 | ADD_STATS(set_pte_at, 1); |
460 | // ADD_STATS(set_pte_at_pinned, xen_page_pinned(ptep)); | 456 | // ADD_STATS(set_pte_at_pinned, xen_page_pinned(ptep)); |
461 | ADD_STATS(set_pte_at_current, mm == current->mm); | 457 | ADD_STATS(set_pte_at_current, mm == current->mm); |
@@ -476,9 +472,7 @@ void xen_set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
476 | } | 472 | } |
477 | xen_set_pte(ptep, pteval); | 473 | xen_set_pte(ptep, pteval); |
478 | 474 | ||
479 | out: | 475 | out: return; |
480 | if (mm == &init_mm) | ||
481 | preempt_enable(); | ||
482 | } | 476 | } |
483 | 477 | ||
484 | pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, | 478 | pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, |
@@ -1152,10 +1146,8 @@ static void drop_other_mm_ref(void *info) | |||
1152 | 1146 | ||
1153 | /* If this cpu still has a stale cr3 reference, then make sure | 1147 | /* If this cpu still has a stale cr3 reference, then make sure |
1154 | it has been flushed. */ | 1148 | it has been flushed. */ |
1155 | if (percpu_read(xen_current_cr3) == __pa(mm->pgd)) { | 1149 | if (percpu_read(xen_current_cr3) == __pa(mm->pgd)) |
1156 | load_cr3(swapper_pg_dir); | 1150 | load_cr3(swapper_pg_dir); |
1157 | arch_flush_lazy_cpu_mode(); | ||
1158 | } | ||
1159 | } | 1151 | } |
1160 | 1152 | ||
1161 | static void xen_drop_mm_ref(struct mm_struct *mm) | 1153 | static void xen_drop_mm_ref(struct mm_struct *mm) |
@@ -1168,7 +1160,6 @@ static void xen_drop_mm_ref(struct mm_struct *mm) | |||
1168 | load_cr3(swapper_pg_dir); | 1160 | load_cr3(swapper_pg_dir); |
1169 | else | 1161 | else |
1170 | leave_mm(smp_processor_id()); | 1162 | leave_mm(smp_processor_id()); |
1171 | arch_flush_lazy_cpu_mode(); | ||
1172 | } | 1163 | } |
1173 | 1164 | ||
1174 | /* Get the "official" set of cpus referring to our pagetable. */ | 1165 | /* Get the "official" set of cpus referring to our pagetable. */ |
@@ -1876,6 +1867,14 @@ __init void xen_post_allocator_init(void) | |||
1876 | xen_mark_init_mm_pinned(); | 1867 | xen_mark_init_mm_pinned(); |
1877 | } | 1868 | } |
1878 | 1869 | ||
1870 | static void xen_leave_lazy_mmu(void) | ||
1871 | { | ||
1872 | preempt_disable(); | ||
1873 | xen_mc_flush(); | ||
1874 | paravirt_leave_lazy_mmu(); | ||
1875 | preempt_enable(); | ||
1876 | } | ||
1877 | |||
1879 | const struct pv_mmu_ops xen_mmu_ops __initdata = { | 1878 | const struct pv_mmu_ops xen_mmu_ops __initdata = { |
1880 | .pagetable_setup_start = xen_pagetable_setup_start, | 1879 | .pagetable_setup_start = xen_pagetable_setup_start, |
1881 | .pagetable_setup_done = xen_pagetable_setup_done, | 1880 | .pagetable_setup_done = xen_pagetable_setup_done, |
@@ -1949,7 +1948,7 @@ const struct pv_mmu_ops xen_mmu_ops __initdata = { | |||
1949 | 1948 | ||
1950 | .lazy_mode = { | 1949 | .lazy_mode = { |
1951 | .enter = paravirt_enter_lazy_mmu, | 1950 | .enter = paravirt_enter_lazy_mmu, |
1952 | .leave = xen_leave_lazy, | 1951 | .leave = xen_leave_lazy_mmu, |
1953 | }, | 1952 | }, |
1954 | 1953 | ||
1955 | .set_fixmap = xen_set_fixmap, | 1954 | .set_fixmap = xen_set_fixmap, |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 15c6c68db6a2..ad0047f47cd4 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -61,9 +61,9 @@ char * __init xen_memory_setup(void) | |||
61 | * - xen_start_info | 61 | * - xen_start_info |
62 | * See comment above "struct start_info" in <xen/interface/xen.h> | 62 | * See comment above "struct start_info" in <xen/interface/xen.h> |
63 | */ | 63 | */ |
64 | e820_add_region(__pa(xen_start_info->mfn_list), | 64 | reserve_early(__pa(xen_start_info->mfn_list), |
65 | xen_start_info->pt_base - xen_start_info->mfn_list, | 65 | __pa(xen_start_info->pt_base), |
66 | E820_RESERVED); | 66 | "XEN START INFO"); |
67 | 67 | ||
68 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 68 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); |
69 | 69 | ||
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index ca6596b05d53..22494fd4c9b5 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h | |||
@@ -30,7 +30,6 @@ pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn); | |||
30 | void xen_ident_map_ISA(void); | 30 | void xen_ident_map_ISA(void); |
31 | void xen_reserve_top(void); | 31 | void xen_reserve_top(void); |
32 | 32 | ||
33 | void xen_leave_lazy(void); | ||
34 | void xen_post_allocator_init(void); | 33 | void xen_post_allocator_init(void); |
35 | 34 | ||
36 | char * __init xen_memory_setup(void); | 35 | char * __init xen_memory_setup(void); |