Skip to contentSkip to conversation

another SysBusDevice::init to Device::realize cleanup

PATCH In review Philippe Mathieu-Daudé 4 participants 17 messages Oct 2, 2018 – Oct 9, 2018 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

v2 cover another SysBusDevice::init to Device::realize cleanup

Peter suggested [1] another crusade for this merge window, then Cédric jumped on his horse [2]. My turn on my dromedary.

since v1:
- let the empty_slot
- sh4_pci and bonito use DeviceState::realize instead of PCIDevice::realize
- reword niagara-iob commit message

v1: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg00220.html
- convert few devices to DeviceState::realize,
- kill the empty_slot device,
- remove unuseful class_init() code [RFC, do we want to keep this?]
- few other minor fixes catched while editing

Regards,

Phil.

[1] https://lists.gnu.org/archive/html/qemu-devel/2018-09/msg03605.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg00001.html

001/12:[----] [--] 'trace-events: Fix copy/paste typo'
002/12:[----] [--] 'hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events' 003/12:[----] [--] 'hw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init' 004/12:[----] [--] 'hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init' 005/12:[0006] [FC] 'hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init' 006/12:[0006] [FC] 'hw/pci-host/bonito: Use DeviceState::realize rather than SysBusDevice::init' 007/12:[----] [--] 'hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method' 008/12:[----] [--] 'hw/mips/gt64xxx_pci: Mark as bridge device'
009/12:[----] [--] 'hw/sparc64/niagara: Model the I/O Bridge with the 'unimplemented_device'' 010/12:[----] [--] 'hw/alpha/typhoon: Remove unuseful code'
011/12:[----] [--] 'hw/hppa/dino: Remove unuseful code'
012/12:[----] [--] 'hw/mips/malta: Remove unuseful code'

Philippe Mathieu-Daudé (12):
trace-events: Fix copy/paste typo
hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events hw/timer/sun4v-rtc: Use DeviceState::realize rather than
SysBusDevice::init
hw/ssi/xilinx_spi: Use DeviceState::realize rather than
SysBusDevice::init
hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init hw/pci-host/bonito: Use DeviceState::realize rather than
SysBusDevice::init
hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device
reset method
hw/mips/gt64xxx_pci: Mark as bridge device hw/sparc64/niagara: Model the I/O Bridge with the
'unimplemented_device'
hw/alpha/typhoon: Remove unuseful code
hw/hppa/dino: Remove unuseful code
hw/mips/malta: Remove unuseful code

 default-configs/sparc64-softmmu.mak |  1 -
 hw/alpha/typhoon.c                  | 13 -------------
 hw/hppa/dino.c                      |  7 -------
 hw/mips/gt64xxx_pci.c               | 18 ++++--------------
 hw/mips/mips_malta.c                | 13 -------------
 hw/pci-host/bonito.c                |  9 +++------
 hw/sh4/sh_pci.c                     | 20 +++++++++-----------
 hw/sparc64/niagara.c                |  4 ++--
 hw/ssi/xilinx_spi.c                 |  9 +++------
 hw/timer/sun4v-rtc.c                | 23 ++++++++---------------
 hw/timer/trace-events               |  6 +++++-
 11 files changed, 34 insertions(+), 89 deletions(-)
Signature · 1 line
2.19.0
#1 lore raw

PATCH v2 1/12 trace-events: Fix copy/paste typo

Missed while reviewing 5dd85b4b486.

---
 hw/timer/trace-events | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/timer/trace-events +1 -1
index fa4213df5b..ca9ad6321a 100644
@@ -56,7 +56,7 @@ systick_timer_tick(void) "systick reload"
 systick_read(uint64_t addr, uint32_t value, unsigned size) "systick read addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u"
 systick_write(uint64_t addr, uint32_t value, unsigned size) "systick write addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u"
 
-# hw/char/cmsdk_apb_timer.c
+# hw/timer/cmsdk_apb_timer.c
 cmsdk_apb_timer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB timer read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
 cmsdk_apb_timer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB timer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
 cmsdk_apb_timer_reset(void) "CMSDK APB timer: reset"
Signature · 1 line
2.19.0
#2 lore raw

PATCH v2 2/12 hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events

