# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1165485336 -32400 # Node ID 8f2ca1131acc136fff4a866e7ab5fa7f89c7c22d # Parent 0dba04cfbdba8474a5915f91b3fbd3b38e20ecab map shared_info into guest pseud physical address space for libxc to map from dom0. This is used by domain builder. PATCHNAME: shared_info Signed-off-by: Isaku Yamahata diff -r 0dba04cfbdba -r 8f2ca1131acc tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c Thu Dec 07 18:48:22 2006 +0900 +++ b/tools/libxc/xc_linux_build.c Thu Dec 07 18:55:36 2006 +0900 @@ -481,9 +481,7 @@ static int setup_guest(int xc_handle, start_info_t *start_info; unsigned long start_info_mpa; struct xen_ia64_boot_param *bp; -#if 0 // see comment below shared_info_t *shared_info; -#endif int i; DECLARE_DOMCTL; int rc; @@ -595,13 +593,20 @@ static int setup_guest(int xc_handle, ctxt->user_regs.r28 = start_info_mpa + sizeof (start_info_t); munmap(start_info, PAGE_SIZE); -#if 0 /* - * XXX FIXME: - * The follwoing initialization is done by XEN_DOMCTL_arch_setup as - * work around. - * Should XENMEM_add_to_physmap with XENMAPSPACE_shared_info be used? + * shared_info is assiged into guest pseudo physical address space + * by XEN_DOMCTL_arch_setup. shared_info_frame is stale value until that. + * So passed shared_info_frame is stale. obtain the right value here. */ + domctl.cmd = XEN_DOMCTL_getdomaininfo; + domctl.domain = (domid_t)dom; + if ( (xc_domctl(xc_handle, &domctl) < 0) || + ((uint16_t)domctl.domain != dom) ) + { + PERROR("Could not get info on domain"); + goto error_out; + } + shared_info_frame = domctl.u.getdomaininfo.shared_info_frame; /* shared_info page starts its life empty. */ shared_info = xc_map_foreign_range( @@ -615,7 +620,6 @@ static int setup_guest(int xc_handle, shared_info->arch.start_info_pfn = nr_pages - 3; munmap(shared_info, PAGE_SIZE); -#endif free(page_array); return 0; diff -r 0dba04cfbdba -r 8f2ca1131acc xen/arch/ia64/xen/dom0_ops.c --- a/xen/arch/ia64/xen/dom0_ops.c Thu Dec 07 18:48:22 2006 +0900 +++ b/xen/arch/ia64/xen/dom0_ops.c Thu Dec 07 18:55:36 2006 +0900 @@ -125,19 +125,19 @@ long arch_do_domctl(xen_domctl_t *op, XE for_each_vcpu (d, v) v->arch.breakimm = d->arch.breakimm; } -#if 1 - /* - * XXX FIXME - * see comment around shared_info in setup_guest() in - * libxc/xc_linux_build.c - */ { - int i; - d->shared_info->arch.start_info_pfn = ds->maxmem >> PAGE_SHIFT; - for_each_cpu(i) - d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1; - } -#endif + /* + * XXX IA64_SHARED_INFO_PADDR + * assign these pages into guest psudo physical address + * space for dom0 to map this page by gmfn. + * this is necessary for domain build, save, restore and + * dump-core. + */ + unsigned long i; + for (i = 0; i < XSI_SIZE; i += PAGE_SIZE) + assign_domain_page(d, IA64_SHARED_INFO_PADDR + i, + virt_to_maddr(d->shared_info + i)); + } } } diff -r 0dba04cfbdba -r 8f2ca1131acc xen/include/asm-ia64/grant_table.h --- a/xen/include/asm-ia64/grant_table.h Thu Dec 07 18:48:22 2006 +0900 +++ b/xen/include/asm-ia64/grant_table.h Thu Dec 07 18:55:36 2006 +0900 @@ -23,8 +23,16 @@ void guest_physmap_add_page(struct domai } while (0) +/* XXX + * somewhere appropriate + * those constand shouldn't be pre-defined and + * those area should be reserved by EFI MD. + */ +/* Guest phsyical address of shared_info */ +#define IA64_SHARED_INFO_PADDR (1UL << 40) + /* Guest physical address of the grant table. */ -#define IA64_GRANT_TABLE_PADDR (1UL << 40) +#define IA64_GRANT_TABLE_PADDR (IA64_SHARED_INFO_PADDR + XSI_SIZE) #define gnttab_shared_maddr(d, t, i) \ virt_to_maddr((char*)(t)->shared + ((i) << PAGE_SHIFT))