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

[Xen-changelog] [xen master] libxl/arm: fix guest type conversion



commit 2cf113891a38cc05434bc9876ffc107a990887be
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Fri Nov 2 12:34:12 2018 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Nov 2 14:22:20 2018 +0000

    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.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 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(-)

diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h
index 930570ef1e..d624159e53 100644
--- a/tools/libxl/libxl_arch.h
+++ b/tools/libxl/libxl_arch.h
@@ -65,6 +65,10 @@ _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);
 
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 25dc3defc6..141e159043 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -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));
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 4bb750e951..fa573344bc 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -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);
diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index 8b6759c089..c04fd75a64 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -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)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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