In reply to Philippe Mathieu-Daudé
---
 hw/timer/sun4v-rtc.c  | 13 +++----------
 hw/timer/trace-events |  4 ++++
 2 files changed, 7 insertions(+), 10 deletions(-)
hw/timer/sun4v-rtc.c +3 -10
index 310523225f..13be94f8da 100644
@@ -14,15 +14,8 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "hw/timer/sun4v-rtc.h"
+#include "trace.h"
 
-//#define DEBUG_SUN4V_RTC
-
-#ifdef DEBUG_SUN4V_RTC
-#define DPRINTF(fmt, ...)                                       \
-    do { printf("sun4v_rtc: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
-#endif
 
 #define TYPE_SUN4V_RTC "sun4v_rtc"
 #define SUN4V_RTC(obj) OBJECT_CHECK(Sun4vRtc, (obj), TYPE_SUN4V_RTC)
@@ -41,14 +34,14 @@ static uint64_t sun4v_rtc_read(void *opaque, hwaddr addr,
         /* accessing the high 32 bits */
         val >>= 32;
     }
-    DPRINTF("read from " TARGET_FMT_plx " val %lx\n", addr, val);
+    trace_sun4v_rtc_read(addr, val);
     return val;
 }
 
 static void sun4v_rtc_write(void *opaque, hwaddr addr,
                              uint64_t val, unsigned size)
 {
-    DPRINTF("write 0x%x to " TARGET_FMT_plx "\n", (unsigned)val, addr);
+    trace_sun4v_rtc_read(addr, val);
 }
 
 static const MemoryRegionOps sun4v_rtc_ops = {
hw/timer/trace-events +4 -0
index ca9ad6321a..75bd3b1042 100644
@@ -66,5 +66,9 @@ cmsdk_apb_dualtimer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK A
 cmsdk_apb_dualtimer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
 cmsdk_apb_dualtimer_reset(void) "CMSDK APB dualtimer: reset"
 
+# hw/timer/sun4v-rtc.c
+sun4v_rtc_read(uint64_t addr, uint64_t value) "read: addr 0x%" PRIx64 " value 0x%" PRIx64
+sun4v_rtc_write(uint64_t addr, uint64_t value) "write: addr 0x%" PRIx64 " value 0x%" PRIx64
+
 # hw/timer/xlnx-zynqmp-rtc.c
 xlnx_zynqmp_rtc_gettime(int year, int month, int day, int hour, int min, int sec) "Get time from host: %d-%d-%d %2d:%02d:%02d"
Signature · 1 line
2.19.0
#3 lore raw

PATCH v2 3/12 hw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init

In reply to Philippe Mathieu-Daudé

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

---
 hw/timer/sun4v-rtc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
hw/timer/sun4v-rtc.c +5 -5
index 13be94f8da..4e7f6a1eff 100644
@@ -63,21 +63,21 @@ void sun4v_rtc_init(hwaddr addr)
     sysbus_mmio_map(s, 0, addr);
 }
 
-static int sun4v_rtc_init1(SysBusDevice *dev)
+static void sun4v_rtc_realize(DeviceState *dev, Error **errp)
 {
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
     Sun4vRtc *s = SUN4V_RTC(dev);
 
     memory_region_init_io(&s->iomem, OBJECT(s), &sun4v_rtc_ops, s,
                           "sun4v-rtc", 0x08ULL);
-    sysbus_init_mmio(dev, &s->iomem);
-    return 0;
+    sysbus_init_mmio(sbd, &s->iomem);
 }
 
 static void sun4v_rtc_class_init(ObjectClass *klass, void *data)
 {
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
 
-    k->init = sun4v_rtc_init1;
+    dc->realize = sun4v_rtc_realize;
 }
 
 static const TypeInfo sun4v_rtc_info = {
Signature · 1 line
2.19.0
#4 lore raw

PATCH v2 4/12 hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init

In reply to Philippe Mathieu-Daudé

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

---
 hw/ssi/xilinx_spi.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
hw/ssi/xilinx_spi.c +3 -6
index 83585bc8b2..3dae303d5b 100644
@@ -319,9 +319,9 @@ static const MemoryRegionOps spi_ops = {
     }
 };
 
-static int xilinx_spi_init(SysBusDevice *sbd)
+static void xilinx_spi_realize(DeviceState *dev, Error **errp)
 {
-    DeviceState *dev = DEVICE(sbd);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
     XilinxSPI *s = XILINX_SPI(dev);
     int i;
 
@@ -344,8 +344,6 @@ static int xilinx_spi_init(SysBusDevice *sbd)
 
     fifo8_create(&s->tx_fifo, FIFO_CAPACITY);
     fifo8_create(&s->rx_fifo, FIFO_CAPACITY);
-
-    return 0;
 }
 
 static const VMStateDescription vmstate_xilinx_spi = {
@@ -368,9 +366,8 @@ static Property xilinx_spi_properties[] = {
 static void xilinx_spi_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = xilinx_spi_init;
+    dc->realize = xilinx_spi_realize;
     dc->reset = xlx_spi_reset;
     dc->props = xilinx_spi_properties;
     dc->vmsd = &vmstate_xilinx_spi;
Signature · 1 line
2.19.0
#5 lore raw

PATCH v2 5/12 hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init

In reply to Philippe Mathieu-Daudé

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

---
 hw/sh4/sh_pci.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
hw/sh4/sh_pci.c +9 -11
index 4ec2e35500..379d0685ed 100644
@@ -120,16 +120,15 @@ static void sh_pci_set_irq(void *opaque, int irq_num, int level)
     qemu_set_irq(pic[irq_num], level);
 }
 
-static int sh_pci_device_init(SysBusDevice *dev)
+static void sh_pci_device_realize(DeviceState *dev, Error **errp)
 {
-    PCIHostState *phb;
-    SHPCIState *s;
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+    SHPCIState *s = SH_PCI_HOST_BRIDGE(dev);
+    PCIHostState *phb = PCI_HOST_BRIDGE(s);
     int i;
 
-    s = SH_PCI_HOST_BRIDGE(dev);
-    phb = PCI_HOST_BRIDGE(s);
     for (i = 0; i < 4; i++) {
-        sysbus_init_irq(dev, &s->irq[i]);
+        sysbus_init_irq(sbd, &s->irq[i]);
     }
     phb->bus = pci_register_root_bus(DEVICE(dev), "pci",
                                      sh_pci_set_irq, sh_pci_map_irq,
@@ -143,13 +142,12 @@ static int sh_pci_device_init(SysBusDevice *dev)
                              &s->memconfig_p4, 0, 0x224);
     memory_region_init_alias(&s->isa, OBJECT(s), "sh_pci.isa",
                              get_system_io(), 0, 0x40000);
-    sysbus_init_mmio(dev, &s->memconfig_p4);
-    sysbus_init_mmio(dev, &s->memconfig_a7);
+    sysbus_init_mmio(sbd, &s->memconfig_p4);
+    sysbus_init_mmio(sbd, &s->memconfig_a7);
     s->iobr = 0xfe240000;
     memory_region_add_subregion(get_system_memory(), s->iobr, &s->isa);
 
     s->dev = pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "sh_pci_host");
-    return 0;
 }
 
 static void sh_pci_host_realize(PCIDevice *d, Error **errp)
@@ -187,9 +185,9 @@ static const TypeInfo sh_pci_host_info = {
 
 static void sh_pci_device_class_init(ObjectClass *klass, void *data)
 {
-    SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
 
-    sdc->init = sh_pci_device_init;
+    dc->realize = sh_pci_device_realize;
 }
 
 static const TypeInfo sh_pci_device_info = {
Signature · 1 line
2.19.0
Reviewed-by on v2 5/12
#6 lore raw

Re: [Qemu-devel] [PATCH v2 05/12] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init

Quoted 52 lines · Philippe Mathieu-Daudé

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

---
 hw/sh4/sh_pci.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
hw/sh4/sh_pci.c +7 -9
index 4ec2e35500..379d0685ed 100644
@@ -120,16 +120,15 @@ static void sh_pci_set_irq(void *opaque, int irq_num, int level)
     qemu_set_irq(pic[irq_num], level);
 }
 
-static int sh_pci_device_init(SysBusDevice *dev)
+static void sh_pci_device_realize(DeviceState *dev, Error **errp)
 {
-    PCIHostState *phb;
-    SHPCIState *s;
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+    SHPCIState *s = SH_PCI_HOST_BRIDGE(dev);
+    PCIHostState *phb = PCI_HOST_BRIDGE(s);
     int i;
 
-    s = SH_PCI_HOST_BRIDGE(dev);
-    phb = PCI_HOST_BRIDGE(s);
     for (i = 0; i < 4; i++) {
-        sysbus_init_irq(dev, &s->irq[i]);
+        sysbus_init_irq(sbd, &s->irq[i]);
     }
     phb->bus = pci_register_root_bus(DEVICE(dev), "pci",
                                      sh_pci_set_irq, sh_pci_map_irq,
@@ -143,13 +142,12 @@ static int sh_pci_device_init(SysBusDevice *dev)
                              &s->memconfig_p4, 0, 0x224);
     memory_region_init_alias(&s->isa, OBJECT(s), "sh_pci.isa",
                              get_system_io(), 0, 0x40000);
-    sysbus_init_mmio(dev, &s->memconfig_p4);
-    sysbus_init_mmio(dev, &s->memconfig_a7);
+    sysbus_init_mmio(sbd, &s->memconfig_p4);
+    sysbus_init_mmio(sbd, &s->memconfig_a7);
     s->iobr = 0xfe240000;
     memory_region_add_subregion(get_system_memory(), s->iobr, &s->isa);
 
     s->dev = pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "sh_pci_host");
-    return 0;
 }
 
 static void sh_pci_host_realize(PCIDevice *d, Error **errp)
@@ -187,9 +185,9 @@ static const TypeInfo sh_pci_host_info = {
 
 static void sh_pci_device_class_init(ObjectClass *klass, void *data)

hw/sh4/sh_pci.c static const TypeInfo sh_pci_host_info = {

Quoted 10 lines
hw/sh4/sh_pci.c +2 -3
 {
-    SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
 
-    sdc->init = sh_pci_device_init;
+    dc->realize = sh_pci_device_realize;
 }
 
 static const TypeInfo sh_pci_device_info = {
--

thanks
-- PMM

#7 lore raw

PATCH v2 6/12 hw/pci-host/bonito: Use DeviceState::realize rather than SysBusDevice::init

In reply to Philippe Mathieu-Daudé

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

---
 hw/pci-host/bonito.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
hw/pci-host/bonito.c +3 -6
index 9868e2eccc..9f33582706 100644
@@ -595,7 +595,7 @@ static const VMStateDescription vmstate_bonito = {
     }
 };
 
-static int bonito_pcihost_initfn(SysBusDevice *dev)
+static void bonito_pcihost_realize(DeviceState *dev, Error **errp)
 {
     PCIHostState *phb = PCI_HOST_BRIDGE(dev);
 
@@ -603,8 +603,6 @@ static int bonito_pcihost_initfn(SysBusDevice *dev)
                                      pci_bonito_set_irq, pci_bonito_map_irq,
                                      dev, get_system_memory(), get_system_io(),
                                      0x28, 32, TYPE_PCI_BUS);
-
-    return 0;
 }
 
 static void bonito_realize(PCIDevice *dev, Error **errp)
@@ -684,7 +682,6 @@ PCIBus *bonito_init(qemu_irq *pic)
     pcihost->pic = pic;
     qdev_init_nofail(dev);
 
-    /* set the pcihost pointer before bonito_initfn is called */
     d = pci_create(phb->bus, PCI_DEVFN(0, 0), TYPE_PCI_BONITO);
     s = PCI_BONITO(d);
     s->pcihost = pcihost;
@@ -726,9 +723,9 @@ static const TypeInfo bonito_info = {
 
 static void bonito_pcihost_class_init(ObjectClass *klass, void *data)
 {
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
 
-    k->init = bonito_pcihost_initfn;
+    dc->realize = bonito_pcihost_realize;
 }
 
 static const TypeInfo bonito_pcihost_info = {
Signature · 1 line
2.19.0
Reviewed-by on v2 6/12
#8 lore raw

Re: [Qemu-devel] [PATCH v2 06/12] hw/pci-host/bonito: Use DeviceState::realize rather than SysBusDevice::init

Quoted 40 lines · Philippe Mathieu-Daudé

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

---
 hw/pci-host/bonito.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
hw/pci-host/bonito.c +1 -4
index 9868e2eccc..9f33582706 100644
@@ -595,7 +595,7 @@ static const VMStateDescription vmstate_bonito = {
     }
 };
 
-static int bonito_pcihost_initfn(SysBusDevice *dev)
+static void bonito_pcihost_realize(DeviceState *dev, Error **errp)
 {
     PCIHostState *phb = PCI_HOST_BRIDGE(dev);
 
@@ -603,8 +603,6 @@ static int bonito_pcihost_initfn(SysBusDevice *dev)
                                      pci_bonito_set_irq, pci_bonito_map_irq,
                                      dev, get_system_memory(), get_system_io(),
                                      0x28, 32, TYPE_PCI_BUS);
-
-    return 0;
 }
 
 static void bonito_realize(PCIDevice *dev, Error **errp)
@@ -684,7 +682,6 @@ PCIBus *bonito_init(qemu_irq *pic)
     pcihost->pic = pic;
     qdev_init_nofail(dev);
 
-    /* set the pcihost pointer before bonito_initfn is called */
     d = pci_create(phb->bus, PCI_DEVFN(0, 0), TYPE_PCI_BONITO);
     s = PCI_BONITO(d);
     s->pcihost = pcihost;
@@ -726,9 +723,9 @@ static const TypeInfo bonito_info = {
 
 static void bonito_pcihost_class_init(ObjectClass *klass, void *data)

hw/pci-host/bonito.c static const TypeInfo bonito_info = {

Quoted 10 lines
hw/pci-host/bonito.c +2 -3
 {
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
 
-    k->init = bonito_pcihost_initfn;
+    dc->realize = bonito_pcihost_realize;
 }
 
 static const TypeInfo bonito_pcihost_info = {
--

thanks
-- PMM

#9 lore raw

PATCH v2 7/12 hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method

In reply to Philippe Mathieu-Daudé

Convert the gt64120_reset() function into a proper Device reset method.

---
 hw/mips/gt64xxx_pci.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
hw/mips/gt64xxx_pci.c +3 -14
index 24ad0ad024..dcd1a66329 100644
@@ -992,9 +992,9 @@ static void gt64120_pci_set_irq(void *opaque, int irq_num, int level)
 }
 
 
-static void gt64120_reset(void *opaque)
+static void gt64120_reset(DeviceState *dev)
 {
-    GT64120State *s = opaque;
+    GT64120State *s = GT64120_PCI_HOST_BRIDGE(dev);
 
     /* FIXME: Malta specific hw assumptions ahead */
 
@@ -1184,16 +1184,6 @@ PCIBus *gt64120_register(qemu_irq *pic)
     return phb->bus;
 }
 
-static int gt64120_init(SysBusDevice *dev)
-{
-    GT64120State *s;
-
-    s = GT64120_PCI_HOST_BRIDGE(dev);
-
-    qemu_register_reset(gt64120_reset, s);
-    return 0;
-}
-
 static void gt64120_pci_realize(PCIDevice *d, Error **errp)
 {
     /* FIXME: Malta specific hw assumptions ahead */
@@ -1241,9 +1231,8 @@ static const TypeInfo gt64120_pci_info = {
 static void gt64120_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
 
-    sdc->init = gt64120_init;
+    dc->reset = gt64120_reset;
     dc->vmsd = &vmstate_gt64120;
 }
 
Signature · 1 line
2.19.0
#10 lore raw

PATCH v2 8/12 hw/mips/gt64xxx_pci: Mark as bridge device

In reply to Philippe Mathieu-Daudé

The gt64120 is currently listed as uncategorized device. Mark it as bridge device.

---
 hw/mips/gt64xxx_pci.c | 1 +
 1 file changed, 1 insertion(+)
hw/mips/gt64xxx_pci.c +1 -0
index dcd1a66329..1cd8aac658 100644
@@ -1232,6 +1232,7 @@ static void gt64120_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
+    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
     dc->reset = gt64120_reset;
     dc->vmsd = &vmstate_gt64120;
 }
Signature · 1 line
2.19.0
#11 lore raw

PATCH v2 9/12 hw/sparc64/niagara: Model the I/O Bridge with the 'unimplemented_device'

In reply to Philippe Mathieu-Daudé

Since the I/O Bridge device is not implemented, Use the TYPE_UNIMPLEMENTED_DEVICE which suits better: if the user asks for 'unimp' warnings via the -d option then all accesses will generate logging.

---
 default-configs/sparc64-softmmu.mak | 1 -
 hw/sparc64/niagara.c                | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)
default-configs/sparc64-softmmu.mak +0 -1
index 52edafe547..ce63d47046 100644
@@ -16,5 +16,4 @@ CONFIG_SIMBA=y
 CONFIG_SUNHME=y
 CONFIG_MC146818RTC=y
 CONFIG_ISA_TESTDEV=y
-CONFIG_EMPTY_SLOT=y
 CONFIG_SUN4V_RTC=y
hw/sparc64/niagara.c +2 -2
index 4fa8cb2904..f8a856f611 100644
@@ -29,7 +29,7 @@
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "hw/char/serial.h"
-#include "hw/empty_slot.h"
+#include "hw/misc/unimp.h"
 #include "hw/loader.h"
 #include "hw/sparc/sparc64.h"
 #include "hw/timer/sun4v-rtc.h"
@@ -161,7 +161,7 @@ static void niagara_init(MachineState *machine)
         serial_mm_init(sysmem, NIAGARA_UART_BASE, 0, NULL, 115200,
                        serial_hd(0), DEVICE_BIG_ENDIAN);
     }
-    empty_slot_init(NIAGARA_IOBBASE, NIAGARA_IOBSIZE);
+    create_unimplemented_device("sun4v-iob", NIAGARA_IOBBASE, NIAGARA_IOBSIZE);
     sun4v_rtc_init(NIAGARA_RTC_BASE);
 }
 
Signature · 1 line
2.19.0
#12 lore raw

PATCH v2 10/12 hw/alpha/typhoon: Remove unuseful code

In reply to Philippe Mathieu-Daudé
---
 hw/alpha/typhoon.c | 13 -------------
 1 file changed, 13 deletions(-)
hw/alpha/typhoon.c +0 -13
index d74b5b55e1..8004afe45b 100644
@@ -932,23 +932,10 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
     return b;
 }
 
