All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17
@ 2014-02-17 22:24 Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 01/49] qtest: don't report signals if qtest driver enabled Andreas Färber
                   ` (49 more replies)
  0 siblings, 50 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Anthony Liguori, Mark Cave-Ayland, Alexander Graf,
	Markus Armbruster, Stefan Hajnoczi, Paolo Bonzini,
	Andreas Färber

Hello Peter,

This is my QOM (devices) patch queue. Please pull.

v2 is rebased to fix a merge conflict, fixes some gcov warnings and
adds 2 Acked-bys and 2 qtest patches.

Regards,
Andreas

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Anthony Liguori <anthony@codemonkey.ws>

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

The following changes since commit f673e70ccc668607620cd6d30fd0b9bc7a54151d:

  Merge remote-tracking branch 'remotes/afaerber/tags/prep-for-upstream' into staging (2014-02-13 14:52:06 +0000)

are available in the git repository at:


  git://github.com/afaerber/qemu-cpu.git tags/qom-devices-for-peter

for you to fetch changes up to 91f32b0c92fb18a403e48d3c8ffc14422a0c1ca5:

  qtest: Include system headers before user headers (2014-02-17 23:10:02 +0100)

----------------------------------------------------------------
QOM infrastructure fixes and device conversions

* QTest cleanups and test cases for PCI NICs
* NAND fix for "info qtree"
* Cleanup and extension of QOM machine tests
* IndustryPack test cases and conversion to QOM realize
* I2C cleanups
* Cleanups of legacy qdev properties

----------------------------------------------------------------
Andreas Färber (29):
      ppcemb-softmmu: Drop Mac and e500 emulation
      target-ppc: Make ppc40x CPUs available in ppcemb
      tests: Fix gcov paths for relocated device sources
      nand: Don't use qdev_create() in nand_init()
      i2c: Rename i2c_bus to I2CBus
      pxa2xx: QOM'ify I2C slave
      tosa: QOM'ify DAC
      z2: QOM'ify AER915
      wm8750: QOM'ify
      ssd0303: QOM'ify
      max7310: QOM'ify
      lm832x: QOM'ify
      ds1338: QOM'ify
      twl92230: QOM'ify
      i2c: Drop FROM_I2C_SLAVE() macro
      tests: Add e1000 qtest
      tests: Add vmxnet3 qtest
      tests: Add rtl8139 qtest
      tests: Add pcnet qtest
      tests: Add eepro100 qtest
      tests: Add ne2000 qtest
      tests: Add virtio-net qtest
      tests: Add tpci200 qtest
      tests: Add ipoctal232 qtest
      ipack: Convert to QOM realize
      ipack: QOM parent field cleanup for IPackBus
      ipack: QOM parent field cleanup for IPackDevice
      ipoctal232: QOM parent field cleanup
      ipack: Move IndustryPack out of hw/char/

Fam Zheng (1):
      qtest: Don't segfault with invalid -qtest option

Markus Armbruster (2):
      qom-test: Run for all available machines
      qom-test: Test shutdown in addition to startup

Michael S. Tsirkin (1):
      qtest: don't report signals if qtest driver enabled

Paolo Bonzini (14):
      qapi: Add size parser to StringInputVisitor
      qdev: Sizes are now parsed by StringInputVisitor
      qdev: Remove legacy parsers for hex8/32/64
      qdev: Legacy properties are now read-only
      qdev: Legacy properties are just strings
      qdev: Inline qdev_prop_parse()
      qapi: Add human mode to StringOutputVisitor
      qdev: Use human mode in "info qtree"
      qdev: Remove most legacy printers
      qdev: Remove hex8/32/64 property types
      block: Handle "rechs" and "large" translation options
      qdev: Add enum property types to QAPI schema
      qdev: Use QAPI type names for properties
      qapi: Refine human printing of sizes

Peter Maydell (1):
      tests: Run qom-test for every architecture

Stefan Hajnoczi (1):
      qtest: Include system headers before user headers

 blockdev.c                            |   4 +
 default-configs/ppc-softmmu.mak       |   1 +
 default-configs/ppc64-softmmu.mak     |   1 +
 default-configs/ppcemb-softmmu.mak    |  20 ---
 hw/Makefile.objs                      |   1 +
 hw/acpi/piix4.c                       |   6 +-
 hw/arm/exynos4210.c                   |   2 +-
 hw/arm/musicpal.c                     |   4 +-
 hw/arm/nseries.c                      |   2 +-
 hw/arm/pxa2xx.c                       |  44 +++--
 hw/arm/realview.c                     |   4 +-
 hw/arm/spitz.c                        |   2 +-
 hw/arm/stellaris.c                    |   8 +-
 hw/arm/tosa.c                         |  18 ++-
 hw/arm/versatilepb.c                  |   4 +-
 hw/arm/z2.c                           |  22 ++-
 hw/audio/adlib.c                      |   2 +-
 hw/audio/cs4231a.c                    |   2 +-
 hw/audio/gus.c                        |   2 +-
 hw/audio/pcspk.c                      |   2 +-
 hw/audio/sb16.c                       |   4 +-
 hw/audio/wm8750.c                     |  33 ++--
 hw/block/fdc.c                        |   2 +-
 hw/block/nand.c                       |   2 +-
 hw/char/Makefile.objs                 |   2 +-
 hw/char/debugcon.c                    |   4 +-
 hw/char/ipoctal232.c                  |  20 +--
 hw/char/parallel.c                    |   2 +-
 hw/char/serial-isa.c                  |   2 +-
 hw/core/qdev-properties-system.c      |  12 +-
 hw/core/qdev-properties.c             | 204 ++----------------------
 hw/core/qdev.c                        |  38 +----
 hw/display/g364fb.c                   |   2 +-
 hw/display/ssd0303.c                  |  18 ++-
 hw/display/tcx.c                      |   4 +-
 hw/dma/i82374.c                       |   2 +-
 hw/dma/sun4m_iommu.c                  |   2 +-
 hw/gpio/max7310.c                     |  23 +--
 hw/i2c/bitbang_i2c.c                  |   6 +-
 hw/i2c/bitbang_i2c.h                  |   2 +-
 hw/i2c/core.c                         |  32 ++--
 hw/i2c/exynos4210_i2c.c               |   2 +-
 hw/i2c/omap_i2c.c                     |   4 +-
 hw/i2c/pm_smbus.c                     |   2 +-
 hw/i2c/smbus.c                        |  18 +--
 hw/i2c/smbus_eeprom.c                 |   2 +-
 hw/i2c/smbus_ich9.c                   |   2 +-
 hw/i2c/versatile_i2c.c                |   2 +-
 hw/i386/kvm/i8254.c                   |   8 +-
 hw/i386/pc_piix.c                     |   2 +-
 hw/ide/isa.c                          |   4 +-
 hw/ide/qdev.c                         |   2 +-
 hw/input/lm832x.c                     |  22 +--
 hw/intc/i8259_common.c                |   6 +-
 hw/ipack/Makefile.objs                |   2 +
 hw/{char => ipack}/ipack.c            |  43 ++---
 hw/{char => ipack}/tpci200.c          |   2 +-
 hw/isa/pc87312.c                      |   2 +-
 hw/isa/vt82c686.c                     |   4 +-
 hw/mips/mips_fulong2e.c               |   2 +-
 hw/mips/mips_malta.c                  |   2 +-
 hw/misc/applesmc.c                    |   2 +-
 hw/misc/debugexit.c                   |   4 +-
 hw/misc/eccmemctl.c                   |   2 +-
 hw/net/ne2000-isa.c                   |   2 +-
 hw/nvram/fw_cfg.c                     |   4 +-
 hw/ppc/Makefile.objs                  |   4 +-
 hw/ppc/spapr_pci.c                    |  16 +-
 hw/scsi/megasas.c                     |   2 +-
 hw/scsi/scsi-disk.c                   |   6 +-
 hw/sd/sdhci.c                         |   4 +-
 hw/timer/ds1338.c                     |  21 ++-
 hw/timer/i8254.c                      |   2 +-
 hw/timer/m48t59.c                     |   4 +-
 hw/timer/mc146818rtc.c                |  14 +-
 hw/timer/twl92230.c                   |  35 ++--
 hw/usb/host-libusb.c                  |   4 +-
 hw/virtio/virtio-pci.c                |   6 +-
 include/hw/arm/exynos4210.h           |   2 +-
 include/hw/arm/omap.h                 |   2 +-
 include/hw/arm/pxa.h                  |   2 +-
 include/hw/block/block.h              |   6 -
 include/hw/i2c/i2c.h                  |  20 ++-
 include/hw/i2c/pm_smbus.h             |   2 +-
 include/hw/i2c/smbus.h                |  20 +--
 include/hw/i386/ich9.h                |   2 +-
 include/hw/i386/pc.h                  |   6 +-
 {hw/char => include/hw/ipack}/ipack.h |  15 +-
 include/hw/isa/vt82c686.h             |   4 +-
 include/hw/qdev-core.h                |   1 -
 include/hw/qdev-dma.h                 |   2 +-
 include/hw/qdev-properties.h          |  11 --
 include/qapi/string-output-visitor.h  |   2 +-
 include/qemu-common.h                 |   8 -
 include/qemu/typedefs.h               |   2 +-
 include/qom/object.h                  |   3 +-
 include/sysemu/qtest.h                |   5 +-
 qapi-schema.json                      |  58 +++++++
 qapi/string-input-visitor.c           |  24 +++
 qapi/string-output-visitor.c          |  56 ++++++-
 qdev-monitor.c                        |   6 +-
 qom/object.c                          |   4 +-
 qtest.c                               |  13 +-
 target-ppc/translate_init.c           |  38 ++---
 tests/Makefile                        |  85 ++++++----
 tests/e1000-test.c                    |  33 ++++
 tests/eepro100-test.c                 |  63 ++++++++
 tests/endianness-test.c               |   2 +-
 tests/fw_cfg-test.c                   |   7 +-
 tests/i440fx-test.c                   |  11 +-
 tests/ipoctal232-test.c               |  33 ++++
 tests/m48t59-test.c                   |   3 +-
 tests/ne2000-test.c                   |  33 ++++
 tests/pcnet-test.c                    |  33 ++++
 tests/qom-test.c                      | 292 ++++++++--------------------------
 tests/rtc-test.c                      |   5 +-
 tests/rtl8139-test.c                  |  33 ++++
 tests/test-string-output-visitor.c    |   2 +-
 tests/test-visitor-serialization.c    |   2 +-
 tests/tmp105-test.c                   |   5 +-
 tests/tpci200-test.c                  |  33 ++++
 tests/virtio-net-test.c               |  33 ++++
 tests/vmxnet3-test.c                  |  33 ++++
 vl.c                                  |  32 +++-
 124 files changed, 1055 insertions(+), 864 deletions(-)
 create mode 100644 hw/ipack/Makefile.objs
 rename hw/{char => ipack}/ipack.c (72%)
 rename hw/{char => ipack}/tpci200.c (99%)
 rename {hw/char => include/hw/ipack}/ipack.h (91%)
 create mode 100644 tests/e1000-test.c
 create mode 100644 tests/eepro100-test.c
 create mode 100644 tests/ipoctal232-test.c
 create mode 100644 tests/ne2000-test.c
 create mode 100644 tests/pcnet-test.c
 create mode 100644 tests/rtl8139-test.c
 create mode 100644 tests/tpci200-test.c
 create mode 100644 tests/virtio-net-test.c
 create mode 100644 tests/vmxnet3-test.c

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 01/49] qtest: don't report signals if qtest driver enabled
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 02/49] ppcemb-softmmu: Drop Mac and e500 emulation Andreas Färber
                   ` (48 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, Anthony Liguori, Michael S. Tsirkin

From: "Michael S. Tsirkin" <mst@redhat.com>

qtest driver always uses signals to kill qemu
no need to report it, whatever the accelerator state.

Add API to detect qtest driver, and suppress reporting
signals in this case.

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/sysemu/qtest.h | 2 ++
 qtest.c                | 5 +++++
 vl.c                   | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h
index 112a661..6aca8e4 100644
--- a/include/sysemu/qtest.h
+++ b/include/sysemu/qtest.h
@@ -23,6 +23,8 @@ static inline bool qtest_enabled(void)
     return qtest_allowed;
 }
 
+bool qtest_driver(void);
+
 int qtest_init_accel(void);
 void qtest_init(const char *qtest_chrdev, const char *qtest_log);
 
diff --git a/qtest.c b/qtest.c
index dcf1301..a738afc 100644
--- a/qtest.c
+++ b/qtest.c
@@ -528,3 +528,8 @@ void qtest_init(const char *qtest_chrdev, const char *qtest_log)
 
     qtest_chr = chr;
 }
+
+bool qtest_driver(void)
+{
+    return qtest_chr;
+}
diff --git a/vl.c b/vl.c
index 383be1b..a7b00cd 100644
--- a/vl.c
+++ b/vl.c
@@ -1750,7 +1750,7 @@ static int qemu_shutdown_requested(void)
 
 static void qemu_kill_report(void)
 {
-    if (!qtest_enabled() && shutdown_signal != -1) {
+    if (!qtest_driver() && shutdown_signal != -1) {
         fprintf(stderr, "qemu: terminating on signal %d", shutdown_signal);
         if (shutdown_pid == 0) {
             /* This happens for eg ^C at the terminal, so it's worth
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 02/49] ppcemb-softmmu: Drop Mac and e500 emulation
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 01/49] qtest: don't report signals if qtest driver enabled Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 03/49] target-ppc: Make ppc40x CPUs available in ppcemb Andreas Färber
                   ` (47 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: open list:PowerPC, Andreas Färber, Alexander Graf

They are still available in ppc-softmmu and ppc64-softmmu.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 default-configs/ppc-softmmu.mak    |  1 +
 default-configs/ppc64-softmmu.mak  |  1 +
 default-configs/ppcemb-softmmu.mak | 20 --------------------
 hw/ppc/Makefile.objs               |  4 ++--
 4 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
index f380ca4..e5f9d36 100644
--- a/default-configs/ppc-softmmu.mak
+++ b/default-configs/ppc-softmmu.mak
@@ -42,6 +42,7 @@ CONFIG_XILINX=y
 CONFIG_XILINX_ETHLITE=y
 CONFIG_OPENPIC=y
 CONFIG_PREP=y
+CONFIG_MAC=y
 CONFIG_E500=y
 CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM))
 # For PReP
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
index fcc0452..e2beac6 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -43,6 +43,7 @@ CONFIG_XILINX_ETHLITE=y
 CONFIG_OPENPIC=y
 CONFIG_PSERIES=y
 CONFIG_PREP=y
+CONFIG_MAC=y
 CONFIG_E500=y
 CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM))
 # For pSeries
diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-softmmu.mak
index fdf1e14..1e4fde2 100644
--- a/default-configs/ppcemb-softmmu.mak
+++ b/default-configs/ppcemb-softmmu.mak
@@ -3,30 +3,12 @@
 include pci.mak
 include sound.mak
 include usb.mak
-CONFIG_ISA_MMIO=y
-CONFIG_ESCC=y
 CONFIG_M48T59=y
 CONFIG_VGA=y
 CONFIG_VGA_PCI=y
 CONFIG_SERIAL=y
-CONFIG_I8254=y
-CONFIG_FDC=y
 CONFIG_I8257=y
 CONFIG_OPENPIC=y
-CONFIG_MACIO=y
-CONFIG_CUDA=y
-CONFIG_ADB=y
-CONFIG_MAC_NVRAM=y
-CONFIG_MAC_DBDMA=y
-CONFIG_HEATHROW_PIC=y
-CONFIG_GRACKLE_PCI=y
-CONFIG_UNIN_PCI=y
-CONFIG_DEC_PCI=y
-CONFIG_PPCE500_PCI=y
-CONFIG_IDE_ISA=y
-CONFIG_IDE_CMD646=y
-CONFIG_IDE_MACIO=y
-CONFIG_NE2000_ISA=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
@@ -34,5 +16,3 @@ CONFIG_I8259=y
 CONFIG_XILINX=y
 CONFIG_XILINX_ETHLITE=y
 CONFIG_OPENPIC=y
-CONFIG_E500=y
-CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM))
diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs
index 2dd5284..ea747f0 100644
--- a/hw/ppc/Makefile.objs
+++ b/hw/ppc/Makefile.objs
@@ -10,9 +10,9 @@ obj-y += ppc4xx_pci.o
 # PReP
 obj-$(CONFIG_PREP) += prep.o
 # OldWorld PowerMac
-obj-y += mac_oldworld.o
+obj-$(CONFIG_MAC) += mac_oldworld.o
 # NewWorld PowerMac
-obj-y += mac_newworld.o
+obj-$(CONFIG_MAC) += mac_newworld.o
 # e500
 obj-$(CONFIG_E500) += e500.o mpc8544ds.o e500plat.o
 obj-$(CONFIG_E500) += mpc8544_guts.o ppce500_spin.o
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 03/49] target-ppc: Make ppc40x CPUs available in ppcemb
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 01/49] qtest: don't report signals if qtest driver enabled Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 02/49] ppcemb-softmmu: Drop Mac and e500 emulation Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 04/49] tests: Fix gcov paths for relocated device sources Andreas Färber
                   ` (46 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: open list:PowerPC, Andreas Färber, Alexander Graf

Not only 44x CPUs (BookE) but also 40x CPUs can run with 1k page size.

Move the criteria to a central inline function to avoid repetition
and #ifdef'fery. Update qom-test to no longer exempt them.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-ppc/translate_init.c | 38 +++++++++++++++++++-------------------
 tests/qom-test.c            |  3 ---
 2 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index c030a20..445c360 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -7960,6 +7960,17 @@ static int ppc_fixup_cpu(PowerPCCPU *cpu)
     return 0;
 }
 
+static inline bool ppc_cpu_is_valid(PowerPCCPUClass *pcc)
+{
+#ifdef TARGET_PPCEMB
+    return pcc->mmu_model == POWERPC_MMU_BOOKE ||
+           pcc->mmu_model == POWERPC_MMU_SOFT_4xx ||
+           pcc->mmu_model == POWERPC_MMU_SOFT_4xx_Z;
+#else
+    return true;
+#endif
+}
+
 static void ppc_cpu_realizefn(DeviceState *dev, Error **errp)
 {
     CPUState *cs = CPU(dev);
@@ -7991,8 +8002,8 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error **errp)
     }
 
 #if defined(TARGET_PPCEMB)
-    if (pcc->mmu_model != POWERPC_MMU_BOOKE) {
-        error_setg(errp, "CPU does not possess a BookE MMU. "
+    if (!ppc_cpu_is_valid(pcc)) {
+        error_setg(errp, "CPU does not possess a BookE or 4xx MMU. "
                    "Please use qemu-system-ppc or qemu-system-ppc64 instead "
                    "or choose another CPU model.");
         return;
@@ -8209,11 +8220,9 @@ static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b)
         return -1;
     }
 
-#if defined(TARGET_PPCEMB)
-    if (pcc->mmu_model != POWERPC_MMU_BOOKE) {
+    if (!ppc_cpu_is_valid(pcc)) {
         return -1;
     }
-#endif
 
     return pcc->pvr == pvr ? 0 : -1;
 }
@@ -8246,11 +8255,10 @@ static gint ppc_cpu_compare_class_pvr_mask(gconstpointer a, gconstpointer b)
         return -1;
     }
 
-#if defined(TARGET_PPCEMB)
-    if (pcc->mmu_model != POWERPC_MMU_BOOKE) {
+    if (!ppc_cpu_is_valid(pcc)) {
         return -1;
     }
-#endif
+
     ret = (((pcc->pvr & pcc->pvr_mask) == (pvr & pcc->pvr_mask)) ? 0 : -1);
 
     return ret;
@@ -8275,14 +8283,10 @@ static gint ppc_cpu_compare_class_name(gconstpointer a, gconstpointer b)
 {
     ObjectClass *oc = (ObjectClass *)a;
     const char *name = b;
-#if defined(TARGET_PPCEMB)
     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
-#endif
 
     if (strncasecmp(name, object_class_get_name(oc), strlen(name)) == 0 &&
-#if defined(TARGET_PPCEMB)
-        pcc->mmu_model == POWERPC_MMU_BOOKE &&
-#endif
+        ppc_cpu_is_valid(pcc) &&
         strcmp(object_class_get_name(oc) + strlen(name),
                "-" TYPE_POWERPC_CPU) == 0) {
         return 0;
@@ -8414,11 +8418,9 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
     char *name;
     int i;
 
-#if defined(TARGET_PPCEMB)
-    if (pcc->mmu_model != POWERPC_MMU_BOOKE) {
+    if (!ppc_cpu_is_valid(pcc)) {
         return;
     }
-#endif
     if (unlikely(strcmp(typename, TYPE_HOST_POWERPC_CPU) == 0)) {
         return;
     }
@@ -8466,13 +8468,11 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
     const char *typename;
     CpuDefinitionInfoList *entry;
     CpuDefinitionInfo *info;
-#if defined(TARGET_PPCEMB)
     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
 
-    if (pcc->mmu_model != POWERPC_MMU_BOOKE) {
+    if (!ppc_cpu_is_valid(pcc)) {
         return;
     }
-#endif
 
     typename = object_class_get_name(oc);
     info = g_malloc0(sizeof(*info));
diff --git a/tests/qom-test.c b/tests/qom-test.c
index 5e5af7a..4dd23f8 100644
--- a/tests/qom-test.c
+++ b/tests/qom-test.c
@@ -221,10 +221,7 @@ int main(int argc, char **argv)
     } else if (strcmp(arch, "or32") == 0) {
         ADD_MACHINE_TESTS(arch, openrisc_machines);
     } else if (strcmp(arch, "ppcemb") == 0) {
-#if 0
-        /* XXX Available in ppcemb but don't work */
         ADD_MACHINE_TESTS(arch, ppc405_machines);
-#endif
         ADD_MACHINE_TESTS(arch, ppc440_machines);
     } else if (strcmp(arch, "ppc") == 0) {
         ADD_MACHINE_TESTS(arch, ppc405_machines);
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 04/49] tests: Fix gcov paths for relocated device sources
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (2 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 03/49] target-ppc: Make ppc40x CPUs available in ppcemb Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 05/49] qom-test: Run for all available machines Andreas Färber
                   ` (45 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber

Commit 49ab747f668f421138d5b40d83fa279c4c5e278d moved
fdc.c, hd-geometry.c, m48t59.c, tmp105.c into hw/ subdirectories;
commit 0ddfaf7fe4c8453446730328bf348b7c6438e4f8 did for mc146818rtc.c.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index fd36eee..74b7a44 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -62,10 +62,10 @@ check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
 # really in libqtest, not in the testcases themselves.
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
-gcov-files-i386-y = hw/fdc.c
+gcov-files-i386-y = hw/block/fdc.c
 check-qtest-i386-y += tests/ide-test$(EXESUF)
 check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
-gcov-files-i386-y += hw/hd-geometry.c
+gcov-files-i386-y += hw/block/hd-geometry.c
 check-qtest-i386-y += tests/boot-order-test$(EXESUF)
 check-qtest-i386-y += tests/acpi-test$(EXESUF)
 check-qtest-i386-y += tests/rtc-test$(EXESUF)
@@ -75,7 +75,7 @@ check-qtest-i386-y += tests/qom-test$(EXESUF)
 check-qtest-i386-y += tests/blockdev-test$(EXESUF)
 check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
-gcov-files-i386-y += i386-softmmu/hw/mc146818rtc.c
+gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
 check-qtest-mips-y = tests/endianness-test$(EXESUF)
 check-qtest-mips64-y = tests/endianness-test$(EXESUF)
@@ -93,12 +93,12 @@ check-qtest-sh4eb-y += tests/qom-test$(EXESUF)
 check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
 #check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
 #check-qtest-sparc64-y += tests/m48t59-test$(EXESUF)
-gcov-files-sparc-y += hw/m48t59.c
-gcov-files-sparc64-y += hw/m48t59.c
+gcov-files-sparc-y += hw/timer/m48t59.c
+gcov-files-sparc64-y += hw/timer/m48t59.c
 check-qtest-sparc-y += tests/qom-test$(EXESUF)
 check-qtest-sparc64-y += tests/qom-test$(EXESUF)
 check-qtest-arm-y = tests/tmp105-test$(EXESUF)
-gcov-files-arm-y += hw/tmp105.c
+gcov-files-arm-y += hw/misc/tmp105.c
 check-qtest-arm-y += tests/qom-test$(EXESUF)
 check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
 check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 05/49] qom-test: Run for all available machines
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (3 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 04/49] tests: Fix gcov paths for relocated device sources Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 06/49] qom-test: Test shutdown in addition to startup Andreas Färber
                   ` (44 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Markus Armbruster, Andreas Färber

From: Markus Armbruster <armbru@redhat.com>

Get available machines via QMP instead of hardcoding a list that's
perpetually out of date.

Xen machines can work only when running under the Xen hypervisor.
Blacklist them.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/qom-test.c | 274 ++++++++++++-------------------------------------------
 1 file changed, 60 insertions(+), 214 deletions(-)

diff --git a/tests/qom-test.c b/tests/qom-test.c
index 4dd23f8..24cb9c5 100644
--- a/tests/qom-test.c
+++ b/tests/qom-test.c
@@ -11,6 +11,36 @@
 #include <glib.h>
 #include <string.h>
 #include "qemu/osdep.h"
+#include "qapi/qmp/types.h"
+
+static const char *blacklist_x86[] = {
+    "xenfv", "xenpv", NULL
+};
+
+static const struct {
+    const char *arch;
+    const char **machine;
+} blacklists[] = {
+    { "i386", blacklist_x86 },
+    { "x86_64", blacklist_x86 },
+};
+
+static bool is_blacklisted(const char *arch, const char *mach)
+{
+    int i;
+    const char **p;
+
+    for (i = 0; i < ARRAY_SIZE(blacklists); i++) {
+        if (!strcmp(blacklists[i].arch, arch)) {
+            for (p = blacklists[i].machine; *p; p++) {
+                if (!strcmp(*p, mach)) {
+                    return true;
+                }
+            }
+        }
+    }
+    return false;
+}
 
 static void test_nop(gconstpointer data)
 {
@@ -26,227 +56,43 @@ static void test_nop(gconstpointer data)
     g_free(args);
 }
 
-static const char *x86_machines[] = {
-    "pc",
-    "isapc",
-    "q35",
-};
-
-static const char *alpha_machines[] = {
-    "clipper",
-};
-
-static const char *arm_machines[] = {
-    "integratorcp",
-    "versatilepb",
-    "versatileab",
-    "lm3s811evb",
-    "lm3s6965evb",
-    "collie",
-    "akita",
-    "spitz",
-    "borzoi",
-    "terrier",
-    "tosa",
-    "cheetah",
-    "sx1-v1",
-    "sx1",
-    "realview-eb",
-    "realview-eb-mpcore",
-    "realview-pb-a8",
-    "realview-pbx-a9",
-    "musicpal",
-    "mainstone",
-    "connex",
-    "verdex",
-    "z2",
-    "n800",
-    "n810",
-    "kzm",
-    "vexpress-a9",
-    "vexpress-a15",
-    "smdkc210",
-    "nuri",
-    "xilinx-zynq-a9",
-    "highbank",
-    "midway",
-    "canon-a1100",
-    "cubieboard",
-};
-
-static const char *cris_machines[] = {
-    "axis-dev88",
-};
-
-static const char *lm32_machines[] = {
-    "lm32-evr",
-    "lm32-uclinux",
-    "milkymist",
-};
-
-static const char *m68k_machines[] = {
-    "mcf5208evb",
-    "an5206",
-    "dummy",
-};
-
-static const char *microblaze_machines[] = {
-    "petalogix-ml605",
-    "petalogix-s3adsp1800",
-};
-
-static const char *mips_machines[] = {
-    "malta",
-    "magnum",
-    "mips",
-    "mipssim",
-    "pica61",
-};
-
-static const char *moxie_machines[] = {
-    "moxiesim",
-};
-
-static const char *openrisc_machines[] = {
-    "or32-sim",
-};
-
-static const char *ppc_machines[] = {
-    "g3beige",
-    "mac99",
-    "prep",
-    "mpc8544ds",
-    "ppce500",
-};
-
-static const char *ppc64_machines[] = {
-    "pseries",
-};
-
-static const char *ppc405_machines[] = {
-    "ref405ep",
-    "taihu",
-};
-
-static const char *ppc440_machines[] = {
-    "bamboo",
-    "virtex-ml507",
-};
-
-static const char *s390_machines[] = {
-    "s390-virtio",
-    "s390-ccw-virtio",
-};
-
-static const char *superh_machines[] = {
-    "r2d",
-    "shix",
-};
-
-static const char *sparc_machines[] = {
-    "SS-4",
-    "SS-5",
-    "SS-10",
-    "SS-20",
-    "SS-600MP",
-    "LX",
-    "SPARCClassic",
-    "SPARCbook",
-    "leon3_generic",
-};
-
-static const char *sparc64_machines[] = {
-    "sun4u",
-    "sun4v",
-    "Niagara",
-};
-
-static const char *unicore32_machines[] = {
-    "puv3",
-};
-
-static const char *xtensa_machines[] = {
-    "sim",
-    "lx60",
-    "lx200",
-};
-
-static void add_test_cases(const char *arch, const char *machine)
+static void add_machine_test_cases(void)
 {
-    char *path;
-    path = g_strdup_printf("/%s/qom/%s", arch, machine);
-    g_test_add_data_func(path, machine, test_nop);
+    const char *arch = qtest_get_arch();
+    QDict *response, *minfo;
+    QList *list;
+    const QListEntry *p;
+    QObject *qobj;
+    QString *qstr;
+    const char *mname, *path;
+
+    qtest_start("-machine none");
+    response = qmp("{ 'execute': 'query-machines' }");
+    g_assert(response);
+    list = qdict_get_qlist(response, "return");
+    g_assert(list);
+
+    for (p = qlist_first(list); p; p = qlist_next(p)) {
+        minfo = qobject_to_qdict(qlist_entry_obj(p));
+        g_assert(minfo);
+        qobj = qdict_get(minfo, "name");
+        g_assert(qobj);
+        qstr = qobject_to_qstring(qobj);
+        g_assert(qstr);
+        mname = qstring_get_str(qstr);
+        if (!is_blacklisted(arch, mname)) {
+            path = g_strdup_printf("/%s/qom/%s", arch, mname);
+            g_test_add_data_func(path, mname, test_nop);
+        }
+    }
+    qtest_end();
 }
 
-#define ADD_MACHINE_TESTS(arch, array) do { \
-    int i; \
-    for (i = 0; i < ARRAY_SIZE(array); i++) { \
-        add_test_cases((arch), (array)[i]); \
-    } \
-} while (false)
-
 int main(int argc, char **argv)
 {
-    const char *arch = qtest_get_arch();
-
     g_test_init(&argc, &argv, NULL);
 
-    add_test_cases(arch, "none");
-
-    if (strcmp(arch, "i386") == 0 ||
-        strcmp(arch, "x86_64") == 0) {
-        ADD_MACHINE_TESTS(arch, x86_machines);
-    } else if (strcmp(arch, "alpha") == 0) {
-        ADD_MACHINE_TESTS(arch, alpha_machines);
-    } else if (strcmp(arch, "arm") == 0) {
-        ADD_MACHINE_TESTS(arch, arm_machines);
-    } else if (strcmp(arch, "cris") == 0) {
-        ADD_MACHINE_TESTS(arch, cris_machines);
-    } else if (strcmp(arch, "lm32") == 0) {
-        ADD_MACHINE_TESTS(arch, lm32_machines);
-    } else if (strcmp(arch, "m68k") == 0) {
-        ADD_MACHINE_TESTS(arch, m68k_machines);
-    } else if (strcmp(arch, "microblaze") == 0 ||
-               strcmp(arch, "microblazeel") == 0) {
-        ADD_MACHINE_TESTS(arch, microblaze_machines);
-    } else if (strcmp(arch, "mips") == 0 ||
-               strcmp(arch, "mipsel") == 0 ||
-               strcmp(arch, "mips64") == 0) {
-        ADD_MACHINE_TESTS(arch, mips_machines);
-    } else if (strcmp(arch, "mips64el") == 0) {
-        ADD_MACHINE_TESTS(arch, mips_machines);
-        add_test_cases(arch, "fulong2e");
-    } else if (strcmp(arch, "moxie") == 0) {
-        ADD_MACHINE_TESTS(arch, moxie_machines);
-    } else if (strcmp(arch, "or32") == 0) {
-        ADD_MACHINE_TESTS(arch, openrisc_machines);
-    } else if (strcmp(arch, "ppcemb") == 0) {
-        ADD_MACHINE_TESTS(arch, ppc405_machines);
-        ADD_MACHINE_TESTS(arch, ppc440_machines);
-    } else if (strcmp(arch, "ppc") == 0) {
-        ADD_MACHINE_TESTS(arch, ppc405_machines);
-        ADD_MACHINE_TESTS(arch, ppc440_machines);
-        ADD_MACHINE_TESTS(arch, ppc_machines);
-    } else if (strcmp(arch, "ppc64") == 0) {
-        ADD_MACHINE_TESTS(arch, ppc405_machines);
-        ADD_MACHINE_TESTS(arch, ppc440_machines);
-        ADD_MACHINE_TESTS(arch, ppc_machines);
-        ADD_MACHINE_TESTS(arch, ppc64_machines);
-    } else if (strcmp(arch, "s390x") == 0) {
-        ADD_MACHINE_TESTS(arch, s390_machines);
-    } else if (strcmp(arch, "sh4") == 0 ||
-               strcmp(arch, "sh4eb") == 0) {
-        ADD_MACHINE_TESTS(arch, superh_machines);
-    } else if (strcmp(arch, "sparc") == 0) {
-        ADD_MACHINE_TESTS(arch, sparc_machines);
-    } else if (strcmp(arch, "sparc64") == 0) {
-        ADD_MACHINE_TESTS(arch, sparc64_machines);
-    } else if (strcmp(arch, "unicore32") == 0) {
-        ADD_MACHINE_TESTS(arch, unicore32_machines);
-    } else if (strcmp(arch, "xtensa") == 0 ||
-               strcmp(arch, "xtensaeb") == 0) {
-        ADD_MACHINE_TESTS(arch, xtensa_machines);
-    }
+    add_machine_test_cases();
 
     return g_test_run();
 }
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 06/49] qom-test: Test shutdown in addition to startup
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (4 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 05/49] qom-test: Run for all available machines Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 07/49] tests: Run qom-test for every architecture Andreas Färber
                   ` (43 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Markus Armbruster, Andreas Färber

From: Markus Armbruster <armbru@redhat.com>

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/qom-test.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/qom-test.c b/tests/qom-test.c
index 24cb9c5..3316a11 100644
--- a/tests/qom-test.c
+++ b/tests/qom-test.c
@@ -42,17 +42,17 @@ static bool is_blacklisted(const char *arch, const char *mach)
     return false;
 }
 
-static void test_nop(gconstpointer data)
+static void test_machine(gconstpointer data)
 {
-    QTestState *s;
     const char *machine = data;
     char *args;
+    QDict *response;
 
     args = g_strdup_printf("-machine %s", machine);
-    s = qtest_start(args);
-    if (s) {
-        qtest_quit(s);
-    }
+    qtest_start(args);
+    response = qmp("{ 'execute': 'quit' }");
+    g_assert(qdict_haskey(response, "return"));
+    qtest_end();
     g_free(args);
 }
 
@@ -82,7 +82,7 @@ static void add_machine_test_cases(void)
         mname = qstring_get_str(qstr);
         if (!is_blacklisted(arch, mname)) {
             path = g_strdup_printf("/%s/qom/%s", arch, mname);
-            g_test_add_data_func(path, mname, test_nop);
+            g_test_add_data_func(path, mname, test_machine);
         }
     }
     qtest_end();
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 07/49] tests: Run qom-test for every architecture
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (5 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 06/49] qom-test: Test shutdown in addition to startup Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 08/49] nand: Don't use qdev_create() in nand_init() Andreas Färber
                   ` (42 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Andreas Färber

From: Peter Maydell <peter.maydell@linaro.org>

Rather than requiring every new architecture to remember to add a line
to the Makefile to say that qom-test will work on it, autogenerate
the list of supported architectures by looking at the files in
default-configs (as configure does), and add qom-test to the
test list for all of them automatically.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index 74b7a44..631dd6c 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,5 +1,9 @@
 export SRC_PATH
 
+# Get the list of all supported sysemu targets
+SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
+   $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
+
 check-unit-y = tests/check-qdict$(EXESUF)
 gcov-files-check-qdict-y = qobject/qdict.c
 check-unit-y += tests/check-qfloat$(EXESUF)
@@ -71,7 +75,6 @@ check-qtest-i386-y += tests/acpi-test$(EXESUF)
 check-qtest-i386-y += tests/rtc-test$(EXESUF)
 check-qtest-i386-y += tests/i440fx-test$(EXESUF)
 check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
-check-qtest-i386-y += tests/qom-test$(EXESUF)
 check-qtest-i386-y += tests/blockdev-test$(EXESUF)
 check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
@@ -80,44 +83,26 @@ gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y)
 check-qtest-mips-y = tests/endianness-test$(EXESUF)
 check-qtest-mips64-y = tests/endianness-test$(EXESUF)
 check-qtest-mips64el-y = tests/endianness-test$(EXESUF)
