[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] new domain builder fix to boot domU on IA64.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Date 1170165172 0
# Node ID f91dd7642a42525c2e012ea4297f1e097dfbb02e
# Parent  b51ed174fe8f92949d04767816223e8842365cb5
new domain builder fix to boot domU on IA64.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 tools/libxc/xc_dom_boot.c |   50 ++++++++++++++++++++++++++++++++++++++++++++--
 tools/libxc/xc_dom_ia64.c |   11 +++++++---
 2 files changed, 56 insertions(+), 5 deletions(-)

diff -r b51ed174fe8f -r f91dd7642a42 tools/libxc/xc_dom_boot.c
--- a/tools/libxc/xc_dom_boot.c Tue Jan 30 13:46:48 2007 +0000
+++ b/tools/libxc/xc_dom_boot.c Tue Jan 30 13:52:52 2007 +0000
@@ -155,6 +155,12 @@ static int arch_setup_early(struct xc_do
        rc = x86_shadow(dom->guest_xc, dom->guest_domid);
     }
     return rc;
+}
+
+static int arch_setup_middle(struct xc_dom_image *dom)
+{
+    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+    return 0;
 }
 
 static int arch_setup_late(struct xc_dom_image *dom)
@@ -259,6 +265,12 @@ static int arch_setup_late(struct xc_dom
 
 static int arch_setup_early(struct xc_dom_image *dom)
 {
+    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+    return 0;
+}
+
+static int arch_setup_middle(struct xc_dom_image *dom)
+{
     DECLARE_DOMCTL;
     int rc;
 
@@ -268,16 +280,35 @@ static int arch_setup_early(struct xc_do
     domctl.cmd = XEN_DOMCTL_arch_setup;
     domctl.domain = dom->guest_domid;
     domctl.u.arch_setup.flags = 0;
+
+    /* dom->start_info_pfn should be initialized by alloc_magic_pages().
+     * However it is called later. So we initialize here.
+     */
+    dom->start_info_pfn = dom->total_pages - 3;
     domctl.u.arch_setup.bp = (dom->start_info_pfn << PAGE_SHIFT)
        + sizeof(start_info_t);
-    domctl.u.arch_setup.maxmem = dom->total_pages << PAGE_SHIFT;
+    /* 3 = start info page, xenstore page and console page */
+    domctl.u.arch_setup.maxmem = (dom->total_pages - 3) << PAGE_SHIFT;
     rc = do_domctl(dom->guest_xc, &domctl);
     return rc;
 }
 
 static int arch_setup_late(struct xc_dom_image *dom)
 {
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+    unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
+    shared_info_t *shared_info;
+
+    /* setup shared_info page */
+    xc_dom_printf("%s: shared_info: mfn 0x%" PRIpfn "\n",
+                 __FUNCTION__, dom->shared_info_mfn);
+    shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
+                                      page_size,
+                                      PROT_READ | PROT_WRITE,
+                                      dom->shared_info_mfn);
+    if (NULL == shared_info)
+       return -1;
+    dom->arch_hooks->shared_info(dom, shared_info);
+    munmap(shared_info, page_size);
     return 0;
 }
 
@@ -287,6 +318,12 @@ static int arch_setup_late(struct xc_dom
 #elif defined(__powerpc64__)
 
 static int arch_setup_early(struct xc_dom_image *dom)
+{
+    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+    return 0;
+}
+
+static int arch_setup_middle(struct xc_dom_image *dom)
 {
     xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
     return 0;
@@ -324,6 +361,12 @@ static int arch_setup_early(struct xc_do
     return 0;
 }
 
+static int arch_setup_middle(struct xc_dom_image *dom)
+{
+    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+    return 0;
+}
+
 static int arch_setup_late(struct xc_dom_image *dom)
 {
     xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
@@ -395,6 +438,9 @@ int xc_dom_boot_mem_init(struct xc_dom_i
        return rc;
     }
 
+    if (0 != (rc = arch_setup_middle(dom)))
+        return rc;
+
     return 0;
 }
 
diff -r b51ed174fe8f -r f91dd7642a42 tools/libxc/xc_dom_ia64.c
--- a/tools/libxc/xc_dom_ia64.c Tue Jan 30 13:46:48 2007 +0000
+++ b/tools/libxc/xc_dom_ia64.c Tue Jan 30 13:52:52 2007 +0000
@@ -26,7 +26,11 @@ static int alloc_magic_pages(struct xc_d
     /* allocate special pages */
     dom->console_pfn = dom->total_pages -1;
     dom->xenstore_pfn = dom->total_pages -2;
-    dom->start_info_pfn = dom->total_pages -3;
+
+    /*
+     * this is initialized by arch_setup_middle().
+     * dom->start_info_pfn = dom->total_pages -3;
+     */
     return 0;
 }
 
@@ -39,6 +43,7 @@ static int start_info_ia64(struct xc_dom
 
     xc_dom_printf("%s\n", __FUNCTION__);
 
+    memset(start_info, 0, sizeof(*start_info));
     sprintf(start_info->magic, dom->guest_type);
     start_info->flags = dom->flags;
     start_info->nr_pages = dom->total_pages;
@@ -54,12 +59,12 @@ static int start_info_ia64(struct xc_dom
        bp->initrd_start = start_info->mod_start;
        bp->initrd_size = start_info->mod_len;
     }
+    bp->command_line = (dom->start_info_pfn << PAGE_SHIFT_IA64)
+           + offsetof(start_info_t, cmd_line);
     if (dom->cmdline)
     {
        strncpy((char *)start_info->cmd_line, dom->cmdline, MAX_GUEST_CMDLINE);
        start_info->cmd_line[MAX_GUEST_CMDLINE - 1] = '\0';
-       bp->command_line = (dom->start_info_pfn << PAGE_SHIFT_IA64)
-           + offsetof(start_info_t, cmd_line);
     }
     return 0;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.