-static int typhoon_pcihost_init(SysBusDevice *dev)
-{
-    return 0;
-}
-
-static void typhoon_pcihost_class_init(ObjectClass *klass, void *data)
-{
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
-
-    k->init = typhoon_pcihost_init;
-}
-
 static const TypeInfo typhoon_pcihost_info = {
     .name          = TYPE_TYPHOON_PCI_HOST_BRIDGE,
     .parent        = TYPE_PCI_HOST_BRIDGE,
     .instance_size = sizeof(TyphoonState),
-    .class_init    = typhoon_pcihost_class_init,
 };
 
 static void typhoon_iommu_memory_region_class_init(ObjectClass *klass,
Signature · 1 line
2.19.0
#13 lore raw

PATCH v2 11/12 hw/hppa/dino: Remove unuseful code

In reply to Philippe Mathieu-Daudé
---
 hw/hppa/dino.c | 7 -------
 1 file changed, 7 deletions(-)
hw/hppa/dino.c +0 -7
index 564b938e3a..31e09942b5 100644
@@ -488,17 +488,10 @@ PCIBus *dino_init(MemoryRegion *addr_space,
     return b;
 }
 
-static int dino_pcihost_init(SysBusDevice *dev)
-{
-    return 0;
-}
-
 static void dino_pcihost_class_init(ObjectClass *klass, void *data)
 {
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
     DeviceClass *dc = DEVICE_CLASS(klass);
 
-    k->init = dino_pcihost_init;
     dc->vmsd = &vmstate_dino;
 }
 
Signature · 1 line
2.19.0
#14 lore raw

PATCH v2 12/12 hw/mips/malta: Remove unuseful code

In reply to Philippe Mathieu-Daudé
---
 hw/mips/mips_malta.c | 13 -------------
 1 file changed, 13 deletions(-)
hw/mips/mips_malta.c +0 -13
index 40041d5ec0..89ca6db94b 100644
@@ -1422,23 +1422,10 @@ void mips_malta_init(MachineState *machine)
     pci_vga_init(pci_bus);
 }
 
