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

[Xen-changelog] Cleanups to tools since HVM domain P2M table and 1-1 table are built in xen.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID f33e537c4ac52b6c928883e9f143e8669a35a1f1
# Parent  1fd6e9c32b034126128ff4fcd2bb6d209446d146
Cleanups to tools since HVM domain P2M table and 1-1 table are built in xen.

Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>

diff -r 1fd6e9c32b03 -r f33e537c4ac5 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Tue Feb 21 17:21:13 2006
+++ b/tools/libxc/xc_hvm_build.c        Tue Feb 21 17:23:35 2006
@@ -192,11 +192,7 @@
     xc_mmu_t *mmu = NULL;
     int rc;
 
-    unsigned long nr_pt_pages;
-
     struct domain_setup_info dsi;
-    unsigned long vpt_start;
-    unsigned long vpt_end;
     unsigned long v_end;
 
     unsigned long shared_page_frame = 0;
@@ -216,20 +212,10 @@
     /* memsize is in megabytes */
     v_end              = (unsigned long)memsize << 20;
 
-#ifdef __i386__
-    nr_pt_pages = 1 + ((memsize + 3) >> 2);
-#else
-    nr_pt_pages = 5 + ((memsize + 1) >> 1);
-#endif
-    vpt_start   = v_end;
-    vpt_end     = vpt_start + (nr_pt_pages * PAGE_SIZE);
-
     printf("VIRTUAL MEMORY ARRANGEMENT:\n"
            " Loaded HVM loader: %08lx->%08lx\n"
-           " Page tables:   %08lx->%08lx\n"
            " TOTAL:         %08lx->%08lx\n",
            dsi.v_kernstart, dsi.v_kernend,
-           vpt_start, vpt_end,
            dsi.v_start, v_end);
     printf(" ENTRY ADDRESS: %08lx\n", dsi.v_kernentry);
 
diff -r 1fd6e9c32b03 -r f33e537c4ac5 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Tue Feb 21 17:21:13 2006
+++ b/tools/python/xen/xend/image.py    Tue Feb 21 17:23:35 2006
@@ -383,28 +383,12 @@
     def getDomainMemory(self, mem):
         """@see ImageHandler.getDomainMemory"""
         page_kb = 4
+        extra_pages = 0
         if os.uname()[4] == 'ia64':
             page_kb = 16
-        # for ioreq_t and xenstore
-        static_pages = 2
-        return mem + (self.getPageTableSize(mem / 1024) + static_pages) * 
page_kb
-
-    def getPageTableSize(self, mem_mb):
-        """Return the pages of memory needed for 1:1 page tables for physical
-           mode.
-
-        @param mem_mb: size in MB
-        @return size in KB
-        """
-        # 1 page for the PGD + 1 pte page for 4MB of memory (rounded)
-        if os.uname()[4] == 'x86_64':
-            return 5 + ((mem_mb + 1) >> 1)
-        elif os.uname()[4] == 'ia64':
-            # 1:1 pgtable is allocated on demand ia64, so just return rom size
-           # for guest firmware
-            return 1024
-        else:
-            return 1 + ((mem_mb + 3) >> 2)
+            # ROM size for guest firmware
+            extra_pages = 1024
+        return mem + extra_pages * page_kb
 
     def register_shutdown_watch(self):
         """ add xen store watch on control/shutdown """
diff -r 1fd6e9c32b03 -r f33e537c4ac5 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Tue Feb 21 17:21:13 2006
+++ b/xen/arch/x86/domain.c     Tue Feb 21 17:23:35 2006
@@ -398,12 +398,15 @@
     if ( v->vcpu_id == 0 )
         d->vm_assist = c->vm_assist;
 
-    phys_basetab = c->ctrlreg[3];
-    phys_basetab =
-        (gmfn_to_mfn(d, phys_basetab >> PAGE_SHIFT) << PAGE_SHIFT) |
-        (phys_basetab & ~PAGE_MASK);
-
-    v->arch.guest_table = mk_pagetable(phys_basetab);
+    if ( !(c->flags & VGCF_HVM_GUEST) )
+    {
+        phys_basetab = c->ctrlreg[3];
+        phys_basetab =
+            (gmfn_to_mfn(d, phys_basetab >> PAGE_SHIFT) << PAGE_SHIFT) |
+            (phys_basetab & ~PAGE_MASK);
+
+        v->arch.guest_table = mk_pagetable(phys_basetab);
+    }
 
     if ( (rc = (int)set_gdt(v, c->gdt_frames, c->gdt_ents)) != 0 )
         return rc;
@@ -428,9 +431,6 @@
 
     if ( c->flags & VGCF_HVM_GUEST )
     {
-        /* HVM uses the initially provided page tables as the P2M map. */
-        if ( !pagetable_get_paddr(d->arch.phys_table) )
-            d->arch.phys_table = v->arch.guest_table;
         v->arch.guest_table = mk_pagetable(0);
 
         if ( !hvm_initialize_guest_resources(v) )

_______________________________________________
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®.