-check-qtest-mips-y += tests/qom-test$(EXESUF)
-check-qtest-mipsel-y += tests/qom-test$(EXESUF)
-check-qtest-mips64-y += tests/qom-test$(EXESUF)
-check-qtest-mips64el-y += tests/qom-test$(EXESUF)
 check-qtest-ppc-y = tests/endianness-test$(EXESUF)
 check-qtest-ppc64-y = tests/endianness-test$(EXESUF)
 check-qtest-sh4-y = tests/endianness-test$(EXESUF)
 check-qtest-sh4eb-y = tests/endianness-test$(EXESUF)
-check-qtest-sh4-y += tests/qom-test$(EXESUF)
-check-qtest-sh4eb-y += tests/qom-test$(EXESUF)
 check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
 #check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
 #check-qtest-sparc64-y += tests/m48t59-test$(EXESUF)
 gcov-files-sparc-y += hw/timer/m48t59.c
 gcov-files-sparc64-y += hw/timer/m48t59.c
-check-qtest-sparc-y += tests/qom-test$(EXESUF)
-check-qtest-sparc64-y += tests/qom-test$(EXESUF)
 check-qtest-arm-y = tests/tmp105-test$(EXESUF)
 gcov-files-arm-y += hw/misc/tmp105.c
-check-qtest-arm-y += tests/qom-test$(EXESUF)
 check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
 check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
-check-qtest-ppc-y += tests/qom-test$(EXESUF)
-check-qtest-ppc64-y += tests/qom-test$(EXESUF)
-check-qtest-ppcemb-y += tests/qom-test$(EXESUF)
-check-qtest-alpha-y += tests/qom-test$(EXESUF)
-check-qtest-cris-y += tests/qom-test$(EXESUF)
-check-qtest-lm32-y += tests/qom-test$(EXESUF)
-check-qtest-m68k-y += tests/qom-test$(EXESUF)
-check-qtest-microblaze-y += tests/qom-test$(EXESUF)
 check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
-check-qtest-moxie-y += tests/qom-test$(EXESUF)
-check-qtest-or32-y += tests/qom-test$(EXESUF)
-check-qtest-s390x-y += tests/qom-test$(EXESUF)
-check-qtest-unicore32-y += tests/qom-test$(EXESUF)
-check-qtest-xtensa-y += tests/qom-test$(EXESUF)
 check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
 
+# qom-test works for all sysemu architectures:
+$(foreach target,$(SYSEMU_TARGET_LIST), \
+    $(eval check-qtest-$(target)-y += tests/qom-test$(EXESUF)))
+
 check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
         comments.json empty.json funny-char.json indented-expr.json \
         missing-colon.json missing-comma-list.json \
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 08/49] nand: Don't use qdev_create() in nand_init()
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (6 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 07/49] tests: Run qom-test for every architecture Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 09/49] i2c: Rename i2c_bus to I2CBus Andreas Färber
                   ` (41 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Crosthwaite, Andreas Färber, Stefan Hajnoczi

Commit 7426aa72c36c908a7d0eae3e38568bb0a70de479 (nand: Don't inherit
from Sysbus) changed the parent type of TYPE_NAND but continued to use
qdev_create(), which handled a NULL BusState as SysBus.

Use object_new() instead, and reuse the TYPE_NAND define while at it.

Reported-by: Markus Armbruster <armbru@redhat.com>
Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/block/nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/nand.c b/hw/block/nand.c
index a871ce0..6d7c804 100644
--- a/hw/block/nand.c
+++ b/hw/block/nand.c
@@ -632,7 +632,7 @@ DeviceState *nand_init(BlockDriverState *bdrv, int manf_id, int chip_id)
     if (nand_flash_ids[chip_id].size == 0) {
         hw_error("%s: Unsupported NAND chip ID.\n", __FUNCTION__);
     }
-    dev = qdev_create(NULL, "nand");
+    dev = DEVICE(object_new(TYPE_NAND));
     qdev_prop_set_uint8(dev, "manufacturer_id", manf_id);
     qdev_prop_set_uint8(dev, "chip_id", chip_id);
     if (bdrv) {
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 09/49] i2c: Rename i2c_bus to I2CBus
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (7 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 08/49] nand: Don't use qdev_create() in nand_init() Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 10/49] pxa2xx: QOM'ify I2C slave Andreas Färber
                   ` (40 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Evgeny Voevodin, Michael S. Tsirkin,
	Igor Mitsyanko, Jan Kiszka, Dmitry Solodkiy, Anthony Liguori,
	Maksim Kozlov, Andreas Färber, Aurelien Jarno

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/acpi/piix4.c             |  6 +++---
 hw/arm/exynos4210.c         |  2 +-
 hw/arm/musicpal.c           |  4 ++--
 hw/arm/nseries.c            |  2 +-
 hw/arm/pxa2xx.c             |  6 +++---
 hw/arm/realview.c           |  4 ++--
 hw/arm/spitz.c              |  2 +-
 hw/arm/stellaris.c          |  8 ++++----
 hw/arm/tosa.c               |  2 +-
 hw/arm/versatilepb.c        |  4 ++--
 hw/arm/z2.c                 |  2 +-
 hw/i2c/bitbang_i2c.c        |  6 +++---
 hw/i2c/bitbang_i2c.h        |  2 +-
 hw/i2c/core.c               | 32 ++++++++++++++++----------------
 hw/i2c/exynos4210_i2c.c     |  2 +-
 hw/i2c/omap_i2c.c           |  4 ++--
 hw/i2c/pm_smbus.c           |  2 +-
 hw/i2c/smbus.c              | 18 +++++++++---------
 hw/i2c/smbus_eeprom.c       |  2 +-
 hw/i2c/smbus_ich9.c         |  2 +-
 hw/i2c/versatile_i2c.c      |  2 +-
 hw/i386/pc_piix.c           |  2 +-
 hw/isa/vt82c686.c           |  4 ++--
 hw/mips/mips_fulong2e.c     |  2 +-
 hw/mips/mips_malta.c        |  2 +-
 include/hw/arm/exynos4210.h |  2 +-
 include/hw/arm/omap.h       |  2 +-
 include/hw/arm/pxa.h        |  2 +-
 include/hw/i2c/i2c.h        | 16 ++++++++--------
 include/hw/i2c/pm_smbus.h   |  2 +-
 include/hw/i2c/smbus.h      | 20 ++++++++++----------
 include/hw/i386/ich9.h      |  2 +-
 include/hw/i386/pc.h        |  6 +++---
 include/hw/isa/vt82c686.h   |  4 ++--
 include/qemu/typedefs.h     |  2 +-
 35 files changed, 91 insertions(+), 91 deletions(-)

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 5d55a3c..33e812d 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -517,9 +517,9 @@ Object *piix4_pm_find(void)
     return o;
 }
 
-i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
-                       qemu_irq sci_irq, qemu_irq smi_irq,
-                       int kvm_enabled, FWCfgState *fw_cfg)
+I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
+                      qemu_irq sci_irq, qemu_irq smi_irq,
+                      int kvm_enabled, FWCfgState *fw_cfg)
 {
     DeviceState *dev;
     PIIX4PMState *s;
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
index 4ebb938..9f137e9 100644
--- a/hw/arm/exynos4210.c
+++ b/hw/arm/exynos4210.c
@@ -326,7 +326,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
         busdev = SYS_BUS_DEVICE(dev);
         sysbus_connect_irq(busdev, 0, i2c_irq);
         sysbus_mmio_map(busdev, 0, addr);
-        s->i2c_if[n] = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
+        s->i2c_if[n] = (I2CBus *)qdev_get_child_bus(dev, "i2c");
     }
 
 
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 023e875..50a3b8f 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1593,7 +1593,7 @@ static void musicpal_init(QEMUMachineInitArgs *args)
     DeviceState *key_dev;
     DeviceState *wm8750_dev;
     SysBusDevice *s;
-    i2c_bus *i2c;
+    I2CBus *i2c;
     int i;
     unsigned long flash_size;
     DriveInfo *dinfo;
@@ -1687,7 +1687,7 @@ static void musicpal_init(QEMUMachineInitArgs *args)
     dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE,
                                pic[MP_GPIO_IRQ]);
     i2c_dev = sysbus_create_simple("gpio_i2c", -1, NULL);
