[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] - Update FreeBSD sparse tree to build against latest -unstable



ChangeSet 1.1323, 2005/04/19 00:25:40+01:00, iap10@xxxxxxxxxxxxxxxxxxxxx

        - Update FreeBSD sparse tree to build against latest -unstable
        - add conditional support for writable pagetables (don't use 
          currently locks up xen)
        - block driver not update to use grant tables yet, DOM0 will have to 
          be re-compiled with grant table substrate disabled
        Signed-off-by: Kip Macy <kmacy@xxxxxxxxxxx>
        Signed-off-by: ian@xxxxxxxxxxxxx



 i386-xen/machdep.c         |   29 +++---
 i386-xen/pmap.c            |   70 +++++++--------
 i386-xen/xen_machdep.c     |  204 +++++++++++++++------------------------------
 include/hypervisor.h       |   35 ++++++-
 include/pmap.h             |    4 
 include/xenfunc.h          |   10 --
 include/xenpmap.h          |  105 +++++++++++++----------
 xen/netfront/xn_netfront.c |    5 -
 8 files changed, 217 insertions(+), 245 deletions(-)


diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c 
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c        2005-04-18 
21:06:38 -04:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c        2005-04-18 
21:06:38 -04:00
@@ -224,7 +224,6 @@
        /*
         * Good {morning,afternoon,evening,night}.
         */
-    /* XXX need to write clock driver */
        startrtclock();
 
        printcpuinfo();
@@ -1375,6 +1374,7 @@
 extern unsigned long *SMPpt;
 pteinfo_t *pteinfo_list;
 unsigned long *xen_machine_phys = ((unsigned long *)VADDR(1008, 0));
+pt_entry_t *KPTphysv;
 int preemptable;
 int gdt_set;
 