-static int mips_malta_sysbus_device_init(SysBusDevice *sysbusdev)
-{
-    return 0;
-}
-
-static void mips_malta_class_init(ObjectClass *klass, void *data)
-{
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
-
-    k->init = mips_malta_sysbus_device_init;
-}
-
 static const TypeInfo mips_malta_device = {
     .name          = TYPE_MIPS_MALTA,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(MaltaState),
-    .class_init    = mips_malta_class_init,
 };
 
 static void mips_malta_machine_init(MachineClass *mc)
Signature · 1 line
2.19.0
#15 lore raw
In reply to Philippe Mathieu-Daudé

Hi Eduardo,

Quoted 21 lines · Philippe Mathieu-Daudé

Peter suggested [1] another crusade for this merge window, then Cédric jumped on his horse [2]. My turn on my dromedary.

since v1:
- let the empty_slot
- sh4_pci and bonito use DeviceState::realize instead of PCIDevice::realize
- reword niagara-iob commit message

v1: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg00220.html
- convert few devices to DeviceState::realize,
- kill the empty_slot device,
- remove unuseful class_init() code [RFC, do we want to keep this?]
- few other minor fixes catched while editing

Regards,

Phil.

[1] https://lists.gnu.org/archive/html/qemu-devel/2018-09/msg03605.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg00001.html