-    i2c = (i2c_bus *)qdev_get_child_bus(i2c_dev, "i2c");
+    i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c");
 
     lcd_dev = sysbus_create_simple(TYPE_MUSICPAL_LCD, MP_LCD_BASE, NULL);
     key_dev = sysbus_create_simple(TYPE_MUSICPAL_KEY, -1, NULL);
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index 9ef31ca..c28f895 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -202,7 +202,7 @@ static void n8x0_i2c_setup(struct n800_s *s)
 {
     DeviceState *dev;
     qemu_irq tmp_irq = qdev_get_gpio_in(s->mpu->gpio, N8X0_TMP105_GPIO);
-    i2c_bus *i2c = omap_i2c_bus(s->mpu->i2c[0]);
+    I2CBus *i2c = omap_i2c_bus(s->mpu->i2c[0]);
 
     /* Attach a menelaus PM chip */
     dev = i2c_create_slave(i2c, "twl92230", N8X0_MENELAUS_ADDR);
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index 25ec549..7de109c 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -1238,7 +1238,7 @@ struct PXA2xxI2CState {
 
     MemoryRegion iomem;
     PXA2xxI2CSlaveState *slave;
-    i2c_bus *bus;
+    I2CBus *bus;
     qemu_irq irq;
     uint32_t offset;
     uint32_t region_size;
@@ -1482,7 +1482,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base,
     DeviceState *dev;
     SysBusDevice *i2c_dev;
     PXA2xxI2CState *s;
-    i2c_bus *i2cbus;
+    I2CBus *i2cbus;
 
     dev = qdev_create(NULL, TYPE_PXA2XX_I2C);
     qdev_prop_set_uint32(dev, "size", region_size + 1);
@@ -1518,7 +1518,7 @@ static int pxa2xx_i2c_initfn(SysBusDevice *sbd)
     return 0;
 }
 
-i2c_bus *pxa2xx_i2c_bus(PXA2xxI2CState *s)
+I2CBus *pxa2xx_i2c_bus(PXA2xxI2CState *s)
 {
     return s->bus;
 }
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index 8d845dd..6ef7646 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -60,7 +60,7 @@ static void realview_init(QEMUMachineInitArgs *args,
     qemu_irq mmc_irq[2];
     PCIBus *pci_bus = NULL;
     NICInfo *nd;
-    i2c_bus *i2c;
+    I2CBus *i2c;
     int n;
     int done_nic = 0;
     qemu_irq cpu_irq[4];
@@ -255,7 +255,7 @@ static void realview_init(QEMUMachineInitArgs *args,
     }
 
     dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL);
-    i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
+    i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
     i2c_create_slave(i2c, "ds1338", 0x68);
 
     /* Memory map for RealView Emulation Baseboard:  */
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index ba17283..2decff1 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -734,7 +734,7 @@ static void spitz_wm8750_addr(void *opaque, int line, int level)
 static void spitz_i2c_setup(PXA2xxState *cpu)
 {
     /* Attach the CPU on one end of our I2C bus.  */
-    i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
+    I2CBus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
 
     DeviceState *wm;
 
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index 3170d69..d6cc77b 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -692,7 +692,7 @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq,
 typedef struct {
     SysBusDevice parent_obj;
 
-    i2c_bus *bus;
+    I2CBus *bus;
     qemu_irq irq;
     MemoryRegion iomem;
     uint32_t msa;
@@ -868,7 +868,7 @@ static int stellaris_i2c_init(SysBusDevice *sbd)
 {
     DeviceState *dev = DEVICE(sbd);
     stellaris_i2c_state *s = STELLARIS_I2C(dev);
-    i2c_bus *bus;
+    I2CBus *bus;
 
     sysbus_init_irq(sbd, &s->irq);
     bus = i2c_init_bus(dev, "i2c");
@@ -1213,7 +1213,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
     qemu_irq adc;
     int sram_size;
     int flash_size;
-    i2c_bus *i2c;
+    I2CBus *i2c;
     DeviceState *dev;
     int i;
     int j;
@@ -1256,7 +1256,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
 
     if (board->dc2 & (1 << 12)) {
         dev = sysbus_create_simple(TYPE_STELLARIS_I2C, 0x40020000, pic[8]);
-        i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
+        i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
         if (board->peripherals & BP_OLED_I2C) {
             i2c_create_slave(i2c, "ssd0303", 0x3d);
         }
diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
index c00d8c2..dd224d3 100644
--- a/hw/arm/tosa.c
+++ b/hw/arm/tosa.c
@@ -194,7 +194,7 @@ static int tosa_dac_init(I2CSlave *i2c)
 
 static void tosa_tg_init(PXA2xxState *cpu)
 {
-    i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
+    I2CBus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
     i2c_create_slave(bus, "tosa_dac", DAC_BASE);
     ssi_create_slave(cpu->ssp[1], "tosa-ssp");
 }
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index aef2bde..e5493b4 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -185,7 +185,7 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
     DeviceState *pl041;
     PCIBus *pci_bus;
     NICInfo *nd;
-    i2c_bus *i2c;
+    I2CBus *i2c;
     int n;
     int done_smc = 0;
     DriveInfo *dinfo;
@@ -288,7 +288,7 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
     sysbus_create_simple("pl031", 0x101e8000, pic[10]);
 
     dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL);
-    i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
+    i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
     i2c_create_slave(i2c, "ds1338", 0x68);
 
     /* Add PL041 AACI Interface to the LM4549 codec */
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index 97367b1..97ec381 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -308,7 +308,7 @@ static void z2_init(QEMUMachineInitArgs *args)
     DriveInfo *dinfo;
     int be;
     void *z2_lcd;
-    i2c_bus *bus;
+    I2CBus *bus;
     DeviceState *wm;
 
     if (!cpu_model) {
diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index ca59456..6d1bb03 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -46,7 +46,7 @@ typedef enum bitbang_i2c_state {
 } bitbang_i2c_state;
 
 struct bitbang_i2c_interface {
-    i2c_bus *bus;
+    I2CBus *bus;
     bitbang_i2c_state state;
     int last_data;
     int last_clock;
@@ -170,7 +170,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level)
     abort();
 }
 
-bitbang_i2c_interface *bitbang_i2c_init(i2c_bus *bus)
+bitbang_i2c_interface *bitbang_i2c_init(I2CBus *bus)
 {
     bitbang_i2c_interface *s;
 
@@ -213,7 +213,7 @@ static int gpio_i2c_init(SysBusDevice *sbd)
 {
     DeviceState *dev = DEVICE(sbd);
     GPIOI2CState *s = GPIO_I2C(dev);
-    i2c_bus *bus;
+    I2CBus *bus;
 
     memory_region_init(&s->dummy_iomem, OBJECT(s), "gpio_i2c", 0);
     sysbus_init_mmio(sbd, &s->dummy_iomem);
diff --git a/hw/i2c/bitbang_i2c.h b/hw/i2c/bitbang_i2c.h
index 2866ac3..3a7126d 100644
--- a/hw/i2c/bitbang_i2c.h
+++ b/hw/i2c/bitbang_i2c.h
@@ -8,7 +8,7 @@ typedef struct bitbang_i2c_interface bitbang_i2c_interface;
 #define BITBANG_I2C_SDA 0
 #define BITBANG_I2C_SCL 1
 
-bitbang_i2c_interface *bitbang_i2c_init(i2c_bus *bus);
+bitbang_i2c_interface *bitbang_i2c_init(I2CBus *bus);
 int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level);
 
 #endif
diff --git a/hw/i2c/core.c b/hw/i2c/core.c
index c97e7f7..efd8b4f 100644
--- a/hw/i2c/core.c
+++ b/hw/i2c/core.c
@@ -9,7 +9,7 @@
 
 #include "hw/i2c/i2c.h"
 
-struct i2c_bus
+struct I2CBus
 {
     BusState qbus;
     I2CSlave *current_dev;
@@ -23,24 +23,24 @@ static Property i2c_props[] = {
 };
 
 #define TYPE_I2C_BUS "i2c-bus"
-#define I2C_BUS(obj) OBJECT_CHECK(i2c_bus, (obj), TYPE_I2C_BUS)
+#define I2C_BUS(obj) OBJECT_CHECK(I2CBus, (obj), TYPE_I2C_BUS)
 
 static const TypeInfo i2c_bus_info = {
     .name = TYPE_I2C_BUS,
     .parent = TYPE_BUS,
-    .instance_size = sizeof(i2c_bus),
+    .instance_size = sizeof(I2CBus),
 };
 
 static void i2c_bus_pre_save(void *opaque)
 {
-    i2c_bus *bus = opaque;
+    I2CBus *bus = opaque;
 
     bus->saved_address = bus->current_dev ? bus->current_dev->address : -1;
 }
 
 static int i2c_bus_post_load(void *opaque, int version_id)
 {
-    i2c_bus *bus = opaque;
+    I2CBus *bus = opaque;
 
     /* The bus is loaded before attached devices, so load and save the
        current device id.  Devices will check themselves as loaded.  */
@@ -56,15 +56,15 @@ static const VMStateDescription vmstate_i2c_bus = {
     .pre_save = i2c_bus_pre_save,
     .post_load = i2c_bus_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_UINT8(saved_address, i2c_bus),
+        VMSTATE_UINT8(saved_address, I2CBus),
         VMSTATE_END_OF_LIST()
     }
 };
 
 /* Create a new I2C bus.  */
-i2c_bus *i2c_init_bus(DeviceState *parent, const char *name)
+I2CBus *i2c_init_bus(DeviceState *parent, const char *name)
 {
-    i2c_bus *bus;
+    I2CBus *bus;
 
     bus = I2C_BUS(qbus_create(TYPE_I2C_BUS, parent, name));
     vmstate_register(NULL, -1, &vmstate_i2c_bus, bus);
@@ -77,14 +77,14 @@ void i2c_set_slave_address(I2CSlave *dev, uint8_t address)
 }
 
 /* Return nonzero if bus is busy.  */
-int i2c_bus_busy(i2c_bus *bus)
+int i2c_bus_busy(I2CBus *bus)
 {
     return bus->current_dev != NULL;
 }
 
 /* Returns non-zero if the address is not valid.  */
 /* TODO: Make this handle multiple masters.  */
-int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv)
+int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv)
 {
     BusChild *kid;
     I2CSlave *slave = NULL;
@@ -113,7 +113,7 @@ int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv)
     return 0;
 }
 
-void i2c_end_transfer(i2c_bus *bus)
+void i2c_end_transfer(I2CBus *bus)
 {
     I2CSlave *dev = bus->current_dev;
     I2CSlaveClass *sc;
@@ -130,7 +130,7 @@ void i2c_end_transfer(i2c_bus *bus)
     bus->current_dev = NULL;
 }
 
-int i2c_send(i2c_bus *bus, uint8_t data)
+int i2c_send(I2CBus *bus, uint8_t data)
 {
     I2CSlave *dev = bus->current_dev;
     I2CSlaveClass *sc;
@@ -147,7 +147,7 @@ int i2c_send(i2c_bus *bus, uint8_t data)
     return -1;
 }
 
-int i2c_recv(i2c_bus *bus)
+int i2c_recv(I2CBus *bus)
 {
     I2CSlave *dev = bus->current_dev;
     I2CSlaveClass *sc;
@@ -164,7 +164,7 @@ int i2c_recv(i2c_bus *bus)
     return -1;
 }
 
-void i2c_nack(i2c_bus *bus)
+void i2c_nack(I2CBus *bus)
 {
     I2CSlave *dev = bus->current_dev;
     I2CSlaveClass *sc;
@@ -182,7 +182,7 @@ void i2c_nack(i2c_bus *bus)
 static int i2c_slave_post_load(void *opaque, int version_id)
 {
     I2CSlave *dev = opaque;
-    i2c_bus *bus;
+    I2CBus *bus;
     bus = I2C_BUS(qdev_get_parent_bus(DEVICE(dev)));
     if (bus->saved_address == dev->address) {
         bus->current_dev = dev;
@@ -210,7 +210,7 @@ static int i2c_slave_qdev_init(DeviceState *dev)
     return sc->init(s);
 }
 
-DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
+DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr)
 {
     DeviceState *dev;
 
diff --git a/hw/i2c/exynos4210_i2c.c b/hw/i2c/exynos4210_i2c.c
index ce5f849..fb99dfd 100644
--- a/hw/i2c/exynos4210_i2c.c
+++ b/hw/i2c/exynos4210_i2c.c
@@ -83,7 +83,7 @@ typedef struct Exynos4210I2CState {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
-    i2c_bus *bus;
+    I2CBus *bus;
     qemu_irq irq;
 
     uint8_t i2ccon;
diff --git a/hw/i2c/omap_i2c.c b/hw/i2c/omap_i2c.c
index 2d8e2b7..d63278d 100644
--- a/hw/i2c/omap_i2c.c
+++ b/hw/i2c/omap_i2c.c
@@ -30,7 +30,7 @@ typedef struct OMAPI2CState {
     MemoryRegion iomem;
     qemu_irq irq;
     qemu_irq drq[2];
-    i2c_bus *bus;
+    I2CBus *bus;
 
     uint8_t revision;
     void *iclk;
@@ -491,7 +491,7 @@ static void omap_i2c_register_types(void)
     type_register_static(&omap_i2c_info);
 }
 
-i2c_bus *omap_i2c_bus(DeviceState *omap_i2c)
+I2CBus *omap_i2c_bus(DeviceState *omap_i2c)
 {
     OMAPI2CState *s = OMAP_I2C(omap_i2c);
     return s->bus;
diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
index c98e447..9f50067 100644
--- a/hw/i2c/pm_smbus.c
+++ b/hw/i2c/pm_smbus.c
@@ -59,7 +59,7 @@ static void smb_transaction(PMSMBus *s)
     uint8_t read = s->smb_addr & 0x01;
     uint8_t cmd = s->smb_cmd;
     uint8_t addr = s->smb_addr >> 1;
-    i2c_bus *bus = s->smbus;
+    I2CBus *bus = s->smbus;
 
     SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
     /* Transaction isn't exec if STS_DEV_ERR bit set */
diff --git a/hw/i2c/smbus.c b/hw/i2c/smbus.c
index 25d2d04..3febf3c 100644
--- a/hw/i2c/smbus.c
+++ b/hw/i2c/smbus.c
@@ -208,13 +208,13 @@ static int smbus_device_init(I2CSlave *i2c)
 }
 
 /* Master device commands.  */
-void smbus_quick_command(i2c_bus *bus, uint8_t addr, int read)
+void smbus_quick_command(I2CBus *bus, uint8_t addr, int read)
 {
     i2c_start_transfer(bus, addr, read);
     i2c_end_transfer(bus);
 }
 
-uint8_t smbus_receive_byte(i2c_bus *bus, uint8_t addr)
+uint8_t smbus_receive_byte(I2CBus *bus, uint8_t addr)
 {
     uint8_t data;
 
@@ -225,14 +225,14 @@ uint8_t smbus_receive_byte(i2c_bus *bus, uint8_t addr)
     return data;
 }
 
-void smbus_send_byte(i2c_bus *bus, uint8_t addr, uint8_t data)
+void smbus_send_byte(I2CBus *bus, uint8_t addr, uint8_t data)
 {
     i2c_start_transfer(bus, addr, 0);
     i2c_send(bus, data);
     i2c_end_transfer(bus);
 }
 
-uint8_t smbus_read_byte(i2c_bus *bus, uint8_t addr, uint8_t command)
+uint8_t smbus_read_byte(I2CBus *bus, uint8_t addr, uint8_t command)
 {
     uint8_t data;
     i2c_start_transfer(bus, addr, 0);
@@ -244,7 +244,7 @@ uint8_t smbus_read_byte(i2c_bus *bus, uint8_t addr, uint8_t command)
     return data;
 }
 
-void smbus_write_byte(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t data)
+void smbus_write_byte(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t data)
 {
     i2c_start_transfer(bus, addr, 0);
     i2c_send(bus, command);
@@ -252,7 +252,7 @@ void smbus_write_byte(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t data)
     i2c_end_transfer(bus);
 }
 
-uint16_t smbus_read_word(i2c_bus *bus, uint8_t addr, uint8_t command)
+uint16_t smbus_read_word(I2CBus *bus, uint8_t addr, uint8_t command)
 {
     uint16_t data;
     i2c_start_transfer(bus, addr, 0);
@@ -265,7 +265,7 @@ uint16_t smbus_read_word(i2c_bus *bus, uint8_t addr, uint8_t command)
     return data;
 }
 
-void smbus_write_word(i2c_bus *bus, uint8_t addr, uint8_t command, uint16_t data)
+void smbus_write_word(I2CBus *bus, uint8_t addr, uint8_t command, uint16_t data)
 {
     i2c_start_transfer(bus, addr, 0);
     i2c_send(bus, command);
@@ -274,7 +274,7 @@ void smbus_write_word(i2c_bus *bus, uint8_t addr, uint8_t command, uint16_t data
     i2c_end_transfer(bus);
 }
 
-int smbus_read_block(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t *data)
+int smbus_read_block(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t *data)
 {
     int len;
     int i;
@@ -292,7 +292,7 @@ int smbus_read_block(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t *data)
     return len;
 }
 
-void smbus_write_block(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t *data,
+void smbus_write_block(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t *data,
                        int len)
 {
     int i;
diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c
index 0218f8a..86f35c1 100644
--- a/hw/i2c/smbus_eeprom.c
+++ b/hw/i2c/smbus_eeprom.c
@@ -139,7 +139,7 @@ static void smbus_eeprom_register_types(void)
 
 type_init(smbus_eeprom_register_types)
 
-void smbus_eeprom_init(i2c_bus *smbus, int nb_eeprom,
+void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom,
                        const uint8_t *eeprom_spd, int eeprom_spd_size)
 {
     int i;
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index 8d47eaf..295b62e 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -108,7 +108,7 @@ static void ich9_smb_class_init(ObjectClass *klass, void *data)
     dc->cannot_instantiate_with_device_add_yet = true;
 }
 
-i2c_bus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base)
+I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base)
 {
     PCIDevice *d =
         pci_create_simple_multifunction(bus, devfn, true, TYPE_ICH9_SMB_DEVICE);
diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c
index 02e9f17..3c0c2c1 100644
--- a/hw/i2c/versatile_i2c.c
+++ b/hw/i2c/versatile_i2c.c
@@ -81,7 +81,7 @@ static int versatile_i2c_init(SysBusDevice *sbd)
 {
     DeviceState *dev = DEVICE(sbd);
     VersatileI2CState *s = VERSATILE_I2C(dev);
-    i2c_bus *bus;
+    I2CBus *bus;
 
     bus = i2c_init_bus(dev, "i2c");
     s->bitbang = bitbang_i2c_init(bus);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index a327d71..3639a6d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -236,7 +236,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
     }
 
     if (pci_enabled && acpi_enabled) {
-        i2c_bus *smbus;
+        I2CBus *smbus;
 
         smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
         /* TODO: Populate SPD eeprom data.  */
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index e639357..1a93afd 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -369,8 +369,8 @@ static int vt82c686b_pm_initfn(PCIDevice *dev)
     return 0;
 }
 
-i2c_bus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
-                       qemu_irq sci_irq)
+I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
+                          qemu_irq sci_irq)
 {
     PCIDevice *dev;
     VT686PMState *s;
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index 9ef3a97..e1551aa 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -276,7 +276,7 @@ static void mips_fulong2e_init(QEMUMachineInitArgs *args)
     qemu_irq *cpu_exit_irq;
     PCIBus *pci_bus;
     ISABus *isa_bus;
-    i2c_bus *smbus;
+    I2CBus *smbus;
     int i;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     MIPSCPU *cpu;
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 05c8771..ac5ec44 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -900,7 +900,7 @@ void mips_malta_init(QEMUMachineInitArgs *args)
     qemu_irq *isa_irq;
     qemu_irq *cpu_exit_irq;
     int piix4_devfn;
-    i2c_bus *smbus;
+    I2CBus *smbus;
     int i;
     DriveInfo *dinfo;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
index bb9a1dd..5c1820f 100644
--- a/include/hw/arm/exynos4210.h
+++ b/include/hw/arm/exynos4210.h
@@ -97,7 +97,7 @@ typedef struct Exynos4210State {
     MemoryRegion dram1_mem;
     MemoryRegion boot_secondary;
     MemoryRegion bootreg_mem;
-    i2c_bus *i2c_if[EXYNOS4210_I2C_NUMBER];
+    I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER];
 } Exynos4210State;
 
 void exynos4210_write_secondary(ARMCPU *cpu,
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index 188cda8..b9655ee 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -765,7 +765,7 @@ void omap_mmc_handlers(struct omap_mmc_s *s, qemu_irq ro, qemu_irq cover);
 void omap_mmc_enable(struct omap_mmc_s *s, int enable);
 
 /* omap_i2c.c */
-i2c_bus *omap_i2c_bus(DeviceState *omap_i2c);
+I2CBus *omap_i2c_bus(DeviceState *omap_i2c);
 
 # define cpu_is_omap310(cpu)		(cpu->mpu_model == omap310)
 # define cpu_is_omap1510(cpu)		(cpu->mpu_model == omap1510)
diff --git a/include/hw/arm/pxa.h b/include/hw/arm/pxa.h
index 7ca330a..c507906 100644
--- a/include/hw/arm/pxa.h
+++ b/include/hw/arm/pxa.h
@@ -116,7 +116,7 @@ void pxa27x_register_keypad(PXA2xxKeyPadState *kp,
 typedef struct PXA2xxI2CState PXA2xxI2CState;
 PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base,
                 qemu_irq irq, uint32_t page_size);
-i2c_bus *pxa2xx_i2c_bus(PXA2xxI2CState *s);
+I2CBus *pxa2xx_i2c_bus(PXA2xxI2CState *s);
 
 typedef struct PXA2xxI2SState PXA2xxI2SState;
 typedef struct PXA2xxFIrState PXA2xxFIrState;
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index 461392f..9df987b 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -50,18 +50,18 @@ struct I2CSlave
     uint8_t address;
 };
 
-i2c_bus *i2c_init_bus(DeviceState *parent, const char *name);
+I2CBus *i2c_init_bus(DeviceState *parent, const char *name);
 void i2c_set_slave_address(I2CSlave *dev, uint8_t address);
-int i2c_bus_busy(i2c_bus *bus);
-int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv);
-void i2c_end_transfer(i2c_bus *bus);
-void i2c_nack(i2c_bus *bus);
-int i2c_send(i2c_bus *bus, uint8_t data);
-int i2c_recv(i2c_bus *bus);
+int i2c_bus_busy(I2CBus *bus);
+int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv);
+void i2c_end_transfer(I2CBus *bus);
+void i2c_nack(I2CBus *bus);
+int i2c_send(I2CBus *bus, uint8_t data);
+int i2c_recv(I2CBus *bus);
 
 #define FROM_I2C_SLAVE(type, dev) DO_UPCAST(type, i2c, dev)
 
-DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr);
+DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
 
 /* wm8750.c */
 void wm8750_data_req_set(DeviceState *dev,
diff --git a/include/hw/i2c/pm_smbus.h b/include/hw/i2c/pm_smbus.h
index e3069bf..926603f 100644
--- a/include/hw/i2c/pm_smbus.h
+++ b/include/hw/i2c/pm_smbus.h
@@ -2,7 +2,7 @@
 #define PM_SMBUS_H
 
 typedef struct PMSMBus {
-    i2c_bus *smbus;
+    I2CBus *smbus;
     MemoryRegion io;
 
     uint8_t smb_stat;
diff --git a/include/hw/i2c/smbus.h b/include/hw/i2c/smbus.h
index d764d75..63f0cc4 100644
--- a/include/hw/i2c/smbus.h
+++ b/include/hw/i2c/smbus.h
@@ -66,18 +66,18 @@ struct SMBusDevice {
 };
 
 /* Master device commands.  */
-void smbus_quick_command(i2c_bus *bus, uint8_t addr, int read);
-uint8_t smbus_receive_byte(i2c_bus *bus, uint8_t addr);
-void smbus_send_byte(i2c_bus *bus, uint8_t addr, uint8_t data);
-uint8_t smbus_read_byte(i2c_bus *bus, uint8_t addr, uint8_t command);
-void smbus_write_byte(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t data);
-uint16_t smbus_read_word(i2c_bus *bus, uint8_t addr, uint8_t command);
-void smbus_write_word(i2c_bus *bus, uint8_t addr, uint8_t command, uint16_t data);
-int smbus_read_block(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t *data);
-void smbus_write_block(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t *data,
+void smbus_quick_command(I2CBus *bus, uint8_t addr, int read);
+uint8_t smbus_receive_byte(I2CBus *bus, uint8_t addr);
+void smbus_send_byte(I2CBus *bus, uint8_t addr, uint8_t data);
+uint8_t smbus_read_byte(I2CBus *bus, uint8_t addr, uint8_t command);
+void smbus_write_byte(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t data);
+uint16_t smbus_read_word(I2CBus *bus, uint8_t addr, uint8_t command);
+void smbus_write_word(I2CBus *bus, uint8_t addr, uint8_t command, uint16_t data);
+int smbus_read_block(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t *data);
+void smbus_write_block(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t *data,
                        int len);
 
-void smbus_eeprom_init(i2c_bus *smbus, int nb_eeprom,
+void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom,
                        const uint8_t *eeprom_spd, int size);
 
 #endif
diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 4a68b35..9e4a0e4 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -20,7 +20,7 @@ int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx);
 PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin);
 void ich9_lpc_pm_init(PCIDevice *pci_lpc);
 PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus);
-i2c_bus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
+I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
 
 #define ICH9_CC_SIZE                            (16 * 1024)     /* 16KB */
 
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 3e1e81b..9010246 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -165,9 +165,9 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
 
 /* acpi_piix.c */
 
-i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
-                       qemu_irq sci_irq, qemu_irq smi_irq,
-                       int kvm_enabled, FWCfgState *fw_cfg);
+I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
+                      qemu_irq sci_irq, qemu_irq smi_irq,
+                      int kvm_enabled, FWCfgState *fw_cfg);
 void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
 
 /* hpet.c */
diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h
index 6ef876d..471b5e9 100644
--- a/include/hw/isa/vt82c686.h
+++ b/include/hw/isa/vt82c686.h
@@ -5,7 +5,7 @@
 ISABus *vt82c686b_init(PCIBus * bus, int devfn);
 void vt82c686b_ac97_init(PCIBus *bus, int devfn);
 void vt82c686b_mc97_init(PCIBus *bus, int devfn);
-i2c_bus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
-            qemu_irq sci_irq);
+I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
+                          qemu_irq sci_irq);
 
 #endif
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 5b4e333..83c9b16 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -43,7 +43,7 @@ typedef struct QemuConsole QemuConsole;
 typedef struct CharDriverState CharDriverState;
 typedef struct MACAddr MACAddr;
 typedef struct NetClientState NetClientState;
-typedef struct i2c_bus i2c_bus;
+typedef struct I2CBus I2CBus;
 typedef struct ISABus ISABus;
 typedef struct ISADevice ISADevice;
 typedef struct SMBusDevice SMBusDevice;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 10/49] pxa2xx: QOM'ify I2C slave
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (8 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 09/49] i2c: Rename i2c_bus to I2CBus Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 11/49] tosa: QOM'ify DAC Andreas Färber
                   ` (39 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Andreas Färber

Replace usages of FROM_I2C_SLAVE() and direct parent field accesses with
QOM cast macro. Rename parent field to assure we caught all. Reuse type
constant in pxa2xx_i2c_init().

Add some missing braces while at it.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/arm/pxa2xx.c | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index 7de109c..66bc0dc 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -1222,8 +1222,14 @@ static const TypeInfo pxa2xx_rtc_sysbus_info = {
 };
 
 /* I2C Interface */
-typedef struct {
-    I2CSlave i2c;
+
+#define TYPE_PXA2XX_I2C_SLAVE "pxa2xx-i2c-slave"
+#define PXA2XX_I2C_SLAVE(obj) \
+    OBJECT_CHECK(PXA2xxI2CSlaveState, (obj), TYPE_PXA2XX_I2C_SLAVE)
+
+typedef struct PXA2xxI2CSlaveState {
+    I2CSlave parent_obj;
+
     PXA2xxI2CState *host;
 } PXA2xxI2CSlaveState;
 
@@ -1268,7 +1274,7 @@ static void pxa2xx_i2c_update(PXA2xxI2CState *s)
 /* These are only stubs now.  */
 static void pxa2xx_i2c_event(I2CSlave *i2c, enum i2c_event event)
 {
-    PXA2xxI2CSlaveState *slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, i2c);
+    PXA2xxI2CSlaveState *slave = PXA2XX_I2C_SLAVE(i2c);
     PXA2xxI2CState *s = slave->host;
 
     switch (event) {
@@ -1292,10 +1298,12 @@ static void pxa2xx_i2c_event(I2CSlave *i2c, enum i2c_event event)
 
 static int pxa2xx_i2c_rx(I2CSlave *i2c)
 {
-    PXA2xxI2CSlaveState *slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, i2c);
+    PXA2xxI2CSlaveState *slave = PXA2XX_I2C_SLAVE(i2c);
     PXA2xxI2CState *s = slave->host;
-    if ((s->control & (1 << 14)) || !(s->control & (1 << 6)))
+
+    if ((s->control & (1 << 14)) || !(s->control & (1 << 6))) {
         return 0;
+    }
 
     if (s->status & (1 << 0)) {			/* RWM */
         s->status |= 1 << 6;			/* set ITE */
@@ -1307,10 +1315,12 @@ static int pxa2xx_i2c_rx(I2CSlave *i2c)
 
 static int pxa2xx_i2c_tx(I2CSlave *i2c, uint8_t data)
 {
-    PXA2xxI2CSlaveState *slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, i2c);
+    PXA2xxI2CSlaveState *slave = PXA2XX_I2C_SLAVE(i2c);
     PXA2xxI2CState *s = slave->host;
-    if ((s->control & (1 << 14)) || !(s->control & (1 << 6)))
+
+    if ((s->control & (1 << 14)) || !(s->control & (1 << 6))) {
         return 1;
+    }
 
     if (!(s->status & (1 << 0))) {		/* RWM */
         s->status |= 1 << 7;			/* set IRF */
@@ -1325,6 +1335,7 @@ static uint64_t pxa2xx_i2c_read(void *opaque, hwaddr addr,
                                 unsigned size)
 {
     PXA2xxI2CState *s = (PXA2xxI2CState *) opaque;
+    I2CSlave *slave;
 
     addr -= s->offset;
     switch (addr) {
@@ -1333,7 +1344,8 @@ static uint64_t pxa2xx_i2c_read(void *opaque, hwaddr addr,
     case ISR:
         return s->status | (i2c_bus_busy(s->bus) << 2);
     case ISAR:
-        return s->slave->i2c.address;
+        slave = I2C_SLAVE(s->slave);
+        return slave->address;
     case IDBR:
         return s->data;
     case IBMR:
@@ -1408,7 +1420,7 @@ static void pxa2xx_i2c_write(void *opaque, hwaddr addr,
         break;
 
     case ISAR:
-        i2c_set_slave_address(&s->slave->i2c, value & 0x7f);
+        i2c_set_slave_address(I2C_SLAVE(s->slave), value & 0x7f);
         break;
 
     case IDBR:
@@ -1432,7 +1444,7 @@ static const VMStateDescription vmstate_pxa2xx_i2c_slave = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField []) {
-        VMSTATE_I2C_SLAVE(i2c, PXA2xxI2CSlaveState),
+        VMSTATE_I2C_SLAVE(parent_obj, PXA2xxI2CSlaveState),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -1470,7 +1482,7 @@ static void pxa2xx_i2c_slave_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pxa2xx_i2c_slave_info = {
-    .name          = "pxa2xx-i2c-slave",
+    .name          = TYPE_PXA2XX_I2C_SLAVE,
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(PXA2xxI2CSlaveState),
     .class_init    = pxa2xx_i2c_slave_class_init,
@@ -1496,8 +1508,8 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base,
     s = PXA2XX_I2C(i2c_dev);
     /* FIXME: Should the slave device really be on a separate bus?  */
     i2cbus = i2c_init_bus(dev, "dummy");
-    dev = i2c_create_slave(i2cbus, "pxa2xx-i2c-slave", 0);
-    s->slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, I2C_SLAVE(dev));
+    dev = i2c_create_slave(i2cbus, TYPE_PXA2XX_I2C_SLAVE, 0);
+    s->slave = PXA2XX_I2C_SLAVE(dev);
     s->slave->host = s;
 
     return s;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 11/49] tosa: QOM'ify DAC
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (9 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 10/49] pxa2xx: QOM'ify I2C slave Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 12/49] z2: QOM'ify AER915 Andreas Färber
                   ` (38 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Andreas Färber

Replace usages of FROM_I2C_SLAVE() with QOM cast macro.
Rename parent field. Use type constant in tosa_tg_init().

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/arm/tosa.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
index dd224d3..2069f55 100644
--- a/hw/arm/tosa.c
+++ b/hw/arm/tosa.c
@@ -132,15 +132,20 @@ static int tosa_ssp_init(SSISlave *dev)
     return 0;
 }
 