@@ -1386,6 +1386,10 @@
 initvalues(start_info_t *startinfo)
 { 
     int i;
+#ifdef WRITABLE_PAGETABLES
+    HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
+#endif
+
     xen_start_info = startinfo;
     xen_phys_machine = (unsigned long *)startinfo->mfn_list;
     unsigned long tmpindex = ((__pa(xen_start_info->pt_base) >> PAGE_SHIFT) + 
xen_start_info->nr_pt_frames) + 3 /* number of pages allocated after the pts + 
1*/;
@@ -1393,6 +1397,7 @@
     /* pre-zero unused mapped pages */
     bzero((char *)(KERNBASE + (tmpindex << PAGE_SHIFT)), (1024 - 
tmpindex)*PAGE_SIZE); 
     IdlePTD = (pd_entry_t *)xpmap_ptom(__pa(startinfo->pt_base));
+    KPTphysv = (pt_entry_t *)(startinfo->pt_base + PAGE_SIZE);
     XENPRINTF("IdlePTD %p\n", IdlePTD);
     XENPRINTF("nr_pages: %ld shared_info: 0x%lx flags: 0x%lx pt_base: 0x%lx "
              "mod_start: 0x%lx mod_len: 0x%lx\n",
@@ -1401,9 +1406,9 @@
              xen_start_info->mod_start, xen_start_info->mod_len);
     
     /* setup self-referential mapping first so vtomach will work */
-    xpq_queue_pt_update(IdlePTD + PTDPTDI , (unsigned long)IdlePTD | 
+    xen_queue_pt_update(IdlePTD + PTDPTDI , (unsigned long)IdlePTD | 
                        PG_V | PG_A);
-    mcl_flush_queue();
+    xen_flush_queue();
     /* Map proc0's UPAGES */
     proc0uarea = (struct user *)(KERNBASE + (tmpindex << PAGE_SHIFT));
     tmpindex += UAREA_PAGES;
@@ -1431,10 +1436,10 @@
     SMPpt[0] = vtomach(cpu0prvpage) | PG_RW | PG_M | PG_V | PG_A;
 
     /* map SMP page table RO */
-    PT_SET_MA(SMPpt, vtomach(SMPpt) & ~PG_RW, TRUE);
+    PT_SET_MA(SMPpt, vtomach(SMPpt) & ~PG_RW);
 
     /* put the page table into the pde */
-    xpq_queue_pt_update(IdlePTD + MPPTDI, xpmap_ptom((tmpindex << 
PAGE_SHIFT))| PG_M | PG_RW | PG_V | PG_A);
+    xen_queue_pt_update(IdlePTD + MPPTDI, xpmap_ptom((tmpindex << 
PAGE_SHIFT))| PG_M | PG_RW | PG_V | PG_A);
 
     tmpindex++;
 #endif
@@ -1448,20 +1453,16 @@
 #endif
     /* unmap remaining pages from initial 4MB chunk */
     for (i = tmpindex; i%1024 != 0; i++) 
-       PT_CLEAR(KERNBASE + (i << PAGE_SHIFT), TRUE);
+       PT_CLEAR_VA(KPTphysv + i, TRUE);
 
     /* allocate remainder of NKPT pages */
     for (i = 0; i < NKPT-1; i++, tmpindex++)
-       xpq_queue_pt_update(IdlePTD + KPTDI + i + 1, xpmap_ptom((tmpindex << 
PAGE_SHIFT))| PG_M | PG_RW | PG_V | PG_A);
-    tmpindex += NKPT-1;
-
-
-
+       PT_SET_VA(((unsigned long *)startinfo->pt_base) + KPTDI + i + 1, 
(tmpindex << PAGE_SHIFT)| PG_M | PG_RW | PG_V | PG_A, TRUE);
     tmpindex += NKPT-1;
     PT_UPDATES_FLUSH();
 
     HYPERVISOR_shared_info = (shared_info_t *)(KERNBASE + (tmpindex << 
PAGE_SHIFT));
-    PT_SET_MA(HYPERVISOR_shared_info, xen_start_info->shared_info | PG_A | 
PG_V | PG_RW | PG_M, TRUE);
+    PT_SET_MA(HYPERVISOR_shared_info, xen_start_info->shared_info | PG_A | 
PG_V | PG_RW | PG_M);
     tmpindex++;
 
     HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list = (unsigned 
long)xen_phys_machine;
@@ -1568,7 +1569,7 @@
        for (x = 0; x < NGDT; x++)
            ssdtosd(&gdt_segs[x], &gdt[x].sd);
 
-       PT_SET_MA(gdt, *vtopte((unsigned long)gdt) & ~PG_RW, TRUE); 
+       PT_SET_MA(gdt, *vtopte((unsigned long)gdt) & ~PG_RW);
        gdtmachpfn = vtomach(gdt) >> PAGE_SHIFT;
        if (HYPERVISOR_set_gdt(&gdtmachpfn, LAST_RESERVED_GDT_ENTRY + 1)) {
            XENPRINTF("set_gdt failed\n");
@@ -1617,7 +1618,7 @@
        default_proc_ldt.ldt_len = 6;
        _default_ldt = (int)&default_proc_ldt;
        PCPU_SET(currentldt, _default_ldt)
-       PT_SET_MA(ldt, *vtopte((unsigned long)ldt) & ~PG_RW, TRUE);
+       PT_SET_MA(ldt, *vtopte((unsigned long)ldt) & ~PG_RW);
        xen_set_ldt((unsigned long) ldt, (sizeof ldt_segs / sizeof 
ldt_segs[0]));
 
 
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/pmap.c 
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/pmap.c
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/pmap.c   2005-04-18 21:06:38 
-04:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/pmap.c   2005-04-18 21:06:38 
-04:00
@@ -793,7 +793,7 @@
                newpf = PT_GET(pde) & PG_FRAME;
                tmppf = PT_GET(PMAP2) & PG_FRAME;
                if (tmppf != newpf) {
-                       PT_SET_VA(PMAP2, newpf | PG_V | PG_A, FALSE);
+                       PD_SET_VA(PMAP2, newpf | PG_V | PG_A, FALSE);
                        pmap_invalidate_page(kernel_pmap, (vm_offset_t)PADDR2);
                }
                return (PADDR2 + (i386_btop(va) & (NPTEPG - 1)));
@@ -852,7 +852,7 @@
                newpf = PT_GET(pde) & PG_FRAME;
                tmppf = PT_GET(PMAP1) & PG_FRAME;
                if (tmppf != newpf) {
-                       PT_SET_VA(PMAP1, newpf | PG_V | PG_A, TRUE);
+                       PD_SET_VA(PMAP1, newpf | PG_V | PG_A, TRUE);
 #ifdef SMP
                        PMAP1cpu = PCPU_GET(cpuid);
 #endif
@@ -955,7 +955,10 @@
 PMAP_INLINE void 
 pmap_kenter(vm_offset_t va, vm_paddr_t pa)
 {
-       PT_SET(va, pa | PG_RW | PG_V | pgeflag, TRUE);
+       pt_entry_t *pte;
+
+       pte = vtopte(va);
+       pte_store(pte, pa | PG_RW | PG_V | pgeflag);
 }
 
 /*
@@ -965,7 +968,10 @@
 PMAP_INLINE void
 pmap_kremove(vm_offset_t va)
 {
-       PT_CLEAR(va, TRUE);
+       pt_entry_t *pte;
+
+       pte = vtopte(va);
+       pte_clear(pte);
 }
 
 /*
@@ -984,12 +990,10 @@
 pmap_map(vm_offset_t *virt, vm_paddr_t start, vm_paddr_t end, int prot)
 {
        vm_offset_t va, sva;
-       pt_entry_t *pte;
        
        va = sva = *virt;
        while (start < end) {
-               pte = vtopte(va);
-               PT_SET_VA(pte, start | PG_RW | PG_V | pgeflag, FALSE);
+               pmap_kenter(va, start);
                va += PAGE_SIZE;
                start += PAGE_SIZE;
        }
@@ -1016,8 +1020,7 @@
 
        va = sva;
        while (count-- > 0) {
-               PT_SET(va, VM_PAGE_TO_PHYS(*m) | PG_RW | PG_V | pgeflag, 
-                         FALSE);
+               pmap_kenter(va, VM_PAGE_TO_PHYS(*m));
                va += PAGE_SIZE;
                m++;
        }
@@ -1037,7 +1040,7 @@
 
        va = sva;
        while (count-- > 0) {
-               PT_CLEAR(va, FALSE);
+               pmap_kremove(va);
                va += PAGE_SIZE;
        }
        /* invalidate will flush the update queue */
@@ -1070,8 +1073,8 @@
        /*
         * unmap the page table page
         */
-       xpq_queue_unpin_table(pmap->pm_pdir[m->pindex]);
-       PT_CLEAR_VA(&pmap->pm_pdir[m->pindex], TRUE);
+       xen_pt_unpin(pmap->pm_pdir[m->pindex]);
+       PD_CLEAR_VA(&pmap->pm_pdir[m->pindex], TRUE);
        --pmap->pm_stats.resident_count;
 
        /*
@@ -1188,16 +1191,14 @@
        /* install self-referential address mapping entry(s) */
        for (i = 0; i < NPGPTD; i++) {
                ma = xpmap_ptom(VM_PAGE_TO_PHYS(ptdpg[i]));
-               pmap->pm_pdir[PTDPTDI + i] = ma | PG_V | PG_A;
+               pmap->pm_pdir[PTDPTDI + i] = ma | PG_V | PG_A | PG_M;
 #ifdef PAE
                pmap->pm_pdpt[i] = ma | PG_V;
 #endif
-#ifndef PAE
-               PT_SET_MA(pmap->pm_pdir, ma | PG_V | PG_A, TRUE);  
-#else
-               panic("FIX ME!");
-#endif
-               xpq_queue_pin_table(ma, XPQ_PIN_L2_TABLE);
+               /* re-map page directory read-only */
+               PT_SET_MA(pmap->pm_pdir, ma | PG_V | PG_A);
+               xen_pgd_pin(ma);
+
        }
 
        pmap->pm_active = 0;
@@ -1249,8 +1250,8 @@
        pmap->pm_stats.resident_count++;
 
        ptepa = VM_PAGE_TO_PHYS(m);
-       xpq_queue_pin_table(xpmap_ptom(ptepa), XPQ_PIN_L1_TABLE);
-       PT_SET_VA(&pmap->pm_pdir[ptepindex], 
+       xen_pt_pin(xpmap_ptom(ptepa));
+       PD_SET_VA(&pmap->pm_pdir[ptepindex], 
                (pd_entry_t) (ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M), TRUE);
 
        return m;
@@ -1425,12 +1426,12 @@
                ptdpg[i] = PHYS_TO_VM_PAGE(PT_GET(&pmap->pm_pdir[PTDPTDI + i]));
 
        for (i = 0; i < nkpt + NPGPTD; i++)
-               PT_CLEAR_VA(&pmap->pm_pdir[PTDPTDI + i], FALSE);
+               PD_CLEAR_VA(&pmap->pm_pdir[PTDPTDI + i], FALSE);
 
        bzero(pmap->pm_pdir + PTDPTDI, (nkpt + NPGPTD) *
            sizeof(*pmap->pm_pdir));
 #ifdef SMP
-       PT_CLEAR_VA(&pmap->pm_pdir[MPPTDI], FALSE);
+       PD_CLEAR_VA(&pmap->pm_pdir[MPPTDI], FALSE);
 #endif
        PT_UPDATES_FLUSH();
        pmap_qremove((vm_offset_t)pmap->pm_pdir, NPGPTD);
@@ -1440,8 +1441,7 @@
                m = ptdpg[i];
                
                ma = xpmap_ptom(VM_PAGE_TO_PHYS(m));
-                xpq_queue_unpin_table(ma);
-               pmap_zero_page(m);
+                xen_pgd_unpin(ma);
 #ifdef PAE

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.