]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
tools/libxl: Switch Arm guest type to PVH
authorJulien Grall <julien.grall@arm.com>
Mon, 1 Oct 2018 18:57:21 +0000 (19:57 +0100)
committerWei Liu <wei.liu2@citrix.com>
Wed, 3 Oct 2018 14:58:02 +0000 (15:58 +0100)
Currently, the toolstack is considering Arm guest always PV. However,
they are very similar to PVH because HW virtualization extension are used
and QEMU is not started. So switch Arm guest type to PVH.

To keep compatibility with toolstack creating Arm guest with PV type
(e.g libvirt), libxl will now convert those guests to PVH.

Furthermore, the default type for Arm in xl will now be PVH to allow
smooth transition for user.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
docs/man/xl.cfg.pod.5.in
tools/libxl/libxl_arch.h
tools/libxl/libxl_arm.c
tools/libxl/libxl_create.c
tools/libxl/libxl_x86.c
tools/xl/xl_parse.c

index b72718151bfa8b14d3bc57e2ca81384d5fe8a336..b1c0be14cd1c5a379b83416c49ebe2e39eccd4b0 100644 (file)
@@ -80,13 +80,14 @@ single host must be unique.
 =item B<type="pv">
 
 Specifies that this is to be a PV domain, suitable for hosting Xen-aware
-guest operating systems. This is the default.
+guest operating systems. This is the default on x86.
 
 =item B<type="pvh">
 
 Specifies that this is to be an PVH domain. That is a lightweight HVM-like
 guest without a device model and without many of the emulated devices
-available to HVM guests. Note that this mode requires a PVH aware kernel.
+available to HVM guests. Note that this mode requires a PVH aware kernel on
+x86. This is the default on Arm.
 
 =item B<type="hvm">
 
index 5ab0c959745be4ff6c4639cdb365a0990caea5ee..930570ef1efdd42a19caf224166a78c8955ae75f 100644 (file)
@@ -65,7 +65,8 @@ _hidden
 int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
 
 _hidden
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info);
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info);
 
 _hidden
 int libxl__arch_extra_memory(libxl__gc *gc,
index 699fd9ddc6e98374c59960c589ed9f553bd7e1ea..25dc3defc6935cde3c990b4ef0bec0a42c1c0952 100644 (file)
@@ -953,7 +953,11 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
     int rc;
     uint64_t val;
 
-    assert(info->type == LIBXL_DOMAIN_TYPE_PV);
+    if (info->type != LIBXL_DOMAIN_TYPE_PVH) {
+        LOG(ERROR, "Unsupported Arm guest type %s",
+            libxl_domain_type_to_string(info->type));
+        return ERROR_INVAL;
+    }
 
     /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */
     val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI,
@@ -1110,10 +1114,28 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)
     return xc_domain_bind_pt_spi_irq(CTX->xch, domid, irq, irq);
 }
 
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
 {
     /* ACPI is disabled by default */
     libxl_defbool_setdefault(&b_info->acpi, false);
+
+    /*
+     * Arm guest are now considered as PVH by the toolstack. To allow
+     * compatibility with previous toolstack, PV guest are automatically
+     * converted to PVH.
+     */
+    if (b_info->type != LIBXL_DOMAIN_TYPE_PV)
+        return;
+
+    LOG(WARN, "Converting PV guest to PVH.");
+    LOG(WARN, "Arm guest are now PVH.");
+    LOG(WARN, "Please fix your configuration file/toolstack.");
+
+    /* Re-initialize type to PVH and all associated fields to defaults. */
+    memset(&b_info->u, '\0', sizeof(b_info->u));
+    b_info->type = LIBXL_DOMAIN_TYPE_INVALID;
+    libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PVH);
 }
 
 /*
index fe97eebdeaf0b9d909b019d610b960d11835e91c..320dbed3c61cd602f66b0576de13f46114ae525b 100644 (file)
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
     if (!b_info->event_channels)
         b_info->event_channels = 1023;
 
-    libxl__arch_domain_build_info_setdefault(b_info);
+    libxl__arch_domain_build_info_setdefault(gc, b_info);
     libxl_defbool_setdefault(&b_info->dm_restrict, false);
 
     switch (b_info->type) {
index 81523a568fb623d92837849055a938c3fa358cd3..8b6759c0893af41bee2bb89127fb03cf06061bfa 100644 (file)
@@ -613,7 +613,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
     return rc;
 }
 
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
 {
     libxl_defbool_setdefault(&b_info->acpi, true);
 }
index 971ec1bc56ccb365166dbb1564276f48feae5fcc..0bda28152bb9d6bb6928007ea4622e66c1ae24a6 100644 (file)
@@ -1286,7 +1286,11 @@ void parse_config_data(const char *config_source,
     }
 
     if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID)
+#if defined(__arm__) || defined(__aarch64__)
+        c_info->type = LIBXL_DOMAIN_TYPE_PVH;
+#else
         c_info->type = LIBXL_DOMAIN_TYPE_PV;
+#endif
 
     xlu_cfg_get_defbool(config, "hap", &c_info->hap, 0);