ia64/xen-unstable

changeset 12880:d85c905beac4

[IA64] Map shared_info into guest pseudo physical address space

Allows libxc to map from dom0. This is used by domain builder.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild2.aw
date Thu Dec 07 14:49:00 2006 -0700 (2006-12-07)
parents 970ff2ba748f
children 178e46776c71
files tools/libxc/xc_linux_build.c xen/arch/ia64/xen/dom0_ops.c xen/include/asm-ia64/grant_table.h
line diff
     1.1 --- a/tools/libxc/xc_linux_build.c	Fri Dec 08 09:09:18 2006 -0700
     1.2 +++ b/tools/libxc/xc_linux_build.c	Thu Dec 07 14:49:00 2006 -0700
     1.3 @@ -481,9 +481,7 @@ static int setup_guest(int xc_handle,
     1.4      start_info_t *start_info;
     1.5      unsigned long start_info_mpa;
     1.6      struct xen_ia64_boot_param *bp;
     1.7 -#if 0 // see comment below
     1.8      shared_info_t *shared_info;
     1.9 -#endif
    1.10      int i;
    1.11      DECLARE_DOMCTL;
    1.12      int rc;
    1.13 @@ -595,13 +593,20 @@ static int setup_guest(int xc_handle,
    1.14      ctxt->user_regs.r28 = start_info_mpa + sizeof (start_info_t);
    1.15      munmap(start_info, PAGE_SIZE);
    1.16  
    1.17 -#if 0
    1.18      /*
    1.19 -     * XXX FIXME:
    1.20 -     * The follwoing initialization is done by XEN_DOMCTL_arch_setup as
    1.21 -     * work around.
    1.22 -     * Should XENMEM_add_to_physmap with XENMAPSPACE_shared_info be used?
    1.23 +     * shared_info is assiged into guest pseudo physical address space
    1.24 +     * by XEN_DOMCTL_arch_setup. shared_info_frame is stale value until that.
    1.25 +     * So passed shared_info_frame is stale. obtain the right value here.
    1.26       */
    1.27 +    domctl.cmd = XEN_DOMCTL_getdomaininfo;
    1.28 +    domctl.domain = (domid_t)dom;
    1.29 +    if ( (xc_domctl(xc_handle, &domctl) < 0) ||
    1.30 +         ((uint16_t)domctl.domain != dom) )
    1.31 +    {
    1.32 +        PERROR("Could not get info on domain");
    1.33 +        goto error_out;
    1.34 +    }
    1.35 +    shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
    1.36  
    1.37      /* shared_info page starts its life empty. */
    1.38      shared_info = xc_map_foreign_range(
    1.39 @@ -615,7 +620,6 @@ static int setup_guest(int xc_handle,
    1.40      shared_info->arch.start_info_pfn = nr_pages - 3;
    1.41  
    1.42      munmap(shared_info, PAGE_SIZE);
    1.43 -#endif
    1.44      free(page_array);
    1.45      return 0;
    1.46  
     2.1 --- a/xen/arch/ia64/xen/dom0_ops.c	Fri Dec 08 09:09:18 2006 -0700
     2.2 +++ b/xen/arch/ia64/xen/dom0_ops.c	Thu Dec 07 14:49:00 2006 -0700
     2.3 @@ -125,19 +125,19 @@ long arch_do_domctl(xen_domctl_t *op, XE
     2.4                      for_each_vcpu (d, v)
     2.5                          v->arch.breakimm = d->arch.breakimm;
     2.6                  }
     2.7 -#if 1
     2.8 -                /*
     2.9 -                 * XXX FIXME 
    2.10 -                 * see comment around shared_info in setup_guest() in 
    2.11 -                 * libxc/xc_linux_build.c
    2.12 -                 */
    2.13                  {
    2.14 -                    int i;
    2.15 -                    d->shared_info->arch.start_info_pfn = ds->maxmem >> PAGE_SHIFT;
    2.16 -                    for_each_cpu(i)
    2.17 -                        d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
    2.18 +                    /*
    2.19 +                     * XXX IA64_SHARED_INFO_PADDR
    2.20 +                     * assign these pages into guest psudo physical address
    2.21 +                     * space for dom0 to map this page by gmfn.
    2.22 +                     * this is necessary for domain build, save, restore and 
    2.23 +                     * dump-core.
    2.24 +                     */
    2.25 +                    unsigned long i;
    2.26 +                    for (i = 0; i < XSI_SIZE; i += PAGE_SIZE)
    2.27 +                        assign_domain_page(d, IA64_SHARED_INFO_PADDR + i,
    2.28 +                                           virt_to_maddr(d->shared_info + i));
    2.29                  }
    2.30 -#endif
    2.31              }
    2.32          }
    2.33  
     3.1 --- a/xen/include/asm-ia64/grant_table.h	Fri Dec 08 09:09:18 2006 -0700
     3.2 +++ b/xen/include/asm-ia64/grant_table.h	Thu Dec 07 14:49:00 2006 -0700
     3.3 @@ -23,8 +23,16 @@ void guest_physmap_add_page(struct domai
     3.4      } while (0)
     3.5  
     3.6  
     3.7 +/* XXX
     3.8 + * somewhere appropriate
     3.9 + * those constand shouldn't be pre-defined and
    3.10 + * those area should be reserved by EFI MD.
    3.11 + */
    3.12 +/* Guest phsyical address of shared_info */
    3.13 +#define IA64_SHARED_INFO_PADDR	(1UL << 40)
    3.14 +
    3.15  /* Guest physical address of the grant table.  */
    3.16 -#define IA64_GRANT_TABLE_PADDR (1UL << 40)
    3.17 +#define IA64_GRANT_TABLE_PADDR  (IA64_SHARED_INFO_PADDR + XSI_SIZE)
    3.18  
    3.19  #define gnttab_shared_maddr(d, t, i)                        \
    3.20      virt_to_maddr((char*)(t)->shared + ((i) << PAGE_SHIFT))