]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/vmi_32.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / vmi_32.c
index 21edd0d6eae5b33e21e657679e8c68af0720e368..0a1b1a9d922df7f4380a40d4b210330dbc8db17a 100644 (file)
@@ -64,6 +64,7 @@ static struct {
        void (*set_tr)(u32 selector);
        void (*write_idt_entry)(struct desc_struct *, int, u32, u32);
        void (*write_gdt_entry)(struct desc_struct *, int, u32, u32);
+       void (*write_ldt_entry)(struct desc_struct *, int, u32, u32);
        void (*set_kernel_stack)(u32 selector, u32 sp0);
        void (*allocate_page)(u32, u32, u32, u32, u32);
        void (*release_page)(u32, u32);
@@ -150,7 +151,7 @@ static unsigned vmi_patch(u8 type, u16 clobbers, void *insns,
                                              insns, ip);
                case PARAVIRT_PATCH(pv_cpu_ops.iret):
                        return patch_internal(VMI_CALL_IRET, len, insns, ip);
-               case PARAVIRT_PATCH(pv_cpu_ops.irq_enable_syscall_ret):
+               case PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit):
                        return patch_internal(VMI_CALL_SYSEXIT, len, insns, ip);
                default:
                        break;
@@ -219,14 +220,21 @@ static void vmi_set_tr(void)
 static void vmi_write_idt_entry(gate_desc *dt, int entry, const gate_desc *g)
 {
        u32 *idt_entry = (u32 *)g;
-       vmi_ops.write_idt_entry(dt, entry, idt_entry[0], idt_entry[2]);
+       vmi_ops.write_idt_entry(dt, entry, idt_entry[0], idt_entry[1]);
 }
 
 static void vmi_write_gdt_entry(struct desc_struct *dt, int entry,
                                const void *desc, int type)
 {
        u32 *gdt_entry = (u32 *)desc;
-       vmi_ops.write_gdt_entry(dt, entry, gdt_entry[0], gdt_entry[2]);
+       vmi_ops.write_gdt_entry(dt, entry, gdt_entry[0], gdt_entry[1]);
+}
+
+static void vmi_write_ldt_entry(struct desc_struct *dt, int entry,
+                               const void *desc)
+{
+       u32 *ldt_entry = (u32 *)desc;
+       vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
 }
 
 static void vmi_load_sp0(struct tss_struct *tss,
@@ -312,7 +320,7 @@ static void check_zeroed_page(u32 pfn, int type, struct page *page)
         * pdes need to be zeroed.
         */
        if (type & VMI_PAGE_CLONE)
-               limit = USER_PTRS_PER_PGD;
+               limit = KERNEL_PGD_BOUNDARY;
        for (i = 0; i < limit; i++)
                BUG_ON(ptr[i]);
 }
@@ -384,13 +392,13 @@ static void *vmi_kmap_atomic_pte(struct page *page, enum km_type type)
 }
 #endif
 
-static void vmi_allocate_pt(struct mm_struct *mm, u32 pfn)
+static void vmi_allocate_pte(struct mm_struct *mm, u32 pfn)
 {
        vmi_set_page_type(pfn, VMI_PAGE_L1);
        vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0);
 }
 
-static void vmi_allocate_pd(u32 pfn)
+static void vmi_allocate_pmd(struct mm_struct *mm, u32 pfn)
 {
        /*
         * This call comes in very early, before mem_map is setup.
@@ -401,20 +409,20 @@ static void vmi_allocate_pd(u32 pfn)
        vmi_ops.allocate_page(pfn, VMI_PAGE_L2, 0, 0, 0);
 }
 
-static void vmi_allocate_pd_clone(u32 pfn, u32 clonepfn, u32 start, u32 count)
+static void vmi_allocate_pmd_clone(u32 pfn, u32 clonepfn, u32 start, u32 count)
 {
        vmi_set_page_type(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE);
        vmi_check_page_type(clonepfn, VMI_PAGE_L2);
        vmi_ops.allocate_page(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE, clonepfn, start, count);
 }
 
-static void vmi_release_pt(u32 pfn)
+static void vmi_release_pte(u32 pfn)
 {
        vmi_ops.release_page(pfn, VMI_PAGE_L1);
        vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
 }
 
-static void vmi_release_pd(u32 pfn)
+static void vmi_release_pmd(u32 pfn)
 {
        vmi_ops.release_page(pfn, VMI_PAGE_L2);
        vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
@@ -467,7 +475,7 @@ static void vmi_set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep
 static void vmi_set_pmd(pmd_t *pmdp, pmd_t pmdval)
 {
 #ifdef CONFIG_X86_PAE
-       const pte_t pte = { pmdval.pmd, pmdval.pmd >> 32 };
+       const pte_t pte = { .pte = pmdval.pmd };
        vmi_check_page_type(__pa(pmdp) >> PAGE_SHIFT, VMI_PAGE_PMD);
 #else
        const pte_t pte = { pmdval.pud.pgd.pgd };
@@ -500,21 +508,21 @@ static void vmi_set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t
 static void vmi_set_pud(pud_t *pudp, pud_t pudval)
 {
        /* Um, eww */
-       const pte_t pte = { pudval.pgd.pgd, pudval.pgd.pgd >> 32 };
+       const pte_t pte = { .pte = pudval.pgd.pgd };
        vmi_check_page_type(__pa(pudp) >> PAGE_SHIFT, VMI_PAGE_PGD);
        vmi_ops.set_pte(pte, (pte_t *)pudp, VMI_PAGE_PDP);
 }
 
 static void vmi_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
