yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-hw-s390x-s390-pci-bus-Convert-sysbus-init-function-t.patch

ae23c9
From 11e6368bca72590e49a7705b55ce031f543941d7 Mon Sep 17 00:00:00 2001
ae23c9
From: Cornelia Huck <cohuck@redhat.com>
ae23c9
Date: Wed, 17 Apr 2019 13:57:23 +0100
ae23c9
Subject: [PATCH 06/24] hw/s390x/s390-pci-bus: Convert sysbus init function to
ae23c9
 realize function
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: Cornelia Huck <cohuck@redhat.com>
ae23c9
Message-id: <20190417135741.25297-7-cohuck@redhat.com>
ae23c9
Patchwork-id: 85787
ae23c9
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 06/24] hw/s390x/s390-pci-bus: Convert sysbus init function to realize function
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: Philippe Mathieu-Daudé <philmd@redhat.com>
ae23c9
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
ae23c9
ae23c9
From: Thomas Huth <thuth@redhat.com>
ae23c9
ae23c9
The SysBusDeviceClass->init() interface is considered as a legacy interface
ae23c9
and there are currently some efforts going on to get rid of it. Thus let's
ae23c9
convert the init function in the s390x code to realize() instead.
ae23c9
ae23c9
Signed-off-by: Thomas Huth <thuth@redhat.com>
ae23c9
Message-Id: <1538466491-2073-1-git-send-email-thuth@redhat.com>
ae23c9
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ae23c9
Reviewed-by: David Hildenbrand <david@redhat.com>
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
(cherry picked from commit b576d582ea2b03f4eada186fff59308d22b40a6a)
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 | 34 +++++++++++++++++++++-------------
ae23c9
 1 file changed, 21 insertions(+), 13 deletions(-)
ae23c9
ae23c9
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
ae23c9
index 10da874..f253774 100644
ae23c9
--- a/hw/s390x/s390-pci-bus.c
ae23c9
+++ b/hw/s390x/s390-pci-bus.c
ae23c9
@@ -692,27 +692,35 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn)
ae23c9
     object_unref(OBJECT(iommu));
ae23c9
 }
ae23c9
 
ae23c9
-static int s390_pcihost_init(SysBusDevice *dev)
ae23c9
+static void s390_pcihost_realize(DeviceState *dev, Error **errp)
ae23c9
 {
ae23c9
     PCIBus *b;
ae23c9
     BusState *bus;
ae23c9
     PCIHostState *phb = PCI_HOST_BRIDGE(dev);
ae23c9
     S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
ae23c9
+    Error *local_err = NULL;
ae23c9
 
ae23c9
     DPRINTF("host_init\n");
ae23c9
 
ae23c9
-    b = pci_register_root_bus(DEVICE(dev), NULL,
ae23c9
-                              s390_pci_set_irq, s390_pci_map_irq, NULL,
ae23c9
-                              get_system_memory(), get_system_io(), 0, 64,
ae23c9
-                              TYPE_PCI_BUS);
ae23c9
+    b = pci_register_root_bus(dev, NULL, s390_pci_set_irq, s390_pci_map_irq,
ae23c9
+                              NULL, get_system_memory(), get_system_io(), 0,
ae23c9
+                              64, TYPE_PCI_BUS);
ae23c9
     pci_setup_iommu(b, s390_pci_dma_iommu, s);
ae23c9
 
ae23c9
     bus = BUS(b);
ae23c9
-    qbus_set_hotplug_handler(bus, DEVICE(dev), NULL);
ae23c9
+    qbus_set_hotplug_handler(bus, dev, &local_err);
ae23c9
+    if (local_err) {
ae23c9
+        error_propagate(errp, local_err);
ae23c9
+        return;
ae23c9
+    }
ae23c9
     phb->bus = b;
ae23c9
 
ae23c9
-    s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
ae23c9
-    qbus_set_hotplug_handler(BUS(s->bus), DEVICE(s), NULL);
ae23c9
+    s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, dev, NULL));
ae23c9
+    qbus_set_hotplug_handler(BUS(s->bus), dev, &local_err);
ae23c9
+    if (local_err) {
ae23c9
+        error_propagate(errp, local_err);
ae23c9
+        return;
ae23c9
+    }
ae23c9
 
ae23c9
     s->iommu_table = g_hash_table_new_full(g_int64_hash, g_int64_equal,
ae23c9
                                            NULL, g_free);
ae23c9
@@ -722,9 +730,10 @@ static int s390_pcihost_init(SysBusDevice *dev)
ae23c9
     QTAILQ_INIT(&s->zpci_devs);
ae23c9
 
ae23c9
     css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
ae23c9
-                             S390_ADAPTER_SUPPRESSIBLE, &error_abort);
ae23c9
-
ae23c9
-    return 0;
ae23c9
+                             S390_ADAPTER_SUPPRESSIBLE, &local_err);
ae23c9
+    if (local_err) {
ae23c9
+        error_propagate(errp, local_err);
ae23c9
+    }
ae23c9
 }
ae23c9
 
ae23c9
 static int s390_pci_msix_init(S390PCIBusDevice *pbdev)
ae23c9
@@ -1018,12 +1027,11 @@ static void s390_pcihost_reset(DeviceState *dev)
ae23c9
 
ae23c9
 static void s390_pcihost_class_init(ObjectClass *klass, void *data)
ae23c9
 {
ae23c9
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
ae23c9
     DeviceClass *dc = DEVICE_CLASS(klass);
ae23c9
     HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
ae23c9
 
ae23c9
     dc->reset = s390_pcihost_reset;
ae23c9
-    k->init = s390_pcihost_init;
ae23c9
+    dc->realize = s390_pcihost_realize;
ae23c9
     hc->plug = s390_pcihost_hot_plug;
ae23c9
     hc->unplug = s390_pcihost_hot_unplug;
ae23c9
     msi_nonbroken = true;
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9