Quoted 12 lines

001/12:[----] [--] 'trace-events: Fix copy/paste typo'
002/12:[----] [--] 'hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events' 003/12:[----] [--] 'hw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init' 004/12:[----] [--] 'hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init' 005/12:[0006] [FC] 'hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init' 006/12:[0006] [FC] 'hw/pci-host/bonito: Use DeviceState::realize rather than SysBusDevice::init' 007/12:[----] [--] 'hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method' 008/12:[----] [--] 'hw/mips/gt64xxx_pci: Mark as bridge device'
009/12:[----] [--] 'hw/sparc64/niagara: Model the I/O Bridge with the 'unimplemented_device'' 010/12:[----] [--] 'hw/alpha/typhoon: Remove unuseful code'
011/12:[----] [--] 'hw/hppa/dino: Remove unuseful code'
012/12:[----] [--] 'hw/mips/malta: Remove unuseful code'

Can you take this via your machine-next tree?

Thanks,

Phil.

#16 lore raw
Quoted 37 lines · Philippe Mathieu-Daudé

Hi Eduardo,

Quoted 21 lines · Philippe Mathieu-Daudé

Peter suggested [1] another crusade for this merge window, then Cédric jumped on his horse [2]. My turn on my dromedary.

since v1:
- let the empty_slot
- sh4_pci and bonito use DeviceState::realize instead of PCIDevice::realize
- reword niagara-iob commit message

