yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-s390x-pci-Warn-when-adding-PCI-devices-without-the-z.patch

ae23c9
From 9f13c7165566f442484fa6c335950465ed6a2050 Mon Sep 17 00:00:00 2001
ae23c9
From: Cornelia Huck <cohuck@redhat.com>
ae23c9
Date: Wed, 17 Apr 2019 13:57:38 +0100
ae23c9
Subject: [PATCH 21/24] s390x/pci: Warn when adding PCI devices without the
ae23c9
 'zpci' feature
ae23c9
ae23c9
RH-Author: Cornelia Huck <cohuck@redhat.com>
ae23c9
Message-id: <20190417135741.25297-22-cohuck@redhat.com>
ae23c9
Patchwork-id: 85803
ae23c9
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 21/24] s390x/pci: Warn when adding PCI devices without the 'zpci' feature
ae23c9
Bugzilla: 1699070
ae23c9
RH-Acked-by: David Hildenbrand <david@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
ae23c9
ae23c9
From: David Hildenbrand <david@redhat.com>
ae23c9
ae23c9
We decided to always create the PCI host bridge, even if 'zpci' is not
ae23c9
enabled (due to migration compatibility). This however right now allows
ae23c9
to add zPCI/PCI devices to a VM although the guest will never actually see
ae23c9
them, confusing people that are using a simple CPU model that has no
ae23c9
'zpci' enabled - "Why isn't this working" (David Hildenbrand)
ae23c9
ae23c9
Let's check for 'zpci' and at least print a warning that this will not
ae23c9
work as expected. We could also bail out, however that might break
ae23c9
existing QEMU commandlines.
ae23c9
ae23c9
Reviewed-by: Thomas Huth <thuth@redhat.com>
ae23c9
Signed-off-by: David Hildenbrand <david@redhat.com>
ae23c9
Message-Id: <20190130155733.32742-4-david@redhat.com>
ae23c9
Reviewed-by: Collin Walling <walling@linux.ibm.com>
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
(cherry picked from commit 703fef6fcf3edcbf169c90b6196fcf88f9e9765a)
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 hw/s390x/s390-pci-bus.c | 6 ++++++
ae23c9
 1 file changed, 6 insertions(+)
ae23c9
ae23c9
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
ae23c9
index a0f7245..1ba7873 100644
ae23c9
--- a/hw/s390x/s390-pci-bus.c
ae23c9
+++ b/hw/s390x/s390-pci-bus.c
ae23c9
@@ -864,6 +864,12 @@ static void s390_pcihost_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
ae23c9
 {
ae23c9
     S390pciState *s = S390_PCI_HOST_BRIDGE(hotplug_dev);
ae23c9
 
ae23c9
+    if (!s390_has_feat(S390_FEAT_ZPCI)) {
ae23c9
+        warn_report("Plugging a PCI/zPCI device without the 'zpci' CPU "
ae23c9
+                    "feature enabled; the guest will not be able to see/use "
ae23c9
+                    "this device");
ae23c9
+    }
ae23c9
+
ae23c9
     if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
ae23c9
         PCIDevice *pdev = PCI_DEVICE(dev);
ae23c9
 
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9