ia64/xen-unstable

changeset 7501:8928c89a8d0a

Necessary change to support ia64/vti domain build in common code.

Signed-off-by Ke Yu <ke.yu@intel.com>
Signed-off-by Anthony Xu <anthony.xu@intel.com>
Signed-off-by Kevin Tian <kevin.tian@intel.com>
author djm@kirby.fc.hp.com
date Mon Oct 24 20:57:47 2005 -0600 (2005-10-24)
parents 935a81f86348
children 7eac3edd0589
files tools/libxc/xc_private.c tools/libxc/xenctrl.h tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/libxc/xc_private.c	Mon Oct 24 20:56:53 2005 -0600
     1.2 +++ b/tools/libxc/xc_private.c	Mon Oct 24 20:57:47 2005 -0600
     1.3 @@ -313,46 +313,6 @@ int xc_get_pfn_list(int xc_handle,
     1.4      return (ret < 0) ? -1 : op.u.getmemlist.num_pfns;
     1.5  }
     1.6  
     1.7 -#ifdef __ia64__
     1.8 -int xc_ia64_get_pfn_list(int xc_handle,
     1.9 -                         uint32_t domid, 
    1.10 -                         unsigned long *pfn_buf, 
    1.11 -                         unsigned int start_page,
    1.12 -                         unsigned int nr_pages)
    1.13 -{
    1.14 -    dom0_op_t op;
    1.15 -    int ret;
    1.16 -
    1.17 -    op.cmd = DOM0_GETMEMLIST;
    1.18 -    op.u.getmemlist.domain   = (domid_t)domid;
    1.19 -    op.u.getmemlist.max_pfns = ((unsigned long)start_page << 32) | nr_pages;
    1.20 -    op.u.getmemlist.buffer   = pfn_buf;
    1.21 -
    1.22 -    if ( mlock(pfn_buf, nr_pages * sizeof(unsigned long)) != 0 )
    1.23 -    {
    1.24 -        PERROR("Could not lock pfn list buffer");
    1.25 -        return -1;
    1.26 -    }    
    1.27 -
    1.28 -    /* XXX Hack to put pages in TLB, hypervisor should be able to handle this */
    1.29 -    memset(pfn_buf, 0, nr_pages * sizeof(unsigned long));
    1.30 -    ret = do_dom0_op(xc_handle, &op);
    1.31 -
    1.32 -    (void)munlock(pfn_buf, nr_pages * sizeof(unsigned long));
    1.33 -
    1.34 -    return (ret < 0) ? -1 : op.u.getmemlist.num_pfns;
    1.35 -}
    1.36 -
    1.37 -long xc_get_max_pages(int xc_handle, uint32_t domid)
    1.38 -{
    1.39 -    dom0_op_t op;
    1.40 -    op.cmd = DOM0_GETDOMAININFO;
    1.41 -    op.u.getdomaininfo.domain = (domid_t)domid;
    1.42 -    return (do_dom0_op(xc_handle, &op) < 0) ? 
    1.43 -        -1 : op.u.getdomaininfo.max_pages;
    1.44 -}
    1.45 -#endif
    1.46 -
    1.47  long xc_get_tot_pages(int xc_handle, uint32_t domid)
    1.48  {
    1.49      dom0_op_t op;
     2.1 --- a/tools/libxc/xenctrl.h	Mon Oct 24 20:56:53 2005 -0600
     2.2 +++ b/tools/libxc/xenctrl.h	Mon Oct 24 20:57:47 2005 -0600
     2.3 @@ -414,6 +414,12 @@ int xc_ia64_get_pfn_list(int xc_handle, 
     2.4                           unsigned long *pfn_buf, 
     2.5                           unsigned int start_page, unsigned int nr_pages);
     2.6  
     2.7 +int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
     2.8 +			   unsigned long dst_pfn, void *src_page);
     2.9 +
    2.10 +int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid,
    2.11 +        void* src_page, unsigned long dst_pfn, int nr_pages);
    2.12 +
    2.13  long xc_get_max_pages(int xc_handle, uint32_t domid);
    2.14  
    2.15  int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
     3.1 --- a/tools/python/xen/xend/image.py	Mon Oct 24 20:56:53 2005 -0600
     3.2 +++ b/tools/python/xen/xend/image.py	Mon Oct 24 20:57:47 2005 -0600
     3.3 @@ -342,12 +342,15 @@ class VmxImageHandler(ImageHandler):
     3.4  
     3.5      def getDomainMemory(self, mem):
     3.6          """@see ImageHandler.getDomainMemory"""
     3.7 +	page_kb = 4
     3.8 +	if os.uname()[4] == 'ia64':
     3.9 +	    page_kb = 16
    3.10          # for ioreq_t and xenstore
    3.11          static_pages = 2
    3.12 -        return mem + self.getPageTableSize(mem / 1024) + 4 * static_pages
    3.13 +        return mem + (self.getPageTableSize(mem / 1024) + static_pages) * page_kb
    3.14              
    3.15      def getPageTableSize(self, mem_mb):
    3.16 -        """Return the size of memory needed for 1:1 page tables for physical
    3.17 +        """Return the pages of memory needed for 1:1 page tables for physical
    3.18             mode.
    3.19  
    3.20          @param mem_mb: size in MB
    3.21 @@ -355,13 +358,13 @@ class VmxImageHandler(ImageHandler):
    3.22          """
    3.23          # 1 page for the PGD + 1 pte page for 4MB of memory (rounded)
    3.24          if os.uname()[4] == 'x86_64':
    3.25 -            return (5 + ((mem_mb + 1) >> 1)) * 4
    3.26 +            return 5 + ((mem_mb + 1) >> 1)
    3.27          elif os.uname()[4] == 'ia64':
    3.28 -            # XEN/IA64 has p2m table allocated on demand, so only return
    3.29 -            # guest firmware size here.
    3.30 -            return 16 * 1024
    3.31 +            # 1:1 pgtable is allocated on demand ia64, so just return rom size
    3.32 +	    # for guest firmware
    3.33 +            return 1024
    3.34          else:
    3.35 -            return (1 + ((mem_mb + 3) >> 2)) * 4
    3.36 +            return 1 + ((mem_mb + 3) >> 2)
    3.37  
    3.38  
    3.39  """Table of image handler classes for virtual machine images.  Indexed by