-       const pte_t pte = { 0 };
+       const pte_t pte = { .pte = 0 };
        vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
        vmi_ops.set_pte(pte, ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0));
 }
 
 static void vmi_pmd_clear(pmd_t *pmd)
 {
-       const pte_t pte = { 0 };
+       const pte_t pte = { .pte = 0 };
        vmi_check_page_type(__pa(pmd) >> PAGE_SHIFT, VMI_PAGE_PMD);
        vmi_ops.set_pte(pte, (pte_t *)pmd, VMI_PAGE_PD);
 }
@@ -805,7 +813,8 @@ static inline int __init activate_vmi(void)
        para_fill(pv_cpu_ops.store_idt, GetIDT);
        para_fill(pv_cpu_ops.store_tr, GetTR);
        pv_cpu_ops.load_tls = vmi_load_tls;
-       para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry);
+       para_wrap(pv_cpu_ops.write_ldt_entry, vmi_write_ldt_entry,
+                 write_ldt_entry, WriteLDTEntry);
        para_wrap(pv_cpu_ops.write_gdt_entry, vmi_write_gdt_entry,
                  write_gdt_entry, WriteGDTEntry);
        para_wrap(pv_cpu_ops.write_idt_entry, vmi_write_idt_entry,
@@ -862,15 +871,15 @@ static inline int __init activate_vmi(void)
 
        vmi_ops.allocate_page = vmi_get_function(VMI_CALL_AllocatePage);
        if (vmi_ops.allocate_page) {
-               pv_mmu_ops.alloc_pt = vmi_allocate_pt;
-               pv_mmu_ops.alloc_pd = vmi_allocate_pd;
-               pv_mmu_ops.alloc_pd_clone = vmi_allocate_pd_clone;
+               pv_mmu_ops.alloc_pte = vmi_allocate_pte;
+               pv_mmu_ops.alloc_pmd = vmi_allocate_pmd;
+               pv_mmu_ops.alloc_pmd_clone = vmi_allocate_pmd_clone;
        }
 
        vmi_ops.release_page = vmi_get_function(VMI_CALL_ReleasePage);
        if (vmi_ops.release_page) {
-               pv_mmu_ops.release_pt = vmi_release_pt;
-               pv_mmu_ops.release_pd = vmi_release_pd;
+               pv_mmu_ops.release_pte = vmi_release_pte;
+               pv_mmu_ops.release_pmd = vmi_release_pmd;
        }
 
        /* Set linear is needed in all cases */
@@ -887,7 +896,7 @@ static inline int __init activate_vmi(void)
         * the backend.  They are performance critical anyway, so requiring
         * a patch is not a big problem.
         */
-       pv_cpu_ops.irq_enable_syscall_ret = (void *)0xfeedbab0;
+       pv_cpu_ops.irq_enable_sysexit = (void *)0xfeedbab0;
        pv_cpu_ops.iret = (void *)0xbadbab0;
 
 #ifdef CONFIG_SMP
@@ -897,7 +906,6 @@ static inline int __init activate_vmi(void)
 #ifdef CONFIG_X86_LOCAL_APIC
        para_fill(pv_apic_ops.apic_read, APICRead);
        para_fill(pv_apic_ops.apic_write, APICWrite);
-       para_fill(pv_apic_ops.apic_write_atomic, APICWrite);
 #endif
 
        /*
@@ -923,7 +931,7 @@ static inline int __init activate_vmi(void)
                pv_apic_ops.setup_secondary_clock = vmi_time_ap_init;
 #endif
                pv_time_ops.sched_clock = vmi_sched_clock;
-               pv_time_ops.get_cpu_khz = vmi_cpu_khz;
+               pv_time_ops.get_tsc_khz = vmi_tsc_khz;
 
                /* We have true wallclock functions; disable CMOS clock sync */
                no_sync_cmos_clock = 1;