|
|
a19a21 |
From 250227a53c1d43d2bd8346922edb3452f3534be6 Mon Sep 17 00:00:00 2001
|
|
|
a19a21 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
a19a21 |
Date: Fri, 2 Oct 2020 10:17:42 -0400
|
|
|
a19a21 |
Subject: [PATCH 03/14] qga/commands-posix: Support fsinfo for non-PCI virtio
|
|
|
a19a21 |
devices, too
|
|
|
a19a21 |
MIME-Version: 1.0
|
|
|
a19a21 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a19a21 |
Content-Transfer-Encoding: 8bit
|
|
|
a19a21 |
|
|
|
a19a21 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
a19a21 |
Message-id: <20201002101742.249169-4-thuth@redhat.com>
|
|
|
a19a21 |
Patchwork-id: 98528
|
|
|
a19a21 |
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 3/3] qga/commands-posix: Support fsinfo for non-PCI virtio devices, too
|
|
|
a19a21 |
Bugzilla: 1755075
|
|
|
a19a21 |
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
|
|
a19a21 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
a19a21 |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
a19a21 |
|
|
|
a19a21 |
QEMU on s390x uses virtio via channel I/O instead of PCI by default.
|
|
|
a19a21 |
Add a function to detect and provide information for virtio-scsi and
|
|
|
a19a21 |
virtio-block devices here, too.
|
|
|
a19a21 |
|
|
|
a19a21 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
a19a21 |
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
a19a21 |
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
|
|
|
a19a21 |
(cherry picked from commit 23843c129d5e1ca360605e511a43a34faebb47c4)
|
|
|
a19a21 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
a19a21 |
|
|
|
a19a21 |
qga/commands-posix.c | 42 +++++++++++++++++++++++++++++++++++++++++-
|
|
|
a19a21 |
1 file changed, 41 insertions(+), 1 deletion(-)
|
|
|
a19a21 |
|
|
|
a19a21 |
diff
|
|
|
a19a21 |
index 6db76aadd1..c86c87ed52 100644
|
|
|
a19a21 |
|
|
|
a19a21 |
|
|
|
a19a21 |
@@ -1000,6 +1000,39 @@ cleanup:
|
|
|
a19a21 |
return ret;
|
|
|
a19a21 |
}
|
|
|
a19a21 |
|
|
|
a19a21 |
+/*
|
|
|
a19a21 |
+ * Store disk device info for non-PCI virtio devices (for example s390x
|
|
|
a19a21 |
+ * channel I/O devices). Returns true if information has been stored, or
|
|
|
a19a21 |
+ * false for failure.
|
|
|
a19a21 |
+ */
|
|
|
a19a21 |
+static bool build_guest_fsinfo_for_nonpci_virtio(char const *syspath,
|
|
|
a19a21 |
+ GuestDiskAddress *disk,
|
|
|
a19a21 |
+ Error **errp)
|
|
|
a19a21 |
+{
|
|
|
a19a21 |
+ unsigned int tgt[3];
|
|
|
a19a21 |
+ char *p;
|
|
|
a19a21 |
+
|
|
|
a19a21 |
+ if (!strstr(syspath, "/virtio") || !strstr(syspath, "/block")) {
|
|
|
a19a21 |
+ g_debug("Unsupported virtio device '%s'", syspath);
|
|
|
a19a21 |
+ return false;
|
|
|
a19a21 |
+ }
|
|
|
a19a21 |
+
|
|
|
a19a21 |
+ p = strstr(syspath, "/target");
|
|
|
a19a21 |
+ if (p && sscanf(p + 7, "%*u:%*u:%*u/%*u:%u:%u:%u",
|
|
|
a19a21 |
+ &tgt[0], &tgt[1], &tgt[2]) == 3) {
|
|
|
a19a21 |
+ /* virtio-scsi: target*:0:<target>:<unit> */
|
|
|
a19a21 |
+ disk->bus_type = GUEST_DISK_BUS_TYPE_SCSI;
|
|
|
a19a21 |
+ disk->bus = tgt[0];
|
|
|
a19a21 |
+ disk->target = tgt[1];
|
|
|
a19a21 |
+ disk->unit = tgt[2];
|
|
|
a19a21 |
+ } else {
|
|
|
a19a21 |
+ /* virtio-blk: 1 disk per 1 device */
|
|
|
a19a21 |
+ disk->bus_type = GUEST_DISK_BUS_TYPE_VIRTIO;
|
|
|
a19a21 |
+ }
|
|
|
a19a21 |
+
|
|
|
a19a21 |
+ return true;
|
|
|
a19a21 |
+}
|
|
|
a19a21 |
+
|
|
|
a19a21 |
|
|
|
a19a21 |
static void build_guest_fsinfo_for_real_device(char const *syspath,
|
|
|
a19a21 |
GuestFilesystemInfo *fs,
|
|
|
a19a21 |
@@ -1050,7 +1083,14 @@ static void build_guest_fsinfo_for_real_device(char const *syspath,
|
|
|
a19a21 |
udev_device_unref(udevice);
|
|
|
a19a21 |
#endif
|
|
|
a19a21 |
|
|
|
a19a21 |
- has_hwinf = build_guest_fsinfo_for_pci_dev(syspath, disk, errp);
|
|
|
a19a21 |
+ if (strstr(syspath, "/devices/pci")) {
|
|
|
a19a21 |
+ has_hwinf = build_guest_fsinfo_for_pci_dev(syspath, disk, errp);
|
|
|
a19a21 |
+ } else if (strstr(syspath, "/virtio")) {
|
|
|
a19a21 |
+ has_hwinf = build_guest_fsinfo_for_nonpci_virtio(syspath, disk, errp);
|
|
|
a19a21 |
+ } else {
|
|
|
a19a21 |
+ g_debug("Unsupported device type for '%s'", syspath);
|
|
|
a19a21 |
+ has_hwinf = false;
|
|
|
a19a21 |
+ }
|
|
|
a19a21 |
|
|
|
a19a21 |
if (has_hwinf || disk->has_dev || disk->has_serial) {
|
|
|
a19a21 |
list->next = fs->disk;
|
|
|
a19a21 |
--
|
|
|
a19a21 |
2.27.0
|
|
|
a19a21 |
|