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

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