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

[Xen-changelog] [xen-unstable] libxc: fixes for the ARM platform


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Tue, 19 Feb 2013 15:22:24 +0000
  • Delivery-date: Tue, 19 Feb 2013 15:22:52 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1360935141 0
# Node ID df1b532019d97fd0097cb749796102a2c876bb24
# Parent  e9c1712765cdfa6fe792ab917767f2e04e83630b
libxc: fixes for the ARM platform

Make xc_dom_feature_translated an arch-dependent function.

alloc_magic_pages: save console and xenstore pfn's in xc_dom_image.
alloc_magic_pages: set HVM_PARAM_CONSOLE_EVTCHN and
HVM_PARAM_STORE_EVTCHN hvm_params using the event channels allocated by
the toolstack.

Call xc_dom_gnttab_hvm_seed instead of xc_dom_gnttab_seed in
xc_dom_gnttab_init for autotranslated guests.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r e9c1712765cd -r df1b532019d9 tools/libxc/xc_dom.h
--- a/tools/libxc/xc_dom.h      Fri Feb 15 13:32:21 2013 +0000
+++ b/tools/libxc/xc_dom.h      Fri Feb 15 13:32:21 2013 +0000
@@ -250,6 +250,7 @@ int xc_dom_gnttab_seed(xc_interface *xch
                        xen_pfn_t xenstore_gmfn,
                        domid_t console_domid,
                        domid_t xenstore_domid);
+int xc_dom_feature_translated(struct xc_dom_image *dom);
 
 /* --- debugging bits ---------------------------------------------- */
 
@@ -312,11 +313,6 @@ static inline void *xc_dom_vaddr_to_ptr(
     return (ptr ? (ptr + offset) : NULL);
 }
 
-static inline int xc_dom_feature_translated(struct xc_dom_image *dom)
-{
-    return elf_xen_feature_get(XENFEAT_auto_translated_physmap, dom->f_active);
-}
-
 static inline xen_pfn_t xc_dom_p2m_host(struct xc_dom_image *dom, xen_pfn_t 
pfn)
 {
     if (dom->shadow_enabled)
diff -r e9c1712765cd -r df1b532019d9 tools/libxc/xc_dom_arm.c
--- a/tools/libxc/xc_dom_arm.c  Fri Feb 15 13:32:21 2013 +0000
+++ b/tools/libxc/xc_dom_arm.c  Fri Feb 15 13:32:21 2013 +0000
@@ -51,7 +51,7 @@ static int setup_pgtables_arm(struct xc_
 static int alloc_magic_pages(struct xc_dom_image *dom)
 {
     int rc, i;
-    xen_pfn_t store_pfn, console_pfn, p2m[NR_MAGIC_PAGES];
+    xen_pfn_t p2m[NR_MAGIC_PAGES];
 
     DOMPRINTF_CALLED(dom->xch);
 
@@ -64,15 +64,20 @@ static int alloc_magic_pages(struct xc_d
     if ( rc < 0 )
         return rc;
 
-    console_pfn = dom->rambase_pfn + dom->total_pages + CONSOLE_PFN_OFFSET;
-    store_pfn = dom->rambase_pfn + dom->total_pages + XENSTORE_PFN_OFFSET;
+    dom->console_pfn = dom->rambase_pfn + dom->total_pages + 
CONSOLE_PFN_OFFSET;
+    dom->xenstore_pfn = dom->rambase_pfn + dom->total_pages + 
XENSTORE_PFN_OFFSET;
 
-    xc_clear_domain_page(dom->xch, dom->guest_domid, console_pfn);
-    xc_clear_domain_page(dom->xch, dom->guest_domid, store_pfn);
+    xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn);
+    xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn);
     xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN,
-            console_pfn);
+            dom->console_pfn);
     xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_STORE_PFN,
-            store_pfn);
+            dom->xenstore_pfn);
+    /* allocated by toolstack */
+    xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_EVTCHN,
+            dom->console_evtchn);
+    xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_STORE_EVTCHN,
+            dom->xenstore_evtchn);
 
     return 0;
 }
@@ -196,6 +201,11 @@ int arch_setup_bootlate(struct xc_dom_im
     return 0;
 }
 
+int xc_dom_feature_translated(struct xc_dom_image *dom)
+{
+    return 1;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r e9c1712765cd -r df1b532019d9 tools/libxc/xc_dom_boot.c
--- a/tools/libxc/xc_dom_boot.c Fri Feb 15 13:32:21 2013 +0000
+++ b/tools/libxc/xc_dom_boot.c Fri Feb 15 13:32:21 2013 +0000
@@ -416,19 +416,16 @@ int xc_dom_gnttab_hvm_seed(xc_interface 
 
 int xc_dom_gnttab_init(struct xc_dom_image *dom)
 {
-    xen_pfn_t console_gmfn;
-    xen_pfn_t xenstore_gmfn;
-    int autotranslated;
-
-    autotranslated = xc_dom_feature_translated(dom);
-    console_gmfn = autotranslated ?
-           dom->console_pfn : xc_dom_p2m_host(dom, dom->console_pfn);
-    xenstore_gmfn = autotranslated ?
-           dom->xenstore_pfn : xc_dom_p2m_host(dom, dom->xenstore_pfn);
-
-    return xc_dom_gnttab_seed(dom->xch, dom->guest_domid,
-                              console_gmfn, xenstore_gmfn,
-                              dom->console_domid, dom->xenstore_domid);
+    if ( xc_dom_feature_translated(dom) ) {
+        return xc_dom_gnttab_hvm_seed(dom->xch, dom->guest_domid,
+                                      dom->console_pfn, dom->xenstore_pfn,
+                                      dom->console_domid, dom->xenstore_domid);
+    } else {
+        return xc_dom_gnttab_seed(dom->xch, dom->guest_domid,
+                                  xc_dom_p2m_host(dom, dom->console_pfn),
+                                  xc_dom_p2m_host(dom, dom->xenstore_pfn),
+                                  dom->console_domid, dom->xenstore_domid);
+    }
 }
 
 /*
diff -r e9c1712765cd -r df1b532019d9 tools/libxc/xc_dom_x86.c
--- a/tools/libxc/xc_dom_x86.c  Fri Feb 15 13:32:21 2013 +0000
+++ b/tools/libxc/xc_dom_x86.c  Fri Feb 15 13:32:21 2013 +0000
@@ -822,6 +822,11 @@ int arch_setup_bootlate(struct xc_dom_im
     return 0;
 }
 
+int xc_dom_feature_translated(struct xc_dom_image *dom)
+{
+    return elf_xen_feature_get(XENFEAT_auto_translated_physmap, dom->f_active);
+}
+
 /*
  * Local variables:
  * mode: C

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.