mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0040-s390x-launch-direct-Use-virtio-ccw-on-this-architect.patch

a30de4
From 516f008f29e77d676907208e51e2f57bb73888aa Mon Sep 17 00:00:00 2001
a30de4
From: "Richard W.M. Jones" <rjones@redhat.com>
a30de4
Date: Tue, 16 May 2017 19:58:59 +0200
a30de4
Subject: [PATCH] s390x: launch: direct: Use virtio-*-ccw on this architecture.
a30de4
a30de4
PCI devices don't exist/work.  You would see errors such as:
a30de4
a30de4
qemu-system-s390x: -device virtio-rng-pci,rng=rng0: MSI-X support is mandatory in the S390 architecture
a30de4
(cherry picked from commit ddde6f9e2f14ccf8d91a8587052d0abcfb6496f1)
a30de4
---
a30de4
 lib/guestfs-internal.h | 26 +++++++++++++++++---------
a30de4
 lib/launch-direct.c    |  4 ++--
a30de4
 2 files changed, 19 insertions(+), 11 deletions(-)
a30de4
a30de4
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
a30de4
index 949cacfef..f035e0931 100644
a30de4
--- a/lib/guestfs-internal.h
a30de4
+++ b/lib/guestfs-internal.h
a30de4
@@ -142,20 +142,28 @@
a30de4
 /* Maximum size of Windows explorer.exe.  2.6MB on Windows 7. */
a30de4
 #define MAX_WINDOWS_EXPLORER_SIZE (4 * 1000 * 1000)
a30de4
 
a30de4
-/* Differences in device names on ARM (virtio-mmio) vs normal
a30de4
- * hardware with PCI.
a30de4
+/* Differences in device names on ARMv7 (virtio-mmio), s/390x (CCW) vs
a30de4
+ * normal hardware with PCI.
a30de4
  */
a30de4
-#if !defined(__arm__)
a30de4
-#define VIRTIO_BLK "virtio-blk-pci"
a30de4
-#define VIRTIO_SCSI "virtio-scsi-pci"
a30de4
-#define VIRTIO_SERIAL "virtio-serial-pci"
a30de4
-#define VIRTIO_NET "virtio-net-pci"
a30de4
-#else /* ARMv7 */
a30de4
+#if defined(__arm__)
a30de4
 #define VIRTIO_BLK "virtio-blk-device"
a30de4
 #define VIRTIO_SCSI "virtio-scsi-device"
a30de4
 #define VIRTIO_SERIAL "virtio-serial-device"
a30de4
 #define VIRTIO_NET "virtio-net-device"
a30de4
-#endif /* ARMv7 */
a30de4
+#define VIRTIO_RNG "virtio-rng-device"
a30de4
+#elif defined(__s390x__)
a30de4
+#define VIRTIO_BLK "virtio-blk-ccw"
a30de4
+#define VIRTIO_SCSI "virtio-scsi-ccw"
a30de4
+#define VIRTIO_SERIAL "virtio-serial-ccw"
a30de4
+#define VIRTIO_NET "virtio-net-ccw"
a30de4
+#define VIRTIO_RNG "virtio-rng-ccw"
a30de4
+#else
a30de4
+#define VIRTIO_BLK "virtio-blk-pci"
a30de4
+#define VIRTIO_SCSI "virtio-scsi-pci"
a30de4
+#define VIRTIO_SERIAL "virtio-serial-pci"
a30de4
+#define VIRTIO_NET "virtio-net-pci"
a30de4
+#define VIRTIO_RNG "virtio-rng-pci"
a30de4
+#endif
a30de4
 
a30de4
 /* Machine types. */
a30de4
 #ifdef __arm__
a30de4
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
a30de4
index 147e158de..c8841bfe4 100644
a30de4
--- a/lib/launch-direct.c
a30de4
+++ b/lib/launch-direct.c
a30de4
@@ -463,11 +463,11 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
a30de4
    * when needing entropy.
a30de4
    */
a30de4
   if (guestfs_int_qemu_supports_device (g, data->qemu_data,
a30de4
-                                        "virtio-rng-pci")) {
a30de4
+                                        VIRTIO_RNG)) {
a30de4
     ADD_CMDLINE ("-object");
a30de4
     ADD_CMDLINE ("rng-random,filename=/dev/urandom,id=rng0");
a30de4
     ADD_CMDLINE ("-device");
a30de4
-    ADD_CMDLINE ("virtio-rng-pci,rng=rng0");
a30de4
+    ADD_CMDLINE (VIRTIO_RNG ",rng=rng0");
a30de4
   }
a30de4
 
a30de4
   /* Add drives */
a30de4
-- 
a30de4
2.14.3
a30de4