v1: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg00220.html
- convert few devices to DeviceState::realize,
- kill the empty_slot device,
- remove unuseful class_init() code [RFC, do we want to keep this?]
- few other minor fixes catched while editing

Regards,

Phil.

[1] https://lists.gnu.org/archive/html/qemu-devel/2018-09/msg03605.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg00001.html

Quoted 12 lines

001/12:[----] [--] 'trace-events: Fix copy/paste typo'
002/12:[----] [--] 'hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events' 003/12:[----] [--] 'hw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init' 004/12:[----] [--] 'hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init' 005/12:[0006] [FC] 'hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init' 006/12:[0006] [FC] 'hw/pci-host/bonito: Use DeviceState::realize rather than SysBusDevice::init' 007/12:[----] [--] 'hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method' 008/12:[----] [--] 'hw/mips/gt64xxx_pci: Mark as bridge device'
009/12:[----] [--] 'hw/sparc64/niagara: Model the I/O Bridge with the 'unimplemented_device'' 010/12:[----] [--] 'hw/alpha/typhoon: Remove unuseful code'
011/12:[----] [--] 'hw/hppa/dino: Remove unuseful code'
012/12:[----] [--] 'hw/mips/malta: Remove unuseful code'

Quoted 1 line

Can you take this via your machine-next tree?

I'll do it. Thanks!

Signature · 1 line
Eduardo