ppc: convert SysBus init method to a realize method
cover ppc: convert SysBus init method to a realize method
Hello,
Here are a couple of patches converting the SysBus init method to a realize method. make check tested only.
Thanks,
C.
Cédric Le Goater (2):
ppc440_pcix: convert SysBus init method to a realize method
ppc4xx_pci: convert SysBus init method to a realize method
hw/ppc/ppc440_pcix.c | 14 ++++++-------- hw/ppc/ppc4xx_pci.c | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/2 ppc440_pcix: convert SysBus init method to a realize method
--- hw/ppc/ppc440_pcix.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
hw/ppc/ppc440_pcix.c +6 -8
@@ -466,17 +466,18 @@ const MemoryRegionOps ppc440_pcix_host_data_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static int ppc440_pcix_initfn (SysBusDevice *dev) +static void ppc440_pcix_realize (DeviceState *dev,Error **errp) { +SysBusDevice *sbd =SYS_BUS_DEVICE (dev);PPC440PCIXState *s;PCIHostState *h; h =PCI_HOST_BRIDGE (dev); s =PPC440_PCIX_HOST_BRIDGE (dev); -sysbus_init_irq (dev, &s->irq); +sysbus_init_irq (sbd, &s->irq);memory_region_init (&s->busmem,OBJECT (dev),"pci bus memory" ,UINT64_MAX ); - h->bus =pci_register_root_bus (DEVICE (dev),NULL , ppc440_pcix_set_irq, + h->bus =pci_register_root_bus (dev,NULL , ppc440_pcix_set_irq, ppc440_pcix_map_irq, &s->irq, &s->busmem,get_system_io (),PCI_DEVFN (0 ,0 ),1 ,TYPE_PCI_BUS );
@@ -497,17 +498,14 @@ static int ppc440_pcix_initfn(SysBusDevice *dev)memory_region_add_subregion (&s->container,PCIC0_CFGADDR , &h->conf_mem);memory_region_add_subregion (&s->container,PCIC0_CFGDATA , &h->data_mem);memory_region_add_subregion (&s->container,PPC440_REG_BASE , &s->iomem); -sysbus_init_mmio (dev, &s->container); - -return 0 ; +sysbus_init_mmio (sbd, &s->container); }static void ppc440_pcix_class_init (ObjectClass *klass,void *data) { -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->init = ppc440_pcix_initfn; + dc->realize = ppc440_pcix_realize; dc->reset = ppc440_pcix_reset; }
Signature · 1 line
2.17.1
Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/2] ppc440_pcix: convert SysBus init method to a realize method
Quoted 2 lines · On Mon, 1 Oct 2018 13:44:20 +0200 Cédric Le Goater <[email protected]> wrote:
Signed-off-by Cédric Le Goater <[email protected]>---
Quoted 49 lines
hw/ppc/ppc440_pcix.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)hw/ppc/ppc440_pcix.c +6
-8@@ -466,17 +466,18 @@ const MemoryRegionOps ppc440_pcix_host_data_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static int ppc440_pcix_initfn (SysBusDevice *dev) +static void ppc440_pcix_realize (DeviceState *dev,Error **errp) { +SysBusDevice *sbd =SYS_BUS_DEVICE (dev);PPC440PCIXState *s;PCIHostState *h; h =PCI_HOST_BRIDGE (dev); s =PPC440_PCIX_HOST_BRIDGE (dev); -sysbus_init_irq (dev, &s->irq); +sysbus_init_irq (sbd, &s->irq);memory_region_init (&s->busmem,OBJECT (dev),"pci bus memory" ,UINT64_MAX ); - h->bus =pci_register_root_bus (DEVICE (dev),NULL , ppc440_pcix_set_irq, + h->bus =pci_register_root_bus (dev,NULL , ppc440_pcix_set_irq, ppc440_pcix_map_irq, &s->irq, &s->busmem,get_system_io (),PCI_DEVFN (0 ,0 ),1 ,TYPE_PCI_BUS );@@ -497,17 +498,14 @@ static int ppc440_pcix_initfn(SysBusDevice *dev)memory_region_add_subregion (&s->container,PCIC0_CFGADDR , &h->conf_mem);memory_region_add_subregion (&s->container,PCIC0_CFGDATA , &h->data_mem);memory_region_add_subregion (&s->container,PPC440_REG_BASE , &s->iomem); -sysbus_init_mmio (dev, &s->container); - -return 0 ; +sysbus_init_mmio (sbd, &s->container); }static void ppc440_pcix_class_init (ObjectClass *klass,void *data) { -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->init = ppc440_pcix_initfn; + dc->realize = ppc440_pcix_realize; dc->reset = ppc440_pcix_reset; }
Re: [Qemu-devel] [PATCH 1/2] ppc440_pcix: convert SysBus init method to a realize method
In reply to Cédric Le GoaterQuoted 1 line · Cédric Le Goater
Signed-off-by Cédric Le Goater <[email protected]>
Quoted 51 lines
--- hw/ppc/ppc440_pcix.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)hw/ppc/ppc440_pcix.c +6
-8@@ -466,17 +466,18 @@ const MemoryRegionOps ppc440_pcix_host_data_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static int ppc440_pcix_initfn (SysBusDevice *dev) +static void ppc440_pcix_realize (DeviceState *dev,Error **errp) { +SysBusDevice *sbd =SYS_BUS_DEVICE (dev);PPC440PCIXState *s;PCIHostState *h; h =PCI_HOST_BRIDGE (dev); s =PPC440_PCIX_HOST_BRIDGE (dev); -sysbus_init_irq (dev, &s->irq); +sysbus_init_irq (sbd, &s->irq);memory_region_init (&s->busmem,OBJECT (dev),"pci bus memory" ,UINT64_MAX ); - h->bus =pci_register_root_bus (DEVICE (dev),NULL , ppc440_pcix_set_irq, + h->bus =pci_register_root_bus (dev,NULL , ppc440_pcix_set_irq, ppc440_pcix_map_irq, &s->irq, &s->busmem,get_system_io (),PCI_DEVFN (0 ,0 ),1 ,TYPE_PCI_BUS );@@ -497,17 +498,14 @@ static int ppc440_pcix_initfn(SysBusDevice *dev)memory_region_add_subregion (&s->container,PCIC0_CFGADDR , &h->conf_mem);memory_region_add_subregion (&s->container,PCIC0_CFGDATA , &h->data_mem);memory_region_add_subregion (&s->container,PPC440_REG_BASE , &s->iomem); -sysbus_init_mmio (dev, &s->container); - -return 0 ; +sysbus_init_mmio (sbd, &s->container); }static void ppc440_pcix_class_init (ObjectClass *klass,void *data) { -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->init = ppc440_pcix_initfn; + dc->realize = ppc440_pcix_realize; dc->reset = ppc440_pcix_reset; }
PATCH 2/2 ppc4xx_pci: convert SysBus init method to a realize method
In reply to Cédric Le Goater--- hw/ppc/ppc4xx_pci.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
hw/ppc/ppc4xx_pci.c +6 -8
@@ -300,8 +300,9 @@ static const VMStateDescription vmstate_ppc4xx_pci = { };/* XXX Interrupt acknowledge cycles not supported. */ -static int ppc4xx_pcihost_initfn (SysBusDevice *dev) +static void ppc4xx_pcihost_realize (DeviceState *dev,Error **errp) { +SysBusDevice *sbd =SYS_BUS_DEVICE (dev);PPC4xxPCIState *s;PCIHostState *h;PCIBus *b;
@@ -311,10 +312,10 @@ static int ppc4xx_pcihost_initfn(SysBusDevice *dev) s =PPC4xx_PCI_HOST_BRIDGE (dev);for (i =0 ; i <ARRAY_SIZE (s->irq); i++) { -sysbus_init_irq (dev, &s->irq[i]); +sysbus_init_irq (sbd, &s->irq[i]); } - b =pci_register_root_bus (DEVICE (dev),NULL , ppc4xx_pci_set_irq, + b =pci_register_root_bus (dev,NULL , ppc4xx_pci_set_irq, ppc4xx_pci_map_irq, s->irq,get_system_memory (),get_system_io (),0 ,4 ,TYPE_PCI_BUS ); h->bus = b;
@@ -332,10 +333,8 @@ static int ppc4xx_pcihost_initfn(SysBusDevice *dev)memory_region_add_subregion (&s->container,PCIC0_CFGADDR , &h->conf_mem);memory_region_add_subregion (&s->container,PCIC0_CFGDATA , &h->data_mem);memory_region_add_subregion (&s->container,PCI_REG_BASE , &s->iomem); -sysbus_init_mmio (dev, &s->container); +sysbus_init_mmio (sbd, &s->container);qemu_register_reset (ppc4xx_pci_reset, s); - -return 0 ; }static void ppc4xx_host_bridge_class_init (ObjectClass *klass,void *data)
@@ -367,10 +366,9 @@ static const TypeInfo ppc4xx_host_bridge_info = {static void ppc4xx_pcihost_class_init (ObjectClass *klass,void *data) { -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->init = ppc4xx_pcihost_initfn; + dc->realize = ppc4xx_pcihost_realize; dc->vmsd = &vmstate_ppc4xx_pci; }
Signature · 1 line
2.17.1
Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] ppc4xx_pci: convert SysBus init method to a realize method
Quoted 2 lines · On Mon, 1 Oct 2018 13:44:21 +0200 Cédric Le Goater <[email protected]> wrote:
Signed-off-by Cédric Le Goater <[email protected]>---
Quoted 55 lines
hw/ppc/ppc4xx_pci.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)hw/ppc/ppc4xx_pci.c +6
-8@@ -300,8 +300,9 @@ static const VMStateDescription vmstate_ppc4xx_pci = { };/* XXX Interrupt acknowledge cycles not supported. */ -static int ppc4xx_pcihost_initfn (SysBusDevice *dev) +static void ppc4xx_pcihost_realize (DeviceState *dev,Error **errp) { +SysBusDevice *sbd =SYS_BUS_DEVICE (dev);PPC4xxPCIState *s;PCIHostState *h;PCIBus *b;@@ -311,10 +312,10 @@ static int ppc4xx_pcihost_initfn(SysBusDevice *dev) s =PPC4xx_PCI_HOST_BRIDGE (dev);for (i =0 ; i <ARRAY_SIZE (s->irq); i++) { -sysbus_init_irq (dev, &s->irq[i]); +sysbus_init_irq (sbd, &s->irq[i]); } - b =pci_register_root_bus (DEVICE (dev),NULL , ppc4xx_pci_set_irq, + b =pci_register_root_bus (dev,NULL , ppc4xx_pci_set_irq, ppc4xx_pci_map_irq, s->irq,get_system_memory (),get_system_io (),0 ,4 ,TYPE_PCI_BUS ); h->bus = b;@@ -332,10 +333,8 @@ static int ppc4xx_pcihost_initfn(SysBusDevice *dev)memory_region_add_subregion (&s->container,PCIC0_CFGADDR , &h->conf_mem);memory_region_add_subregion (&s->container,PCIC0_CFGDATA , &h->data_mem);memory_region_add_subregion (&s->container,PCI_REG_BASE , &s->iomem); -sysbus_init_mmio (dev, &s->container); +sysbus_init_mmio (sbd, &s->container);qemu_register_reset (ppc4xx_pci_reset, s); - -return 0 ; }static void ppc4xx_host_bridge_class_init (ObjectClass *klass,void *data)@@ -367,10 +366,9 @@ static const TypeInfo ppc4xx_host_bridge_info = {static void ppc4xx_pcihost_class_init (ObjectClass *klass,void *data) { -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->init = ppc4xx_pcihost_initfn; + dc->realize = ppc4xx_pcihost_realize; dc->vmsd = &vmstate_ppc4xx_pci; }
Re: [Qemu-devel] [PATCH 2/2] ppc4xx_pci: convert SysBus init method to a realize method
In reply to Cédric Le GoaterHi Cédric,
Quoted 34 lines · Cédric Le Goater
Signed-off-by Cédric Le Goater <[email protected]>--- hw/ppc/ppc4xx_pci.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)hw/ppc/ppc4xx_pci.c +4
-3@@ -300,8 +300,9 @@ static const VMStateDescription vmstate_ppc4xx_pci = { };/* XXX Interrupt acknowledge cycles not supported. */ -static int ppc4xx_pcihost_initfn (SysBusDevice *dev) +static void ppc4xx_pcihost_realize (DeviceState *dev,Error **errp) { +SysBusDevice *sbd =SYS_BUS_DEVICE (dev);PPC4xxPCIState *s;PCIHostState *h;PCIBus *b;@@ -311,10 +312,10 @@ static int ppc4xx_pcihost_initfn(SysBusDevice *dev) s =PPC4xx_PCI_HOST_BRIDGE (dev);for (i =0 ; i <ARRAY_SIZE (s->irq); i++) { -sysbus_init_irq (dev, &s->irq[i]); +sysbus_init_irq (sbd, &s->irq[i]); } - b =pci_register_root_bus (DEVICE (dev),NULL , ppc4xx_pci_set_irq, + b =pci_register_root_bus (dev,NULL , ppc4xx_pci_set_irq, ppc4xx_pci_map_irq, s->irq,get_system_memory (),get_system_io (),0 ,4 ,TYPE_PCI_BUS ); h->bus = b;
hw/ppc/ppc4xx_pci.c static int ppc4xx_pcihost_initfn(SysBusDevice *dev) · line 337
Quoted 6 lines
hw/ppc/ppc4xx_pci.c +1
-1@@ -332,10 +333,8 @@ static int ppc4xx_pcihost_initfn(SysBusDevice *dev)memory_region_add_subregion (&s->container,PCIC0_CFGADDR , &h->conf_mem);memory_region_add_subregion (&s->container,PCIC0_CFGDATA , &h->data_mem);memory_region_add_subregion (&s->container,PCI_REG_BASE , &s->iomem); -sysbus_init_mmio (dev, &s->container); +sysbus_init_mmio (sbd, &s->container);qemu_register_reset (ppc4xx_pci_reset, s);
While here, can you also convert to DeviceClass::reset()?
Quoted 18 lines
hw/ppc/ppc4xx_pci.c +1
-4- -return 0 ; }static void ppc4xx_host_bridge_class_init (ObjectClass *klass,void *data)@@ -367,10 +366,9 @@ static const TypeInfo ppc4xx_host_bridge_info = {static void ppc4xx_pcihost_class_init (ObjectClass *klass,void *data) { -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - k->init = ppc4xx_pcihost_initfn; + dc->realize = ppc4xx_pcihost_realize; dc->vmsd = &vmstate_ppc4xx_pci; }
David Gibson
AppliedQuoted 4 lines · Cédric Le Goater
Hello,
Here are a couple of patches converting the SysBus init method to a realize method. make check tested only.
Applied to ppc-for-3.1, thanks.
Quoted 14 lines
Thanks,
C.
Cédric Le Goater (2):
ppc440_pcix: convert SysBus init method to a realize method
ppc4xx_pci: convert SysBus init method to a realize methodhw/ppc/ppc440_pcix.c | 14 ++++++-------- hw/ppc/ppc4xx_pci.c | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-)
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson