You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.3 KiB
66 lines
2.3 KiB
2 years ago
|
From 6657d0c1018ab44ae680376463ac3f0421548fb4 Mon Sep 17 00:00:00 2001
|
||
|
From: Laszlo Ersek <lersek@redhat.com>
|
||
|
Date: Thu, 23 Dec 2021 11:36:59 +0100
|
||
|
Subject: [PATCH] launch-libvirt: place our virtio-net-pci device in slot 0x1e
|
||
|
|
||
|
The <qemu:commandline> trick we use for adding our virtio-net-pci device
|
||
|
in the libvirt backend can conflict with libvirtd's and QEMU's PCI address
|
||
|
assignment. Try to mitigate that by placing our device in slot 0x1e on the
|
||
|
root bus. In practice this could only conflict with a "dmi-to-pci-bridge"
|
||
|
device model, which libvirtd itself places in slot 0x1e. However, given
|
||
|
the XMLs we generate, and modern QEMU versions, libvirtd has no reason to
|
||
|
auto-add "dmi-to-pci-bridge". Refer to
|
||
|
<https://libvirt.org/formatdomain.html#controllers>.
|
||
|
|
||
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160
|
||
|
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||
|
Message-Id: <20211223103701.12702-2-lersek@redhat.com>
|
||
|
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||
|
Tested-by: Richard W.M. Jones <rjones@redhat.com>
|
||
|
(cherry picked from commit 5ce5ef6a97a58c5e906083ad4e944545712b3f3f)
|
||
|
---
|
||
|
lib/guestfs-internal.h | 11 +++++++++++
|
||
|
lib/launch-libvirt.c | 4 +++-
|
||
|
2 files changed, 14 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
|
||
|
index 4799ee0a1..0b46f0070 100644
|
||
|
--- a/lib/guestfs-internal.h
|
||
|
+++ b/lib/guestfs-internal.h
|
||
|
@@ -147,6 +147,17 @@
|
||
|
#define VIRTIO_DEVICE_NAME(type) type "-pci"
|
||
|
#endif
|
||
|
|
||
|
+/* Place the virtio-net controller in slot 0x1e on the root bus, on normal
|
||
|
+ * hardware with PCI. Refer to RHBZ#2034160.
|
||
|
+ */
|
||
|
+#ifdef HAVE_LIBVIRT_BACKEND
|
||
|
+#if defined(__arm__) || defined(__s390x__)
|
||
|
+#define VIRTIO_NET_PCI_ADDR ""
|
||
|
+#else
|
||
|
+#define VIRTIO_NET_PCI_ADDR ",addr=1e.0"
|
||
|
+#endif
|
||
|
+#endif
|
||
|
+
|
||
|
/* Guestfs handle and associated structures. */
|
||
|
|
||
|
/* State. */
|
||
|
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
|
||
|
index 026dc6b26..5842319df 100644
|
||
|
--- a/lib/launch-libvirt.c
|
||
|
+++ b/lib/launch-libvirt.c
|
||
|
@@ -1834,7 +1834,9 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
|
||
|
} end_element ();
|
||
|
|
||
|
start_element ("qemu:arg") {
|
||
|
- attribute ("value", VIRTIO_DEVICE_NAME ("virtio-net") ",netdev=usernet");
|
||
|
+ attribute ("value", (VIRTIO_DEVICE_NAME ("virtio-net")
|
||
|
+ ",netdev=usernet"
|
||
|
+ VIRTIO_NET_PCI_ADDR));
|
||
|
} end_element ();
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.31.1
|
||
|
|