another SysBusDevice::init to Device::realize cleanup
PATCH 6/15 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
@@ -595,7 +595,7 @@ static const VMStateDescription vmstate_bonito = { } }; -static int bonito_pcihost_initfn (SysBusDevice *dev) +static void bonito_pcihost_realize (PCIDevice *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); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); - k->init = bonito_pcihost_initfn; + k->realize = bonito_pcihost_realize; }static const TypeInfo bonito_pcihost_info = {
Signature · 1 line
2.19.0
RFC PATCH 14/15 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
@@ -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
PATCH 11/15 hw/sparc/sun4m: Replace 'empty_slot' by 'unimplemented_device'
In reply to Philippe Mathieu-DaudéThe TYPE_EMPTY_SLOT and TYPE_UNIMPLEMENTED_DEVICE are identical devices, however the later use more recent APIs and is more widely used.
Replace 'empty_slot' by 'unimplemented_device' to simplify devices code maintenance.
--- default-configs/sparc-softmmu.mak | 1 - hw/sparc/sun4m.c | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-)
default-configs/sparc-softmmu.mak +0 -1
@@ -8,7 +8,6 @@ CONFIG_ESCC=y CONFIG_M48T59=y CONFIG_PTIMER=y CONFIG_FDC=y -CONFIG_EMPTY_SLOT=y CONFIG_PCNET_COMMON=y CONFIG_LANCE=y CONFIG_TCX=y
hw/sparc/sun4m.c +14 -10
@@ -42,7 +42,7 @@#include "hw/nvram/chrp_nvram.h" #include "hw/nvram/fw_cfg.h" #include "hw/char/escc.h" -#include "hw/empty_slot.h" +#include "hw/misc/unimp.h" #include "hw/loader.h" #include "elf.h" #include "trace.h"
@@ -863,7 +863,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,ram_init (0 , machine->ram_size, hwdef->max_mem);/* models without ECC don't trap when missing ram is accessed */ if (!hwdef->ecc_base) { -empty_slot_init (machine->ram_size, hwdef->max_mem - machine->ram_size); +create_unimplemented_device ("ecc" , machine->ram_size, + hwdef->max_mem - machine->ram_size); }prom_init (hwdef->slavio_base, bios_name);
@@ -892,9 +893,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,if (hwdef->iommu_pad_base) {/* On the real hardware (SS-5, LX) the MMU is not padded, but aliased. Software shouldn't use aliased addresses, neither should it crash -when does. Using empty_slot instead of aliasing can help with -debugging such accesses */ -empty_slot_init (hwdef->iommu_pad_base,hwdef->iommu_pad_len); +when does. Using the 'unimplemented device' instead of aliasing can +help with debugging such accesses */ +create_unimplemented_device ("iommu.alias" , hwdef->iommu_pad_base, + hwdef->iommu_pad_len); } sparc32_dma_init(hwdef->dma_base,
@@ -944,12 +946,13 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,for (i = num_vsimms; i <MAX_VSIMMS ; i++) {/* vsimm registers probed by OBP */ if (hwdef->vsimm[i].reg_base) { -empty_slot_init (hwdef->vsimm[i].reg_base,0x2000 ); +create_unimplemented_device ("vsimm" , hwdef->vsimm[i].reg_base, +0x2000 ); } }if (hwdef->sx_base) { -empty_slot_init (hwdef->sx_base,0x2000 ); +create_unimplemented_device ("sx" , hwdef->sx_base,0x2000 ); } nvram =m48t59_init (slavio_irq[0 ], hwdef->nvram_base,0 ,0x2000 ,1968 ,8 );
@@ -1012,14 +1015,15 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,if (hwdef->dbri_base) {/* ISDN chip with attached CS4215 audio codec */ /* prom space */ -empty_slot_init (hwdef->dbri_base+0x1000 ,0x30 ); +create_unimplemented_device ("dbri.prom" , hwdef->dbri_base +0x1000 , +0x30 );/* reg space */ -empty_slot_init (hwdef->dbri_base+0x10000 ,0x100 ); +create_unimplemented_device ("dbri" , hwdef->dbri_base +0x10000 ,0x100 ); }if (hwdef->bpp_base) {/* parallel port */ -empty_slot_init (hwdef->bpp_base,0x20 ); +create_unimplemented_device ("bpp" , hwdef->bpp_base,0x20 ); } kernel_size = sun4m_load_kernel(machine->kernel_filename,
Signature · 1 line
2.19.0
PATCH 12/15 hw/core: Remove the 'empty_slot' device
In reply to Philippe Mathieu-DaudéAll previous users of TYPE_EMPTY_SLOT now use TYPE_UNIMPLEMENTED_DEVICE.
Since TYPE_EMPTY_SLOT is no more used/referenced, remove it.
--- include/hw/empty_slot.h | 7 --- hw/core/empty_slot.c | 103 ---------------------------------------- hw/core/Makefile.objs | 1 - 3 files changed, 111 deletions(-) delete mode 100644 include/hw/empty_slot.h delete mode 100644 hw/core/empty_slot.c
include/hw/empty_slot.h deleted +0 -7
@@ -1,7 +0,0 @@ -#ifndef HW_EMPTY_SLOT_H -#define HW_EMPTY_SLOT_H - -/* empty_slot.c */ -void empty_slot_init (hwaddr addr,uint64_t slot_size); - -#endif
hw/core/empty_slot.c deleted +0 -103
103 lines not on this page · raw message
hw/core/Makefile.objs +0 -1
@@ -8,7 +8,6 @@ common-obj-y += irq.o common-obj-y += hotplug.o common-obj-$(CONFIG_SOFTMMU) += nmi.o -common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o common-obj-$(CONFIG_XILINX_AXI) += stream.o common-obj-$(CONFIG_PTIMER) += ptimer.o common-obj-$(CONFIG_SOFTMMU) += sysbus.o
Signature · 1 line
2.19.0
RFC PATCH 15/15 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
@@ -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
PATCH 8/15 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
@@ -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
RFC PATCH 13/15 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
@@ -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
PATCH 7/15 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
@@ -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
PATCH 9/15 hw/mips/malta: Replace 'empty_slot' by 'unimplemented_device'
In reply to Philippe Mathieu-DaudéThe TYPE_EMPTY_SLOT and TYPE_UNIMPLEMENTED_DEVICE are identical devices, however the later use more recent APIs and is more widely used.
Replace 'empty_slot' by 'unimplemented_device' to simplify devices code maintenance.
--- default-configs/mips-softmmu-common.mak | 1 - hw/mips/mips_malta.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
default-configs/mips-softmmu-common.mak +0 -1
@@ -32,7 +32,6 @@ CONFIG_PFLASH_CFI01=y CONFIG_I8259=y CONFIG_MC146818RTC=y CONFIG_ISA_TESTDEV=y -CONFIG_EMPTY_SLOT=y CONFIG_MIPS_CPS=y CONFIG_MIPS_ITU=y CONFIG_I2C=y
hw/mips/mips_malta.c +2 -2
@@ -53,7 +53,7 @@#include "sysemu/qtest.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "hw/empty_slot.h" +#include "hw/misc/unimp.h" #include "sysemu/kvm.h" #include "exec/semihost.h" #include "hw/mips/cps.h"
@@ -1216,7 +1216,7 @@ void mips_malta_init(MachineState *machine)/* The whole address space decoded by the GT-64120A doesn't generate exception when accessing invalid memory. Create an empty slot to emulate this feature. */ -empty_slot_init (0 ,0x20000000 ); +create_unimplemented_device ("gt64120-SysAD" ,0 ,0x20000000 );qdev_init_nofail (dev);
Signature · 1 line
2.19.0
PATCH 10/15 hw/sparc64/niagara: Replace 'empty_slot' by 'unimplemented_device'
In reply to Philippe Mathieu-DaudéThe TYPE_EMPTY_SLOT and TYPE_UNIMPLEMENTED_DEVICE are identical devices, however the later use more recent APIs and is more widely used.
Replace 'empty_slot' by 'unimplemented_device' to simplify devices code maintenance.
--- 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
@@ -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
@@ -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
PATCH 4/15 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
@@ -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
PATCH 5/15 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
@@ -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 (PCIDevice *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); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); - sdc->init = sh_pci_device_init; + k->realize = sh_pci_device_realize; }static const TypeInfo sh_pci_device_info = {
Signature · 1 line
2.19.0
PATCH 1/15 trace-events: Fix copy/paste typo
In reply to Philippe Mathieu-DaudéMissed while reviewing 5dd85b4b486.
--- hw/timer/trace-events | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/timer/trace-events +1 -1
@@ -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
PATCH 2/15 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
@@ -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
@@ -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
PATCH 3/15 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
@@ -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
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.
- 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
Philippe Mathieu-Daudé (15):
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/mips/malta: Replace 'empty_slot' by 'unimplemented_device' hw/sparc64/niagara: Replace 'empty_slot' by 'unimplemented_device' hw/sparc/sun4m: Replace 'empty_slot' by 'unimplemented_device' hw/core: Remove the 'empty_slot' device
hw/alpha/typhoon: Remove unuseful code
hw/hppa/dino: Remove unuseful code
hw/mips/malta: Remove unuseful code
default-configs/mips-softmmu-common.mak | 1 - default-configs/sparc-softmmu.mak | 1 - default-configs/sparc64-softmmu.mak | 1 - include/hw/empty_slot.h | 7 -- hw/alpha/typhoon.c | 13 --- hw/core/empty_slot.c | 103 ------------------------ hw/hppa/dino.c | 7 -- hw/mips/gt64xxx_pci.c | 18 +---- hw/mips/mips_malta.c | 17 +--- hw/pci-host/bonito.c | 9 +-- hw/sh4/sh_pci.c | 20 +++-- hw/sparc/sun4m.c | 24 +++--- hw/sparc64/niagara.c | 4 +- hw/ssi/xilinx_spi.c | 9 +-- hw/timer/sun4v-rtc.c | 23 ++---- hw/core/Makefile.objs | 1 - hw/timer/trace-events | 6 +- 17 files changed, 50 insertions(+), 214 deletions(-) delete mode 100644 include/hw/empty_slot.h delete mode 100644 hw/core/empty_slot.c
Signature · 1 line
2.19.0
Re: [Qemu-devel] [PATCH 11/15] hw/sparc/sun4m: Replace 'empty_slot' by 'unimplemented_device'
In reply to Philippe Mathieu-DaudéHi Philippe,
Quoted 39 lines · Philippe Mathieu-Daudé
The
TYPE_EMPTY_SLOTandTYPE_UNIMPLEMENTED_DEVICEare identical devices, however the later use more recent APIs and is more widely used.Replace '
empty_slot' by 'unimplemented_device' to simplify devices code maintenance.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- default-configs/sparc-softmmu.mak | 1 - hw/sparc/sun4m.c | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-)default-configs/sparc-softmmu.mak +0
-1@@ -8,7 +8,6 @@ CONFIG_ESCC=y CONFIG_M48T59=y CONFIG_PTIMER=y CONFIG_FDC=y -CONFIG_EMPTY_SLOT=y CONFIG_PCNET_COMMON=y CONFIG_LANCE=y CONFIG_TCX=yhw/sparc/sun4m.c +1
-1@@ -42,7 +42,7 @@#include "hw/nvram/chrp_nvram.h" #include "hw/nvram/fw_cfg.h" #include "hw/char/escc.h" -#include "hw/empty_slot.h" +#include "hw/misc/unimp.h" #include "hw/loader.h" #include "elf.h" #include "trace.h"
hw/sparc/sun4m.c static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, · line 867
Quoted 6 lines
hw/sparc/sun4m.c +2
-1@@ -863,7 +863,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,ram_init (0 , machine->ram_size, hwdef->max_mem);/* models without ECC don't trap when missing ram is accessed */ if (!hwdef->ecc_base) { -empty_slot_init (machine->ram_size, hwdef->max_mem - machine->ram_size); +create_unimplemented_device ("ecc" , machine->ram_size, + hwdef->max_mem - machine->ram_size);
In this particular case of find the name UNIMPLEMENTED_DEVICE a bit
misleading: there is nothing to implement for non-installed memory SIMMs. It's rather an unconnected device. And the name "ecc" is misleading too. These machines are not supposed to have any ECC. Maybe "unconnected-ram", "empty-ram-slot" or "empty-slot"?
Regards,
Artyom
Quoted 55 lines
hw/sparc/sun4m.c +11
-9}prom_init (hwdef->slavio_base, bios_name);@@ -892,9 +893,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,if (hwdef->iommu_pad_base) {/* On the real hardware (SS-5, LX) the MMU is not padded, but aliased. Software shouldn't use aliased addresses, neither should it crash -when does. Using empty_slot instead of aliasing can help with -debugging such accesses */ -empty_slot_init (hwdef->iommu_pad_base,hwdef->iommu_pad_len); +when does. Using the 'unimplemented device' instead of aliasing can +help with debugging such accesses */ +create_unimplemented_device ("iommu.alias" , hwdef->iommu_pad_base, + hwdef->iommu_pad_len); } sparc32_dma_init(hwdef->dma_base,@@ -944,12 +946,13 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,for (i = num_vsimms; i <MAX_VSIMMS ; i++) {/* vsimm registers probed by OBP */ if (hwdef->vsimm[i].reg_base) { -empty_slot_init (hwdef->vsimm[i].reg_base,0x2000 ); +create_unimplemented_device ("vsimm" , hwdef->vsimm[i].reg_base, +0x2000 ); } }if (hwdef->sx_base) { -empty_slot_init (hwdef->sx_base,0x2000 ); +create_unimplemented_device ("sx" , hwdef->sx_base,0x2000 ); } nvram =m48t59_init (slavio_irq[0 ], hwdef->nvram_base,0 ,0x2000 ,1968 ,8 );@@ -1012,14 +1015,15 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,if (hwdef->dbri_base) {/* ISDN chip with attached CS4215 audio codec */ /* prom space */ -empty_slot_init (hwdef->dbri_base+0x1000 ,0x30 ); +create_unimplemented_device ("dbri.prom" , hwdef->dbri_base +0x1000 , +0x30 );/* reg space */ -empty_slot_init (hwdef->dbri_base+0x10000 ,0x100 ); +create_unimplemented_device ("dbri" , hwdef->dbri_base +0x10000 ,0x100 ); }if (hwdef->bpp_base) {/* parallel port */ -empty_slot_init (hwdef->bpp_base,0x20 ); +create_unimplemented_device ("bpp" , hwdef->bpp_base,0x20 ); } kernel_size = sun4m_load_kernel(machine->kernel_filename, --2.19.0
Signature · 4 lines
Regards, Artyom Tarasenko SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
Re: [Qemu-devel] [RFC PATCH 13/15] hw/alpha/typhoon: Remove unuseful code
In reply to Philippe Mathieu-DaudéQuoted 23 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/alpha/typhoon.c | 13 ------------- 1 file changed, 13 deletions(-)hw/alpha/typhoon.c +0
-10@@ -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;
hw/alpha/typhoon.c PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, · line 941
Quoted 10 lines
hw/alpha/typhoon.c +0
-3-} -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,
As far as I can see, this should be fine.
Re: [Qemu-devel] [RFC PATCH 14/15] hw/hppa/dino: Remove unuseful code
In reply to Philippe Mathieu-DaudéQuoted 16 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/hppa/dino.c | 7 ------- 1 file changed, 7 deletions(-)hw/hppa/dino.c +0
-3@@ -488,17 +488,10 @@ PCIBus *dino_init(MemoryRegion *addr_space,return b; } -static int dino_pcihost_init (SysBusDevice *dev) -{ -return 0 ;
hw/hppa/dino.c PCIBus *dino_init(MemoryRegion *addr_space, · line 496
Quoted 10 lines
hw/hppa/dino.c +0
-4-} -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; }
Re: [Qemu-devel] [RFC PATCH 15/15] hw/mips/malta: Remove unuseful code
In reply to Philippe Mathieu-DaudéQuoted 23 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/mips/mips_malta.c | 13 ------------- 1 file changed, 13 deletions(-)hw/mips/mips_malta.c +0
-10@@ -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;
hw/mips/mips_malta.c void mips_malta_init(MachineState *machine) · line 1431
Quoted 10 lines
hw/mips/mips_malta.c +0
-3-} -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)
Re: [Qemu-devel] [PATCH 03/15] hw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init
In reply to Philippe Mathieu-DaudéQuoted 28 lines · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/timer/sun4v-rtc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)hw/timer/sun4v-rtc.c +3
-3@@ -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); }
hw/timer/sun4v-rtc.c void sun4v_rtc_init(hwaddr addr) · line 83
Quoted 10 lines
hw/timer/sun4v-rtc.c +2
-2static 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 = {
Re: [Qemu-devel] [PATCH 04/15] hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init
In reply to Philippe Mathieu-DaudéQuoted 34 lines · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/ssi/xilinx_spi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)hw/ssi/xilinx_spi.c +2
-4@@ -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 = {
hw/ssi/xilinx_spi.c static Property xilinx_spi_properties[] = { · line 373
Quoted 10 lines
hw/ssi/xilinx_spi.c +1
-2@@ -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;
Re: [Qemu-devel] [PATCH 02/15] hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 60 lines
--- 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@@ -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
-1@@ -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" --2.19.0
Signature · 4 lines
Regards, Artyom Tarasenko SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
Re: [Qemu-devel] [PATCH 01/15] trace-events: Fix copy/paste typo
In reply to Philippe Mathieu-DaudéQuoted 21 lines · Philippe Mathieu-Daudé
Missed while reviewing
5dd85b4b486.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/timer/trace-events | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/timer/trace-events +1
-2@@ -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" --
Quoted 1 line
2.19.0
I think I saw this in the trace file before going on holiday and then forgot to send out a fix; thanks for the patch.
thanks
-- PMM
Re: [Qemu-devel] [PATCH 05/15] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init
In reply to Philippe Mathieu-DaudéQuoted 1 line · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.
Comment says DeviceState::realize but the code is using PCIDevice::realize ?
I didn't realize pci devices had their own realize method:
what's the difference between it and plain old DeviceState::realize, which they also have, since PCIDeviceClass inherits from DeviceClass ?
thanks
-- PMM
Re: [Qemu-devel] [PATCH 07/15] hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method
In reply to Philippe Mathieu-DaudéQuoted 6 lines · Philippe Mathieu-Daudé
Convert the
gt64120_reset()function into a proper Device reset method.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/mips/gt64xxx_pci.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
thanks
-- PMM
Re: [Qemu-devel] [PATCH 08/15] hw/mips/gt64xxx_pci: Mark as bridge device
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
The gt64120 is currently listed as uncategorized device. Mark it as bridge device.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/mips/gt64xxx_pci.c | 1 + 1 file changed, 1 insertion(+)
Should this device be in hw/pci-host/ with the other PCI host controller models ?
thanks
-- PMM
Re: [Qemu-devel] [PATCH 09/15] hw/mips/malta: Replace 'empty_slot' by 'unimplemented_device'
In reply to Philippe Mathieu-DaudéQuoted 38 lines · Philippe Mathieu-Daudé
The
TYPE_EMPTY_SLOTandTYPE_UNIMPLEMENTED_DEVICEare identical devices, however the later use more recent APIs and is more widely used.Replace '
empty_slot' by 'unimplemented_device' to simplify devices code maintenance.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- default-configs/mips-softmmu-common.mak | 1 - hw/mips/mips_malta.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)default-configs/mips-softmmu-common.mak +0
-1@@ -32,7 +32,6 @@ CONFIG_PFLASH_CFI01=y CONFIG_I8259=y CONFIG_MC146818RTC=y CONFIG_ISA_TESTDEV=y -CONFIG_EMPTY_SLOT=y CONFIG_MIPS_CPS=y CONFIG_MIPS_ITU=y CONFIG_I2C=yhw/mips/mips_malta.c +1
-1@@ -53,7 +53,7 @@#include "sysemu/qtest.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "hw/empty_slot.h" +#include "hw/misc/unimp.h" #include "sysemu/kvm.h" #include "exec/semihost.h" #include "hw/mips/cps.h"
hw/mips/mips_malta.c void mips_malta_init(MachineState *machine) · line 1221
Quoted 7 lines
hw/mips/mips_malta.c +1
-1@@ -1216,7 +1216,7 @@ void mips_malta_init(MachineState *machine)/* The whole address space decoded by the GT-64120A doesn't generate exception when accessing invalid memory. Create an empty slot to emulate this feature. */ -empty_slot_init (0 ,0x20000000 ); +create_unimplemented_device ("gt64120-SysAD" ,0 ,0x20000000 );qdev_init_nofail (dev);
Not sure about this one. unimplemented_device means "there should be something here, but QEMU's model is incomplete", and if the user asks for 'unimp' warnings via the -d option then all accesses will generate logging. In this MIPS board, we're modelling the hardware's actual behaviour, and we shouldn't generate debug messages that imply that QEMU has unimplemented functionality here.
If we were writing a model of the Malta board from scratch we'd probably do it by having the GT-64120A be modelled as a device which was a container object that instantiated all its various bits and pieces and mapped them into a MemoryRegion that spanned the whole 1GB size of that part of the address space. We could then give that MR a background region with the "RAZ/WI" behaviour the hardware requires.
thanks
-- PMM
Re: [Qemu-devel] [PATCH 10/15] hw/sparc64/niagara: Replace 'empty_slot' by 'unimplemented_device'
In reply to Philippe Mathieu-DaudéQuoted 10 lines · Philippe Mathieu-Daudé
The
TYPE_EMPTY_SLOTandTYPE_UNIMPLEMENTED_DEVICEare identical devices, however the later use more recent APIs and is more widely used.Replace '
empty_slot' by 'unimplemented_device' to simplify devices code maintenance.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/sparc64/niagara.c static void niagara_init(MachineState *machine) · line 166
Quoted 7 lines
hw/sparc64/niagara.c +1
-1@@ -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 ); }
Is this actually an unimplemented (missing) device, or are we implementing hardware-defined "no bus errors when this range is touched" behaviour ?
thanks
-- PMM
Re: [Qemu-devel] [PATCH 02/15] hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events
In reply to Philippe Mathieu-DaudéQuoted 1 line · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 58 lines
--- 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@@ -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@@ -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"
Re: [Qemu-devel] [PATCH 04/15] hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init
In reply to Philippe Mathieu-DaudéQuoted 3 lines · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 41 lines
--- hw/ssi/xilinx_spi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)hw/ssi/xilinx_spi.c +3
-6@@ -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;
Re: [Qemu-devel] [PATCH 05/15] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init
In reply to Philippe Mathieu-DaudéQuoted 3 lines · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
one question below,
Thanks,
C.
Quoted 15 lines
--- hw/sh4/sh_pci.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)hw/sh4/sh_pci.c +1
-1@@ -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 (PCIDevice *dev,Error **errp) {
hw/sh4/sh_pci.c static void sh_pci_set_irq(void *opaque, int irq_num, int level) · line 130
Quoted 10 lines
hw/sh4/sh_pci.c +3
-4-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++) {
is that PCI_NUM_PINS ?
Quoted 34 lines
hw/sh4/sh_pci.c +5
-6-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); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); - sdc->init = sh_pci_device_init; + k->realize = sh_pci_device_realize; }static const TypeInfo sh_pci_device_info = {
Re: [Qemu-devel] [PATCH 03/15] hw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init
In reply to Philippe Mathieu-DaudéQuoted 3 lines · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 36 lines
--- hw/timer/sun4v-rtc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)hw/timer/sun4v-rtc.c +5
-5@@ -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 = {
Re: [Qemu-devel] [PATCH 01/15] trace-events: Fix copy/paste typo
In reply to Philippe Mathieu-DaudéQuoted 3 lines · Philippe Mathieu-Daudé
Missed while reviewing
5dd85b4b486.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 18 lines
--- hw/timer/trace-events | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/timer/trace-events +1
-1@@ -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"
Re: [Qemu-devel] [PATCH 07/15] hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method
In reply to Philippe Mathieu-DaudéQuoted 3 lines · Philippe Mathieu-Daudé
Convert the
gt64120_reset()function into a proper Device reset method.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 49 lines
--- hw/mips/gt64xxx_pci.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)hw/mips/gt64xxx_pci.c +3
-14@@ -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; }
Re: [Qemu-devel] [PATCH 08/15] hw/mips/gt64xxx_pci: Mark as bridge device
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
The gt64120 is currently listed as uncategorized device. Mark it as bridge device.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 17 lines
--- hw/mips/gt64xxx_pci.c | 1 + 1 file changed, 1 insertion(+)hw/mips/gt64xxx_pci.c +1
-0@@ -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; }
Re: [Qemu-devel] [PATCH 10/15] hw/sparc64/niagara: Replace 'empty_slot' by 'unimplemented_device'
In reply to Peter MaydellQuoted 11 lines · Peter Maydell
Quoted 8 lines · Philippe Mathieu-Daudé
The
TYPE_EMPTY_SLOTandTYPE_UNIMPLEMENTED_DEVICEare identical devices, however the later use more recent APIs and is more widely used.Replace '
empty_slot' by 'unimplemented_device' to simplify devices code maintenance.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 12 lines
hw/sparc64/niagara.c static void niagara_init(MachineState *machine) · line 166
Quoted 8 lines
hw/sparc64/niagara.c +1
-1@@ -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 ); }Is this actually an unimplemented (missing) device, or are we implementing hardware-defined "no bus errors when this range is touched" behaviour ?
In this case it's really an unimplemented device. But in sun4m (patch 11/15) it's
"no bus errors when this range is touched" behaviour.
Artyom
--
Regards,
Artyom Tarasenko
SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
Re: [Qemu-devel] [PATCH 09/15] hw/mips/malta: Replace 'empty_slot' by 'unimplemented_device'
In reply to Peter MaydellQuoted 54 lines · Peter Maydell
Quoted 38 lines · Philippe Mathieu-Daudé
The
TYPE_EMPTY_SLOTandTYPE_UNIMPLEMENTED_DEVICEare identical devices, however the later use more recent APIs and is more widely used.Replace '
empty_slot' by 'unimplemented_device' to simplify devices code maintenance.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- default-configs/mips-softmmu-common.mak | 1 - hw/mips/mips_malta.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)default-configs/mips-softmmu-common.mak +0
-1@@ -32,7 +32,6 @@ CONFIG_PFLASH_CFI01=y CONFIG_I8259=y CONFIG_MC146818RTC=y CONFIG_ISA_TESTDEV=y -CONFIG_EMPTY_SLOT=y CONFIG_MIPS_CPS=y CONFIG_MIPS_ITU=y CONFIG_I2C=yhw/mips/mips_malta.c +1
-1@@ -53,7 +53,7 @@#include "sysemu/qtest.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "hw/empty_slot.h" +#include "hw/misc/unimp.h" #include "sysemu/kvm.h" #include "exec/semihost.h" #include "hw/mips/cps.h" hw/mips/mips_malta.c void mips_malta_init(MachineState *machine) · line 1221
Quoted 7 lines
hw/mips/mips_malta.c +1
-1@@ -1216,7 +1216,7 @@ void mips_malta_init(MachineState *machine)/* The whole address space decoded by the GT-64120A doesn't generate exception when accessing invalid memory. Create an empty slot to emulate this feature. */ -empty_slot_init (0 ,0x20000000 ); +create_unimplemented_device ("gt64120-SysAD" ,0 ,0x20000000 );qdev_init_nofail (dev);Not sure about this one.
unimplemented_devicemeans "there should be something here, but QEMU's model is incomplete", and if the user asks for 'unimp' warnings via the -d option then all accesses will generate logging. In this MIPS board, we're modelling the hardware's actual behaviour, and we shouldn't generate debug messages that imply that QEMU has unimplemented functionality here.
Quoted 7 lines
If we were writing a model of the Malta board from scratch we'd probably do it by having the GT-64120A be modelled as a device which was a container object that instantiated all its various bits and pieces and mapped them into a MemoryRegion that spanned the whole 1GB size of that part of the address space. We could then give that MR a background region with the "RAZ/WI" behaviour the hardware requires.
Is 'git revert c7c3c9f8' a good example of your explanation?
Re: [Qemu-devel] [PATCH 05/15] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init
In reply to Peter MaydellQuoted 9 lines · Peter Maydell
Quoted 1 line · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Comment says
DeviceState::realizebut the code is usingPCIDevice::realize?I didn't realize pci devices had their own realize method:
what's the difference between it and plain oldDeviceState::realize, which they also have, since PCIDeviceClass inherits from DeviceClass ?
Cc'ing Michael and Marcel.
Re: [Qemu-devel] [PATCH 05/15] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init
Hi Philippe, Peter
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Peter Maydell
Quoted 1 line · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Comment says
DeviceState::realizebut the code is usingPCIDevice::realize?I didn't realize pci devices had their own realize method:
what's the difference between it and plain oldDeviceState::realize,
PCIDevice:realize handles PCI specific "realization" tasks:
* setup of the PCI configuration space
* PCI BARs configuration
* MSI initalization
*...
The PCIDevice's DeviceState::realize function named 'pci_qdev_realize' calls PCIDevice:realize after it runs some generic initialization code.
It is possible we have this design so we would be able to move from "qdev" to QOM.
Thanks,
Marcel
Quoted 2 lines
Quoted 1 line
which they also have, since PCIDeviceClass inherits from DeviceClass ?
Cc'ing Michael and Marcel.
Re: [Qemu-devel] [PATCH 05/15] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init
Quoted 20 lines · Marcel Apfelbaum
Hi Philippe, Peter
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Peter Maydell
Quoted 2 lines · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Comment says
DeviceState::realizebut the code is usingPCIDevice::realize?I didn't realize pci devices had their own realize method:
what's the difference between it and plain oldDeviceState::realize,PCIDevice:realize handles PCI specific "realization" tasks:
* setup of the PCI configuration space
* PCI BARs configuration
* MSI initalization
*...
Quoted 5 lines
The PCIDevice's
DeviceState::realizefunction named 'pci_qdev_realize' calls PCIDevice:realize after it runs some generic initialization code.It is possible we have this design so we would be able to move from "qdev" to QOM.
Thanks Marcel, so this patch is incorrect.
TYPE_SH_PCI_HOST_BRIDGE inherits TYPE_PCI_HOST_BRIDGE which inherits TYPE_SYS_BUS_DEVICE which inherits TYPE_DEVICE, so can implement DeviceState::realize but not PCIDevice::realize.
TYPE_"sh_pci_host" inherits TYPE_PCI_DEVICE, so can implement PCIDevice::realize.
I'll respin.
Quoted 5 lines
Thanks,
MarcelQuoted 2 lines
Quoted 1 line
which they also have, since PCIDeviceClass inherits from DeviceClass ?
Cc'ing Michael and Marcel.
Re: [Qemu-devel] [PATCH 06/15] hw/pci-host/bonito: Use DeviceState::realize rather than SysBusDevice::init
In reply to Philippe Mathieu-DaudéQuoted 12 lines · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/pci-host/bonito.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)hw/pci-host/bonito.c +0
-0
hw/pci-host/bonito.c static const VMStateDescription vmstate_bonito = { · line 598
Quoted 5 lines
hw/pci-host/bonito.c +1
-1@@ -595,7 +595,7 @@ static const VMStateDescription vmstate_bonito = { } }; -static int bonito_pcihost_initfn (SysBusDevice *dev) +static void bonito_pcihost_realize (PCIDevice *dev,Error **errp)
This patch is incorrect, see:
https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg00378.html
Quoted 33 lines
hw/pci-host/bonito.c +2
-5{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); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); - k->init = bonito_pcihost_initfn; + k->realize = bonito_pcihost_realize; }static const TypeInfo bonito_pcihost_info = {
Re: [Qemu-devel] [PATCH 11/15] hw/sparc/sun4m: Replace 'empty_slot' by 'unimplemented_device'
In reply to Artyom TarasenkoHi Artyom,
Quoted 46 lines · Artyom Tarasenko
Hi Philippe,
Quoted 43 lines · Philippe Mathieu-Daudé
The
TYPE_EMPTY_SLOTandTYPE_UNIMPLEMENTED_DEVICEare identical devices, however the later use more recent APIs and is more widely used.Replace '
empty_slot' by 'unimplemented_device' to simplify devices code maintenance.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- default-configs/sparc-softmmu.mak | 1 - hw/sparc/sun4m.c | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-)default-configs/sparc-softmmu.mak +0
-1@@ -8,7 +8,6 @@ CONFIG_ESCC=y CONFIG_M48T59=y CONFIG_PTIMER=y CONFIG_FDC=y -CONFIG_EMPTY_SLOT=y CONFIG_PCNET_COMMON=y CONFIG_LANCE=y CONFIG_TCX=yhw/sparc/sun4m.c +1
-2@@ -42,7 +42,7 @@#include "hw/nvram/chrp_nvram.h" #include "hw/nvram/fw_cfg.h" #include "hw/char/escc.h" -#include "hw/empty_slot.h" +#include "hw/misc/unimp.h" #include "hw/loader.h" #include "elf.h" #include "trace.h" @@ -863,7 +863,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,ram_init (0 , machine->ram_size, hwdef->max_mem);/* models without ECC don't trap when missing ram is accessed */ if (!hwdef->ecc_base) { -empty_slot_init (machine->ram_size, hwdef->max_mem - machine->ram_size);
Quoted 8 lines
hw/sparc/sun4m.c static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, · line 867
Quoted 2 lines
hw/sparc/sun4m.c +2
-0+create_unimplemented_device ("ecc" , machine->ram_size, + hwdef->max_mem - machine->ram_size);In this particular case of find the name
UNIMPLEMENTED_DEVICEa bit
misleading: there is nothing to implement for non-installed memory SIMMs. It's rather an unconnected device. And the name "ecc" is misleading too. These machines are not supposed to have any ECC. Maybe "unconnected-ram", "empty-ram-slot" or "empty-slot"?
OK. I'll rework on this patch later and resend in another series.
Thanks for your review!
Phil.
Quoted 60 lines
Regards,
ArtyomQuoted 55 lines
hw/sparc/sun4m.c +11
-9}prom_init (hwdef->slavio_base, bios_name);@@ -892,9 +893,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,if (hwdef->iommu_pad_base) {/* On the real hardware (SS-5, LX) the MMU is not padded, but aliased. Software shouldn't use aliased addresses, neither should it crash -when does. Using empty_slot instead of aliasing can help with -debugging such accesses */ -empty_slot_init (hwdef->iommu_pad_base,hwdef->iommu_pad_len); +when does. Using the 'unimplemented device' instead of aliasing can +help with debugging such accesses */ +create_unimplemented_device ("iommu.alias" , hwdef->iommu_pad_base, + hwdef->iommu_pad_len); } sparc32_dma_init(hwdef->dma_base,@@ -944,12 +946,13 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,for (i = num_vsimms; i <MAX_VSIMMS ; i++) {/* vsimm registers probed by OBP */ if (hwdef->vsimm[i].reg_base) { -empty_slot_init (hwdef->vsimm[i].reg_base,0x2000 ); +create_unimplemented_device ("vsimm" , hwdef->vsimm[i].reg_base, +0x2000 ); } }if (hwdef->sx_base) { -empty_slot_init (hwdef->sx_base,0x2000 ); +create_unimplemented_device ("sx" , hwdef->sx_base,0x2000 ); } nvram =m48t59_init (slavio_irq[0 ], hwdef->nvram_base,0 ,0x2000 ,1968 ,8 );@@ -1012,14 +1015,15 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,if (hwdef->dbri_base) {/* ISDN chip with attached CS4215 audio codec */ /* prom space */ -empty_slot_init (hwdef->dbri_base+0x1000 ,0x30 ); +create_unimplemented_device ("dbri.prom" , hwdef->dbri_base +0x1000 , +0x30 );/* reg space */ -empty_slot_init (hwdef->dbri_base+0x10000 ,0x100 ); +create_unimplemented_device ("dbri" , hwdef->dbri_base +0x10000 ,0x100 ); }if (hwdef->bpp_base) {/* parallel port */ -empty_slot_init (hwdef->bpp_base,0x20 ); +create_unimplemented_device ("bpp" , hwdef->bpp_base,0x20 ); } kernel_size = sun4m_load_kernel(machine->kernel_filename, --2.19.0
Re: [Qemu-devel] [PATCH 09/15] hw/mips/malta: Replace 'empty_slot' by 'unimplemented_device'
In reply to Philippe Mathieu-DaudéQuoted 16 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Peter Maydell
Not sure about this one.
unimplemented_devicemeans "there should be something here, but QEMU's model is incomplete", and if the user asks for 'unimp' warnings via the -d option then all accesses will generate logging. In this MIPS board, we're modelling the hardware's actual behaviour, and we shouldn't generate debug messages that imply that QEMU has unimplemented functionality here.Quoted 7 lines
If we were writing a model of the Malta board from scratch we'd probably do it by having the GT-64120A be modelled as a device which was a container object that instantiated all its various bits and pieces and mapped them into a MemoryRegion that spanned the whole 1GB size of that part of the address space. We could then give that MR a background region with the "RAZ/WI" behaviour the hardware requires.
Quoted 1 line
Is 'git revert
c7c3c9f8' a good example of your explanation?
That commit is OK, because the previous version was also logging accesses as being unimplemented.
thanks
-- PMM
Re: [Qemu-devel] [PATCH 04/15] hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
Move from the legacy
SysBusDevice::initmethod to usingDeviceState::realize.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 44 lines
--- hw/ssi/xilinx_spi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)hw/ssi/xilinx_spi.c +3
-7@@ -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; --2.19.0