]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/xen/enlighten.c
Merge branches 'x86/asm', 'x86/cleanups', 'x86/cpudetect', 'x86/debug', 'x86/doc...
[linux-2.6-omap-h63xx.git] / arch / x86 / xen / enlighten.c
index 5e4686d70f629de22f81adc96b658ab06216be24..6b3f7eef57e3eea3cb6b5bf966385db090f1cf1f 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/console.h>
 
 #include <xen/interface/xen.h>
+#include <xen/interface/version.h>
 #include <xen/interface/physdev.h>
 #include <xen/interface/vcpu.h>
 #include <xen/features.h>
@@ -633,35 +634,27 @@ static void xen_flush_tlb_single(unsigned long addr)
        preempt_enable();
 }
 
-static void xen_flush_tlb_others(const cpumask_t *cpus, struct mm_struct *mm,
-                                unsigned long va)
+static void xen_flush_tlb_others(const struct cpumask *cpus,
+                                struct mm_struct *mm, unsigned long va)
 {
        struct {
                struct mmuext_op op;
-               cpumask_t mask;
+               DECLARE_BITMAP(mask, NR_CPUS);
        } *args;
-       cpumask_t cpumask = *cpus;
        struct multicall_space mcs;
 
-       /*
-        * A couple of (to be removed) sanity checks:
-        *
-        * - current CPU must not be in mask
-        * - mask must exist :)
-        */
-       BUG_ON(cpus_empty(cpumask));
-       BUG_ON(cpu_isset(smp_processor_id(), cpumask));
+       BUG_ON(cpumask_empty(cpus));
        BUG_ON(!mm);
 
-       /* If a CPU which we ran on has gone down, OK. */
-       cpus_and(cpumask, cpumask, cpu_online_map);
-       if (cpus_empty(cpumask))
-               return;
-
        mcs = xen_mc_entry(sizeof(*args));
        args = mcs.args;
-       args->mask = cpumask;
-       args->op.arg2.vcpumask = &args->mask;
+       args->op.arg2.vcpumask = to_cpumask(args->mask);
+
+       /* Remove us, and any offline CPUS. */
+       cpumask_and(to_cpumask(args->mask), cpus, cpu_online_mask);
+       cpumask_clear_cpu(smp_processor_id(), to_cpumask(args->mask));
+       if (unlikely(cpumask_empty(to_cpumask(args->mask))))
+               goto issue;
 
        if (va == TLB_FLUSH_ALL) {
                args->op.cmd = MMUEXT_TLB_FLUSH_MULTI;
@@ -672,6 +665,7 @@ static void xen_flush_tlb_others(const cpumask_t *cpus, struct mm_struct *mm,
 
        MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF);
 
+issue:
        xen_mc_issue(PARAVIRT_LAZY_MMU);
 }
 
@@ -701,17 +695,17 @@ static void xen_write_cr0(unsigned long cr0)
 
 static void xen_write_cr2(unsigned long cr2)
 {
-       x86_read_percpu(xen_vcpu)->arch.cr2 = cr2;
+       percpu_read(xen_vcpu)->arch.cr2 = cr2;
 }
 
 static unsigned long xen_read_cr2(void)
 {
-       return x86_read_percpu(xen_vcpu)->arch.cr2;
+       return percpu_read(xen_vcpu)->arch.cr2;
 }
 
 static unsigned long xen_read_cr2_direct(void)
 {
-       return x86_read_percpu(xen_vcpu_info.arch.cr2);
+       return percpu_read(xen_vcpu_info.arch.cr2);
 }
 
 static void xen_write_cr4(unsigned long cr4)
@@ -724,12 +718,12 @@ static void xen_write_cr4(unsigned long cr4)
 
 static unsigned long xen_read_cr3(void)
 {
-       return x86_read_percpu(xen_cr3);
+       return percpu_read(xen_cr3);
 }
 
 static void set_current_cr3(void *v)
 {
-       x86_write_percpu(xen_current_cr3, (unsigned long)v);
+       percpu_write(xen_current_cr3, (unsigned long)v);
 }
 
 static void __xen_write_cr3(bool kernel, unsigned long cr3)
@@ -754,7 +748,7 @@ static void __xen_write_cr3(bool kernel, unsigned long cr3)
        MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
 
        if (kernel) {
-               x86_write_percpu(xen_cr3, cr3);
+               percpu_write(xen_cr3, cr3);
 
                /* Update xen_current_cr3 once the batch has actually
                   been submitted. */
@@ -770,7 +764,7 @@ static void xen_write_cr3(unsigned long cr3)
 
        /* Update while interrupts are disabled, so its atomic with
           respect to ipis */
-       x86_write_percpu(xen_cr3, cr3);
+       percpu_write(xen_cr3, cr3);
 
        __xen_write_cr3(true, cr3);
 
@@ -793,7 +787,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
 
        ret = 0;
 
-       switch(msr) {
+       switch (msr) {
 #ifdef CONFIG_X86_64
                unsigned which;
                u64 base;
@@ -1313,7 +1307,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
        .ptep_modify_prot_commit = __ptep_modify_prot_commit,
 
        .pte_val = xen_pte_val,
-       .pte_flags = native_pte_flags,
        .pgd_val = xen_pgd_val,
 
        .make_pte = xen_make_pte,
@@ -1453,7 +1446,7 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
 
        ident_pte = 0;
        pfn = 0;
-       for(pmdidx = 0; pmdidx < PTRS_PER_PMD && pfn < max_pfn; pmdidx++) {
+       for (pmdidx = 0; pmdidx < PTRS_PER_PMD && pfn < max_pfn; pmdidx++) {
                pte_t *pte_page;
 
                /* Reuse or allocate a page of ptes */
@@ -1471,7 +1464,7 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
                }
 
                /* Install mappings */
-               for(pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) {
+               for (pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) {
                        pte_t pte;
 
                        if (pfn > max_pfn_mapped)
@@ -1485,7 +1478,7 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
                }
        }
 
-       for(pteidx = 0; pteidx < ident_pte; pteidx += PTRS_PER_PTE)
+       for (pteidx = 0; pteidx < ident_pte; pteidx += PTRS_PER_PTE)
                set_page_prot(&level1_ident_pgt[pteidx], PAGE_KERNEL_RO);
 
        set_page_prot(pmd, PAGE_KERNEL_RO);
@@ -1499,7 +1492,7 @@ static void convert_pfn_mfn(void *v)
 
        /* All levels are converted the same way, so just treat them
           as ptes. */
-       for(i = 0; i < PTRS_PER_PTE; i++)
+       for (i = 0; i < PTRS_PER_PTE; i++)
                pte[i] = xen_make_pte(pte[i].pte);
 }
 
@@ -1514,7 +1507,8 @@ static void convert_pfn_mfn(void *v)
  * of the physical mapping once some sort of allocator has been set
  * up.
  */
-static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
+static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
+                                               unsigned long max_pfn)
 {
        pud_t *l3;
        pmd_t *l2;
@@ -1577,7 +1571,8 @@ static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pf
 #else  /* !CONFIG_X86_64 */
 static pmd_t level2_kernel_pgt[PTRS_PER_PMD] __page_aligned_bss;
 
-static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
+static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
+                                               unsigned long max_pfn)
 {
        pmd_t *kernel_pmd;
 
@@ -1649,7 +1644,6 @@ asmlinkage void __init xen_start_kernel(void)
 #ifdef CONFIG_X86_64
        /* Disable until direct per-cpu data access. */
        have_vcpu_info_placement = 0;
-       x86_64_init_pda();
 #endif
 
        xen_smp_init();