* [Qemu-devel] [PATCH] hw/s390x/s390-pci-bus: Convert sysbus init function to realize function
@ 2018-10-02 7:48 Thomas Huth
2018-10-02 19:16 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thomas Huth @ 2018-10-02 7:48 UTC (permalink / raw)
To: qemu-s390x, Cornelia Huck, Christian Borntraeger, Yi Min Zhao
Cc: qemu-devel, David Hildenbrand, Peter Maydell, Pierre Morel
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: Thomas Huth <thuth@redhat.com>
---
hw/s390x/s390-pci-bus.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index e3e0ebb..e42e1b8 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -692,27 +692,35 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn)
object_unref(OBJECT(iommu));
}
-static int s390_pcihost_init(SysBusDevice *dev)
+static void s390_pcihost_realize(DeviceState *dev, Error **errp)
{
PCIBus *b;
BusState *bus;
PCIHostState *phb = PCI_HOST_BRIDGE(dev);
S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
+ Error *local_err = NULL;
DPRINTF("host_init\n");
- b = pci_register_root_bus(DEVICE(dev), NULL,
- s390_pci_set_irq, s390_pci_map_irq, NULL,
- get_system_memory(), get_system_io(), 0, 64,
- TYPE_PCI_BUS);
+ b = pci_register_root_bus(dev, NULL, s390_pci_set_irq, s390_pci_map_irq,
+ NULL, get_system_memory(), get_system_io(), 0,
+ 64, TYPE_PCI_BUS);
pci_setup_iommu(b, s390_pci_dma_iommu, s);
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;
- s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
- qbus_set_hotplug_handler(BUS(s->bus), DEVICE(s), NULL);
+ s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, dev, 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,
NULL, g_free);
@@ -722,9 +730,10 @@ static int s390_pcihost_init(SysBusDevice *dev)
QTAILQ_INIT(&s->zpci_devs);
css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
- S390_ADAPTER_SUPPRESSIBLE, &error_abort);
-
- return 0;
+ S390_ADAPTER_SUPPRESSIBLE, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ }
}
static int s390_pci_msix_init(S390PCIBusDevice *pbdev)
@@ -1018,12 +1027,11 @@ static void s390_pcihost_reset(DeviceState *dev)
static void s390_pcihost_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
dc->reset = s390_pcihost_reset;
- k->init = s390_pcihost_init;
+ dc->realize = s390_pcihost_realize;
hc->plug = s390_pcihost_hot_plug;
hc->unplug = s390_pcihost_hot_unplug;
msi_nonbroken = true;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/s390x/s390-pci-bus: Convert sysbus init function to realize function
2018-10-02 7:48 [Qemu-devel] [PATCH] hw/s390x/s390-pci-bus: Convert sysbus init function to realize function Thomas Huth
@ 2018-10-02 19:16 ` Philippe Mathieu-Daudé
2018-10-04 8:53 ` Cornelia Huck
2018-10-04 9:50 ` David Hildenbrand
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-10-02 19:16 UTC (permalink / raw)
To: Thomas Huth, qemu-s390x, Cornelia Huck, Christian Borntraeger,
Yi Min Zhao
Cc: Peter Maydell, qemu-devel, Pierre Morel, David Hildenbrand
On 10/2/18 9:48 AM, Thomas Huth wrote:
> 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: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/s390x/s390-pci-bus.c | 34 +++++++++++++++++++++-------------
> 1 file changed, 21 insertions(+), 13 deletions(-)
>
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index e3e0ebb..e42e1b8 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -692,27 +692,35 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn)
> object_unref(OBJECT(iommu));
> }
>
> -static int s390_pcihost_init(SysBusDevice *dev)
> +static void s390_pcihost_realize(DeviceState *dev, Error **errp)
> {
> PCIBus *b;
> BusState *bus;
> PCIHostState *phb = PCI_HOST_BRIDGE(dev);
> S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
> + Error *local_err = NULL;
>
> DPRINTF("host_init\n");
>
> - b = pci_register_root_bus(DEVICE(dev), NULL,
> - s390_pci_set_irq, s390_pci_map_irq, NULL,
> - get_system_memory(), get_system_io(), 0, 64,
> - TYPE_PCI_BUS);
> + b = pci_register_root_bus(dev, NULL, s390_pci_set_irq, s390_pci_map_irq,
> + NULL, get_system_memory(), get_system_io(), 0,
> + 64, TYPE_PCI_BUS);
> pci_setup_iommu(b, s390_pci_dma_iommu, s);
>
> 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;
>
> - s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
> - qbus_set_hotplug_handler(BUS(s->bus), DEVICE(s), NULL);
> + s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, dev, 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,
> NULL, g_free);
> @@ -722,9 +730,10 @@ static int s390_pcihost_init(SysBusDevice *dev)
> QTAILQ_INIT(&s->zpci_devs);
>
> css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
> - S390_ADAPTER_SUPPRESSIBLE, &error_abort);
> -
> - return 0;
> + S390_ADAPTER_SUPPRESSIBLE, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + }
> }
>
> static int s390_pci_msix_init(S390PCIBusDevice *pbdev)
> @@ -1018,12 +1027,11 @@ static void s390_pcihost_reset(DeviceState *dev)
>
> static void s390_pcihost_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
> DeviceClass *dc = DEVICE_CLASS(klass);
> HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
>
> dc->reset = s390_pcihost_reset;
> - k->init = s390_pcihost_init;
> + dc->realize = s390_pcihost_realize;
> hc->plug = s390_pcihost_hot_plug;
> hc->unplug = s390_pcihost_hot_unplug;
> msi_nonbroken = true;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/s390x/s390-pci-bus: Convert sysbus init function to realize function
2018-10-02 7:48 [Qemu-devel] [PATCH] hw/s390x/s390-pci-bus: Convert sysbus init function to realize function Thomas Huth
2018-10-02 19:16 ` Philippe Mathieu-Daudé
@ 2018-10-04 8:53 ` Cornelia Huck
2018-10-04 9:50 ` David Hildenbrand
2 siblings, 0 replies; 4+ messages in thread
From: Cornelia Huck @ 2018-10-04 8:53 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-s390x, Christian Borntraeger, Yi Min Zhao, qemu-devel,
David Hildenbrand, Peter Maydell, Pierre Morel
On Tue, 2 Oct 2018 09:48:11 +0200
Thomas Huth <thuth@redhat.com> wrote:
> 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: Thomas Huth <thuth@redhat.com>
> ---
> hw/s390x/s390-pci-bus.c | 34 +++++++++++++++++++++-------------
> 1 file changed, 21 insertions(+), 13 deletions(-)
Thanks, applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/s390x/s390-pci-bus: Convert sysbus init function to realize function
2018-10-02 7:48 [Qemu-devel] [PATCH] hw/s390x/s390-pci-bus: Convert sysbus init function to realize function Thomas Huth
2018-10-02 19:16 ` Philippe Mathieu-Daudé
2018-10-04 8:53 ` Cornelia Huck
@ 2018-10-04 9:50 ` David Hildenbrand
2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2018-10-04 9:50 UTC (permalink / raw)
To: Thomas Huth, qemu-s390x, Cornelia Huck, Christian Borntraeger,
Yi Min Zhao
Cc: qemu-devel, Peter Maydell, Pierre Morel
On 02/10/2018 09:48, Thomas Huth wrote:
> 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: Thomas Huth <thuth@redhat.com>
> ---
> hw/s390x/s390-pci-bus.c | 34 +++++++++++++++++++++-------------
> 1 file changed, 21 insertions(+), 13 deletions(-)
>
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index e3e0ebb..e42e1b8 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -692,27 +692,35 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn)
> object_unref(OBJECT(iommu));
> }
>
> -static int s390_pcihost_init(SysBusDevice *dev)
> +static void s390_pcihost_realize(DeviceState *dev, Error **errp)
> {
> PCIBus *b;
> BusState *bus;
> PCIHostState *phb = PCI_HOST_BRIDGE(dev);
> S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
> + Error *local_err = NULL;
>
> DPRINTF("host_init\n");
>
> - b = pci_register_root_bus(DEVICE(dev), NULL,
> - s390_pci_set_irq, s390_pci_map_irq, NULL,
> - get_system_memory(), get_system_io(), 0, 64,
> - TYPE_PCI_BUS);
> + b = pci_register_root_bus(dev, NULL, s390_pci_set_irq, s390_pci_map_irq,
> + NULL, get_system_memory(), get_system_io(), 0,
> + 64, TYPE_PCI_BUS);
> pci_setup_iommu(b, s390_pci_dma_iommu, s);
>
> 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;
>
> - s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
> - qbus_set_hotplug_handler(BUS(s->bus), DEVICE(s), NULL);
> + s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, dev, 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,
> NULL, g_free);
> @@ -722,9 +730,10 @@ static int s390_pcihost_init(SysBusDevice *dev)
> QTAILQ_INIT(&s->zpci_devs);
>
> css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
> - S390_ADAPTER_SUPPRESSIBLE, &error_abort);
> -
> - return 0;
> + S390_ADAPTER_SUPPRESSIBLE, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + }
> }
>
> static int s390_pci_msix_init(S390PCIBusDevice *pbdev)
> @@ -1018,12 +1027,11 @@ static void s390_pcihost_reset(DeviceState *dev)
>
> static void s390_pcihost_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
> DeviceClass *dc = DEVICE_CLASS(klass);
> HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
>
> dc->reset = s390_pcihost_reset;
> - k->init = s390_pcihost_init;
> + dc->realize = s390_pcihost_realize;
> hc->plug = s390_pcihost_hot_plug;
> hc->unplug = s390_pcihost_hot_unplug;
> msi_nonbroken = true;
>
So we really only overwrite sysbus_realize() here, which only does an
init call.
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-04 9:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 7:48 [Qemu-devel] [PATCH] hw/s390x/s390-pci-bus: Convert sysbus init function to realize function Thomas Huth
2018-10-02 19:16 ` Philippe Mathieu-Daudé
2018-10-04 8:53 ` Cornelia Huck
2018-10-04 9:50 ` David Hildenbrand
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.