Blame SOURCES/0090-aarch64-launch-libvirt-As-a-workaround-pass-cpu-para.patch

ffd6ed
From 240cd5f90c83bcd0441d8ea079c3e5f6508d1202 Mon Sep 17 00:00:00 2001
ffd6ed
From: "Richard W.M. Jones" <rjones@redhat.com>
ffd6ed
Date: Wed, 21 Jan 2015 05:37:56 -0500
ffd6ed
Subject: [PATCH] aarch64: launch: libvirt: As a workaround, pass -cpu
ffd6ed
 parameter to qemu.
ffd6ed
ffd6ed
When libguestfs is running using TCG on aarch64, we need to pass the
ffd6ed
-cpu cortex-a57 parameter to qemu.  Libvirt doesn't let us do this,
ffd6ed
complaining "Unable to find CPU definition".
ffd6ed
ffd6ed
As a temporary workaround only, use <qemu:commandline> to pass this
ffd6ed
argument directly to qemu.  When libvirt is fixed we can remove this
ffd6ed
hack.
ffd6ed
ffd6ed
This is a workaround for libvirt bug RHBZ#1184411.
ffd6ed
ffd6ed
See:
ffd6ed
https://www.redhat.com/archives/libvirt-users/2014-August/msg00043.html
ffd6ed
https://bugzilla.redhat.com/show_bug.cgi?id=1184411
ffd6ed
(cherry picked from commit 7e4b7a346a4558a02aeb58f82d518509ce6e5d03)
ffd6ed
---
ffd6ed
 src/launch-libvirt.c | 21 ++++++++++++++++++++-
ffd6ed
 1 file changed, 20 insertions(+), 1 deletion(-)
ffd6ed
ffd6ed
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
ffd6ed
index e6899ac..79bc6fd 100644
ffd6ed
--- a/src/launch-libvirt.c
ffd6ed
+++ b/src/launch-libvirt.c
ffd6ed
@@ -1035,12 +1035,16 @@ construct_libvirt_xml_cpu (guestfs_h *g,
ffd6ed
         } end_element ();
ffd6ed
       }
ffd6ed
       else {
ffd6ed
-        /* XXX This does not work, see:
ffd6ed
+        /* XXX This does not work on aarch64, see:
ffd6ed
          * https://www.redhat.com/archives/libvirt-users/2014-August/msg00043.html
ffd6ed
+	 * https://bugzilla.redhat.com/show_bug.cgi?id=1184411
ffd6ed
+	 * Instead we hack around it using <qemu:commandline> below.
ffd6ed
          */
ffd6ed
+#ifndef __aarch64__
ffd6ed
         start_element ("model") {
ffd6ed
           string (cpu_model);
ffd6ed
         } end_element ();
ffd6ed
+#endif
ffd6ed
       }
ffd6ed
     } end_element ();
ffd6ed
   }
ffd6ed
@@ -1670,6 +1674,21 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
ffd6ed
       }
ffd6ed
     }
ffd6ed
 
ffd6ed
+#ifdef __aarch64__
ffd6ed
+    /* This is a temporary hack until RHBZ#1184411 is resolved.
ffd6ed
+     * See comments above about cpu model and aarch64.
ffd6ed
+     */
ffd6ed
+    const char *cpu_model = guestfs___get_cpu_model (params->data->is_kvm);
ffd6ed
+    if (STRNEQ (cpu_model, "host")) {
ffd6ed
+      start_element ("qemu:arg") {
ffd6ed
+        attribute ("value", "-cpu");
ffd6ed
+      } end_element ();
ffd6ed
+      start_element ("qemu:arg") {
ffd6ed
+        attribute ("value", cpu_model);
ffd6ed
+      } end_element ();
ffd6ed
+    }
ffd6ed
+#endif
ffd6ed
+
ffd6ed
   } end_element (); /* </qemu:commandline> */
ffd6ed
 
ffd6ed
   return 0;
ffd6ed
-- 
ffd6ed
1.8.3.1
ffd6ed