提交 b576d582 编写于 作者: T Thomas Huth 提交者: Cornelia Huck

hw/s390x/s390-pci-bus: Convert sysbus init function to realize function

The SysBusDeviceClass->init() interface is considered as a legacy interface
and there are currently some efforts going on to get rid of it. Thus let's
convert the init function in the s390x code to realize() instead.
Signed-off-by: NThomas Huth <thuth@redhat.com>
Message-Id: <1538466491-2073-1-git-send-email-thuth@redhat.com>
Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: NDavid Hildenbrand <david@redhat.com>
Signed-off-by: NCornelia Huck <cohuck@redhat.com>
上级 74fbae31
...@@ -692,27 +692,35 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn) ...@@ -692,27 +692,35 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn)
object_unref(OBJECT(iommu)); object_unref(OBJECT(iommu));
} }
static int s390_pcihost_init(SysBusDevice *dev) static void s390_pcihost_realize(DeviceState *dev, Error **errp)
{ {
PCIBus *b; PCIBus *b;
BusState *bus; BusState *bus;
PCIHostState *phb = PCI_HOST_BRIDGE(dev); PCIHostState *phb = PCI_HOST_BRIDGE(dev);
S390pciState *s = S390_PCI_HOST_BRIDGE(dev); S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
Error *local_err = NULL;
DPRINTF("host_init\n"); DPRINTF("host_init\n");
b = pci_register_root_bus(DEVICE(dev), NULL, b = pci_register_root_bus(dev, NULL, s390_pci_set_irq, s390_pci_map_irq,
s390_pci_set_irq, s390_pci_map_irq, NULL, NULL, get_system_memory(), get_system_io(), 0,
get_system_memory(), get_system_io(), 0, 64, 64, TYPE_PCI_BUS);
TYPE_PCI_BUS);
pci_setup_iommu(b, s390_pci_dma_iommu, s); pci_setup_iommu(b, s390_pci_dma_iommu, s);
bus = BUS(b); bus = BUS(b);
qbus_set_hotplug_handler(bus, DEVICE(dev), NULL); qbus_set_hotplug_handler(bus, dev, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
phb->bus = b; phb->bus = b;
s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL)); s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, dev, NULL));
qbus_set_hotplug_handler(BUS(s->bus), DEVICE(s), NULL); qbus_set_hotplug_handler(BUS(s->bus), dev, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
s->iommu_table = g_hash_table_new_full(g_int64_hash, g_int64_equal, s->iommu_table = g_hash_table_new_full(g_int64_hash, g_int64_equal,
NULL, g_free); NULL, g_free);
...@@ -722,9 +730,10 @@ static int s390_pcihost_init(SysBusDevice *dev) ...@@ -722,9 +730,10 @@ static int s390_pcihost_init(SysBusDevice *dev)
QTAILQ_INIT(&s->zpci_devs); QTAILQ_INIT(&s->zpci_devs);
css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false, css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
S390_ADAPTER_SUPPRESSIBLE, &error_abort); S390_ADAPTER_SUPPRESSIBLE, &local_err);
if (local_err) {
return 0; error_propagate(errp, local_err);
}
} }
static int s390_pci_msix_init(S390PCIBusDevice *pbdev) static int s390_pci_msix_init(S390PCIBusDevice *pbdev)
...@@ -1018,12 +1027,11 @@ static void s390_pcihost_reset(DeviceState *dev) ...@@ -1018,12 +1027,11 @@ static void s390_pcihost_reset(DeviceState *dev)
static void s390_pcihost_class_init(ObjectClass *klass, void *data) static void s390_pcihost_class_init(ObjectClass *klass, void *data)
{ {
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
dc->reset = s390_pcihost_reset; dc->reset = s390_pcihost_reset;
k->init = s390_pcihost_init; dc->realize = s390_pcihost_realize;
hc->plug = s390_pcihost_hot_plug; hc->plug = s390_pcihost_hot_plug;
hc->unplug = s390_pcihost_hot_unplug; hc->unplug = s390_pcihost_hot_unplug;
msi_nonbroken = true; msi_nonbroken = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册