Skip to contentSkip to conversation

libxl/arm: fix guest type conversion

PATCH In review Wei Liu 2 participants 2 messages Nov 2, 2018

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH v3 1/1 libxl/arm: fix guest type conversion

Commit 359970fd8b ("tools/libxl: Switch Arm guest type to PVH") missed changing the type field in c_info. This issue didn't surface until ef72c93df9 which made creating PV guest on Arm unusable.

Create libxl__arch_domain_create_info_setdefault and switch the type there.

---
Cc: Stefano Stabellini <[email protected]>
Cc: Julien Grall <[email protected]>

This should fix libvirt breakage.

---
 tools/libxl/libxl_arch.h   |  4 ++++
 tools/libxl/libxl_arm.c    | 27 +++++++++++++++++++--------
 tools/libxl/libxl_create.c |  2 ++
 tools/libxl/libxl_x86.c    |  5 +++++
 4 files changed, 30 insertions(+), 8 deletions(-)
tools/libxl/libxl_arch.h +4 -0
index 930570ef1e..d624159e53 100644
@@ -64,6 +64,10 @@ int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc,
 _hidden
 int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
 
+_hidden
+void libxl__arch_domain_create_info_setdefault(libxl__gc *gc,
+                                               libxl_domain_create_info *c_info);
+
 _hidden
 void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
                                               libxl_domain_build_info *b_info);
tools/libxl/libxl_arm.c +19 -8
index 25dc3defc6..141e159043 100644
@@ -1114,23 +1114,34 @@ 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__gc *gc,
-                                              libxl_domain_build_info *b_info)
+void libxl__arch_domain_create_info_setdefault(libxl__gc *gc,
+                                               libxl_domain_create_info *c_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 (c_info->type == LIBXL_DOMAIN_TYPE_PV) {
+        LOG(WARN, "Converting PV guest to PVH.");
+        LOG(WARN, "Arm guest are now PVH.");
+        LOG(WARN, "Please fix your configuration file/toolstack.");
+
+        c_info->type = LIBXL_DOMAIN_TYPE_PVH;
+        /* All other fields can remain untouched */
+    }
+}
+
+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);
+
     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.");
+    LOG(DEBUG, "Converting build_info to PVH");
 
     /* Re-initialize type to PVH and all associated fields to defaults. */
     memset(&b_info->u, '\0', sizeof(b_info->u));
tools/libxl/libxl_create.c +2 -0
index 4bb750e951..fa573344bc 100644
@@ -35,6 +35,8 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc,
         return ERROR_INVAL;
     }
 
+    libxl__arch_domain_create_info_setdefault(gc, c_info);
+
     if (c_info->type != LIBXL_DOMAIN_TYPE_PV) {
         libxl_defbool_setdefault(&c_info->hap, true);
         libxl_defbool_setdefault(&c_info->oos, true);
tools/libxl/libxl_x86.c +5 -0
index 8b6759c089..c04fd75a64 100644
@@ -613,6 +613,11 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
     return rc;
 }
 
+void libxl__arch_domain_create_info_setdefault(libxl__gc *gc,
+                                               libxl_domain_create_info *c_info)
+{
+}
+
 void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
                                               libxl_domain_build_info *b_info)
 {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v3 1/1
#1 lore raw

Wei Liu writes ("[PATCH v3] libxl/arm: fix guest type conversion"):

Quoted 6 lines

Commit 359970fd8b ("tools/libxl: Switch Arm guest type to PVH") missed changing the type field in c_info. This issue didn't surface until ef72c93df9 which made creating PV guest on Arm unusable.

Create libxl__arch_domain_create_info_setdefault and switch the type there.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel