ia64/xen-unstable

changeset 12780:ba7fca36fbd0

[IA64] Fix VTi domain creation

Signed-off-by: Zhang Xin <xing.z.zhang@intel.com>
author awilliam@xenbuild.aw
date Tue Dec 05 09:44:24 2006 -0700 (2006-12-05)
parents 27c2e9aa83e9
children 918ea03857b9
files tools/libxc/ia64/xc_ia64_hvm_build.c tools/python/xen/lowlevel/xc/xc.c xen/include/public/arch-ia64.h
line diff
     1.1 --- a/tools/libxc/ia64/xc_ia64_hvm_build.c	Tue Dec 05 09:09:44 2006 -0700
     1.2 +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c	Tue Dec 05 09:44:24 2006 -0700
     1.3 @@ -591,6 +591,7 @@ setup_guest(int xc_handle, uint32_t dom,
     1.4      unsigned long dom_memsize = ((memsize - 16) << 20);
     1.5      unsigned long nr_pages = (unsigned long)memsize << (20 - PAGE_SHIFT);
     1.6      unsigned long normal_pages = nr_pages - GFW_PAGES;
     1.7 +    unsigned long vcpus;
     1.8      int rc;
     1.9      long i, j;
    1.10      DECLARE_DOMCTL;
    1.11 @@ -668,7 +669,6 @@ setup_guest(int xc_handle, uint32_t dom,
    1.12      if (xc_domctl(xc_handle, &domctl))
    1.13          goto error_out;
    1.14  
    1.15 -
    1.16      // Load guest firmware 
    1.17      if (xc_ia64_copy_to_domain_pages(xc_handle, dom, image,
    1.18                              (GFW_START + GFW_SIZE - image_size) >> PAGE_SHIFT,
    1.19 @@ -677,15 +677,17 @@ setup_guest(int xc_handle, uint32_t dom,
    1.20          goto error_out;
    1.21      }
    1.22  
    1.23 +    // Get number of vcpus, stored by pyxc_hvm_build()
    1.24 +    xc_get_hvm_param(xc_handle, dom, HVM_PARAM_VCPUS, &vcpus);
    1.25 +
    1.26      // Hand-off state passed to guest firmware 
    1.27 -    if (xc_ia64_build_hob(xc_handle, dom, dom_memsize,
    1.28 -                          (unsigned long)vcpus) < 0) {
    1.29 +    if (xc_ia64_build_hob(xc_handle, dom, dom_memsize, vcpus) < 0) {
    1.30          PERROR("Could not build hob\n");
    1.31          goto error_out;
    1.32      }
    1.33  
    1.34      xc_set_hvm_param(xc_handle, dom,
    1.35 -                     HVM_PARAM_STORE_PFN, STORE_PAGE_START>>PAGE_SHIFT);
    1.36 +                     HVM_PARAM_STORE_PFN, pfn_list[nr_pages - 2]);
    1.37  
    1.38      // Retrieve special pages like io, xenstore, etc. 
    1.39      sp = (shared_iopage_t *)xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
     2.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Tue Dec 05 09:09:44 2006 -0700
     2.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Tue Dec 05 09:44:24 2006 -0700
     2.3 @@ -374,10 +374,13 @@ static PyObject *pyxc_hvm_build(XcObject
     2.4                                  PyObject *kwds)
     2.5  {
     2.6      uint32_t dom;
     2.7 +#if !defined(__ia64__)
     2.8      struct hvm_info_table *va_hvm;
     2.9      uint8_t *va_map, sum;
    2.10 +    int i;
    2.11 +#endif
    2.12      char *image;
    2.13 -    int i, store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1;
    2.14 +    int store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1;
    2.15      unsigned long store_mfn;
    2.16  
    2.17      static char *kwd_list[] = { "domid", "store_evtchn",
    2.18 @@ -388,9 +391,14 @@ static PyObject *pyxc_hvm_build(XcObject
    2.19                                        &image, &vcpus, &pae, &acpi, &apic) )
    2.20          return NULL;
    2.21  
    2.22 +#if defined(__ia64__)
    2.23 +    /* Set vcpus to later be retrieved in setup_guest() */
    2.24 +    xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_VCPUS, vcpus);
    2.25 +#endif
    2.26      if ( xc_hvm_build(self->xc_handle, dom, memsize, image) != 0 )
    2.27          return PyErr_SetFromErrno(xc_error);
    2.28  
    2.29 +#if !defined(__ia64__)
    2.30      /* Set up the HVM info table. */
    2.31      va_map = xc_map_foreign_range(self->xc_handle, dom, XC_PAGE_SIZE,
    2.32                                    PROT_READ | PROT_WRITE,
    2.33 @@ -408,9 +416,12 @@ static PyObject *pyxc_hvm_build(XcObject
    2.34          sum += ((uint8_t *)va_hvm)[i];
    2.35      va_hvm->checksum = -sum;
    2.36      munmap(va_map, XC_PAGE_SIZE);
    2.37 +#endif
    2.38  
    2.39      xc_get_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_PFN, &store_mfn);
    2.40 +#if !defined(__ia64__)
    2.41      xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_PAE_ENABLED, pae);
    2.42 +#endif
    2.43      xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_EVTCHN,
    2.44                       store_evtchn);
    2.45  
     3.1 --- a/xen/include/public/arch-ia64.h	Tue Dec 05 09:09:44 2006 -0700
     3.2 +++ b/xen/include/public/arch-ia64.h	Tue Dec 05 09:44:24 2006 -0700
     3.3 @@ -66,6 +66,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
     3.4  /* WARNING: before changing this, check that shared_info fits on a page */
     3.5  #define MAX_VIRT_CPUS 64
     3.6  
     3.7 +/*
     3.8 + * HVM_PARAM_PAE_ENABLED is meaningless on ia64, so we overload this
     3.9 + * entry to store the number of vCPUs.  XXX Need arch-specific extentions
    3.10 + * for xc_get/set_hvm_param().
    3.11 + */
    3.12 +#define HVM_PARAM_VCPUS    HVM_PARAM_PAE_ENABLED
    3.13 +
    3.14  #ifndef __ASSEMBLY__
    3.15  
    3.16  typedef unsigned long xen_ulong_t;