# HG changeset patch
# User awilliam@xxxxxxxxxxxx
# Node ID d85c905beac438a9d62905a842f8e8ccfbde3bed
# Parent 970ff2ba748f0c81c764897be23849603a7f9b5b
[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@xxxxxxxxxxxxx>
---
tools/libxc/xc_linux_build.c | 20 ++++++++++++--------
xen/arch/ia64/xen/dom0_ops.c | 24 ++++++++++++------------
xen/include/asm-ia64/grant_table.h | 10 +++++++++-
3 files changed, 33 insertions(+), 21 deletions(-)
diff -r 970ff2ba748f -r d85c905beac4 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Fri Dec 08 09:09:18 2006 -0700
+++ b/tools/libxc/xc_linux_build.c Thu Dec 07 14:49:00 2006 -0700
@@ -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 970ff2ba748f -r d85c905beac4 xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c Fri Dec 08 09:09:18 2006 -0700
+++ b/xen/arch/ia64/xen/dom0_ops.c Thu Dec 07 14:49:00 2006 -0700
@@ -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 970ff2ba748f -r d85c905beac4 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h Fri Dec 08 09:09:18 2006 -0700
+++ b/xen/include/asm-ia64/grant_table.h Thu Dec 07 14:49:00 2006 -0700
@@ -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))
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|