+#define TYPE_TOSA_DAC "tosa_dac"
+#define TOSA_DAC(obj) OBJECT_CHECK(TosaDACState, (obj), TYPE_TOSA_DAC)
+
 typedef struct {
-    I2CSlave i2c;
+    I2CSlave parent_obj;
+
     int len;
     char buf[3];
 } TosaDACState;
 
 static int tosa_dac_send(I2CSlave *i2c, uint8_t data)
 {
-    TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);
+    TosaDACState *s = TOSA_DAC(i2c);
+
     s->buf[s->len] = data;
     if (s->len ++ > 2) {
 #ifdef VERBOSE
@@ -159,7 +164,8 @@ static int tosa_dac_send(I2CSlave *i2c, uint8_t data)
 
 static void tosa_dac_event(I2CSlave *i2c, enum i2c_event event)
 {
-    TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);
+    TosaDACState *s = TOSA_DAC(i2c);
+
     s->len = 0;
     switch (event) {
     case I2C_START_SEND:
@@ -195,7 +201,7 @@ static int tosa_dac_init(I2CSlave *i2c)
 static void tosa_tg_init(PXA2xxState *cpu)
 {
     I2CBus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
-    i2c_create_slave(bus, "tosa_dac", DAC_BASE);
+    i2c_create_slave(bus, TYPE_TOSA_DAC, DAC_BASE);
     ssi_create_slave(cpu->ssp[1], "tosa-ssp");
 }
 
@@ -271,7 +277,7 @@ static void tosa_dac_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo tosa_dac_info = {
-    .name          = "tosa_dac",
+    .name          = TYPE_TOSA_DAC,
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(TosaDACState),
     .class_init    = tosa_dac_class_init,
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 12/49] z2: QOM'ify AER915
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (10 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 11/49] tosa: QOM'ify DAC Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 13/49] wm8750: QOM'ify Andreas Färber
                   ` (37 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Andreas Färber

Replace usages of FROM_I2C_SLAVE() with QOM cast macro.
Rename the parent field. Reuse the type constant in z2_init().

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[AF: Use TYPE_AER915 in z2_init() too]
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/arm/z2.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index 97ec381..67c1be8 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -193,15 +193,20 @@ static const TypeInfo zipit_lcd_info = {
     .class_init    = zipit_lcd_class_init,
 };
 
-typedef struct {
-    I2CSlave i2c;
+#define TYPE_AER915 "aer915"
+#define AER915(obj) OBJECT_CHECK(AER915State, (obj), TYPE_AER915)
+
+typedef struct AER915State {
+    I2CSlave parent_obj;
+
     int len;
     uint8_t buf[3];
 } AER915State;
 
 static int aer915_send(I2CSlave *i2c, uint8_t data)
 {
-    AER915State *s = FROM_I2C_SLAVE(AER915State, i2c);
+    AER915State *s = AER915(i2c);
+
     s->buf[s->len] = data;
     if (s->len++ > 2) {
         DPRINTF("%s: message too long (%i bytes)\n",
@@ -219,7 +224,8 @@ static int aer915_send(I2CSlave *i2c, uint8_t data)
 
 static void aer915_event(I2CSlave *i2c, enum i2c_event event)
 {
-    AER915State *s = FROM_I2C_SLAVE(AER915State, i2c);
+    AER915State *s = AER915(i2c);
+
     switch (event) {
     case I2C_START_SEND:
         s->len = 0;
@@ -238,8 +244,8 @@ static void aer915_event(I2CSlave *i2c, enum i2c_event event)
 
 static int aer915_recv(I2CSlave *slave)
 {
+    AER915State *s = AER915(slave);
     int retval = 0x00;
-    AER915State *s = FROM_I2C_SLAVE(AER915State, slave);
 
     switch (s->buf[0]) {
     /* Return hardcoded battery voltage,
@@ -290,7 +296,7 @@ static void aer915_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo aer915_info = {
-    .name          = "aer915",
+    .name          = TYPE_AER915,
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(AER915State),
     .class_init    = aer915_class_init,
@@ -351,7 +357,7 @@ static void z2_init(QEMUMachineInitArgs *args)
     type_register_static(&aer915_info);
     z2_lcd = ssi_create_slave(mpu->ssp[1], "zipit-lcd");
     bus = pxa2xx_i2c_bus(mpu->i2c[0]);
-    i2c_create_slave(bus, "aer915", 0x55);
+    i2c_create_slave(bus, TYPE_AER915, 0x55);
     wm = i2c_create_slave(bus, "wm8750", 0x1b);
     mpu->i2s->opaque = wm;
     mpu->i2s->codec_out = wm8750_dac_dat;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 13/49] wm8750: QOM'ify
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (11 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 12/49] z2: QOM'ify AER915 Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 14/49] ssd0303: QOM'ify Andreas Färber
                   ` (36 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vassili Karpov (malc), Andreas Färber, Gerd Hoffmann

Replace usages of FROM_I2C_SLAVE() and direct parent field accesses with
QOM cast macro. Rename parent field.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/audio/wm8750.c | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
index 6b5a349..c18f245 100644
--- a/hw/audio/wm8750.c
+++ b/hw/audio/wm8750.c
@@ -23,8 +23,12 @@ typedef struct {
     int dac_hz;
 } WMRate;
 
-typedef struct {
-    I2CSlave i2c;
+#define TYPE_WM8750 "wm8750"
+#define WM8750(obj) OBJECT_CHECK(WM8750State, (obj), TYPE_WM8750)
+
+typedef struct WM8750State {
+    I2CSlave parent_obj;
+
     uint8_t i2c_data[2];
     int i2c_len;
     QEMUSoundCard card;
@@ -256,7 +260,8 @@ static void wm8750_clk_update(WM8750State *s, int ext)
 
 static void wm8750_reset(I2CSlave *i2c)
 {
-    WM8750State *s = (WM8750State *) i2c;
+    WM8750State *s = WM8750(i2c);
+
     s->rate = &wm_rate_table[0];
     s->enable = 0;
     wm8750_clk_update(s, 1);
@@ -299,7 +304,7 @@ static void wm8750_reset(I2CSlave *i2c)
 
 static void wm8750_event(I2CSlave *i2c, enum i2c_event event)
 {
-    WM8750State *s = (WM8750State *) i2c;
+    WM8750State *s = WM8750(i2c);
 
     switch (event) {
     case I2C_START_SEND:
@@ -356,7 +361,7 @@ static void wm8750_event(I2CSlave *i2c, enum i2c_event event)
 
 static int wm8750_tx(I2CSlave *i2c, uint8_t data)
 {
-    WM8750State *s = (WM8750State *) i2c;
+    WM8750State *s = WM8750(i2c);
     uint8_t cmd;
     uint16_t value;
 
@@ -542,7 +547,7 @@ static int wm8750_tx(I2CSlave *i2c, uint8_t data)
         break;
 
     case WM8750_RESET:	/* Reset */
-        wm8750_reset(&s->i2c);
+        wm8750_reset(I2C_SLAVE(s));
         break;
 
 #ifdef VERBOSE
@@ -604,17 +609,17 @@ static const VMStateDescription vmstate_wm8750 = {
         VMSTATE_UINT8(format, WM8750State),
         VMSTATE_UINT8(power, WM8750State),
         VMSTATE_UINT8(rate_vmstate, WM8750State),
-        VMSTATE_I2C_SLAVE(i2c, WM8750State),
+        VMSTATE_I2C_SLAVE(parent_obj, WM8750State),
         VMSTATE_END_OF_LIST()
     }
 };
 
 static int wm8750_init(I2CSlave *i2c)
 {
-    WM8750State *s = FROM_I2C_SLAVE(WM8750State, i2c);
+    WM8750State *s = WM8750(i2c);
 
     AUD_register_card(CODEC, &s->card);
-    wm8750_reset(&s->i2c);
+    wm8750_reset(I2C_SLAVE(s));
 
     return 0;
 }
@@ -622,8 +627,9 @@ static int wm8750_init(I2CSlave *i2c)
 #if 0
 static void wm8750_fini(I2CSlave *i2c)
 {
-    WM8750State *s = (WM8750State *) i2c;
-    wm8750_reset(&s->i2c);
+    WM8750State *s = WM8750(i2c);
+
+    wm8750_reset(I2C_SLAVE(s));
     AUD_remove_card(&s->card);
     g_free(s);
 }
@@ -632,7 +638,8 @@ static void wm8750_fini(I2CSlave *i2c)
 void wm8750_data_req_set(DeviceState *dev,
                 void (*data_req)(void *, int, int), void *opaque)
 {
-    WM8750State *s = FROM_I2C_SLAVE(WM8750State, I2C_SLAVE(dev));
+    WM8750State *s = WM8750(dev);
+
     s->data_req = data_req;
     s->opaque = opaque;
 }
@@ -702,7 +709,7 @@ static void wm8750_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo wm8750_info = {
-    .name          = "wm8750",
+    .name          = TYPE_WM8750,
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(WM8750State),
     .class_init    = wm8750_class_init,
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 14/49] ssd0303: QOM'ify
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (12 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 13/49] wm8750: QOM'ify Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 15/49] max7310: QOM'ify Andreas Färber
                   ` (35 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Replace usages of FROM_I2C_SLAVE() with QOM cast macro.
Rename parent field.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/display/ssd0303.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c
index beea5bf..89804e1 100644
--- a/hw/display/ssd0303.c
+++ b/hw/display/ssd0303.c
@@ -41,8 +41,12 @@ enum ssd0303_cmd {
     SSD0303_CMD_SKIP1
 };
 
+#define TYPE_SSD0303 "ssd0303"
+#define SSD0303(obj) OBJECT_CHECK(ssd0303_state, (obj), TYPE_SSD0303)
+
 typedef struct {
-    I2CSlave i2c;
+    I2CSlave parent_obj;
+
     QemuConsole *con;
     int row;
     int col;
@@ -65,8 +69,9 @@ static int ssd0303_recv(I2CSlave *i2c)
 
 static int ssd0303_send(I2CSlave *i2c, uint8_t data)
 {
-    ssd0303_state *s = (ssd0303_state *)i2c;
+    ssd0303_state *s = SSD0303(i2c);
     enum ssd0303_cmd old_cmd_state;
+
     switch (s->mode) {
     case SSD0303_IDLE:
         DPRINTF("byte 0x%02x\n", data);
@@ -175,7 +180,8 @@ static int ssd0303_send(I2CSlave *i2c, uint8_t data)
 
 static void ssd0303_event(I2CSlave *i2c, enum i2c_event event)
 {
-    ssd0303_state *s = (ssd0303_state *)i2c;
+    ssd0303_state *s = SSD0303(i2c);
+
     switch (event) {
     case I2C_FINISH:
         s->mode = SSD0303_IDLE;
@@ -279,7 +285,7 @@ static const VMStateDescription vmstate_ssd0303 = {
         VMSTATE_UINT32(mode, ssd0303_state),
         VMSTATE_UINT32(cmd_state, ssd0303_state),
         VMSTATE_BUFFER(framebuffer, ssd0303_state),
-        VMSTATE_I2C_SLAVE(i2c, ssd0303_state),
+        VMSTATE_I2C_SLAVE(parent_obj, ssd0303_state),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -291,7 +297,7 @@ static const GraphicHwOps ssd0303_ops = {
 
 static int ssd0303_init(I2CSlave *i2c)
 {
-    ssd0303_state *s = FROM_I2C_SLAVE(ssd0303_state, i2c);
+    ssd0303_state *s = SSD0303(i2c);
 
     s->con = graphic_console_init(DEVICE(i2c), &ssd0303_ops, s);
     qemu_console_resize(s->con, 96 * MAGNIFY, 16 * MAGNIFY);
@@ -311,7 +317,7 @@ static void ssd0303_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo ssd0303_info = {
-    .name          = "ssd0303",
+    .name          = TYPE_SSD0303,
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(ssd0303_state),
     .class_init    = ssd0303_class_init,
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 15/49] max7310: QOM'ify
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (13 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 14/49] ssd0303: QOM'ify Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 16/49] lm832x: QOM'ify Andreas Färber
                   ` (34 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Replace FROM_I2C_SLAVE() usages with QOM cast macro.
Rename parent field.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/gpio/max7310.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
index 59b2877..cfcd89c 100644
--- a/hw/gpio/max7310.c
+++ b/hw/gpio/max7310.c
@@ -9,8 +9,12 @@
 
 #include "hw/i2c/i2c.h"
 
-typedef struct {
-    I2CSlave i2c;
+#define TYPE_MAX7310 "max7310"
+#define MAX7310(obj) OBJECT_CHECK(MAX7310State, (obj), TYPE_MAX7310)
+
+typedef struct MAX7310State {
+    I2CSlave parent_obj;
+
     int i2c_command_byte;
     int len;
 
@@ -25,7 +29,8 @@ typedef struct {
 
 static void max7310_reset(DeviceState *dev)
 {
-    MAX7310State *s = FROM_I2C_SLAVE(MAX7310State, I2C_SLAVE(dev));
+    MAX7310State *s = MAX7310(dev);
+
     s->level &= s->direction;
     s->direction = 0xff;
     s->polarity = 0xf0;
@@ -35,7 +40,7 @@ static void max7310_reset(DeviceState *dev)
 
 static int max7310_rx(I2CSlave *i2c)
 {
-    MAX7310State *s = (MAX7310State *) i2c;
+    MAX7310State *s = MAX7310(i2c);
 
     switch (s->command) {
     case 0x00:	/* Input port */
@@ -70,7 +75,7 @@ static int max7310_rx(I2CSlave *i2c)
 
 static int max7310_tx(I2CSlave *i2c, uint8_t data)
 {
-    MAX7310State *s = (MAX7310State *) i2c;
+    MAX7310State *s = MAX7310(i2c);
     uint8_t diff;
     int line;
 
@@ -125,7 +130,7 @@ static int max7310_tx(I2CSlave *i2c, uint8_t data)
 
 static void max7310_event(I2CSlave *i2c, enum i2c_event event)
 {
-    MAX7310State *s = (MAX7310State *) i2c;
+    MAX7310State *s = MAX7310(i2c);
     s->len = 0;
 
     switch (event) {
@@ -156,7 +161,7 @@ static const VMStateDescription vmstate_max7310 = {
         VMSTATE_UINT8(polarity, MAX7310State),
         VMSTATE_UINT8(status, MAX7310State),
         VMSTATE_UINT8(command, MAX7310State),
-        VMSTATE_I2C_SLAVE(i2c, MAX7310State),
+        VMSTATE_I2C_SLAVE(parent_obj, MAX7310State),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -177,7 +182,7 @@ static void max7310_gpio_set(void *opaque, int line, int level)
  * but also accepts sequences that are not SMBus so return an I2C device.  */
 static int max7310_init(I2CSlave *i2c)
 {
-    MAX7310State *s = FROM_I2C_SLAVE(MAX7310State, i2c);
+    MAX7310State *s = MAX7310(i2c);
 
     qdev_init_gpio_in(&i2c->qdev, max7310_gpio_set, 8);
     qdev_init_gpio_out(&i2c->qdev, s->handler, 8);
@@ -199,7 +204,7 @@ static void max7310_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo max7310_info = {
-    .name          = "max7310",
+    .name          = TYPE_MAX7310,
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(MAX7310State),
     .class_init    = max7310_class_init,
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 16/49] lm832x: QOM'ify
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (14 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 15/49] max7310: QOM'ify Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 17/49] ds1338: QOM'ify Andreas Färber
                   ` (33 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Replace usages of FROM_I2C_SLAVE() and direct parent field accesses with
QOM cast macro. Rename parent field.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/input/lm832x.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c
index f583cf0..4ae1cd9 100644
--- a/hw/input/lm832x.c
+++ b/hw/input/lm832x.c
@@ -23,8 +23,12 @@
 #include "qemu/timer.h"
 #include "ui/console.h"
 
+#define TYPE_LM8323 "lm8323"
+#define LM8323(obj) OBJECT_CHECK(LM823KbdState, (obj), TYPE_LM8323)
+
 typedef struct {
-    I2CSlave i2c;
+    I2CSlave parent_obj;
+
     uint8_t i2c_dir;
     uint8_t i2c_cycle;
     uint8_t reg;
@@ -380,7 +384,7 @@ static void lm_kbd_write(LM823KbdState *s, int reg, int byte, uint8_t value)
 
 static void lm_i2c_event(I2CSlave *i2c, enum i2c_event event)
 {
-    LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, i2c);
+    LM823KbdState *s = LM8323(i2c);
 
     switch (event) {
     case I2C_START_RECV:
@@ -396,14 +400,14 @@ static void lm_i2c_event(I2CSlave *i2c, enum i2c_event event)
 
 static int lm_i2c_rx(I2CSlave *i2c)
 {
-    LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, i2c);
+    LM823KbdState *s = LM8323(i2c);
 
     return lm_kbd_read(s, s->reg, s->i2c_cycle ++);
 }
 
 static int lm_i2c_tx(I2CSlave *i2c, uint8_t data)
 {
-    LM823KbdState *s = (LM823KbdState *) i2c;
+    LM823KbdState *s = LM8323(i2c);
 
     if (!s->i2c_cycle)
         s->reg = data;
@@ -431,7 +435,7 @@ static const VMStateDescription vmstate_lm_kbd = {
     .minimum_version_id_old = 0,
     .post_load = lm_kbd_post_load,
     .fields      = (VMStateField []) {
-        VMSTATE_I2C_SLAVE(i2c, LM823KbdState),
+        VMSTATE_I2C_SLAVE(parent_obj, LM823KbdState),
         VMSTATE_UINT8(i2c_dir, LM823KbdState),
         VMSTATE_UINT8(i2c_cycle, LM823KbdState),
         VMSTATE_UINT8(reg, LM823KbdState),
@@ -460,13 +464,13 @@ static const VMStateDescription vmstate_lm_kbd = {
 
 static int lm8323_init(I2CSlave *i2c)
 {
-    LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, i2c);
+    LM823KbdState *s = LM8323(i2c);
 
     s->model = 0x8323;
     s->pwm.tm[0] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm0_tick, s);
     s->pwm.tm[1] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm1_tick, s);
     s->pwm.tm[2] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm2_tick, s);
-    qdev_init_gpio_out(&i2c->qdev, &s->nirq, 1);
+    qdev_init_gpio_out(DEVICE(i2c), &s->nirq, 1);
 
     lm_kbd_reset(s);
 
@@ -476,7 +480,7 @@ static int lm8323_init(I2CSlave *i2c)
 
 void lm832x_key_event(DeviceState *dev, int key, int state)
 {
-    LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, I2C_SLAVE(dev));
+    LM823KbdState *s = LM8323(dev);
 
     if ((s->status & INT_ERROR) && (s->error & ERR_FIFOOVR))
         return;
@@ -507,7 +511,7 @@ static void lm8323_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo lm8323_info = {
-    .name          = "lm8323",
+    .name          = TYPE_LM8323,
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(LM823KbdState),
     .class_init    = lm8323_class_init,
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 17/49] ds1338: QOM'ify
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (15 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 16/49] lm832x: QOM'ify Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 18/49] twl92230: QOM'ify Andreas Färber
                   ` (32 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Replace usages of FROM_I2C_SLAVE() with QOM cast macro.
Rename parent field.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/timer/ds1338.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/hw/timer/ds1338.c b/hw/timer/ds1338.c
index 8987cdc..bb2f8ee 100644
--- a/hw/timer/ds1338.c
+++ b/hw/timer/ds1338.c
@@ -23,8 +23,12 @@
 #define HOURS_PM   0x20
 #define CTRL_OSF   0x20
 
-typedef struct {
-    I2CSlave i2c;
+#define TYPE_DS1338 "ds1338"
+#define DS1338(obj) OBJECT_CHECK(DS1338State, (obj), TYPE_DS1338)
+
+typedef struct DS1338State {
+    I2CSlave parent_obj;
+
     int64_t offset;
     uint8_t wday_offset;
     uint8_t nvram[NVRAM_SIZE];
@@ -38,7 +42,7 @@ static const VMStateDescription vmstate_ds1338 = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_I2C_SLAVE(i2c, DS1338State),
+        VMSTATE_I2C_SLAVE(parent_obj, DS1338State),
         VMSTATE_INT64(offset, DS1338State),
         VMSTATE_UINT8_V(wday_offset, DS1338State, 2),
         VMSTATE_UINT8_ARRAY(nvram, DS1338State, NVRAM_SIZE),
@@ -90,7 +94,7 @@ static void inc_regptr(DS1338State *s)
 
 static void ds1338_event(I2CSlave *i2c, enum i2c_event event)
 {
-    DS1338State *s = FROM_I2C_SLAVE(DS1338State, i2c);
+    DS1338State *s = DS1338(i2c);
 
     switch (event) {
     case I2C_START_RECV:
@@ -111,7 +115,7 @@ static void ds1338_event(I2CSlave *i2c, enum i2c_event event)
 
 static int ds1338_recv(I2CSlave *i2c)
 {
-    DS1338State *s = FROM_I2C_SLAVE(DS1338State, i2c);
+    DS1338State *s = DS1338(i2c);
     uint8_t res;
 
     res  = s->nvram[s->ptr];
@@ -121,7 +125,8 @@ static int ds1338_recv(I2CSlave *i2c)
 
 static int ds1338_send(I2CSlave *i2c, uint8_t data)
 {
-    DS1338State *s = FROM_I2C_SLAVE(DS1338State, i2c);
+    DS1338State *s = DS1338(i2c);
+
     if (s->addr_byte) {
         s->ptr = data & (NVRAM_SIZE - 1);
         s->addr_byte = false;
@@ -198,7 +203,7 @@ static int ds1338_init(I2CSlave *i2c)
 
 static void ds1338_reset(DeviceState *dev)
 {
-    DS1338State *s = FROM_I2C_SLAVE(DS1338State, I2C_SLAVE(dev));
+    DS1338State *s = DS1338(dev);
 
     /* The clock is running and synchronized with the host */
     s->offset = 0;
@@ -222,7 +227,7 @@ static void ds1338_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo ds1338_info = {
-    .name          = "ds1338",
+    .name          = TYPE_DS1338,
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(DS1338State),
     .class_init    = ds1338_class_init,
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 18/49] twl92230: QOM'ify
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (16 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 17/49] ds1338: QOM'ify Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 19/49] i2c: Drop FROM_I2C_SLAVE() macro Andreas Färber
                   ` (31 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Replace usages of FROM_I2C_SLAVE() and direct parent field accesses with
QOM cast macro. Rename parent field.

Add missing braces while at it.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/timer/twl92230.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/hw/timer/twl92230.c b/hw/timer/twl92230.c
index f3ea365..85d5990 100644
--- a/hw/timer/twl92230.c
+++ b/hw/timer/twl92230.c
@@ -27,8 +27,11 @@
 
 #define VERBOSE 1
 
-typedef struct {
-    I2CSlave i2c;
+#define TYPE_TWL92230 "twl92230"
+#define TWL92230(obj) OBJECT_CHECK(MenelausState, (obj), TYPE_TWL92230)
+
+typedef struct MenelausState {
+    I2CSlave parent_obj;
 
     int firstbyte;
     uint8_t reg;
@@ -127,7 +130,8 @@ static void menelaus_rtc_hz(void *opaque)
 
 static void menelaus_reset(I2CSlave *i2c)
 {
-    MenelausState *s = (MenelausState *) i2c;
+    MenelausState *s = TWL92230(i2c);
+
     s->reg = 0x00;
 
     s->vcore[0] = 0x0c;	/* XXX: X-loader needs 0x8c? check!  */
@@ -492,8 +496,9 @@ static void menelaus_write(void *opaque, uint8_t addr, uint8_t value)
         break;
 
     case MENELAUS_DEVICE_OFF:
-        if (value & 1)
-            menelaus_reset(&s->i2c);
+        if (value & 1) {
+            menelaus_reset(I2C_SLAVE(s));
+        }
         break;
 
     case MENELAUS_OSC_CTRL:
@@ -708,7 +713,7 @@ static void menelaus_write(void *opaque, uint8_t addr, uint8_t value)
 
 static void menelaus_event(I2CSlave *i2c, enum i2c_event event)
 {
-    MenelausState *s = (MenelausState *) i2c;
+    MenelausState *s = TWL92230(i2c);
 
     if (event == I2C_START_SEND)
         s->firstbyte = 1;
@@ -716,7 +721,8 @@ static void menelaus_event(I2CSlave *i2c, enum i2c_event event)
 
 static int menelaus_tx(I2CSlave *i2c, uint8_t data)
 {
-    MenelausState *s = (MenelausState *) i2c;
+    MenelausState *s = TWL92230(i2c);
+
     /* Interpret register address byte */
     if (s->firstbyte) {
         s->reg = data;
@@ -729,7 +735,7 @@ static int menelaus_tx(I2CSlave *i2c, uint8_t data)
 
 static int menelaus_rx(I2CSlave *i2c)
 {
-    MenelausState *s = (MenelausState *) i2c;
+    MenelausState *s = TWL92230(i2c);
 
     return menelaus_read(s, s->reg ++);
 }
@@ -834,23 +840,24 @@ static const VMStateDescription vmstate_menelaus = {
         VMSTATE_STRUCT(rtc.alm, MenelausState, 0, vmstate_menelaus_tm,
                        struct tm),
         VMSTATE_UINT8(pwrbtn_state, MenelausState),
-        VMSTATE_I2C_SLAVE(i2c, MenelausState),
+        VMSTATE_I2C_SLAVE(parent_obj, MenelausState),
         VMSTATE_END_OF_LIST()
     }
 };
 
 static int twl92230_init(I2CSlave *i2c)
 {
-    MenelausState *s = FROM_I2C_SLAVE(MenelausState, i2c);
+    DeviceState *dev = DEVICE(i2c);
+    MenelausState *s = TWL92230(i2c);
 
     s->rtc.hz_tm = timer_new_ms(rtc_clock, menelaus_rtc_hz, s);
     /* Three output pins plus one interrupt pin.  */
-    qdev_init_gpio_out(&i2c->qdev, s->out, 4);
+    qdev_init_gpio_out(dev, s->out, 4);
 
     /* Three input pins plus one power-button pin.  */
-    qdev_init_gpio_in(&i2c->qdev, menelaus_gpio_set, 4);
+    qdev_init_gpio_in(dev, menelaus_gpio_set, 4);
 
-    menelaus_reset(&s->i2c);
+    menelaus_reset(i2c);
 
     return 0;
 }
@@ -868,7 +875,7 @@ static void twl92230_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo twl92230_info = {
-    .name          = "twl92230",
+    .name          = TYPE_TWL92230,
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(MenelausState),
     .class_init    = twl92230_class_init,
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 19/49] i2c: Drop FROM_I2C_SLAVE() macro
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (17 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 18/49] twl92230: QOM'ify Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 20/49] tests: Add e1000 qtest Andreas Färber
                   ` (30 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

We now use type-specific QOM cast macros instead.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/hw/i2c/i2c.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index 9df987b..4986ebc 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -59,8 +59,6 @@ void i2c_nack(I2CBus *bus);
 int i2c_send(I2CBus *bus, uint8_t data);
 int i2c_recv(I2CBus *bus);
 
-#define FROM_I2C_SLAVE(type, dev) DO_UPCAST(type, i2c, dev)
-
 DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
 
 /* wm8750.c */
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 20/49] tests: Add e1000 qtest
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (18 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 19/49] i2c: Drop FROM_I2C_SLAVE() macro Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 21/49] tests: Add vmxnet3 qtest Andreas Färber
                   ` (29 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, Michael S. Tsirkin

Cc: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile     |  7 +++++++
 tests/e1000-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 tests/e1000-test.c

diff --git a/tests/Makefile b/tests/Makefile
index 631dd6c..fe4edad 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -64,6 +64,10 @@ check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
 
 # All QTests for now are POSIX-only, but the dependencies are
 # really in libqtest, not in the testcases themselves.
+
+check-qtest-pci-y += tests/e1000-test$(EXESUF)
+gcov-files-pci-y += hw/net/e1000.c
+
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
 gcov-files-i386-y = hw/block/fdc.c
@@ -77,6 +81,8 @@ check-qtest-i386-y += tests/i440fx-test$(EXESUF)
 check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
 check-qtest-i386-y += tests/blockdev-test$(EXESUF)
 check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
+check-qtest-i386-y += $(check-qtest-pci-y)
+gcov-files-i386-y += $(gcov-files-pci-y)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -196,6 +202,7 @@ tests/acpi-test$(EXESUF): tests/acpi-test.o $(libqos-obj-y)
 tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
 tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
 tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
+tests/e1000-test$(EXESUF): tests/e1000-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
diff --git a/tests/e1000-test.c b/tests/e1000-test.c
new file mode 100644
index 0000000..a8ba2fc
--- /dev/null
+++ b/tests/e1000-test.c
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for e1000 NIC
+ *
+ * Copyright (c) 2013-2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/e1000/nop", nop);
+
+    qtest_start("-device e1000");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 21/49] tests: Add vmxnet3 qtest
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (19 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 20/49] tests: Add e1000 qtest Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 22/49] tests: Add rtl8139 qtest Andreas Färber
                   ` (28 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Note that this will emit a warning:
[vmxnet3][WR][vmxnet3_peer_has_vnet_hdr]: Peer has no virtio extension.
Task offloads will be emulated.

Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile       |  5 +++++
 tests/vmxnet3-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 tests/vmxnet3-test.c

diff --git a/tests/Makefile b/tests/Makefile
index fe4edad..8c06abb 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -83,6 +83,10 @@ check-qtest-i386-y += tests/blockdev-test$(EXESUF)
 check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
 check-qtest-i386-y += $(check-qtest-pci-y)
 gcov-files-i386-y += $(gcov-files-pci-y)
+check-qtest-i386-y += tests/vmxnet3-test$(EXESUF)
+gcov-files-i386-y += hw/net/vmxnet3.c
+gcov-files-i386-y += hw/net/vmxnet_rx_pkt.c
+gcov-files-i386-y += hw/net/vmxnet_tx_pkt.c
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -203,6 +207,7 @@ tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
 tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
 tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
 tests/e1000-test$(EXESUF): tests/e1000-test.o
+tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
diff --git a/tests/vmxnet3-test.c b/tests/vmxnet3-test.c
new file mode 100644
index 0000000..a2ebed3
--- /dev/null
+++ b/tests/vmxnet3-test.c
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for vmxnet3 NIC
+ *
+ * Copyright (c) 2013-2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/vmxnet3/nop", nop);
+
+    qtest_start("-device vmxnet3");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 22/49] tests: Add rtl8139 qtest
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (20 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 21/49] tests: Add vmxnet3 qtest Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 23/49] tests: Add pcnet qtest Andreas Färber
                   ` (27 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile       |  3 +++
 tests/rtl8139-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 tests/rtl8139-test.c

diff --git a/tests/Makefile b/tests/Makefile
index 8c06abb..d7993fd 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -67,6 +67,8 @@ check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
+check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
+gcov-files-pci-y += hw/net/rtl8139.c
 
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -207,6 +209,7 @@ tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
 tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
 tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
 tests/e1000-test$(EXESUF): tests/e1000-test.o
+tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o
 tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
diff --git a/tests/rtl8139-test.c b/tests/rtl8139-test.c
new file mode 100644
index 0000000..f6a1be3
--- /dev/null
+++ b/tests/rtl8139-test.c
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for Realtek 8139 NIC
+ *
+ * Copyright (c) 2013-2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/rtl8139/nop", nop);
+
+    qtest_start("-device rtl8139");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 23/49] tests: Add pcnet qtest
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (21 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 22/49] tests: Add rtl8139 qtest Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 24/49] tests: Add eepro100 qtest Andreas Färber
                   ` (26 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Test PCI only for now.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile     |  4 ++++
 tests/pcnet-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 tests/pcnet-test.c

diff --git a/tests/Makefile b/tests/Makefile
index d7993fd..125527d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -69,6 +69,9 @@ check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
 check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
 gcov-files-pci-y += hw/net/rtl8139.c
+check-qtest-pci-y += tests/pcnet-test$(EXESUF)
+gcov-files-pci-y += hw/net/pcnet.c
+gcov-files-pci-y += hw/net/pcnet-pci.c
 
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -210,6 +213,7 @@ tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
 tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
 tests/e1000-test$(EXESUF): tests/e1000-test.o
 tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o
+tests/pcnet-test$(EXESUF): tests/pcnet-test.o
 tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
diff --git a/tests/pcnet-test.c b/tests/pcnet-test.c
new file mode 100644
index 0000000..84af4f3
--- /dev/null
+++ b/tests/pcnet-test.c
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for PC-Net NIC
+ *
+ * Copyright (c) 2013-2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/pcnet/pci/nop", pci_nop);
+
+    qtest_start("-device pcnet");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 24/49] tests: Add eepro100 qtest
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (22 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 23/49] tests: Add pcnet qtest Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 25/49] tests: Add ne2000 qtest Andreas Färber
                   ` (25 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile        |  3 +++
 tests/eepro100-test.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
 create mode 100644 tests/eepro100-test.c

diff --git a/tests/Makefile b/tests/Makefile
index 125527d..3617e63 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -72,6 +72,8 @@ gcov-files-pci-y += hw/net/rtl8139.c
 check-qtest-pci-y += tests/pcnet-test$(EXESUF)
 gcov-files-pci-y += hw/net/pcnet.c
 gcov-files-pci-y += hw/net/pcnet-pci.c
+check-qtest-pci-y += tests/eepro100-test$(EXESUF)
+gcov-files-pci-y += hw/net/eepro100.c
 
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -214,6 +216,7 @@ tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
 tests/e1000-test$(EXESUF): tests/e1000-test.o
 tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o
 tests/pcnet-test$(EXESUF): tests/pcnet-test.o
+tests/eepro100-test$(EXESUF): tests/eepro100-test.o
 tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
diff --git a/tests/eepro100-test.c b/tests/eepro100-test.c
new file mode 100644
index 0000000..bf82526
--- /dev/null
+++ b/tests/eepro100-test.c
@@ -0,0 +1,63 @@
+/*
+ * QTest testcase for eepro100 NIC
+ *
+ * Copyright (c) 2013-2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+static void test_device(gconstpointer data)
+{
+    const char *model = data;
+    QTestState *s;
+    char *args;
+
+    args = g_strdup_printf("-device %s", model);
+    s = qtest_start(args);
+
+    /* Tests only initialization so far. TODO: Implement functional tests */
+
+    if (s) {
+        qtest_quit(s);
+    }
+    g_free(args);
+}
+
+static const char *models[] = {
+    "i82550",
+    "i82551",
+    "i82557a",
+    "i82557b",
+    "i82557c",
+    "i82558a",
+    "i82558b",
+    "i82559a",
+    "i82559b",
+    "i82559c",
+    "i82559er",
+    "i82562",
+    "i82801",
+};
+
+int main(int argc, char **argv)
+{
+    int i;
+
+    g_test_init(&argc, &argv, NULL);
+
+    for (i = 0; i < ARRAY_SIZE(models); i++) {
+        char *path;
+
+        path = g_strdup_printf("/%s/eepro100/%s",
+                               qtest_get_arch(), models[i]);
+        g_test_add_data_func(path, models[i], test_device);
+    }
+
+    return g_test_run();
+}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 25/49] tests: Add ne2000 qtest
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (23 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 24/49] tests: Add eepro100 qtest Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 26/49] tests: Add virtio-net qtest Andreas Färber
                   ` (24 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile      |  3 +++
 tests/ne2000-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 tests/ne2000-test.c

diff --git a/tests/Makefile b/tests/Makefile
index 3617e63..8ece028 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -74,6 +74,8 @@ gcov-files-pci-y += hw/net/pcnet.c
 gcov-files-pci-y += hw/net/pcnet-pci.c
 check-qtest-pci-y += tests/eepro100-test$(EXESUF)
 gcov-files-pci-y += hw/net/eepro100.c
+check-qtest-pci-y += tests/ne2000-test$(EXESUF)
+gcov-files-pci-y += hw/net/ne2000.c
 
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -218,6 +220,7 @@ tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o
 tests/pcnet-test$(EXESUF): tests/pcnet-test.o
 tests/eepro100-test$(EXESUF): tests/eepro100-test.o
 tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
+tests/ne2000-test$(EXESUF): tests/ne2000-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
diff --git a/tests/ne2000-test.c b/tests/ne2000-test.c
new file mode 100644
index 0000000..61a678a
--- /dev/null
+++ b/tests/ne2000-test.c
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for ne2000 NIC
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/ne2000/pci/nop", pci_nop);
+
+    qtest_start("-device ne2k_pci");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 26/49] tests: Add virtio-net qtest
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (24 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 25/49] tests: Add ne2000 qtest Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 27/49] tests: Add tpci200 qtest Andreas Färber
                   ` (23 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, Michael S. Tsirkin

Cc: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile          |  7 +++++++
 tests/virtio-net-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 tests/virtio-net-test.c

diff --git a/tests/Makefile b/tests/Makefile
index 8ece028..cfd0052 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -65,6 +65,10 @@ check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
 # All QTests for now are POSIX-only, but the dependencies are
 # really in libqtest, not in the testcases themselves.
 
+gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
+check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
+gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
+
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
 check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
@@ -76,6 +80,8 @@ check-qtest-pci-y += tests/eepro100-test$(EXESUF)
 gcov-files-pci-y += hw/net/eepro100.c
 check-qtest-pci-y += tests/ne2000-test$(EXESUF)
 gcov-files-pci-y += hw/net/ne2000.c
+check-qtest-pci-y += $(check-qtest-virtio-y)
+gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
 
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -221,6 +227,7 @@ tests/pcnet-test$(EXESUF): tests/pcnet-test.o
 tests/eepro100-test$(EXESUF): tests/eepro100-test.o
 tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
 tests/ne2000-test$(EXESUF): tests/ne2000-test.o
+tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c
new file mode 100644
index 0000000..df99343
--- /dev/null
+++ b/tests/virtio-net-test.c
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for VirtIO NIC
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void pci_nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/virtio/net/pci/nop", pci_nop);
+
+    qtest_start("-device virtio-net-pci");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 27/49] tests: Add tpci200 qtest
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (25 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 26/49] tests: Add virtio-net qtest Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 28/49] tests: Add ipoctal232 qtest Andreas Färber
                   ` (22 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Acked-by: Alberto Garcia <agarcia@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile       |  3 +++
 tests/tpci200-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 tests/tpci200-test.c

diff --git a/tests/Makefile b/tests/Makefile
index cfd0052..107300a 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -82,6 +82,8 @@ check-qtest-pci-y += tests/ne2000-test$(EXESUF)
 gcov-files-pci-y += hw/net/ne2000.c
 check-qtest-pci-y += $(check-qtest-virtio-y)
 gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
+check-qtest-pci-y += tests/tpci200-test$(EXESUF)
+gcov-files-pci-y += hw/char/tpci200.c
 
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -228,6 +230,7 @@ tests/eepro100-test$(EXESUF): tests/eepro100-test.o
 tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
 tests/ne2000-test$(EXESUF): tests/ne2000-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
+tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
diff --git a/tests/tpci200-test.c b/tests/tpci200-test.c
new file mode 100644
index 0000000..9ae0127
--- /dev/null
+++ b/tests/tpci200-test.c
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for tpci200 PCI-IndustryPack bridge
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/tpci200/nop", nop);
+
+    qtest_start("-device tpci200");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 28/49] tests: Add ipoctal232 qtest
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (26 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 27/49] tests: Add tpci200 qtest Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 29/49] ipack: Convert to QOM realize Andreas Färber
                   ` (21 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Acked-by: Alberto Garcia <agarcia@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile          |  7 +++++++
 tests/ipoctal232-test.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 tests/ipoctal232-test.c

diff --git a/tests/Makefile b/tests/Makefile
index 107300a..584fe4e 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -65,6 +65,10 @@ check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
 # All QTests for now are POSIX-only, but the dependencies are
 # really in libqtest, not in the testcases themselves.
 
+gcov-files-ipack-y += hw/char/ipack.c
+check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF)
+gcov-files-ipack-y += hw/char/ipoctal232.c
+
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
 check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
@@ -84,6 +88,8 @@ check-qtest-pci-y += $(check-qtest-virtio-y)
 gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
 check-qtest-pci-y += tests/tpci200-test$(EXESUF)
 gcov-files-pci-y += hw/char/tpci200.c
+check-qtest-pci-y += $(check-qtest-ipack-y)
+gcov-files-pci-y += $(gcov-files-ipack-y) hw/char/tpci200.c
 
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
@@ -231,6 +237,7 @@ tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
 tests/ne2000-test$(EXESUF): tests/ne2000-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
+tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
 tests/qom-test$(EXESUF): tests/qom-test.o
 tests/blockdev-test$(EXESUF): tests/blockdev-test.o $(libqos-pc-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
diff --git a/tests/ipoctal232-test.c b/tests/ipoctal232-test.c
new file mode 100644
index 0000000..3ac1714
--- /dev/null
+++ b/tests/ipoctal232-test.c
@@ -0,0 +1,33 @@
+/*
+ * QTest testcase for IndustryPack Octal-RS232
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/ipoctal232/tpci200/nop", nop);
+
+    qtest_start("-device tpci200,id=ipack0 -device ipoctal232,bus=ipack0.0");
+    ret = g_test_run();
+
+    qtest_end();
+
+    return ret;
+}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 29/49] ipack: Convert to QOM realize
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (27 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 28/49] tests: Add ipoctal232 qtest Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 30/49] ipack: QOM parent field cleanup for IPackBus Andreas Färber
                   ` (20 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Acked-by: Alberto Garcia <agarcia@igalia.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/char/ipack.c      | 41 ++++++++++++++++++++++-------------------
 hw/char/ipack.h      |  6 ++++--
 hw/char/ipoctal232.c |  8 +++-----
 3 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/hw/char/ipack.c b/hw/char/ipack.c
index b7e45be..15cef7b 100644
--- a/hw/char/ipack.c
+++ b/hw/char/ipack.c
@@ -34,37 +34,39 @@ void ipack_bus_new_inplace(IPackBus *bus, size_t bus_size,
     bus->set_irq = handler;
 }
 
-static int ipack_device_dev_init(DeviceState *qdev)
+static void ipack_device_realize(DeviceState *dev, Error **errp)
 {
-    IPackBus *bus = IPACK_BUS(qdev_get_parent_bus(qdev));
-    IPackDevice *dev = IPACK_DEVICE(qdev);
+    IPackDevice *idev = IPACK_DEVICE(dev);
+    IPackBus *bus = IPACK_BUS(qdev_get_parent_bus(dev));
     IPackDeviceClass *k = IPACK_DEVICE_GET_CLASS(dev);
 
-    if (dev->slot < 0) {
-        dev->slot = bus->free_slot;
+    if (idev->slot < 0) {
+        idev->slot = bus->free_slot;
     }
-    if (dev->slot >= bus->n_slots) {
-        return -1;
+    if (idev->slot >= bus->n_slots) {
+        error_setg(errp, "Only %" PRIu8 " slots available.", bus->n_slots);
+        return;
     }
-    bus->free_slot = dev->slot + 1;
+    bus->free_slot = idev->slot + 1;
 
-    dev->irq = qemu_allocate_irqs(bus->set_irq, dev, 2);
+    idev->irq = qemu_allocate_irqs(bus->set_irq, idev, 2);
 
-    return k->init(dev);
+    k->realize(dev, errp);
 }
 
-static int ipack_device_dev_exit(DeviceState *qdev)
+static void ipack_device_unrealize(DeviceState *dev, Error **errp)
 {
-    IPackDevice *dev = IPACK_DEVICE(qdev);
+    IPackDevice *idev = IPACK_DEVICE(dev);
     IPackDeviceClass *k = IPACK_DEVICE_GET_CLASS(dev);
+    Error *err = NULL;
 
-    if (k->exit) {
-        k->exit(dev);
+    if (k->unrealize) {
+        k->unrealize(dev, &err);
+        error_propagate(errp, err);
+        return;
     }
 
-    qemu_free_irqs(dev->irq);
-
-    return 0;
+    qemu_free_irqs(idev->irq);
 }
 
 static Property ipack_device_props[] = {
@@ -75,10 +77,11 @@ static Property ipack_device_props[] = {
 static void ipack_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *k = DEVICE_CLASS(klass);
+
     set_bit(DEVICE_CATEGORY_INPUT, k->categories);
     k->bus_type = TYPE_IPACK_BUS;
-    k->init = ipack_device_dev_init;
-    k->exit = ipack_device_dev_exit;
+    k->realize = ipack_device_realize;
+    k->unrealize = ipack_device_unrealize;
     k->props = ipack_device_props;
 }
 
diff --git a/hw/char/ipack.h b/hw/char/ipack.h
index f8dc0f2..b62066f 100644
--- a/hw/char/ipack.h
+++ b/hw/char/ipack.h
@@ -38,10 +38,12 @@ typedef struct IPackDeviceClass IPackDeviceClass;
      OBJECT_GET_CLASS(IPackDeviceClass, (obj), TYPE_IPACK_DEVICE)
 
 struct IPackDeviceClass {
+    /*< private >*/
     DeviceClass parent_class;
+    /*< public >*/
 
-    int (*init)(IPackDevice *dev);
-    int (*exit)(IPackDevice *dev);
+    DeviceRealize realize;
+    DeviceUnrealize unrealize;
 
     uint16_t (*io_read)(IPackDevice *dev, uint8_t addr);
     void (*io_write)(IPackDevice *dev, uint8_t addr, uint16_t val);
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index 88e2cca..b33cfff 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -534,9 +534,9 @@ static void hostdev_event(void *opaque, int event)
     }
 }
 
-static int ipoctal_init(IPackDevice *ip)
+static void ipoctal_realize(DeviceState *dev, Error **errp)
 {
-    IPOctalState *s = IPOCTAL(ip);
+    IPOctalState *s = IPOCTAL(dev);
     unsigned i;
 
     for (i = 0; i < N_CHANNELS; i++) {
@@ -552,8 +552,6 @@ static int ipoctal_init(IPackDevice *ip)
             DPRINTF("Could not redirect channel %u, no chardev set\n", i);
         }
     }
-
-    return 0;
 }
 
 static Property ipoctal_properties[] = {
@@ -573,7 +571,7 @@ static void ipoctal_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     IPackDeviceClass *ic = IPACK_DEVICE_CLASS(klass);
 
-    ic->init        = ipoctal_init;
+    ic->realize     = ipoctal_realize;
     ic->io_read     = io_read;
     ic->io_write    = io_write;
     ic->id_read     = id_read;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 30/49] ipack: QOM parent field cleanup for IPackBus
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (28 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 29/49] ipack: Convert to QOM realize Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 31/49] ipack: QOM parent field cleanup for IPackDevice Andreas Färber
                   ` (19 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Clean up the only user of IPackBus::qbus field and rename it.

Acked-by: Alberto Garcia <agarcia@igalia.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/char/ipack.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/char/ipack.h b/hw/char/ipack.h
index b62066f..a386b88 100644
--- a/hw/char/ipack.h
+++ b/hw/char/ipack.h
@@ -19,7 +19,9 @@ typedef struct IPackBus IPackBus;
 #define IPACK_BUS(obj) OBJECT_CHECK(IPackBus, (obj), TYPE_IPACK_BUS)
 
 struct IPackBus {
-    BusState qbus;
+    /*< private >*/
+    BusState parent_obj;
+
     /* All fields are private */
     uint8_t n_slots;
     uint8_t free_slot;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 31/49] ipack: QOM parent field cleanup for IPackDevice
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (29 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 30/49] ipack: QOM parent field cleanup for IPackBus Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 32/49] ipoctal232: QOM parent field cleanup Andreas Färber
                   ` (18 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Rename the IPackDevice::qdev field to avoid accidental use.

Acked-by: Alberto Garcia <agarcia@igalia.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/char/ipack.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/char/ipack.h b/hw/char/ipack.h
index a386b88..e95ffe8 100644
--- a/hw/char/ipack.h
+++ b/hw/char/ipack.h
@@ -64,7 +64,10 @@ struct IPackDeviceClass {
 };
 
 struct IPackDevice {
-    DeviceState qdev;
+    /*< private >*/
+    DeviceState parent_obj;
+    /*< public >*/
+
     int32_t slot;
     /* IRQ objects for the IndustryPack INT0# and INT1# */
     qemu_irq *irq;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 32/49] ipoctal232: QOM parent field cleanup
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (30 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 31/49] ipack: QOM parent field cleanup for IPackDevice Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 33/49] ipack: Move IndustryPack out of hw/char/ Andreas Färber
                   ` (17 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Clean up accesses to IPOctalState::dev field and rename it.

Acked-by: Alberto Garcia <agarcia@igalia.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/char/ipoctal232.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index b33cfff..99bab4d 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -108,7 +108,8 @@ struct SCC2698Block {
 };
 
 struct IPOctalState {
-    IPackDevice dev;
+    IPackDevice parent_obj;
+
     SCC2698Channel ch[N_CHANNELS];
     SCC2698Block blk[N_BLOCKS];
     uint8_t irq_vector;
@@ -154,7 +155,7 @@ static const VMStateDescription vmstate_ipoctal = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField[]) {
-        VMSTATE_IPACK_DEVICE(dev, IPOctalState),
+        VMSTATE_IPACK_DEVICE(parent_obj, IPOctalState),
         VMSTATE_STRUCT_ARRAY(ch, IPOctalState, N_CHANNELS, 1,
                              vmstate_scc2698_channel, SCC2698Channel),
         VMSTATE_STRUCT_ARRAY(blk, IPOctalState, N_BLOCKS, 1,
@@ -172,6 +173,7 @@ static const uint8_t id_prom_data[] = {
 
 static void update_irq(IPOctalState *dev, unsigned block)
 {
+    IPackDevice *idev = IPACK_DEVICE(dev);
     /* Blocks A and B interrupt on INT0#, C and D on INT1#.
        Thus, to get the status we have to check two blocks. */
     SCC2698Block *blk0 = &dev->blk[block];
@@ -179,9 +181,9 @@ static void update_irq(IPOctalState *dev, unsigned block)
     unsigned intno = block / 2;
 
     if ((blk0->isr & blk0->imr) || (blk1->isr & blk1->imr)) {
-        qemu_irq_raise(dev->dev.irq[intno]);
+        qemu_irq_raise(idev->irq[intno]);
     } else {
-        qemu_irq_lower(dev->dev.irq[intno]);
+        qemu_irq_lower(idev->irq[intno]);
     }
 }
 
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 33/49] ipack: Move IndustryPack out of hw/char/
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (31 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 32/49] ipoctal232: QOM parent field cleanup Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 34/49] qtest: Don't segfault with invalid -qtest option Andreas Färber
                   ` (16 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Move the header defining an IPackBus and IPackDevice base class into
a new include/ directory and move their implementation and a
PCI-IndustryPack bridge out of hw/char/ directory into a new hw/ipack/.

Acked-by: Alberto Garcia <agarcia@igalia.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/Makefile.objs                      | 1 +
 hw/char/Makefile.objs                 | 2 +-
 hw/char/ipoctal232.c                  | 2 +-
 hw/ipack/Makefile.objs                | 2 ++
 hw/{char => ipack}/ipack.c            | 2 +-
 hw/{char => ipack}/tpci200.c          | 2 +-
 {hw/char => include/hw/ipack}/ipack.h | 0
 tests/Makefile                        | 4 ++--
 8 files changed, 9 insertions(+), 6 deletions(-)
 create mode 100644 hw/ipack/Makefile.objs
 rename hw/{char => ipack}/ipack.c (99%)
 rename hw/{char => ipack}/tpci200.c (99%)
 rename {hw/char => include/hw/ipack}/ipack.h (100%)

diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index d91b9cc..05a00dc 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -12,6 +12,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += i2c/
 devices-dirs-$(CONFIG_SOFTMMU) += ide/
 devices-dirs-$(CONFIG_SOFTMMU) += input/
 devices-dirs-$(CONFIG_SOFTMMU) += intc/
+devices-dirs-$(CONFIG_IPACK) += ipack/
 devices-dirs-$(CONFIG_SOFTMMU) += isa/
 devices-dirs-$(CONFIG_SOFTMMU) += misc/
 devices-dirs-$(CONFIG_SOFTMMU) += net/
diff --git a/hw/char/Makefile.objs b/hw/char/Makefile.objs
index be2a7d9..317385d 100644
--- a/hw/char/Makefile.objs
+++ b/hw/char/Makefile.objs
@@ -1,4 +1,4 @@
-common-obj-$(CONFIG_IPACK) += tpci200.o ipoctal232.o ipack.o
+common-obj-$(CONFIG_IPACK) += ipoctal232.o
 common-obj-$(CONFIG_ESCC) += escc.o
 common-obj-$(CONFIG_PARALLEL) += parallel.o
 common-obj-$(CONFIG_PL011) += pl011.o
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index 99bab4d..f9c388e 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -8,7 +8,7 @@
  * later version.
  */
 
-#include "ipack.h"
+#include "hw/ipack/ipack.h"
 #include "qemu/bitops.h"
 #include "sysemu/char.h"
 
diff --git a/hw/ipack/Makefile.objs b/hw/ipack/Makefile.objs
new file mode 100644
index 0000000..8b9bdcb
--- /dev/null
+++ b/hw/ipack/Makefile.objs
@@ -0,0 +1,2 @@
+common-obj-$(CONFIG_IPACK) += ipack.o
+common-obj-$(CONFIG_IPACK) += tpci200.o
diff --git a/hw/char/ipack.c b/hw/ipack/ipack.c
similarity index 99%
rename from hw/char/ipack.c
rename to hw/ipack/ipack.c
index 15cef7b..ed63d2a 100644
--- a/hw/char/ipack.c
+++ b/hw/ipack/ipack.c
@@ -8,7 +8,7 @@
  * later version.
  */
 
-#include "ipack.h"
+#include "hw/ipack/ipack.h"
 
 IPackDevice *ipack_device_find(IPackBus *bus, int32_t slot)
 {
diff --git a/hw/char/tpci200.c b/hw/ipack/tpci200.c
similarity index 99%
rename from hw/char/tpci200.c
rename to hw/ipack/tpci200.c
index a49d2ed..e1b69b4 100644
--- a/hw/char/tpci200.c
+++ b/hw/ipack/tpci200.c
@@ -8,7 +8,7 @@
  * later version.
  */
 
-#include "ipack.h"
+#include "hw/ipack/ipack.h"
 #include "hw/pci/pci.h"
 #include "qemu/bitops.h"
 #include <stdio.h>
diff --git a/hw/char/ipack.h b/include/hw/ipack/ipack.h
similarity index 100%
rename from hw/char/ipack.h
rename to include/hw/ipack/ipack.h
diff --git a/tests/Makefile b/tests/Makefile
index 584fe4e..0ef8727 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -65,7 +65,7 @@ check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
 # All QTests for now are POSIX-only, but the dependencies are
 # really in libqtest, not in the testcases themselves.
 
-gcov-files-ipack-y += hw/char/ipack.c
+gcov-files-ipack-y += hw/ipack/ipack.c
 check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF)
 gcov-files-ipack-y += hw/char/ipoctal232.c
 
@@ -89,7 +89,7 @@ gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
 check-qtest-pci-y += tests/tpci200-test$(EXESUF)
 gcov-files-pci-y += hw/char/tpci200.c
 check-qtest-pci-y += $(check-qtest-ipack-y)
-gcov-files-pci-y += $(gcov-files-ipack-y) hw/char/tpci200.c
+gcov-files-pci-y += $(gcov-files-ipack-y) hw/ipack/tpci200.c
 
 check-qtest-i386-y = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 34/49] qtest: Don't segfault with invalid -qtest option
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (32 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 33/49] ipack: Move IndustryPack out of hw/char/ Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 35/49] qapi: Add size parser to StringInputVisitor Andreas Färber
                   ` (15 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng, Andreas Färber, Anthony Liguori

From: Fam Zheng <famz@redhat.com>

This prints an error message, instead of core dump, when "-qtest"
option value is invalid, e.g.:

    $ ./x86_64-softmmu/qemu-system-x86_64 -qtest unknown
        qemu-system-x86_64: Failed to initialize device for qtest:
        "unknown"

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/sysemu/qtest.h | 3 ++-
 qtest.c                | 8 +++++++-
 vl.c                   | 8 +++++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h
index 6aca8e4..28f4875 100644
--- a/include/sysemu/qtest.h
+++ b/include/sysemu/qtest.h
@@ -15,6 +15,7 @@
 #define QTEST_H
 
 #include "qemu-common.h"
+#include "qapi/error.h"
 
 extern bool qtest_allowed;
 
@@ -26,7 +27,7 @@ static inline bool qtest_enabled(void)
 bool qtest_driver(void);
 
 int qtest_init_accel(void);
-void qtest_init(const char *qtest_chrdev, const char *qtest_log);
+void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp);
 
 static inline int qtest_available(void)
 {
diff --git a/qtest.c b/qtest.c
index a738afc..ae941d6 100644
--- a/qtest.c
+++ b/qtest.c
@@ -507,12 +507,18 @@ int qtest_init_accel(void)
     return 0;
 }
 
-void qtest_init(const char *qtest_chrdev, const char *qtest_log)
+void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp)
 {
     CharDriverState *chr;
 
     chr = qemu_chr_new("qtest", qtest_chrdev, NULL);
 
+    if (chr == NULL) {
+        error_setg(errp, "Failed to initialize device for qtest: \"%s\"",
+                   qtest_chrdev);
+        return;
+    }
+
     qemu_chr_add_handlers(chr, qtest_can_read, qtest_read, qtest_event, chr);
     qemu_chr_fe_set_echo(chr, true);
 
diff --git a/vl.c b/vl.c
index a7b00cd..0f7d31f 100644
--- a/vl.c
+++ b/vl.c
@@ -4078,7 +4078,13 @@ int main(int argc, char **argv, char **envp)
     configure_accelerator();
 
     if (qtest_chrdev) {
-        qtest_init(qtest_chrdev, qtest_log);
+        Error *local_err = NULL;
+        qtest_init(qtest_chrdev, qtest_log, &local_err);
+        if (local_err) {
+            error_report("%s", error_get_pretty(local_err));
+            error_free(local_err);
+            exit(1);
+        }
     }
 
     machine_opts = qemu_get_machine_opts();
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 35/49] qapi: Add size parser to StringInputVisitor
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (33 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 34/49] qtest: Don't segfault with invalid -qtest option Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 36/49] qdev: Sizes are now parsed by StringInputVisitor Andreas Färber
                   ` (14 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Roth, Paolo Bonzini, Andreas Färber, Luiz Capitulino

From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 qapi/string-input-visitor.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index 8f1bc41..793548a 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -14,6 +14,7 @@
 #include "qapi/string-input-visitor.h"
 #include "qapi/visitor-impl.h"
 #include "qapi/qmp/qerror.h"
+#include "qemu/option.h"
 
 struct StringInputVisitor
 {
@@ -41,6 +42,28 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name,
     *obj = val;
 }
 
+static void parse_type_size(Visitor *v, uint64_t *obj, const char *name,
+                            Error **errp)
+{
+    StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v);
+    Error *err = NULL;
+    uint64_t val;
+
+    if (siv->string) {
+        parse_option_size(name, siv->string, &val, &err);
+    } else {
+        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+                  "size");
+        return;
+    }
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
+
+    *obj = val;
+}
+
 static void parse_type_bool(Visitor *v, bool *obj, const char *name,
                             Error **errp)
 {
@@ -128,6 +151,7 @@ StringInputVisitor *string_input_visitor_new(const char *str)
 
     v->visitor.type_enum = input_type_enum;
     v->visitor.type_int = parse_type_int;
+    v->visitor.type_size = parse_type_size;
     v->visitor.type_bool = parse_type_bool;
     v->visitor.type_str = parse_type_str;
     v->visitor.type_number = parse_type_number;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 36/49] qdev: Sizes are now parsed by StringInputVisitor
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (34 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 35/49] qapi: Add size parser to StringInputVisitor Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 37/49] qdev: Remove legacy parsers for hex8/32/64 Andreas Färber
                   ` (13 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev-properties.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index b949f0e..da37710 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1140,16 +1140,6 @@ static void set_size(Object *obj, Visitor *v, void *opaque,
     visit_type_size(v, ptr, name, errp);
 }
 
-static int parse_size(DeviceState *dev, Property *prop, const char *str)
-{
-    uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
-
-    if (str != NULL) {
-        parse_option_size(prop->name, str, ptr, &error_abort);
-    }
-    return 0;
-}
-
 static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
     static const char suffixes[] = { 'B', 'K', 'M', 'G', 'T' };
@@ -1171,7 +1161,6 @@ static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len)
 
 PropertyInfo qdev_prop_size = {
     .name  = "size",
-    .parse = parse_size,
     .print = print_size,
     .get = get_size,
     .set = set_size,
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 37/49] qdev: Remove legacy parsers for hex8/32/64
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (35 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 36/49] qdev: Sizes are now parsed by StringInputVisitor Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 38/49] qdev: Legacy properties are now read-only Andreas Färber
                   ` (12 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

The hexNN property types have not been accepting values not prefixed
by "0x" since QEMU 1.2.  Parse those values as decimals now.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev-properties.c | 54 -----------------------------------------------
 1 file changed, 54 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index da37710..e223ce1 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -189,23 +189,6 @@ PropertyInfo qdev_prop_uint8 = {
 
 /* --- 8bit hex value --- */
 
-static int parse_hex8(DeviceState *dev, Property *prop, const char *str)
-{
-    uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
-    char *end;
-
-    if (str[0] != '0' || str[1] != 'x') {
-        return -EINVAL;
-    }
-
-    *ptr = strtoul(str, &end, 16);
-    if ((*end != '\0') || (end == str)) {
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
 static int print_hex8(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
     uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
@@ -215,7 +198,6 @@ static int print_hex8(DeviceState *dev, Property *prop, char *dest, size_t len)
 PropertyInfo qdev_prop_hex8 = {
     .name  = "uint8",
     .legacy_name  = "hex8",
-    .parse = parse_hex8,
     .print = print_hex8,
     .get   = get_uint8,
     .set   = set_uint8,
@@ -320,23 +302,6 @@ PropertyInfo qdev_prop_int32 = {
 
 /* --- 32bit hex value --- */
 
-static int parse_hex32(DeviceState *dev, Property *prop, const char *str)
-{
-    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
-    char *end;
-
-    if (str[0] != '0' || str[1] != 'x') {
-        return -EINVAL;
-    }
-
-    *ptr = strtoul(str, &end, 16);
-    if ((*end != '\0') || (end == str)) {
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
 static int print_hex32(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
     uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
@@ -346,7 +311,6 @@ static int print_hex32(DeviceState *dev, Property *prop, char *dest, size_t len)
 PropertyInfo qdev_prop_hex32 = {
     .name  = "uint32",
     .legacy_name  = "hex32",
-    .parse = parse_hex32,
     .print = print_hex32,
     .get   = get_uint32,
     .set   = set_uint32,
@@ -387,23 +351,6 @@ PropertyInfo qdev_prop_uint64 = {
 
 /* --- 64bit hex value --- */
 
-static int parse_hex64(DeviceState *dev, Property *prop, const char *str)
-{
-    uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
-    char *end;
-
-    if (str[0] != '0' || str[1] != 'x') {
-        return -EINVAL;
-    }
-
-    *ptr = strtoull(str, &end, 16);
-    if ((*end != '\0') || (end == str)) {
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
 static int print_hex64(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
     uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
@@ -413,7 +360,6 @@ static int print_hex64(DeviceState *dev, Property *prop, char *dest, size_t len)
 PropertyInfo qdev_prop_hex64 = {
     .name  = "uint64",
     .legacy_name  = "hex64",
-    .parse = parse_hex64,
     .print = print_hex64,
     .get   = get_uint64,
     .set   = set_uint64,
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 38/49] qdev: Legacy properties are now read-only
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (36 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 37/49] qdev: Remove legacy parsers for hex8/32/64 Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 39/49] qdev: Legacy properties are just strings Andreas Färber
                   ` (11 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev-properties.c | 10 +---------
 hw/core/qdev.c            | 30 ++----------------------------
 include/hw/qdev-core.h    |  1 -
 3 files changed, 3 insertions(+), 38 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index e223ce1..a60a183 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -936,15 +936,7 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
 void qdev_prop_parse(DeviceState *dev, const char *name, const char *value,
                      Error **errp)
 {
-    char *legacy_name;
-
-    legacy_name = g_strdup_printf("legacy-%s", name);
-    if (object_property_get_type(OBJECT(dev), legacy_name, NULL)) {
-        object_property_parse(OBJECT(dev), value, legacy_name, errp);
-    } else {
-        object_property_parse(OBJECT(dev), value, name, errp);
-    }
-    g_free(legacy_name);
+    object_property_parse(OBJECT(dev), value, name, errp);
 }
 
 void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 82a9123..7c1b732 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -578,31 +578,6 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v, void *opaque,
     visit_type_str(v, &ptr, name, errp);
 }
 
-static void qdev_set_legacy_property(Object *obj, Visitor *v, void *opaque,
-                                     const char *name, Error **errp)
-{
-    DeviceState *dev = DEVICE(obj);
-    Property *prop = opaque;
-    Error *local_err = NULL;
-    char *ptr = NULL;
-    int ret;
-
-    if (dev->realized) {
-        qdev_prop_set_after_realize(dev, name, errp);
-        return;
-    }
-
-    visit_type_str(v, &ptr, name, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
-        return;
-    }
-
-    ret = prop->info->parse(dev, prop, ptr);
-    error_set_from_qdev_prop_error(errp, ret, dev, prop, ptr);
-    g_free(ptr);
-}
-
 /**
  * @qdev_add_legacy_property - adds a legacy property
  *
@@ -618,8 +593,7 @@ void qdev_property_add_legacy(DeviceState *dev, Property *prop,
     gchar *name, *type;
 
     /* Register pointer properties as legacy properties */
-    if (!prop->info->print && !prop->info->parse &&
-        (prop->info->set || prop->info->get)) {
+    if (!prop->info->print && prop->info->get) {
         return;
     }
 
@@ -629,7 +603,7 @@ void qdev_property_add_legacy(DeviceState *dev, Property *prop,
 
     object_property_add(OBJECT(dev), name, type,
                         prop->info->print ? qdev_get_legacy_property : prop->info->get,
-                        prop->info->parse ? qdev_set_legacy_property : prop->info->set,
+                        NULL,
                         NULL,
                         prop, errp);
 
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 2c4f140..d0cda38 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -209,7 +209,6 @@ struct PropertyInfo {
     const char *name;
     const char *legacy_name;
     const char **enum_table;
-    int (*parse)(DeviceState *dev, Property *prop, const char *str);
     int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
     ObjectPropertyAccessor *get;
     ObjectPropertyAccessor *set;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 39/49] qdev: Legacy properties are just strings
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (37 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 38/49] qdev: Legacy properties are now read-only Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 40/49] qdev: Inline qdev_prop_parse() Andreas Färber
                   ` (10 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

prop->info->legacy_name is still used by "-device foo,?".

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 7c1b732..482a978 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -590,7 +590,7 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v, void *opaque,
 void qdev_property_add_legacy(DeviceState *dev, Property *prop,
                               Error **errp)
 {
-    gchar *name, *type;
+    gchar *name;
 
     /* Register pointer properties as legacy properties */
     if (!prop->info->print && prop->info->get) {
@@ -598,16 +598,12 @@ void qdev_property_add_legacy(DeviceState *dev, Property *prop,
     }
 
     name = g_strdup_printf("legacy-%s", prop->name);
-    type = g_strdup_printf("legacy<%s>",
-                           prop->info->legacy_name ?: prop->info->name);
-
-    object_property_add(OBJECT(dev), name, type,
+    object_property_add(OBJECT(dev), name, "str",
                         prop->info->print ? qdev_get_legacy_property : prop->info->get,
                         NULL,
                         NULL,
                         prop, errp);
 
-    g_free(type);
     g_free(name);
 }
 
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 40/49] qdev: Inline qdev_prop_parse()
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (38 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 39/49] qdev: Legacy properties are just strings Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 41/49] qapi: Add human mode to StringOutputVisitor Andreas Färber
                   ` (9 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev-properties.c    | 8 +-------
 include/hw/qdev-properties.h | 2 --
 qdev-monitor.c               | 4 ++--
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index a60a183..22ddebf 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -933,12 +933,6 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
     }
 }
 
-void qdev_prop_parse(DeviceState *dev, const char *name, const char *value,
-                     Error **errp)
-{
-    object_property_parse(OBJECT(dev), value, name, errp);
-}
-
 void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value)
 {
     object_property_set_bool(OBJECT(dev), value, name, &error_abort);
@@ -1031,7 +1025,7 @@ void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename,
         if (strcmp(typename, prop->driver) != 0) {
             continue;
         }
-        qdev_prop_parse(dev, prop->property, prop->value, &err);
+        object_property_parse(OBJECT(dev), prop->value, prop->property, &err);
         if (err != NULL) {
             error_propagate(errp, err);
             return;
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 77c6f7c..4651459 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -168,8 +168,6 @@ extern PropertyInfo qdev_prop_arraylen;
 
 /* Set properties between creation and init.  */
 void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
-void qdev_prop_parse(DeviceState *dev, const char *name, const char *value,
-                     Error **errp);
 void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value);
 void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value);
 void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value);
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 1d3b68d..4d1634c 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -145,7 +145,7 @@ static void qdev_print_devinfos(bool show_no_user)
 
 static int set_property(const char *name, const char *value, void *opaque)
 {
-    DeviceState *dev = opaque;
+    Object *obj = opaque;
     Error *err = NULL;
 
     if (strcmp(name, "driver") == 0)
@@ -153,7 +153,7 @@ static int set_property(const char *name, const char *value, void *opaque)
     if (strcmp(name, "bus") == 0)
         return 0;
 
-    qdev_prop_parse(dev, name, value, &err);
+    object_property_parse(obj, value, name, &err);
     if (err != NULL) {
         qerror_report_err(err);
         error_free(err);
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 41/49] qapi: Add human mode to StringOutputVisitor
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (39 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 40/49] qdev: Inline qdev_prop_parse() Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 42/49] qdev: Use human mode in "info qtree" Andreas Färber
                   ` (8 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Roth, Paolo Bonzini, Andreas Färber, Luiz Capitulino

From: Paolo Bonzini <pbonzini@redhat.com>

This will be used by "info qtree".  For numbers it prints both the
decimal and hex values.  For sizes it rounds to the nearest power
of 2^10.  For strings, it puts quotes around the string and separates
NULL and empty string.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/qapi/string-output-visitor.h |  2 +-
 include/qom/object.h                 |  3 +-
 qapi/string-output-visitor.c         | 55 ++++++++++++++++++++++++++++++++++--
 qdev-monitor.c                       |  2 +-
 qom/object.c                         |  4 +--
 tests/test-string-output-visitor.c   |  2 +-
 tests/test-visitor-serialization.c   |  2 +-
 7 files changed, 60 insertions(+), 10 deletions(-)

diff --git a/include/qapi/string-output-visitor.h b/include/qapi/string-output-visitor.h
index ec81e42..d99717f 100644
--- a/include/qapi/string-output-visitor.h
+++ b/include/qapi/string-output-visitor.h
@@ -17,7 +17,7 @@
 
 typedef struct StringOutputVisitor StringOutputVisitor;
 
-StringOutputVisitor *string_output_visitor_new(void);
+StringOutputVisitor *string_output_visitor_new(bool human);
 void string_output_visitor_cleanup(StringOutputVisitor *v);
 
 char *string_output_get_string(StringOutputVisitor *v);
diff --git a/include/qom/object.h b/include/qom/object.h
index e0ff212..9c7c361 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -946,12 +946,13 @@ void object_property_parse(Object *obj, const char *string,
  * object_property_print:
  * @obj: the object
  * @name: the name of the property
+ * @human: if true, print for human consumption
  * @errp: returns an error if this function fails
  *
  * Returns a string representation of the value of the property.  The
  * caller shall free the string.
  */
-char *object_property_print(Object *obj, const char *name,
+char *object_property_print(Object *obj, const char *name, bool human,
                             Error **errp);
 
 /**
diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c
index 921653d..67a8798 100644
--- a/qapi/string-output-visitor.c
+++ b/qapi/string-output-visitor.c
@@ -14,10 +14,12 @@
 #include "qapi/string-output-visitor.h"
 #include "qapi/visitor-impl.h"
 #include "qapi/qmp/qerror.h"
+#include "qemu/host-utils.h"
 
 struct StringOutputVisitor
 {
     Visitor visitor;
+    bool human;
     char *string;
 };
 
@@ -31,7 +33,45 @@ static void print_type_int(Visitor *v, int64_t *obj, const char *name,
                            Error **errp)
 {
     StringOutputVisitor *sov = DO_UPCAST(StringOutputVisitor, visitor, v);
-    string_output_set(sov, g_strdup_printf("%lld", (long long) *obj));
+    char *out;
+
+    if (sov->human) {
+        out = g_strdup_printf("%lld (%#llx)", (long long) *obj, (long long) *obj);
+    } else {
+        out = g_strdup_printf("%lld", (long long) *obj);
+    }
+    string_output_set(sov, out);
+}
+
+static void print_type_size(Visitor *v, uint64_t *obj, const char *name,
+                           Error **errp)
+{
+    StringOutputVisitor *sov = DO_UPCAST(StringOutputVisitor, visitor, v);
+    static const char suffixes[] = { 'B', 'K', 'M', 'G', 'T' };
+    uint64_t div, val;
+    char *out;
+    int i;
+
+    if (!sov->human) {
+        out = g_strdup_printf("%llu", (long long) *obj);
+        string_output_set(sov, out);
+        return;
+    }
+
+    val = *obj;
+
+    /* Compute floor(log2(val)).  */
+    i = 64 - clz64(val);
+
+    /* Find the power of 1024 that we'll display as the units.  */
+    i /= 10;
+    if (i >= ARRAY_SIZE(suffixes)) {
+        i = ARRAY_SIZE(suffixes) - 1;
+    }
+    div = 1ULL << (i * 10);
+
+    out = g_strdup_printf("%0.03f%c", (double)val/div, suffixes[i]);
+    string_output_set(sov, out);
 }
 
 static void print_type_bool(Visitor *v, bool *obj, const char *name,
@@ -45,7 +85,14 @@ static void print_type_str(Visitor *v, char **obj, const char *name,
                            Error **errp)
 {
     StringOutputVisitor *sov = DO_UPCAST(StringOutputVisitor, visitor, v);
-    string_output_set(sov, g_strdup(*obj ? *obj : ""));
+    char *out;
+
+    if (sov->human) {
+        out = *obj ? g_strdup_printf("\"%s\"", *obj) : g_strdup("<null>");
+    } else {
+        out = g_strdup(*obj ? *obj : "");
+    }
+    string_output_set(sov, out);
 }
 
 static void print_type_number(Visitor *v, double *obj, const char *name,
@@ -73,14 +120,16 @@ void string_output_visitor_cleanup(StringOutputVisitor *sov)
     g_free(sov);
 }
 
-StringOutputVisitor *string_output_visitor_new(void)
+StringOutputVisitor *string_output_visitor_new(bool human)
 {
     StringOutputVisitor *v;
 
     v = g_malloc0(sizeof(*v));
 
+    v->human = human;
     v->visitor.type_enum = output_type_enum;
     v->visitor.type_int = print_type_int;
+    v->visitor.type_size = print_type_size;
     v->visitor.type_bool = print_type_bool;
     v->visitor.type_str = print_type_str;
     v->visitor.type_number = print_type_number;
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 4d1634c..f385fb3 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -577,7 +577,7 @@ static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props,
         if (object_property_get_type(OBJECT(dev), legacy_name, NULL)) {
             value = object_property_get_str(OBJECT(dev), legacy_name, &err);
         } else {
-            value = object_property_print(OBJECT(dev), props->name, &err);
+            value = object_property_print(OBJECT(dev), props->name, false, &err);
         }
         g_free(legacy_name);
 
diff --git a/qom/object.c b/qom/object.c
index 62e7e41..660859c 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -948,13 +948,13 @@ void object_property_parse(Object *obj, const char *string,
     string_input_visitor_cleanup(mi);
 }
 
-char *object_property_print(Object *obj, const char *name,
+char *object_property_print(Object *obj, const char *name, bool human,
                             Error **errp)
 {
     StringOutputVisitor *mo;
     char *string;
 
-    mo = string_output_visitor_new();
+    mo = string_output_visitor_new(human);
     object_property_get(obj, string_output_get_visitor(mo), name, errp);
     string = string_output_get_string(mo);
     string_output_visitor_cleanup(mo);
diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index 79d815f..56cc21d 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -26,7 +26,7 @@ typedef struct TestOutputVisitorData {
 static void visitor_output_setup(TestOutputVisitorData *data,
                                  const void *unused)
 {
-    data->sov = string_output_visitor_new();
+    data->sov = string_output_visitor_new(false);
     g_assert(data->sov != NULL);
 
     data->ov = string_output_get_visitor(data->sov);
diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
index 9aaa587..6bff950 100644
--- a/tests/test-visitor-serialization.c
+++ b/tests/test-visitor-serialization.c
@@ -1083,7 +1083,7 @@ static void string_serialize(void *native_in, void **datap,
 {
     StringSerializeData *d = g_malloc0(sizeof(*d));
 
-    d->sov = string_output_visitor_new();
+    d->sov = string_output_visitor_new(false);
     visit(string_output_get_visitor(d->sov), &native_in, errp);
     *datap = d;
 }
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 42/49] qdev: Use human mode in "info qtree"
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (40 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 41/49] qapi: Add human mode to StringOutputVisitor Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 43/49] qdev: Remove most legacy printers Andreas Färber
                   ` (7 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 qdev-monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qdev-monitor.c b/qdev-monitor.c
index f385fb3..b37778f 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -577,7 +577,7 @@ static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props,
         if (object_property_get_type(OBJECT(dev), legacy_name, NULL)) {
             value = object_property_get_str(OBJECT(dev), legacy_name, &err);
         } else {
-            value = object_property_print(OBJECT(dev), props->name, false, &err);
+            value = object_property_print(OBJECT(dev), props->name, true, &err);
         }
         g_free(legacy_name);
 
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 43/49] qdev: Remove most legacy printers
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (41 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 42/49] qdev: Use human mode in "info qtree" Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 44/49] qdev: Remove hex8/32/64 property types Andreas Färber
                   ` (6 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

Their functionality is either aesthetic only (e.g. on/off vs. true/false)
or obtained by the "human mode" of StringOutputVisitor.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev-properties.c | 60 -----------------------------------------------
 1 file changed, 60 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 22ddebf..a4f1f78 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -74,13 +74,6 @@ static void bit_prop_set(DeviceState *dev, Property *props, bool val)
     }
 }
 
-static int prop_print_bit(DeviceState *dev, Property *prop, char *dest,
-                          size_t len)
-{
-    uint32_t *p = qdev_get_prop_ptr(dev, prop);
-    return snprintf(dest, len, (*p & qdev_get_prop_mask(prop)) ? "on" : "off");
-}
-
 static void prop_get_bit(Object *obj, Visitor *v, void *opaque,
                     const char *name, Error **errp)
 {
@@ -116,7 +109,6 @@ static void prop_set_bit(Object *obj, Visitor *v, void *opaque,
 PropertyInfo qdev_prop_bit = {
     .name  = "boolean",
     .legacy_name  = "on/off",
-    .print = prop_print_bit,
     .get   = prop_get_bit,
     .set   = prop_set_bit,
 };
@@ -189,16 +181,9 @@ PropertyInfo qdev_prop_uint8 = {
 
 /* --- 8bit hex value --- */
 
-static int print_hex8(DeviceState *dev, Property *prop, char *dest, size_t len)
-{
-    uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
-    return snprintf(dest, len, "0x%" PRIx8, *ptr);
-}
-
 PropertyInfo qdev_prop_hex8 = {
     .name  = "uint8",
     .legacy_name  = "hex8",
-    .print = print_hex8,
     .get   = get_uint8,
     .set   = set_uint8,
 };
@@ -302,16 +287,9 @@ PropertyInfo qdev_prop_int32 = {
 
 /* --- 32bit hex value --- */
 
-static int print_hex32(DeviceState *dev, Property *prop, char *dest, size_t len)
-{
-    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
-    return snprintf(dest, len, "0x%" PRIx32, *ptr);
-}
-
 PropertyInfo qdev_prop_hex32 = {
     .name  = "uint32",
     .legacy_name  = "hex32",
-    .print = print_hex32,
     .get   = get_uint32,
     .set   = set_uint32,
 };
@@ -351,16 +329,9 @@ PropertyInfo qdev_prop_uint64 = {
 
 /* --- 64bit hex value --- */
 
-static int print_hex64(DeviceState *dev, Property *prop, char *dest, size_t len)
-{
-    uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
-    return snprintf(dest, len, "0x%" PRIx64, *ptr);
-}
-
 PropertyInfo qdev_prop_hex64 = {
     .name  = "uint64",
     .legacy_name  = "hex64",
-    .print = print_hex64,
     .get   = get_uint64,
     .set   = set_uint64,
 };
@@ -373,16 +344,6 @@ static void release_string(Object *obj, const char *name, void *opaque)
     g_free(*(char **)qdev_get_prop_ptr(DEVICE(obj), prop));
 }
 
-static int print_string(DeviceState *dev, Property *prop, char *dest,
-                        size_t len)
-{
-    char **ptr = qdev_get_prop_ptr(dev, prop);
-    if (!*ptr) {
-        return snprintf(dest, len, "<null>");
-    }
-    return snprintf(dest, len, "\"%s\"", *ptr);
-}
-
 static void get_string(Object *obj, Visitor *v, void *opaque,
                        const char *name, Error **errp)
 {
@@ -425,7 +386,6 @@ static void set_string(Object *obj, Visitor *v, void *opaque,
 
 PropertyInfo qdev_prop_string = {
     .name  = "string",
-    .print = print_string,
     .release = release_string,
     .get   = get_string,
     .set   = set_string,
@@ -1072,28 +1032,8 @@ static void set_size(Object *obj, Visitor *v, void *opaque,
     visit_type_size(v, ptr, name, errp);
 }
 
-static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len)
-{
-    static const char suffixes[] = { 'B', 'K', 'M', 'G', 'T' };
-    uint64_t div, val = *(uint64_t *)qdev_get_prop_ptr(dev, prop);
-    int i;
-
-    /* Compute floor(log2(val)).  */
-    i = 64 - clz64(val);
-
-    /* Find the power of 1024 that we'll display as the units.  */
-    i /= 10;
-    if (i >= ARRAY_SIZE(suffixes)) {
-        i = ARRAY_SIZE(suffixes) - 1;
-    }
-    div = 1ULL << (i * 10);
-
-    return snprintf(dest, len, "%0.03f%c", (double)val/div, suffixes[i]);
-}
-
 PropertyInfo qdev_prop_size = {
     .name  = "size",
-    .print = print_size,
     .get = get_size,
     .set = set_size,
 };
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 44/49] qdev: Remove hex8/32/64 property types
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (42 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 43/49] qdev: Remove most legacy printers Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 45/49] block: Handle "rechs" and "large" translation options Andreas Färber
                   ` (5 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, open list:PReP, Anthony Liguori, Michael S. Tsirkin,
	Alexander Graf, Andreas Färber, Vassili Karpov (malc),
	Gerd Hoffmann, Stefan Hajnoczi, Paolo Bonzini,
	Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

Replace them with uint8/32/64.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/audio/adlib.c             |  2 +-
 hw/audio/cs4231a.c           |  2 +-
 hw/audio/gus.c               |  2 +-
 hw/audio/pcspk.c             |  2 +-
 hw/audio/sb16.c              |  4 ++--
 hw/block/fdc.c               |  2 +-
 hw/char/debugcon.c           |  4 ++--
 hw/char/parallel.c           |  2 +-
 hw/char/serial-isa.c         |  2 +-
 hw/core/qdev-properties.c    | 27 ---------------------------
 hw/display/g364fb.c          |  2 +-
 hw/display/tcx.c             |  4 ++--
 hw/dma/i82374.c              |  2 +-
 hw/dma/sun4m_iommu.c         |  2 +-
 hw/i386/kvm/i8254.c          |  2 +-
 hw/ide/isa.c                 |  4 ++--
 hw/ide/qdev.c                |  2 +-
 hw/intc/i8259_common.c       |  6 +++---
 hw/isa/pc87312.c             |  2 +-
 hw/misc/applesmc.c           |  2 +-
 hw/misc/debugexit.c          |  4 ++--
 hw/misc/eccmemctl.c          |  2 +-
 hw/net/ne2000-isa.c          |  2 +-
 hw/nvram/fw_cfg.c            |  4 ++--
 hw/ppc/spapr_pci.c           | 16 ++++++++--------
 hw/scsi/megasas.c            |  2 +-
 hw/scsi/scsi-disk.c          |  6 +++---
 hw/sd/sdhci.c                |  4 ++--
 hw/timer/i8254.c             |  2 +-
 hw/timer/m48t59.c            |  4 ++--
 hw/usb/host-libusb.c         |  4 ++--
 hw/virtio/virtio-pci.c       |  6 +++---
 include/hw/qdev-dma.h        |  2 +-
 include/hw/qdev-properties.h |  9 ---------
 34 files changed, 54 insertions(+), 90 deletions(-)

diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index e88d2dd..28eed81 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -354,7 +354,7 @@ static void adlib_realizefn (DeviceState *dev, Error **errp)
 }
 
 static Property adlib_properties[] = {
-    DEFINE_PROP_HEX32  ("iobase",  AdlibState, port, 0x220),
+    DEFINE_PROP_UINT32 ("iobase",  AdlibState, port, 0x220),
     DEFINE_PROP_UINT32 ("freq",    AdlibState, freq,  44100),
     DEFINE_PROP_END_OF_LIST (),
 };
diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c
index 666096b..a0ec17a 100644
--- a/hw/audio/cs4231a.c
+++ b/hw/audio/cs4231a.c
@@ -673,7 +673,7 @@ static int cs4231a_init (ISABus *bus)
 }
 
 static Property cs4231a_properties[] = {
-    DEFINE_PROP_HEX32  ("iobase",  CSState, port, 0x534),
+    DEFINE_PROP_UINT32 ("iobase",  CSState, port, 0x534),
     DEFINE_PROP_UINT32 ("irq",     CSState, irq,  9),
     DEFINE_PROP_UINT32 ("dma",     CSState, dma,  3),
     DEFINE_PROP_END_OF_LIST (),
diff --git a/hw/audio/gus.c b/hw/audio/gus.c
index 71be3c6..e29a571 100644
--- a/hw/audio/gus.c
+++ b/hw/audio/gus.c
@@ -304,7 +304,7 @@ static int GUS_init (ISABus *bus)
 
 static Property gus_properties[] = {
     DEFINE_PROP_UINT32 ("freq",    GUSState, freq,        44100),
-    DEFINE_PROP_HEX32  ("iobase",  GUSState, port,        0x240),
+    DEFINE_PROP_UINT32 ("iobase",  GUSState, port,        0x240),
     DEFINE_PROP_UINT32 ("irq",     GUSState, emu.gusirq,  7),
     DEFINE_PROP_UINT32 ("dma",     GUSState, emu.gusdma,  3),
     DEFINE_PROP_END_OF_LIST (),
diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
index f980d66..1d81bbe 100644
--- a/hw/audio/pcspk.c
+++ b/hw/audio/pcspk.c
@@ -181,7 +181,7 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
 }
 
 static Property pcspk_properties[] = {
-    DEFINE_PROP_HEX32("iobase", PCSpkState, iobase,  -1),
+    DEFINE_PROP_UINT32("iobase", PCSpkState, iobase,  -1),
     DEFINE_PROP_PTR("pit", PCSpkState, pit),
     DEFINE_PROP_END_OF_LIST(),
 };
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
index db79131..bb24e00 100644
--- a/hw/audio/sb16.c
+++ b/hw/audio/sb16.c
@@ -1399,8 +1399,8 @@ static int SB16_init (ISABus *bus)
 }
 
 static Property sb16_properties[] = {
-    DEFINE_PROP_HEX32  ("version", SB16State, ver,  0x0405), /* 4.5 */
-    DEFINE_PROP_HEX32  ("iobase",  SB16State, port, 0x220),
+    DEFINE_PROP_UINT32 ("version", SB16State, ver,  0x0405), /* 4.5 */
+    DEFINE_PROP_UINT32 ("iobase",  SB16State, port, 0x220),
     DEFINE_PROP_UINT32 ("irq",     SB16State, irq,  5),
     DEFINE_PROP_UINT32 ("dma",     SB16State, dma,  1),
     DEFINE_PROP_UINT32 ("dma16",   SB16State, hdma, 5),
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 592b58f..1651007 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -2216,7 +2216,7 @@ static const VMStateDescription vmstate_isa_fdc ={
 };
 
 static Property isa_fdc_properties[] = {
-    DEFINE_PROP_HEX32("iobase", FDCtrlISABus, iobase, 0x3f0),
+    DEFINE_PROP_UINT32("iobase", FDCtrlISABus, iobase, 0x3f0),
     DEFINE_PROP_UINT32("irq", FDCtrlISABus, irq, 6),
     DEFINE_PROP_UINT32("dma", FDCtrlISABus, dma, 2),
     DEFINE_PROP_DRIVE("driveA", FDCtrlISABus, state.drives[0].bs),
diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c
index 02d0d57..36f1c4a 100644
--- a/hw/char/debugcon.c
+++ b/hw/char/debugcon.c
@@ -110,9 +110,9 @@ static void debugcon_isa_realizefn(DeviceState *dev, Error **errp)
 }
 
 static Property debugcon_isa_properties[] = {
-    DEFINE_PROP_HEX32("iobase", ISADebugconState, iobase, 0xe9),
+    DEFINE_PROP_UINT32("iobase", ISADebugconState, iobase, 0xe9),
     DEFINE_PROP_CHR("chardev",  ISADebugconState, state.chr),
-    DEFINE_PROP_HEX32("readback", ISADebugconState, state.readback, 0xe9),
+    DEFINE_PROP_UINT32("readback", ISADebugconState, state.readback, 0xe9),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index 7a3b264..7ac90a5 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -595,7 +595,7 @@ bool parallel_mm_init(MemoryRegion *address_space,
 
 static Property parallel_isa_properties[] = {
     DEFINE_PROP_UINT32("index", ISAParallelState, index,   -1),
-    DEFINE_PROP_HEX32("iobase", ISAParallelState, iobase,  -1),
+    DEFINE_PROP_UINT32("iobase", ISAParallelState, iobase,  -1),
     DEFINE_PROP_UINT32("irq",   ISAParallelState, isairq,  7),
     DEFINE_PROP_CHR("chardev",  ISAParallelState, state.chr),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index 5cb77b3..c9fcb27 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -88,7 +88,7 @@ static const VMStateDescription vmstate_isa_serial = {
 
 static Property serial_isa_properties[] = {
     DEFINE_PROP_UINT32("index",  ISASerialState, index,   -1),
-    DEFINE_PROP_HEX32("iobase",  ISASerialState, iobase,  -1),
+    DEFINE_PROP_UINT32("iobase",  ISASerialState, iobase,  -1),
     DEFINE_PROP_UINT32("irq",    ISASerialState, isairq,  -1),
     DEFINE_PROP_CHR("chardev",   ISASerialState, state.chr),
     DEFINE_PROP_UINT32("wakeup", ISASerialState, state.wakeup, 0),
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index a4f1f78..2c3a756 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -179,15 +179,6 @@ PropertyInfo qdev_prop_uint8 = {
     .set   = set_uint8,
 };
 
-/* --- 8bit hex value --- */
-
-PropertyInfo qdev_prop_hex8 = {
-    .name  = "uint8",
-    .legacy_name  = "hex8",
-    .get   = get_uint8,
-    .set   = set_uint8,
-};
-
 /* --- 16bit integer --- */
 
 static void get_uint16(Object *obj, Visitor *v, void *opaque,
@@ -285,15 +276,6 @@ PropertyInfo qdev_prop_int32 = {
     .set   = set_int32,
 };
 
-/* --- 32bit hex value --- */
-
-PropertyInfo qdev_prop_hex32 = {
-    .name  = "uint32",
-    .legacy_name  = "hex32",
-    .get   = get_uint32,
-    .set   = set_uint32,
-};
-
 /* --- 64bit integer --- */
 
 static void get_uint64(Object *obj, Visitor *v, void *opaque,
@@ -327,15 +309,6 @@ PropertyInfo qdev_prop_uint64 = {
     .set   = set_uint64,
 };
 
-/* --- 64bit hex value --- */
-
-PropertyInfo qdev_prop_hex64 = {
-    .name  = "uint64",
-    .legacy_name  = "hex64",
-    .get   = get_uint64,
-    .set   = set_uint64,
-};
-
 /* --- string --- */
 
 static void release_string(Object *obj, const char *name, void *opaque)
diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
index 7082171..bc909bb 100644
--- a/hw/display/g364fb.c
+++ b/hw/display/g364fb.c
@@ -524,7 +524,7 @@ static void g364fb_sysbus_reset(DeviceState *d)
 }
 
 static Property g364fb_sysbus_properties[] = {
-    DEFINE_PROP_HEX32("vram_size", G364SysBusState, g364.vram_size,
+    DEFINE_PROP_UINT32("vram_size", G364SysBusState, g364.vram_size,
     8 * 1024 * 1024),
     DEFINE_PROP_END_OF_LIST(),
 };
diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index 873b82c..e60769c 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -617,11 +617,11 @@ static int tcx_init1(SysBusDevice *dev)
 }
 
 static Property tcx_properties[] = {
-    DEFINE_PROP_HEX32("vram_size", TCXState, vram_size, -1),
+    DEFINE_PROP_UINT32("vram_size", TCXState, vram_size, -1),
     DEFINE_PROP_UINT16("width",    TCXState, width,     -1),
     DEFINE_PROP_UINT16("height",   TCXState, height,    -1),
     DEFINE_PROP_UINT16("depth",    TCXState, depth,     -1),
-    DEFINE_PROP_HEX64("prom_addr", TCXState, prom_addr, -1),
+    DEFINE_PROP_UINT64("prom_addr", TCXState, prom_addr, -1),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index a5b891f..dc7a767 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -149,7 +149,7 @@ static void i82374_isa_realize(DeviceState *dev, Error **errp)
 }
 
 static Property i82374_properties[] = {
-    DEFINE_PROP_HEX32("iobase", ISAi82374State, iobase, 0x400),
+    DEFINE_PROP_UINT32("iobase", ISAi82374State, iobase, 0x400),
     DEFINE_PROP_END_OF_LIST()
 };
 
diff --git a/hw/dma/sun4m_iommu.c b/hw/dma/sun4m_iommu.c
index 723f66d..899d454 100644
--- a/hw/dma/sun4m_iommu.c
+++ b/hw/dma/sun4m_iommu.c
@@ -362,7 +362,7 @@ static int iommu_init1(SysBusDevice *dev)
 }
 
 static Property iommu_properties[] = {
-    DEFINE_PROP_HEX32("version", IOMMUState, version, 0),
+    DEFINE_PROP_UINT32("version", IOMMUState, version, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index 20b6457..f8f3021 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -298,7 +298,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
 }
 
 static Property kvm_pit_properties[] = {
-    DEFINE_PROP_HEX32("iobase", PITCommonState, iobase,  -1),
+    DEFINE_PROP_UINT32("iobase", PITCommonState, iobase,  -1),
     DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", KVMPITState,
                                lost_tick_policy, LOST_TICK_DELAY),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index afc24d4..d2cabc1 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -104,8 +104,8 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
 }
 
 static Property isa_ide_properties[] = {
-    DEFINE_PROP_HEX32("iobase",  ISAIDEState, iobase,  0x1f0),
-    DEFINE_PROP_HEX32("iobase2", ISAIDEState, iobase2, 0x3f6),
+    DEFINE_PROP_UINT32("iobase",  ISAIDEState, iobase,  0x1f0),
+    DEFINE_PROP_UINT32("iobase2", ISAIDEState, iobase2, 0x3f6),
     DEFINE_PROP_UINT32("irq",    ISAIDEState, isairq,  14),
     DEFINE_PROP_END_OF_LIST(),
 };
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 18c4b7e..6e475e6 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -206,7 +206,7 @@ static int ide_drive_initfn(IDEDevice *dev)
 #define DEFINE_IDE_DEV_PROPERTIES()                     \
     DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf),        \
     DEFINE_PROP_STRING("ver",  IDEDrive, dev.version),  \
-    DEFINE_PROP_HEX64("wwn",  IDEDrive, dev.wwn, 0),    \
+    DEFINE_PROP_UINT64("wwn",  IDEDrive, dev.wwn, 0),    \
     DEFINE_PROP_STRING("serial",  IDEDrive, dev.serial),\
     DEFINE_PROP_STRING("model", IDEDrive, dev.model)
 
diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c
index 9d29399..61381c4 100644
--- a/hw/intc/i8259_common.c
+++ b/hw/intc/i8259_common.c
@@ -123,9 +123,9 @@ static const VMStateDescription vmstate_pic_common = {
 };
 
 static Property pic_properties_common[] = {
-    DEFINE_PROP_HEX32("iobase", PICCommonState, iobase,  -1),
-    DEFINE_PROP_HEX32("elcr_addr", PICCommonState, elcr_addr,  -1),
-    DEFINE_PROP_HEX8("elcr_mask", PICCommonState, elcr_mask,  -1),
+    DEFINE_PROP_UINT32("iobase", PICCommonState, iobase,  -1),
+    DEFINE_PROP_UINT32("elcr_addr", PICCommonState, elcr_addr,  -1),
+    DEFINE_PROP_UINT8("elcr_mask", PICCommonState, elcr_mask,  -1),
     DEFINE_PROP_BIT("master", PICCommonState, master,  0, false),
     DEFINE_PROP_END_OF_LIST(),
 };
diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c
index 46a23fb..b352b49 100644
--- a/hw/isa/pc87312.c
+++ b/hw/isa/pc87312.c
@@ -369,7 +369,7 @@ static const VMStateDescription vmstate_pc87312 = {
 };
 
 static Property pc87312_properties[] = {
-    DEFINE_PROP_HEX32("iobase", PC87312State, iobase, 0x398),
+    DEFINE_PROP_UINT32("iobase", PC87312State, iobase, 0x398),
     DEFINE_PROP_UINT8("config", PC87312State, config, 1),
     DEFINE_PROP_END_OF_LIST()
 };
diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c
index 627adb9..6a56b07 100644
--- a/hw/misc/applesmc.c
+++ b/hw/misc/applesmc.c
@@ -249,7 +249,7 @@ static void applesmc_isa_realize(DeviceState *dev, Error **errp)
 }
 
 static Property applesmc_isa_properties[] = {
-    DEFINE_PROP_HEX32("iobase", AppleSMCState, iobase,
+    DEFINE_PROP_UINT32("iobase", AppleSMCState, iobase,
                       APPLESMC_DEFAULT_IOBASE),
     DEFINE_PROP_STRING("osk", AppleSMCState, osk),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/misc/debugexit.c b/hw/misc/debugexit.c
index 9db5680..69a1b00 100644
--- a/hw/misc/debugexit.c
+++ b/hw/misc/debugexit.c
@@ -47,8 +47,8 @@ static void debug_exit_realizefn(DeviceState *d, Error **errp)
 }
 
 static Property debug_exit_properties[] = {
-    DEFINE_PROP_HEX32("iobase", ISADebugExitState, iobase, 0x501),
-    DEFINE_PROP_HEX32("iosize", ISADebugExitState, iosize, 0x02),
+    DEFINE_PROP_UINT32("iobase", ISADebugExitState, iobase, 0x501),
+    DEFINE_PROP_UINT32("iosize", ISADebugExitState, iosize, 0x02),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/misc/eccmemctl.c b/hw/misc/eccmemctl.c
index 96a69d4..549431c 100644
--- a/hw/misc/eccmemctl.c
+++ b/hw/misc/eccmemctl.c
@@ -314,7 +314,7 @@ static int ecc_init1(SysBusDevice *dev)
 }
 
 static Property ecc_properties[] = {
-    DEFINE_PROP_HEX32("version", ECCState, version, -1),
+    DEFINE_PROP_UINT32("version", ECCState, version, -1),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
index 26b83ce..c660e58 100644
--- a/hw/net/ne2000-isa.c
+++ b/hw/net/ne2000-isa.c
@@ -86,7 +86,7 @@ static void isa_ne2000_realizefn(DeviceState *dev, Error **errp)
 }
 
 static Property ne2000_isa_properties[] = {
-    DEFINE_PROP_HEX32("iobase", ISANE2000State, iobase, 0x300),
+    DEFINE_PROP_UINT32("iobase", ISANE2000State, iobase, 0x300),
     DEFINE_PROP_UINT32("irq",   ISANE2000State, isairq, 9),
     DEFINE_NIC_PROPERTIES(ISANE2000State, ne2000.c),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index ee96c16..cb36dc2 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -584,8 +584,8 @@ static void fw_cfg_realize(DeviceState *dev, Error **errp)
 }
 
 static Property fw_cfg_properties[] = {
-    DEFINE_PROP_HEX32("ctl_iobase", FWCfgState, ctl_iobase, -1),
-    DEFINE_PROP_HEX32("data_iobase", FWCfgState, data_iobase, -1),
+    DEFINE_PROP_UINT32("ctl_iobase", FWCfgState, ctl_iobase, -1),
+    DEFINE_PROP_UINT32("data_iobase", FWCfgState, data_iobase, -1),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index ec00300..4c7c3ae 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -651,14 +651,14 @@ static void spapr_phb_reset(DeviceState *qdev)
 
 static Property spapr_phb_properties[] = {
     DEFINE_PROP_INT32("index", sPAPRPHBState, index, -1),
-    DEFINE_PROP_HEX64("buid", sPAPRPHBState, buid, -1),
-    DEFINE_PROP_HEX32("liobn", sPAPRPHBState, dma_liobn, -1),
-    DEFINE_PROP_HEX64("mem_win_addr", sPAPRPHBState, mem_win_addr, -1),
-    DEFINE_PROP_HEX64("mem_win_size", sPAPRPHBState, mem_win_size,
-                      SPAPR_PCI_MMIO_WIN_SIZE),
-    DEFINE_PROP_HEX64("io_win_addr", sPAPRPHBState, io_win_addr, -1),
-    DEFINE_PROP_HEX64("io_win_size", sPAPRPHBState, io_win_size,
-                      SPAPR_PCI_IO_WIN_SIZE),
+    DEFINE_PROP_UINT64("buid", sPAPRPHBState, buid, -1),
+    DEFINE_PROP_UINT32("liobn", sPAPRPHBState, dma_liobn, -1),
+    DEFINE_PROP_UINT64("mem_win_addr", sPAPRPHBState, mem_win_addr, -1),
+    DEFINE_PROP_UINT64("mem_win_size", sPAPRPHBState, mem_win_size,
+                       SPAPR_PCI_MMIO_WIN_SIZE),
+    DEFINE_PROP_UINT64("io_win_addr", sPAPRPHBState, io_win_addr, -1),
+    DEFINE_PROP_UINT64("io_win_size", sPAPRPHBState, io_win_size,
+                       SPAPR_PCI_IO_WIN_SIZE),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 59570e2..e6e1ffd 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -2195,7 +2195,7 @@ static Property megasas_properties[] = {
     DEFINE_PROP_UINT32("max_cmds", MegasasState, fw_cmds,
                        MEGASAS_DEFAULT_FRAMES),
     DEFINE_PROP_STRING("hba_serial", MegasasState, hba_serial),
-    DEFINE_PROP_HEX64("sas_address", MegasasState, sas_addr, 0),
+    DEFINE_PROP_UINT64("sas_address", MegasasState, sas_addr, 0),
 #ifdef USE_MSIX
     DEFINE_PROP_BIT("use_msix", MegasasState, flags,
                     MEGASAS_FLAG_USE_MSIX, false),
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index a8d0f15..b4fadd2 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2535,7 +2535,7 @@ static Property scsi_hd_properties[] = {
                     SCSI_DISK_F_REMOVABLE, false),
     DEFINE_PROP_BIT("dpofua", SCSIDiskState, features,
                     SCSI_DISK_F_DPOFUA, false),
-    DEFINE_PROP_HEX64("wwn", SCSIDiskState, wwn, 0),
+    DEFINE_PROP_UINT64("wwn", SCSIDiskState, wwn, 0),
     DEFINE_PROP_UINT64("max_unmap_size", SCSIDiskState, max_unmap_size,
                        DEFAULT_MAX_UNMAP_SIZE),
     DEFINE_BLOCK_CHS_PROPERTIES(SCSIDiskState, qdev.conf),
@@ -2583,7 +2583,7 @@ static const TypeInfo scsi_hd_info = {
 
 static Property scsi_cd_properties[] = {
     DEFINE_SCSI_DISK_PROPERTIES(),
-    DEFINE_PROP_HEX64("wwn", SCSIDiskState, wwn, 0),
+    DEFINE_PROP_UINT64("wwn", SCSIDiskState, wwn, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -2646,7 +2646,7 @@ static Property scsi_disk_properties[] = {
                     SCSI_DISK_F_REMOVABLE, false),
     DEFINE_PROP_BIT("dpofua", SCSIDiskState, features,
                     SCSI_DISK_F_DPOFUA, false),
-    DEFINE_PROP_HEX64("wwn", SCSIDiskState, wwn, 0),
+    DEFINE_PROP_UINT64("wwn", SCSIDiskState, wwn, 0),
     DEFINE_PROP_UINT64("max_unmap_size", SCSIDiskState, max_unmap_size,
                        DEFAULT_MAX_UNMAP_SIZE),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 0906a1d..027a6fa 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1234,9 +1234,9 @@ const VMStateDescription sdhci_vmstate = {
 /* Capabilities registers provide information on supported features of this
  * specific host controller implementation */
 static Property sdhci_properties[] = {
-    DEFINE_PROP_HEX32("capareg", SDHCIState, capareg,
+    DEFINE_PROP_UINT32("capareg", SDHCIState, capareg,
             SDHC_CAPAB_REG_DEFAULT),
-    DEFINE_PROP_HEX32("maxcurr", SDHCIState, maxcurr, 0),
+    DEFINE_PROP_UINT32("maxcurr", SDHCIState, maxcurr, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c
index cdbf481..28152d8 100644
--- a/hw/timer/i8254.c
+++ b/hw/timer/i8254.c
@@ -342,7 +342,7 @@ static void pit_realizefn(DeviceState *dev, Error **err)
 }
 
 static Property pit_properties[] = {
-    DEFINE_PROP_HEX32("iobase", PITCommonState, iobase,  -1),
+    DEFINE_PROP_UINT32("iobase", PITCommonState, iobase,  -1),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c
index 3cfb18a..7cf8684 100644
--- a/hw/timer/m48t59.c
+++ b/hw/timer/m48t59.c
@@ -741,7 +741,7 @@ static int m48t59_init1(SysBusDevice *dev)
 static Property m48t59_isa_properties[] = {
     DEFINE_PROP_UINT32("size",    M48t59ISAState, state.size,    -1),
     DEFINE_PROP_UINT32("model",   M48t59ISAState, state.model,   -1),
-    DEFINE_PROP_HEX32( "io_base", M48t59ISAState, state.io_base,  0),
+    DEFINE_PROP_UINT32("io_base", M48t59ISAState, state.io_base,  0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -766,7 +766,7 @@ static const TypeInfo m48t59_isa_info = {
 static Property m48t59_properties[] = {
     DEFINE_PROP_UINT32("size",    M48t59SysBusState, state.size,    -1),
     DEFINE_PROP_UINT32("model",   M48t59SysBusState, state.model,   -1),
-    DEFINE_PROP_HEX32( "io_base", M48t59SysBusState, state.io_base,  0),
+    DEFINE_PROP_UINT32("io_base", M48t59SysBusState, state.io_base,  0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index fd320cd..57bed09 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1324,8 +1324,8 @@ static Property usb_host_dev_properties[] = {
     DEFINE_PROP_UINT32("hostbus",  USBHostDevice, match.bus_num,    0),
     DEFINE_PROP_UINT32("hostaddr", USBHostDevice, match.addr,       0),
     DEFINE_PROP_STRING("hostport", USBHostDevice, match.port),
-    DEFINE_PROP_HEX32("vendorid",  USBHostDevice, match.vendor_id,  0),
-    DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0),
+    DEFINE_PROP_UINT32("vendorid",  USBHostDevice, match.vendor_id,  0),
+    DEFINE_PROP_UINT32("productid", USBHostDevice, match.product_id, 0),
     DEFINE_PROP_UINT32("isobufs",  USBHostDevice, iso_urb_count,    4),
     DEFINE_PROP_UINT32("isobsize", USBHostDevice, iso_urb_frames,   32),
     DEFINE_PROP_INT32("bootindex", USBHostDevice, bootindex,        -1),
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 30c9f2b..7b91841 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1063,7 +1063,7 @@ static const TypeInfo virtio_pci_info = {
 /* virtio-blk-pci */
 
 static Property virtio_blk_pci_properties[] = {
-    DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
+    DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0),
     DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
@@ -1275,7 +1275,7 @@ static void balloon_pci_stats_set_poll_interval(Object *obj, struct Visitor *v,
 
 static Property virtio_balloon_pci_properties[] = {
     DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
-    DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
+    DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -1376,7 +1376,7 @@ static Property virtio_serial_pci_properties[] = {
     DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
     DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
-    DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
+    DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0),
     DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
     DEFINE_VIRTIO_SERIAL_PROPERTIES(VirtIOSerialPCI, vdev.serial),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/include/hw/qdev-dma.h b/include/hw/qdev-dma.h
index 6812735..8cfb0f3 100644
--- a/include/hw/qdev-dma.h
+++ b/include/hw/qdev-dma.h
@@ -7,4 +7,4 @@
  * See the COPYING file in the top-level directory.
  */
 #define DEFINE_PROP_DMAADDR(_n, _s, _f, _d)                               \
-    DEFINE_PROP_HEX64(_n, _s, _f, _d)
+    DEFINE_PROP_UINT64(_n, _s, _f, _d)
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 4651459..0c0babf 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -12,9 +12,6 @@ extern PropertyInfo qdev_prop_uint16;
 extern PropertyInfo qdev_prop_uint32;
 extern PropertyInfo qdev_prop_int32;
 extern PropertyInfo qdev_prop_uint64;
-extern PropertyInfo qdev_prop_hex8;
-extern PropertyInfo qdev_prop_hex32;
-extern PropertyInfo qdev_prop_hex64;
 extern PropertyInfo qdev_prop_size;
 extern PropertyInfo qdev_prop_string;
 extern PropertyInfo qdev_prop_chr;
@@ -111,12 +108,6 @@ extern PropertyInfo qdev_prop_arraylen;
     DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_int32, int32_t)
 #define DEFINE_PROP_UINT64(_n, _s, _f, _d)                      \
     DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_uint64, uint64_t)
-#define DEFINE_PROP_HEX8(_n, _s, _f, _d)                       \
-    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_hex8, uint8_t)
-#define DEFINE_PROP_HEX32(_n, _s, _f, _d)                       \
-    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_hex32, uint32_t)
-#define DEFINE_PROP_HEX64(_n, _s, _f, _d)                       \
-    DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_hex64, uint64_t)
 #define DEFINE_PROP_SIZE(_n, _s, _f, _d)                       \
     DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_size, uint64_t)
 #define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d)                   \
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 45/49] block: Handle "rechs" and "large" translation options
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (43 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 44/49] qdev: Remove hex8/32/64 property types Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 46/49] qdev: Add enum property types to QAPI schema Andreas Färber
                   ` (4 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Paolo Bonzini, Andreas Färber, Stefan Hajnoczi,
	Anthony Liguori

From: Paolo Bonzini <pbonzini@redhat.com>

Sure, CHS translation is an obscure topic, and legacy options for
hard-disk geometries are obscure as well.  But since QEMU does nothing
with it except telling the BIOS, and since there "large" and "rechs"
are listed in the enums, parsing them seems to be the bare minimum.

Acked-by: Stefan Hajnoczi <stefanha@gmail.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 blockdev.c                |  4 ++++
 hw/core/qdev-properties.c |  8 +++++---
 vl.c                      | 22 ++++++++++++++++------
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 36ceece..d71f815 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -776,6 +776,10 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
             translation = BIOS_ATA_TRANSLATION_NONE;
         } else if (!strcmp(value, "lba")) {
             translation = BIOS_ATA_TRANSLATION_LBA;
+        } else if (!strcmp(value, "large")) {
+            translation = BIOS_ATA_TRANSLATION_LARGE;
+        } else if (!strcmp(value, "rechs")) {
+            translation = BIOS_ATA_TRANSLATION_RECHS;
         } else if (!strcmp(value, "auto")) {
             translation = BIOS_ATA_TRANSLATION_AUTO;
         } else {
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 2c3a756..76a0c4d 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -469,9 +469,11 @@ PropertyInfo qdev_prop_losttickpolicy = {
 /* --- BIOS CHS translation */
 
 static const char *bios_chs_trans_table[] = {
-    [BIOS_ATA_TRANSLATION_AUTO] = "auto",
-    [BIOS_ATA_TRANSLATION_NONE] = "none",
-    [BIOS_ATA_TRANSLATION_LBA]  = "lba",
+    [BIOS_ATA_TRANSLATION_AUTO]  = "auto",
+    [BIOS_ATA_TRANSLATION_NONE]  = "none",
+    [BIOS_ATA_TRANSLATION_LBA]   = "lba",
+    [BIOS_ATA_TRANSLATION_LARGE] = "large",
+    [BIOS_ATA_TRANSLATION_RECHS] = "rechs",
 };
 
 PropertyInfo qdev_prop_bios_chs_trans = {
diff --git a/vl.c b/vl.c
index 0f7d31f..071372d 100644
--- a/vl.c
+++ b/vl.c
@@ -3073,14 +3073,19 @@ int main(int argc, char **argv, char **envp)
                         goto chs_fail;
                     if (*p == ',') {
                         p++;
-                        if (!strcmp(p, "none"))
+                        if (!strcmp(p, "large")) {
+                            translation = BIOS_ATA_TRANSLATION_LARGE;
+                        } else if (!strcmp(p, "rechs")) {
+                            translation = BIOS_ATA_TRANSLATION_RECHS;
+                        } else if (!strcmp(p, "none")) {
                             translation = BIOS_ATA_TRANSLATION_NONE;
-                        else if (!strcmp(p, "lba"))
+                        } else if (!strcmp(p, "lba")) {
                             translation = BIOS_ATA_TRANSLATION_LBA;
-                        else if (!strcmp(p, "auto"))
+                        } else if (!strcmp(p, "auto")) {
                             translation = BIOS_ATA_TRANSLATION_AUTO;
-                        else
+                        } else {
                             goto chs_fail;
+                        }
                     } else if (*p != '\0') {
                     chs_fail:
                         fprintf(stderr, "qemu: invalid physical CHS format\n");
@@ -3094,10 +3099,15 @@ int main(int argc, char **argv, char **envp)
                         qemu_opt_set(hda_opts, "heads", num);
                         snprintf(num, sizeof(num), "%d", secs);
                         qemu_opt_set(hda_opts, "secs", num);
-                        if (translation == BIOS_ATA_TRANSLATION_LBA)
+                        if (translation == BIOS_ATA_TRANSLATION_LARGE) {
+                            qemu_opt_set(hda_opts, "trans", "large");
+                        } else if (translation == BIOS_ATA_TRANSLATION_RECHS) {
+                            qemu_opt_set(hda_opts, "trans", "rechs");
+                        } else if (translation == BIOS_ATA_TRANSLATION_LBA) {
                             qemu_opt_set(hda_opts, "trans", "lba");
-                        if (translation == BIOS_ATA_TRANSLATION_NONE)
+                        } else if (translation == BIOS_ATA_TRANSLATION_NONE) {
                             qemu_opt_set(hda_opts, "trans", "none");
+                        }
                     }
                 }
                 break;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 46/49] qdev: Add enum property types to QAPI schema
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (44 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 45/49] block: Handle "rechs" and "large" translation options Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:30   ` Eric Blake
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 47/49] qdev: Use QAPI type names for properties Andreas Färber
                   ` (3 subsequent siblings)
  49 siblings, 1 reply; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Markus Armbruster, Luiz Capitulino,
	Anthony Liguori, Paolo Bonzini, Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev-properties.c | 20 +++-------------
 hw/i386/kvm/i8254.c       |  6 ++---
 hw/timer/mc146818rtc.c    | 14 ++++++------
 include/hw/block/block.h  |  6 -----
 include/qemu-common.h     |  8 -------
 qapi-schema.json          | 58 +++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 71 insertions(+), 41 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 76a0c4d..0a2ca05 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -449,36 +449,22 @@ PropertyInfo qdev_prop_macaddr = {
 
 /* --- lost tick policy --- */
 
-static const char *lost_tick_policy_table[LOST_TICK_MAX+1] = {
-    [LOST_TICK_DISCARD] = "discard",
-    [LOST_TICK_DELAY] = "delay",
-    [LOST_TICK_MERGE] = "merge",
-    [LOST_TICK_SLEW] = "slew",
-    [LOST_TICK_MAX] = NULL,
-};
-
 QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) != sizeof(int));
 
 PropertyInfo qdev_prop_losttickpolicy = {
     .name  = "LostTickPolicy",
-    .enum_table  = lost_tick_policy_table,
+    .enum_table  = LostTickPolicy_lookup,
     .get   = get_enum,
     .set   = set_enum,
 };
 
 /* --- BIOS CHS translation */
 
-static const char *bios_chs_trans_table[] = {
-    [BIOS_ATA_TRANSLATION_AUTO]  = "auto",
-    [BIOS_ATA_TRANSLATION_NONE]  = "none",
-    [BIOS_ATA_TRANSLATION_LBA]   = "lba",
-    [BIOS_ATA_TRANSLATION_LARGE] = "large",
-    [BIOS_ATA_TRANSLATION_RECHS] = "rechs",
-};
+QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));
 
 PropertyInfo qdev_prop_bios_chs_trans = {
     .name = "bios-chs-trans",
-    .enum_table = bios_chs_trans_table,
+    .enum_table = BiosAtaTranslation_lookup,
     .get = get_enum,
     .set = set_enum,
 };
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index f8f3021..59373aa 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -268,9 +268,9 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
         return;
     }
     switch (s->lost_tick_policy) {
-    case LOST_TICK_DELAY:
+    case LOST_TICK_POLICY_DELAY:
         break; /* enabled by default */
-    case LOST_TICK_DISCARD:
+    case LOST_TICK_POLICY_DISCARD:
         if (kvm_check_extension(kvm_state, KVM_CAP_REINJECT_CONTROL)) {
             struct kvm_reinject_control control = { .pit_reinject = 0 };
 
@@ -300,7 +300,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
 static Property kvm_pit_properties[] = {
     DEFINE_PROP_UINT32("iobase", PITCommonState, iobase,  -1),
     DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", KVMPITState,
-                               lost_tick_policy, LOST_TICK_DELAY),
+                               lost_tick_policy, LOST_TICK_POLICY_DELAY),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 6fb124f..8509309 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -185,7 +185,7 @@ static void rtc_periodic_timer(void *opaque)
     if (s->cmos_data[RTC_REG_B] & REG_B_PIE) {
         s->cmos_data[RTC_REG_C] |= REG_C_IRQF;
 #ifdef TARGET_I386
-        if (s->lost_tick_policy == LOST_TICK_SLEW) {
+        if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) {
             if (s->irq_reinject_on_ack_count >= RTC_REINJECT_ON_ACK_COUNT)
                 s->irq_reinject_on_ack_count = 0;		
             apic_reset_irq_delivered();
@@ -708,7 +708,7 @@ static int rtc_post_load(void *opaque, int version_id)
 
 #ifdef TARGET_I386
     if (version_id >= 2) {
-        if (s->lost_tick_policy == LOST_TICK_SLEW) {
+        if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) {
             rtc_coalesced_timer_update(s);
         }
     }
@@ -749,7 +749,7 @@ static void rtc_notify_clock_reset(Notifier *notifier, void *data)
     periodic_timer_update(s, now);
     check_update_timer(s);
 #ifdef TARGET_I386
-    if (s->lost_tick_policy == LOST_TICK_SLEW) {
+    if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) {
         rtc_coalesced_timer_update(s);
     }
 #endif
@@ -774,7 +774,7 @@ static void rtc_reset(void *opaque)
     qemu_irq_lower(s->irq);
 
 #ifdef TARGET_I386
-    if (s->lost_tick_policy == LOST_TICK_SLEW) {
+    if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) {
         s->irq_coalesced = 0;
     }
 #endif
@@ -835,11 +835,11 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
 
 #ifdef TARGET_I386
     switch (s->lost_tick_policy) {
-    case LOST_TICK_SLEW:
+    case LOST_TICK_POLICY_SLEW:
         s->coalesced_timer =
             timer_new_ns(rtc_clock, rtc_coalesced_timer, s);
         break;
-    case LOST_TICK_DISCARD:
+    case LOST_TICK_POLICY_DISCARD:
         break;
     default:
         error_setg(errp, "Invalid lost tick policy.");
@@ -890,7 +890,7 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
 static Property mc146818rtc_properties[] = {
     DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980),
     DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
-                               lost_tick_policy, LOST_TICK_DISCARD),
+                               lost_tick_policy, LOST_TICK_POLICY_DISCARD),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/include/hw/block/block.h b/include/hw/block/block.h
index dd11532..7c3d6c8 100644
--- a/include/hw/block/block.h
+++ b/include/hw/block/block.h
@@ -65,12 +65,6 @@ int blkconf_geometry(BlockConf *conf, int *trans,
 
 /* Hard disk geometry */
 
-#define BIOS_ATA_TRANSLATION_AUTO   0
-#define BIOS_ATA_TRANSLATION_NONE   1
-#define BIOS_ATA_TRANSLATION_LBA    2
-#define BIOS_ATA_TRANSLATION_LARGE  3
-#define BIOS_ATA_TRANSLATION_RECHS  4
-
 void hd_geometry_guess(BlockDriverState *bs,
                        uint32_t *pcyls, uint32_t *pheads, uint32_t *psecs,
                        int *ptrans);
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 5054836..b0e34b2 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -261,14 +261,6 @@ typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size)
 
 typedef uint64_t pcibus_t;
 
-typedef enum LostTickPolicy {
-    LOST_TICK_DISCARD,
-    LOST_TICK_DELAY,
-    LOST_TICK_MERGE,
-    LOST_TICK_SLEW,
-    LOST_TICK_MAX
-} LostTickPolicy;
-
 typedef struct PCIHostDeviceAddress {
     unsigned int domain;
     unsigned int bus;
diff --git a/qapi-schema.json b/qapi-schema.json
index 7cfb5e5..2d64ce6 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -28,7 +28,65 @@
   'data': [ 'GenericError', 'CommandNotFound', 'DeviceEncrypted',
             'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
 
+
+##
+# LostTickPolicy:
+#
+# Policy for handling lost ticks in timer devices.
+#
+# @discard: throw away the missed tick(s) and continue with future injection
+#           normally.  Guest time may be delayed, unless the OS has explicit
+#           handling of lost ticks
+#
+# @delay: continue to deliver ticks at the normal rate.  Guest time will be
+#         delayed due to the late tick
+#
+# @merge: merge the missed tick(s) into one tick and inject.  Guest time
+#         may be delayed, depending on how the OS reacts to the merging
+#         of ticks
+#
+# @slew: deliver ticks at a higher rate to catch up with the missed tick. The
+#        guest time should not be delayed once catchup is complete.
+#
+# Since: 2.0
+##
+{ 'enum': 'LostTickPolicy',
+  'data': ['discard', 'delay', 'merge', 'slew' ] }
+
 ##
+# BiosAtaTranslation:
+#
+# Policy that BIOS should use to interpret cylinder/head/sector
+# addresses.  Note that Bochs BIOS and SeaBIOS will not actually
+# translate logical CHS to physical; instead, they will use logical
+# block addressing.
+#
+# @auto: If cylinder/heads/sizes are passed, choose between none and LBA
+#        depending on the size of the disk.  If they are not passed,
+#        choose none if QEMU can guess that the disk had 16 or fewer
+#        heads, large if QEMU can guess that the disk had 131072 or
+#        fewer tracks across all heads (i.e. cylinders*heads<131072),
+#        otherwise LBA.
+#
+# @none: The physical disk geometry is equal to the logical geometry.
+#
+# @lba: Assume 63 sectors per track and one of 16, 32, 64, 128 or 255
+#       heads (if fewer than 255 are enough to cover the whole disk
+#       with 1024 cylinders/head).  The number of cylinders/head is
+#       then computed based on the number of sectors and heads.
+#
+# @large: The number of cylinders per head is scaled down to 1024
+#         by correspondingly scaling up the number of heads.
+#
+# @rechs: Same as @large, but first convert a 16-head geometry to
+#         15-head, by proportionally scaling up the number of
+#         cylinders/head.
+#
+# Since: 2.0
+##
+{ 'enum': 'BiosAtaTranslation',
+  'data': ['auto', 'none', 'lba', 'large', 'rechs']}
+
 # @add_client
 #
 # Allow client connections for VNC, Spice and socket based
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 47/49] qdev: Use QAPI type names for properties
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (45 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 46/49] qdev: Add enum property types to QAPI schema Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 48/49] qapi: Refine human printing of sizes Andreas Färber
                   ` (2 subsequent siblings)
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber

From: Paolo Bonzini <pbonzini@redhat.com>

Use "drive", "chr", etc. only for legacy_name (which shows up
in -device foo,? output).

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev-properties-system.c | 12 ++++++++----
 hw/core/qdev-properties.c        | 18 +++++++++++-------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 3f29b49..5f5957e 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -109,7 +109,8 @@ static void set_drive(Object *obj, Visitor *v, void *opaque,
 }
 
 PropertyInfo qdev_prop_drive = {
-    .name  = "drive",
+    .name  = "str",
+    .legacy_name  = "drive",
     .get   = get_drive,
     .set   = set_drive,
     .release = release_drive,
@@ -164,7 +165,8 @@ static void set_chr(Object *obj, Visitor *v, void *opaque,
 }
 
 PropertyInfo qdev_prop_chr = {
-    .name  = "chr",
+    .name  = "str",
+    .legacy_name  = "chr",
     .get   = get_chr,
     .set   = set_chr,
     .release = release_chr,
@@ -242,7 +244,8 @@ static void set_netdev(Object *obj, Visitor *v, void *opaque,
 }
 
 PropertyInfo qdev_prop_netdev = {
-    .name  = "netdev",
+    .name  = "str",
+    .legacy_name  = "netdev",
     .get   = get_netdev,
     .set   = set_netdev,
 };
@@ -321,7 +324,8 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
 }
 
 PropertyInfo qdev_prop_vlan = {
-    .name  = "vlan",
+    .name  = "int32",
+    .legacy_name  = "vlan",
     .print = print_vlan,
     .get   = get_vlan,
     .set   = set_vlan,
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 0a2ca05..77d0c66 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -107,7 +107,7 @@ static void prop_set_bit(Object *obj, Visitor *v, void *opaque,
 }
 
 PropertyInfo qdev_prop_bit = {
-    .name  = "boolean",
+    .name  = "bool",
     .legacy_name  = "on/off",
     .get   = prop_get_bit,
     .set   = prop_set_bit,
@@ -141,7 +141,7 @@ static void set_bool(Object *obj, Visitor *v, void *opaque,
 }
 
 PropertyInfo qdev_prop_bool = {
-    .name  = "boolean",
+    .name  = "bool",
     .get   = get_bool,
     .set   = set_bool,
 };
@@ -358,7 +358,7 @@ static void set_string(Object *obj, Visitor *v, void *opaque,
 }
 
 PropertyInfo qdev_prop_string = {
-    .name  = "string",
+    .name  = "str",
     .release = release_string,
     .get   = get_string,
     .set   = set_string,
@@ -442,7 +442,8 @@ inval:
 }
 
 PropertyInfo qdev_prop_macaddr = {
-    .name  = "macaddr",
+    .name  = "str",
+    .legacy_name  = "macaddr",
     .get   = get_mac,
     .set   = set_mac,
 };
@@ -463,7 +464,8 @@ PropertyInfo qdev_prop_losttickpolicy = {
 QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));
 
 PropertyInfo qdev_prop_bios_chs_trans = {
-    .name = "bios-chs-trans",
+    .name = "BiosAtaTranslation",
+    .legacy_name = "bios-chs-trans",
     .enum_table = BiosAtaTranslation_lookup,
     .get = get_enum,
     .set = set_enum,
@@ -582,7 +584,8 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
 }
 
 PropertyInfo qdev_prop_blocksize = {
-    .name  = "blocksize",
+    .name  = "uint16",
+    .legacy_name  = "blocksize",
     .get   = get_uint16,
     .set   = set_blocksize,
 };
@@ -689,7 +692,8 @@ inval:
 }
 
 PropertyInfo qdev_prop_pci_host_devaddr = {
-    .name = "pci-host-devaddr",
+    .name = "str",
+    .legacy_name = "pci-host-devaddr",
     .get = get_pci_host_devaddr,
     .set = set_pci_host_devaddr,
 };
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 48/49] qapi: Refine human printing of sizes
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (46 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 47/49] qdev: Use QAPI type names for properties Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 49/49] qtest: Include system headers before user headers Andreas Färber
  2014-02-20 15:02 ` [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Peter Maydell
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Roth, Paolo Bonzini, Andreas Färber, Luiz Capitulino

From: Paolo Bonzini <pbonzini@redhat.com>

This fixes several bugs or shortcomings of the previous pretty-printer.
In particular:

* use PRIu64 instead of casting to long long

* the exact value is included too

* the correct unit of measure (MiB, GiB, etc.) is used.  PiB and EiB
are added too.

* due to an off-by-one error, 512*2^30 was printed as 0.500MiB rather than
512MiB.  floor(log2(val)) is equal to 63 - clz(val), while the code used 64.

* The desired specification is %g rather than %f, which always uses three
decimals in the current code.  However %g would switch to scientific
notation when the integer part is >= 1000 (e.g. 1000*2^30).  To keep the
code simple, switch to the higher power when the integer part is >= 1000;
overflow is avoided by using frexp instead of clz.

Suggested-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 qapi/string-output-visitor.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c
index 67a8798..fb1d2e8 100644
--- a/qapi/string-output-visitor.c
+++ b/qapi/string-output-visitor.c
@@ -15,6 +15,7 @@
 #include "qapi/visitor-impl.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/host-utils.h"
+#include <math.h>
 
 struct StringOutputVisitor
 {
@@ -47,30 +48,30 @@ static void print_type_size(Visitor *v, uint64_t *obj, const char *name,
                            Error **errp)
 {
     StringOutputVisitor *sov = DO_UPCAST(StringOutputVisitor, visitor, v);
-    static const char suffixes[] = { 'B', 'K', 'M', 'G', 'T' };
+    static const char suffixes[] = { 'B', 'K', 'M', 'G', 'T', 'P', 'E' };
     uint64_t div, val;
     char *out;
     int i;
 
     if (!sov->human) {
-        out = g_strdup_printf("%llu", (long long) *obj);
+        out = g_strdup_printf("%"PRIu64, *obj);
         string_output_set(sov, out);
         return;
     }
 
     val = *obj;
 
-    /* Compute floor(log2(val)).  */
-    i = 64 - clz64(val);
-
-    /* Find the power of 1024 that we'll display as the units.  */
-    i /= 10;
-    if (i >= ARRAY_SIZE(suffixes)) {
-        i = ARRAY_SIZE(suffixes) - 1;
-    }
+    /* The exponent (returned in i) minus one gives us
+     * floor(log2(val * 1024 / 1000).  The correction makes us
+     * switch to the higher power when the integer part is >= 1000.
+     */
+    frexp(val / (1000.0 / 1024.0), &i);
+    i = (i - 1) / 10;
+    assert(i < ARRAY_SIZE(suffixes));
     div = 1ULL << (i * 10);
 
-    out = g_strdup_printf("%0.03f%c", (double)val/div, suffixes[i]);
+    out = g_strdup_printf("%"PRIu64" (%0.3g %c%s)", val,
+                          (double)val/div, suffixes[i], i ? "iB" : "");
     string_output_set(sov, out);
 }
 
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PULL v2 49/49] qtest: Include system headers before user headers
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (47 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 48/49] qapi: Refine human printing of sizes Andreas Färber
@ 2014-02-17 22:24 ` Andreas Färber
  2014-02-20 15:02 ` [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Peter Maydell
  49 siblings, 0 replies; 53+ messages in thread
From: Andreas Färber @ 2014-02-17 22:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, Stefan Hajnoczi

From: Stefan Hajnoczi <stefanha@redhat.com>

It is dangerous to include user headers before system headers since user
macros can affect system headers.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/endianness-test.c |  2 +-
 tests/fw_cfg-test.c     |  7 +++----
 tests/i440fx-test.c     | 11 +++++------
 tests/m48t59-test.c     |  3 ++-
 tests/qom-test.c        |  3 ++-
 tests/rtc-test.c        |  5 +++--
 tests/tmp105-test.c     |  5 +++--
 7 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/tests/endianness-test.c b/tests/endianness-test.c
index 646df7d..92e17d2 100644
--- a/tests/endianness-test.c
+++ b/tests/endianness-test.c
@@ -10,7 +10,6 @@
  * See the COPYING file in the top-level directory.
  *
  */
-#include "libqtest.h"
 
 #include <glib.h>
 #include <stdio.h>
@@ -18,6 +17,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "libqtest.h"
 #include "qemu/bswap.h"
 
 typedef struct TestCase TestCase;
diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index e4f355c..5c8f8d6 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -10,15 +10,14 @@
  * See the COPYING file in the top-level directory.
  */
 
-#define NO_QEMU_PROTOS
+#include <string.h>
+#include <glib.h>
 
 #include "libqtest.h"
+#define NO_QEMU_PROTOS
 #include "hw/nvram/fw_cfg.h"
 #include "libqos/fw_cfg.h"
 
-#include <string.h>
-#include <glib.h>
-
 static uint64_t ram_size = 128 << 20;
 static uint16_t nb_cpus = 1;
 static uint16_t max_cpus = 1;
diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c
index fa3e3d6..e398b83 100644
--- a/tests/i440fx-test.c
+++ b/tests/i440fx-test.c
@@ -12,12 +12,6 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include "libqos/pci.h"
-#include "libqos/pci-pc.h"
-#include "libqtest.h"
-
-#include "hw/pci/pci_regs.h"
-
 #include <glib.h>
 #include <string.h>
 #include <stdio.h>
@@ -26,6 +20,11 @@
 #include <sys/mman.h>
 #include <stdlib.h>
 
+#include "libqtest.h"
+#include "libqos/pci.h"
+#include "libqos/pci-pc.h"
+#include "hw/pci/pci_regs.h"
+
 #define BROKEN 1
 
 #define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
diff --git a/tests/m48t59-test.c b/tests/m48t59-test.c
index 6abc4c8..71b4f28 100644
--- a/tests/m48t59-test.c
+++ b/tests/m48t59-test.c
@@ -11,7 +11,6 @@
  * See the COPYING file in the top-level directory.
  *
  */
-#include "libqtest.h"
 
 #include <glib.h>
 #include <stdio.h>
@@ -19,6 +18,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "libqtest.h"
+
 #define RTC_SECONDS             0x9
 #define RTC_MINUTES             0xa
 #define RTC_HOURS               0xb
diff --git a/tests/qom-test.c b/tests/qom-test.c
index 3316a11..b6671fb 100644
--- a/tests/qom-test.c
+++ b/tests/qom-test.c
@@ -6,10 +6,11 @@
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
  * See the COPYING file in the top-level directory.
  */
-#include "libqtest.h"
 
 #include <glib.h>
 #include <string.h>
+
+#include "libqtest.h"
 #include "qemu/osdep.h"
 #include "qapi/qmp/types.h"
 
diff --git a/tests/rtc-test.c b/tests/rtc-test.c
index f1b123f..4243624 100644
--- a/tests/rtc-test.c
+++ b/tests/rtc-test.c
@@ -10,8 +10,6 @@
  * See the COPYING file in the top-level directory.
  *
  */
-#include "libqtest.h"
-#include "hw/timer/mc146818rtc_regs.h"
 
 #include <glib.h>
 #include <stdio.h>
@@ -19,6 +17,9 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "libqtest.h"
+#include "hw/timer/mc146818rtc_regs.h"
+
 static uint8_t base = 0x70;
 
 static int bcd2dec(int value)
diff --git a/tests/tmp105-test.c b/tests/tmp105-test.c
index 5ac48e2..0834219 100644
--- a/tests/tmp105-test.c
+++ b/tests/tmp105-test.c
@@ -6,12 +6,13 @@
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
  * See the COPYING file in the top-level directory.
  */
+
+#include <glib.h>
+
 #include "libqtest.h"
 #include "libqos/i2c.h"
 #include "hw/misc/tmp105_regs.h"
 
-#include <glib.h>
-
 #define OMAP2_I2C_1_BASE 0x48070000
 
 #define N8X0_ADDR 0x48
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PULL v2 46/49] qdev: Add enum property types to QAPI schema
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 46/49] qdev: Add enum property types to QAPI schema Andreas Färber
@ 2014-02-17 22:30   ` Eric Blake
  2014-02-18  8:05     ` Paolo Bonzini
  0 siblings, 1 reply; 53+ messages in thread
From: Eric Blake @ 2014-02-17 22:30 UTC (permalink / raw)
  To: Andreas Färber, qemu-devel
  Cc: Paolo Bonzini, Luiz Capitulino, Markus Armbruster,
	Anthony Liguori, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

On 02/17/2014 03:24 PM, Andreas Färber wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---

> +++ b/qapi-schema.json
> @@ -28,7 +28,65 @@
>    'data': [ 'GenericError', 'CommandNotFound', 'DeviceEncrypted',
>              'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
>  
> +
> +##
> +# LostTickPolicy:

...

> +
>  ##
> +# BiosAtaTranslation:
> +#

...

> +
>  # @add_client

Oops - we lost the ## header before add_client.  Sounds like a followup
patch might be called for, unless you are okay tweaking the pull request.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PULL v2 46/49] qdev: Add enum property types to QAPI schema
  2014-02-17 22:30   ` Eric Blake
@ 2014-02-18  8:05     ` Paolo Bonzini
  0 siblings, 0 replies; 53+ messages in thread
From: Paolo Bonzini @ 2014-02-18  8:05 UTC (permalink / raw)
  To: Eric Blake, Andreas Färber, qemu-devel
  Cc: Michael S. Tsirkin, Markus Armbruster, Anthony Liguori, Luiz Capitulino

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 17/02/2014 23:30, Eric Blake ha scritto:
| Oops - we lost the ## header before add_client.  Sounds like a
| followup patch might be called for, unless you are okay tweaking
| the pull request.

Yeah, I can do that with qemu-trivial.

Paolo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTAxRgAAoJEBvWZb6bTYby+0kP/jo/84UmFlN6zJssfed++kkm
tffNBa2Aom2oWiPiUv80J8sstiL7QRI44szHrnj9IVew8q/iSuIjHKQSvG9NvdE+
zEB1XKqcm4dlXOpVZ+Jq4w9g2K7BLmtoEJY75oZEE/u8731EI1IMVqmzGJ1dBYsh
/XDS9drIsHfZvDNcqTtRdY7ZhFP4QZo/UrDcX4vHx8ak6QcGWllfTn8sUGmkV3rS
p643v54WCwE+ZhTtfWEHwhTU7c0tUZzr+UxGXZ6bumJ7CXCdgeZltYkqxUc/qOlb
Fg9HEZiFaDxGDtI2IzJu4G2Y67j7twM8h/USSkx1lUqaQNQ2wC7nLDZ3GsnkY8XY
450DfVKfBAN7bAFf8jVT+h2D/AgfX1qYsKrozgOGppxQRmIhU0QlPFm/1/V9paCX
0Nje6oG+89XMUl3KKstyXzKiKGQSnETu2iyVMpeLcQyDUZWdst0c7yh4yME3giIH
sS8354qcdOs2VYE02z7ceRU7M3vwv6sfuGyrN15oeFI/x42CTCseH2B8Unvn815F
Da/hHNqNy58PTgVbMybz/sxYRBKBl8euTvQuxjLyg+2SvOJUtvK040lRuVk9YwTO
Q0RmnVU5bXkO8A27l34zccnekLAbIJVgJKLVzB9tpGdONNLsUuXXwgtfP2Kw+IVI
I0fyhNi64xs6LCER/QI6
=FzxL
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17
  2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
                   ` (48 preceding siblings ...)
  2014-02-17 22:24 ` [Qemu-devel] [PULL v2 49/49] qtest: Include system headers before user headers Andreas Färber
@ 2014-02-20 15:02 ` Peter Maydell
  49 siblings, 0 replies; 53+ messages in thread
From: Peter Maydell @ 2014-02-20 15:02 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Anthony Liguori, Markus Armbruster, Mark Cave-Ayland,
	Alexander Graf, QEMU Developers, Stefan Hajnoczi, Paolo Bonzini

On 17 February 2014 22:24, Andreas Färber <afaerber@suse.de> wrote:
> Hello Peter,
>
> This is my QOM (devices) patch queue. Please pull.
>
> v2 is rebased to fix a merge conflict, fixes some gcov warnings and
> adds 2 Acked-bys and 2 qtest patches.
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2014-02-20 15:03 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17 22:24 [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 01/49] qtest: don't report signals if qtest driver enabled Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 02/49] ppcemb-softmmu: Drop Mac and e500 emulation Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 03/49] target-ppc: Make ppc40x CPUs available in ppcemb Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 04/49] tests: Fix gcov paths for relocated device sources Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 05/49] qom-test: Run for all available machines Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 06/49] qom-test: Test shutdown in addition to startup Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 07/49] tests: Run qom-test for every architecture Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 08/49] nand: Don't use qdev_create() in nand_init() Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 09/49] i2c: Rename i2c_bus to I2CBus Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 10/49] pxa2xx: QOM'ify I2C slave Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 11/49] tosa: QOM'ify DAC Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 12/49] z2: QOM'ify AER915 Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 13/49] wm8750: QOM'ify Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 14/49] ssd0303: QOM'ify Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 15/49] max7310: QOM'ify Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 16/49] lm832x: QOM'ify Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 17/49] ds1338: QOM'ify Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 18/49] twl92230: QOM'ify Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 19/49] i2c: Drop FROM_I2C_SLAVE() macro Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 20/49] tests: Add e1000 qtest Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 21/49] tests: Add vmxnet3 qtest Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 22/49] tests: Add rtl8139 qtest Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 23/49] tests: Add pcnet qtest Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 24/49] tests: Add eepro100 qtest Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 25/49] tests: Add ne2000 qtest Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 26/49] tests: Add virtio-net qtest Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 27/49] tests: Add tpci200 qtest Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 28/49] tests: Add ipoctal232 qtest Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 29/49] ipack: Convert to QOM realize Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 30/49] ipack: QOM parent field cleanup for IPackBus Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 31/49] ipack: QOM parent field cleanup for IPackDevice Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 32/49] ipoctal232: QOM parent field cleanup Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 33/49] ipack: Move IndustryPack out of hw/char/ Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 34/49] qtest: Don't segfault with invalid -qtest option Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 35/49] qapi: Add size parser to StringInputVisitor Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 36/49] qdev: Sizes are now parsed by StringInputVisitor Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 37/49] qdev: Remove legacy parsers for hex8/32/64 Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 38/49] qdev: Legacy properties are now read-only Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 39/49] qdev: Legacy properties are just strings Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 40/49] qdev: Inline qdev_prop_parse() Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 41/49] qapi: Add human mode to StringOutputVisitor Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 42/49] qdev: Use human mode in "info qtree" Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 43/49] qdev: Remove most legacy printers Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 44/49] qdev: Remove hex8/32/64 property types Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 45/49] block: Handle "rechs" and "large" translation options Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 46/49] qdev: Add enum property types to QAPI schema Andreas Färber
2014-02-17 22:30   ` Eric Blake
2014-02-18  8:05     ` Paolo Bonzini
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 47/49] qdev: Use QAPI type names for properties Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 48/49] qapi: Refine human printing of sizes Andreas Färber
2014-02-17 22:24 ` [Qemu-devel] [PULL v2 49/49] qtest: Include system headers before user headers Andreas Färber
2014-02-20 15:02 ` [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.