ia64/xen-unstable

changeset 8951:f33e537c4ac5

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

Signed-off-by: Xin Li <xin.b.li@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Feb 21 18:23:35 2006 +0100 (2006-02-21)
parents 1fd6e9c32b03
children 602bf0aa15ab
files tools/libxc/xc_hvm_build.c tools/python/xen/xend/image.py xen/arch/x86/domain.c
line diff
     1.1 --- a/tools/libxc/xc_hvm_build.c	Tue Feb 21 18:21:13 2006 +0100
     1.2 +++ b/tools/libxc/xc_hvm_build.c	Tue Feb 21 18:23:35 2006 +0100
     1.3 @@ -192,11 +192,7 @@ static int setup_guest(int xc_handle,
     1.4      xc_mmu_t *mmu = NULL;
     1.5      int rc;
     1.6  
     1.7 -    unsigned long nr_pt_pages;
     1.8 -
     1.9      struct domain_setup_info dsi;
    1.10 -    unsigned long vpt_start;
    1.11 -    unsigned long vpt_end;
    1.12      unsigned long v_end;
    1.13  
    1.14      unsigned long shared_page_frame = 0;
    1.15 @@ -216,20 +212,10 @@ static int setup_guest(int xc_handle,
    1.16      /* memsize is in megabytes */
    1.17      v_end              = (unsigned long)memsize << 20;
    1.18  
    1.19 -#ifdef __i386__
    1.20 -    nr_pt_pages = 1 + ((memsize + 3) >> 2);
    1.21 -#else
    1.22 -    nr_pt_pages = 5 + ((memsize + 1) >> 1);
    1.23 -#endif
    1.24 -    vpt_start   = v_end;
    1.25 -    vpt_end     = vpt_start + (nr_pt_pages * PAGE_SIZE);
    1.26 -
    1.27      printf("VIRTUAL MEMORY ARRANGEMENT:\n"
    1.28             " Loaded HVM loader: %08lx->%08lx\n"
    1.29 -           " Page tables:   %08lx->%08lx\n"
    1.30             " TOTAL:         %08lx->%08lx\n",
    1.31             dsi.v_kernstart, dsi.v_kernend,
    1.32 -           vpt_start, vpt_end,
    1.33             dsi.v_start, v_end);
    1.34      printf(" ENTRY ADDRESS: %08lx\n", dsi.v_kernentry);
    1.35  
     2.1 --- a/tools/python/xen/xend/image.py	Tue Feb 21 18:21:13 2006 +0100
     2.2 +++ b/tools/python/xen/xend/image.py	Tue Feb 21 18:23:35 2006 +0100
     2.3 @@ -383,28 +383,12 @@ class HVMImageHandler(ImageHandler):
     2.4      def getDomainMemory(self, mem):
     2.5          """@see ImageHandler.getDomainMemory"""
     2.6          page_kb = 4
     2.7 +        extra_pages = 0
     2.8          if os.uname()[4] == 'ia64':
     2.9              page_kb = 16
    2.10 -        # for ioreq_t and xenstore
    2.11 -        static_pages = 2
    2.12 -        return mem + (self.getPageTableSize(mem / 1024) + static_pages) * page_kb
    2.13 -
    2.14 -    def getPageTableSize(self, mem_mb):
    2.15 -        """Return the pages of memory needed for 1:1 page tables for physical
    2.16 -           mode.
    2.17 -
    2.18 -        @param mem_mb: size in MB
    2.19 -        @return size in KB
    2.20 -        """
    2.21 -        # 1 page for the PGD + 1 pte page for 4MB of memory (rounded)
    2.22 -        if os.uname()[4] == 'x86_64':
    2.23 -            return 5 + ((mem_mb + 1) >> 1)
    2.24 -        elif os.uname()[4] == 'ia64':
    2.25 -            # 1:1 pgtable is allocated on demand ia64, so just return rom size
    2.26 -	    # for guest firmware
    2.27 -            return 1024
    2.28 -        else:
    2.29 -            return 1 + ((mem_mb + 3) >> 2)
    2.30 +            # ROM size for guest firmware
    2.31 +            extra_pages = 1024
    2.32 +        return mem + extra_pages * page_kb
    2.33  
    2.34      def register_shutdown_watch(self):
    2.35          """ add xen store watch on control/shutdown """
     3.1 --- a/xen/arch/x86/domain.c	Tue Feb 21 18:21:13 2006 +0100
     3.2 +++ b/xen/arch/x86/domain.c	Tue Feb 21 18:23:35 2006 +0100
     3.3 @@ -398,12 +398,15 @@ int arch_set_info_guest(
     3.4      if ( v->vcpu_id == 0 )
     3.5          d->vm_assist = c->vm_assist;
     3.6  
     3.7 -    phys_basetab = c->ctrlreg[3];
     3.8 -    phys_basetab =
     3.9 -        (gmfn_to_mfn(d, phys_basetab >> PAGE_SHIFT) << PAGE_SHIFT) |
    3.10 -        (phys_basetab & ~PAGE_MASK);
    3.11 +    if ( !(c->flags & VGCF_HVM_GUEST) )
    3.12 +    {
    3.13 +        phys_basetab = c->ctrlreg[3];
    3.14 +        phys_basetab =
    3.15 +            (gmfn_to_mfn(d, phys_basetab >> PAGE_SHIFT) << PAGE_SHIFT) |
    3.16 +            (phys_basetab & ~PAGE_MASK);
    3.17  
    3.18 -    v->arch.guest_table = mk_pagetable(phys_basetab);
    3.19 +        v->arch.guest_table = mk_pagetable(phys_basetab);
    3.20 +    }
    3.21  
    3.22      if ( (rc = (int)set_gdt(v, c->gdt_frames, c->gdt_ents)) != 0 )
    3.23          return rc;
    3.24 @@ -428,9 +431,6 @@ int arch_set_info_guest(
    3.25  
    3.26      if ( c->flags & VGCF_HVM_GUEST )
    3.27      {
    3.28 -        /* HVM uses the initially provided page tables as the P2M map. */
    3.29 -        if ( !pagetable_get_paddr(d->arch.phys_table) )
    3.30 -            d->arch.phys_table = v->arch.guest_table;
    3.31          v->arch.guest_table = mk_pagetable(0);
    3.32  
    3.33          if ( !hvm_initialize_guest_resources(v) )