]> xenbits.xensource.com Git - people/julieng/xen-unstable.git/commitdiff
libxc: introduce the notion of a container type
authorRoger Pau Monne <roger.pau@citrix.com>
Fri, 2 Oct 2015 15:48:35 +0000 (17:48 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 8 Oct 2015 11:12:05 +0000 (12:12 +0100)
Introduce the notion of a container type into xc_dom_image. This will be
needed by later changes that will also use xc_dom_image in order to build
HVM guests.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
tools/libxc/include/xc_dom.h
tools/libxc/xc_dom_x86.c
tools/libxl/libxl_dom.c

index e794a1340d2ca347b1cc3bdf424c2c0fc962486e..30fa8c5e4a40be592d0d3565e7105b418e324a9c 100644 (file)
@@ -177,6 +177,12 @@ struct xc_dom_image {
     struct xc_dom_arch *arch_hooks;
     /* allocate up to virt_alloc_end */
     int (*allocate) (struct xc_dom_image * dom, xen_vaddr_t up_to);
+
+    /* Container type (HVM or PV). */
+    enum {
+        XC_DOM_PV_CONTAINER,
+        XC_DOM_HVM_CONTAINER,
+    } container_type;
 };
 
 /* --- pluggable kernel loader ------------------------------------- */
index f3962cd491d7560b3f74bb9059f6933df70f39e3..d306475eb6930d995780704d14542f162f68ca99 100644 (file)
@@ -1069,6 +1069,10 @@ int arch_setup_bootlate(struct xc_dom_image *dom)
 
 int xc_dom_feature_translated(struct xc_dom_image *dom)
 {
+    /* Guests running inside HVM containers are always auto-translated. */
+    if ( dom->container_type == XC_DOM_HVM_CONTAINER )
+        return 1;
+
     return elf_xen_feature_get(XENFEAT_auto_translated_physmap, dom->f_active);
 }
 
index 4c7698c285ed1174671fb9695b4bb60f37dd413b..2b92d484eef8e5e7f9ba4dde34a4ae8b8957a977 100644 (file)
@@ -618,6 +618,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
     }
 
     dom->pvh_enabled = state->pvh_enabled;
+    dom->container_type = XC_DOM_PV_CONTAINER;
 
     LOG(DEBUG, "pv kernel mapped %d path %s", state->pv_kernel.mapped, state->pv_kernel.path);