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

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