Skip to contentSkip to conversation

hw/qdev: Warn when using pre-qdev/QOM devices

RFC PATCH Superseded Philippe Mathieu-Daudé 5 participants 55 messages Jun 8, 2020 – Jun 9, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover hw/qdev: Warn when using pre-qdev/QOM devices

Based on today's IRC chat, this is a trivial RFC series to anotate pre-qdev/QOM devices so developers using them without knowing they are not QOM'ified yet can realize it and convert them if they have time.

qdev/QOM devices are introspectable, so easier to test or even fuzz.

Philippe Mathieu-Daudé (35):
qom/object: Update documentation
hw/core/qdev: Add qdev_warn_deprecated_function_used() helper hw/arm/omap: Emit warning when old code is used hw/arm/pxa2xx: Emit warning when old code is used hw/arm/nseries: Emit warning when old code is used hw/timer/arm_timer: Emit warning when old code is used hw/char/parallel: Emit warning when old code is used hw/display/blizzard: Emit warning when old code is used hw/display/ramfb: Emit warning when old code is used hw/display/tc6393xb: Emit warning when old code is used hw/display/vga-isa-mm: Emit warning when old code is used hw/dma/etraxfs_dma: Emit warning when old code is used hw/dma/soc_dma: Emit warning when old code is used hw/i386/pc: Emit warning when old code is used hw/i386/xen/xen-hvm: Emit warning when old code is used hw/input/lasips2: Emit warning when old code is used hw/input/pckbd: Emit warning when old code is used hw/input/ps2: Emit warning when old code is used hw/input/tsc2005: Emit warning when old code is used hw/intc/i8259: Emit warning when old code is used hw/lm32/lm32_hwsetup: Emit warning when old code is used hw/m68k/mcf520x: Emit warning when old code is used hw/misc/applesmc: Emit warning when old code is used hw/misc/cbus: Emit warning when old code is used hw/nvram/eeprom93xx: Emit warning when old code is used hw/openrisc/cputimer: Emit warning when old code is used hw/ppc/ppc: Emit warning when old code is used hw/ppc/ppc4xx: Emit warning when old code is used hw/ppc/ppc_booke: Emit warning when old code is used hw/ppc/virtex_ml507: Emit warning when old code is used hw/sh4: Emit warning when old code is used hw/riscv: Emit warning when old code is used hw/timer/slavio_timer: Emit warning when old code is used hw/usb/hcd-musb: Emit warning when old code is used hw/xtensa/xtfpga: Emit warning when old code is used

 configure                    |  8 ++++++++
 hw/lm32/lm32_hwsetup.h       |  3 +++
 include/hw/qdev-deprecated.h | 26 ++++++++++++++++++++++++++
 include/qom/object.h         |  6 +++---
 hw/arm/nseries.c             |  2 ++
 hw/arm/omap1.c               |  6 ++++++
 hw/arm/pxa2xx.c              |  3 +++
 hw/char/omap_uart.c          |  5 +++++
 hw/char/parallel.c           |  3 +++
 hw/char/sh_serial.c          |  3 +++
 hw/core/qdev.c               |  8 ++++++++
 hw/display/blizzard.c        |  3 +++
 hw/display/pxa2xx_lcd.c      |  3 +++
 hw/display/ramfb.c           |  3 +++
 hw/display/tc6393xb.c        |  3 +++
 hw/display/vga-isa-mm.c      |  5 +++++
 hw/display/vga.c             |  3 +++
 hw/dma/etraxfs_dma.c         |  4 +++-
 hw/dma/soc_dma.c             |  3 +++
 hw/i386/pc.c                 |  3 +++
 hw/i386/xen/xen-hvm.c        |  4 +++-
 hw/input/lasips2.c           |  4 +++-
 hw/input/pckbd.c             |  4 +++-
 hw/input/ps2.c               |  6 +++++-
 hw/input/pxa2xx_keypad.c     |  3 +++
 hw/input/tsc2005.c           |  3 +++
 hw/intc/i8259.c              |  3 +++
 hw/intc/sh_intc.c            |  3 +++
 hw/m68k/mcf5206.c            |  5 +++++
 hw/m68k/mcf5208.c            |  3 +++
 hw/misc/applesmc.c           |  3 +++
 hw/misc/cbus.c               |  3 +++
 hw/misc/omap_gpmc.c          |  3 +++
 hw/misc/omap_l4.c            |  3 +++
 hw/misc/omap_sdrc.c          |  3 +++
 hw/nvram/eeprom93xx.c        |  3 +++
 hw/openrisc/cputimer.c       |  3 +++
 hw/ppc/ppc.c                 |  3 +++
 hw/ppc/ppc405_boards.c       |  5 +++++
 hw/ppc/ppc405_uc.c           | 21 +++++++++++++++++++++
 hw/ppc/ppc4xx_devs.c         |  7 +++++++
 hw/ppc/ppc_booke.c           |  4 +++-
 hw/ppc/virtex_ml507.c        |  4 +++-
 hw/riscv/riscv_htif.c        |  4 ++++
 hw/riscv/sifive_uart.c       |  4 ++++
 hw/sd/omap_mmc.c             |  5 +++++
 hw/sh4/r2d.c                 |  3 +++
 hw/sh4/sh7750.c              |  4 ++++
 hw/ssi/omap_spi.c            |  3 +++
 hw/timer/arm_timer.c         |  3 +++
 hw/timer/omap_synctimer.c    |  4 ++++
 hw/timer/sh_timer.c          |  5 +++++
 hw/timer/slavio_timer.c      |  3 +++
 hw/usb/hcd-musb.c            |  3 +++
 hw/xtensa/xtfpga.c           |  3 +++
 55 files changed, 240 insertions(+), 10 deletions(-)
 create mode 100644 include/hw/qdev-deprecated.h
Signature · 1 line
2.21.3
#1 lore raw

RFC PATCH 1/35 qom/object: Update documentation

The documentation was introduced in 2f28d2ff9dc, then 0d09e41a51 and a27bd6c77 moved the headers around. Update the comment.

---
 include/qom/object.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/qom/object.h +3 -3
index fd453dc8d6..eb560bf32f 100644
@@ -45,7 +45,7 @@ typedef struct InterfaceInfo InterfaceInfo;
  * <example>
  *   <title>Creating a minimal type</title>
  *   <programlisting>
- * #include "qdev.h"
+ * #include "hw/qdev-core.h"
  *
  * #define TYPE_MY_DEVICE "my-device"
  *
@@ -146,7 +146,7 @@ typedef struct InterfaceInfo InterfaceInfo;
  * <example>
  *   <title>Overriding a virtual function</title>
  *   <programlisting>
- * #include "qdev.h"
+ * #include "hw/qdev-core.h"
  *
  * void my_device_class_init(ObjectClass *klass, void *class_data)
  * {
@@ -170,7 +170,7 @@ typedef struct InterfaceInfo InterfaceInfo;
  * <example>
  *   <title>Defining an abstract class</title>
  *   <programlisting>
- * #include "qdev.h"
+ * #include "hw/qdev-core.h"
  *
  * typedef struct MyDeviceClass
  * {
Signature · 1 line
2.21.3
#2 lore raw

RFC PATCH 2/35 hw/core/qdev: Add qdev_warn_deprecated_function_used() helper

In reply to Philippe Mathieu-Daudé

When built with --enable-qdev-deprecation-warning, calling qdev_warn_deprecated_function_used() will emit a warning such:

  $ qemu-system-arm -M verdex ...
  qemu-system-arm: warning: use of deprecated non-qdev/non-qom code in pxa2xx_lcdc_init()
  qemu-system-arm: warning: use of deprecated non-qdev/non-qom code in pxa2xx_i2s_init()
  qemu-system-arm: warning: use of deprecated non-qdev/non-qom code in pxa27x_keypad_init()
---
 configure                    |  8 ++++++++
 include/hw/qdev-deprecated.h | 26 ++++++++++++++++++++++++++
 hw/core/qdev.c               |  8 ++++++++
 3 files changed, 42 insertions(+)
 create mode 100644 include/hw/qdev-deprecated.h
configure +8 -0
index 597e909b53..9b7a8927c6 100755
@@ -434,6 +434,7 @@ edk2_blobs="no"
 pkgversion=""
 pie=""
 qom_cast_debug="yes"
+qdev_deprecation_warning="no"
 trace_backends="log"
 trace_file="trace"
 spice=""
@@ -1114,6 +1115,8 @@ for opt do
   ;;
   --enable-qom-cast-debug) qom_cast_debug="yes"
   ;;
+  --enable-qdev-deprecation-warning) qdev_deprecation_warning="yes"
+  ;;
   --disable-virtfs) virtfs="no"
   ;;
   --enable-virtfs) virtfs="yes"
@@ -1882,6 +1885,7 @@ disabled with --disable-FEATURE, default is enabled if available:
   virglrenderer   virgl rendering support
   xfsctl          xfsctl support
   qom-cast-debug  cast debugging support
+  qdev-deprecation-warning display qdev deprecation warnings
   tools           build qemu-io, qemu-nbd and qemu-img tools
   vxhs            Veritas HyperScale vDisk backend support
   bochs           bochs image format support
@@ -6723,6 +6727,7 @@ echo "gcov enabled      $gcov"
 echo "TPM support       $tpm"
 echo "libssh support    $libssh"
 echo "QOM debugging     $qom_cast_debug"
+echo "QDEV deprecation warnings $qdev_deprecation_warning"
 echo "Live block migration $live_block_migration"
 echo "lzo support       $lzo"
 echo "snappy support    $snappy"
@@ -7345,6 +7350,9 @@ fi
 if test "$qom_cast_debug" = "yes" ; then
   echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
 fi
+if test "$qdev_deprecation_warning" = "yes" ; then
+  echo "CONFIG_QDEV_DEPRECATION_WARNING=y" >> $config_host_mak
+fi
 if test "$rbd" = "yes" ; then
   echo "CONFIG_RBD=m" >> $config_host_mak
   echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
include/hw/qdev-deprecated.h new file +26 -0
new file mode 100644
index 0000000000..b815f62dae
@@ -0,0 +1,26 @@
+/*
+ * QEMU QOM qdev deprecation helpers
+ *
+ * Copyright (c) 2020 Red Hat, Inc.
+ *
+ * Author:
+ *   Philippe Mathieu-Daudé <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef HW_QDEV_DEPRECATED_H
+#define HW_QDEV_DEPRECATED_H
+
+/**
+ * qdev_warn_deprecated_function_used:
+ *
+ * Display a warning that deprecated code is used.
+ */
+#define qdev_warn_deprecated_function_used() \
+    qdev_warn_deprecated_function(__func__)
+void qdev_warn_deprecated_function(const char *function);
+
+#endif
hw/core/qdev.c +8 -0
index 9e5538aeae..901fa93657 100644
@@ -35,6 +35,7 @@
 #include "hw/hotplug.h"
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
+#include "hw/qdev-deprecated.h"
 #include "hw/boards.h"
 #include "hw/sysbus.h"
 #include "hw/qdev-clock.h"
@@ -819,6 +820,13 @@ void qdev_alias_all_properties(DeviceState *target, Object *source)
     } while (class != object_class_by_name(TYPE_DEVICE));
 }
 
+void qdev_warn_deprecated_function(const char *function)
+{
+#ifdef CONFIG_QDEV_DEPRECATION_WARNING
+    warn_report("use of deprecated non-qdev/non-qom code in %s()", function);
+#endif
+}
+
 static bool device_get_realized(Object *obj, Error **errp)
 {
     DeviceState *dev = DEVICE(obj);
Signature · 1 line
2.21.3
#3 lore raw

RFC PATCH 3/35 hw/arm/omap: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/arm/omap1.c            | 6 ++++++
 hw/char/omap_uart.c       | 5 +++++
 hw/misc/omap_gpmc.c       | 3 +++
 hw/misc/omap_l4.c         | 3 +++
 hw/misc/omap_sdrc.c       | 3 +++
 hw/sd/omap_mmc.c          | 5 +++++
 hw/ssi/omap_spi.c         | 3 +++
 hw/timer/omap_synctimer.c | 4 ++++
 8 files changed, 32 insertions(+)
hw/arm/omap1.c +6 -0
index 761cc17ea9..d7d6253be0 100644
@@ -40,6 +40,7 @@
 #include "hw/sysbus.h"
 #include "qemu/cutils.h"
 #include "qemu/bcd.h"
+#include "hw/qdev-deprecated.h"
 
 static inline void omap_log_badwidth(const char *funcname, hwaddr addr, int sz)
 {
@@ -1451,6 +1452,7 @@ static struct dpll_ctl_s  *omap_dpll_init(MemoryRegion *memory,
                            hwaddr base, omap_clk clk)
 {
     struct dpll_ctl_s *s = g_malloc0(sizeof(*s));
+    qdev_warn_deprecated_function_used();
     memory_region_init_io(&s->iomem, NULL, &omap_dpll_ops, s, "omap-dpll", 0x100);
 
     s->dpll = clk;
@@ -2427,6 +2429,8 @@ static struct omap_pwl_s *omap_pwl_init(MemoryRegion *system_memory,
 {
     struct omap_pwl_s *s = g_malloc0(sizeof(*s));
 
+    qdev_warn_deprecated_function_used();
+
     omap_pwl_reset(s);
 
     memory_region_init_io(&s->iomem, NULL, &omap_pwl_ops, s,
@@ -2534,6 +2538,8 @@ static struct omap_pwt_s *omap_pwt_init(MemoryRegion *system_memory,
                                         omap_clk clk)
 {
     struct omap_pwt_s *s = g_malloc0(sizeof(*s));
+
+    qdev_warn_deprecated_function_used();
     s->clk = clk;
     omap_pwt_reset(s);
 
hw/char/omap_uart.c +5 -0
index e8da933378..7e106772ce 100644
@@ -22,6 +22,7 @@
 #include "hw/arm/omap.h"
 #include "hw/char/serial.h"
 #include "exec/address-spaces.h"
+#include "hw/qdev-deprecated.h"
 
 /* UARTs */
 struct omap_uart_s {
@@ -57,6 +58,8 @@ struct omap_uart_s *omap_uart_init(hwaddr base,
 {
     struct omap_uart_s *s = g_new0(struct omap_uart_s, 1);
 
+    qdev_warn_deprecated_function_used();
+
     s->base = base;
     s->fclk = fclk;
     s->irq = irq;
@@ -168,6 +171,8 @@ struct omap_uart_s *omap2_uart_init(MemoryRegion *sysmem,
     struct omap_uart_s *s = omap_uart_init(base, irq,
                     fclk, iclk, txdma, rxdma, label, chr);
 
+    qdev_warn_deprecated_function_used();
+
     memory_region_init_io(&s->iomem, NULL, &omap_uart_ops, s, "omap.uart", 0x100);
 
     s->ta = ta;
hw/misc/omap_gpmc.c +3 -0
index 10de7a5523..9e29d7a8bd 100644
@@ -25,6 +25,7 @@
 #include "hw/arm/omap.h"
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
+#include "hw/qdev-deprecated.h"
 
 /* General-Purpose Memory Controller */
 struct omap_gpmc_s {
@@ -830,6 +831,8 @@ struct omap_gpmc_s *omap_gpmc_init(struct omap_mpu_state_s *mpu,
     int cs;
     struct omap_gpmc_s *s = g_new0(struct omap_gpmc_s, 1);
 
+    qdev_warn_deprecated_function_used();
+
     memory_region_init_io(&s->iomem, NULL, &omap_gpmc_ops, s, "omap-gpmc", 0x1000);
     memory_region_add_subregion(get_system_memory(), base, &s->iomem);
 
hw/misc/omap_l4.c +3 -0
index 54aeaecd69..b412790c19 100644
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "hw/arm/omap.h"
+#include "hw/qdev-deprecated.h"
 
 struct omap_l4_s {
     MemoryRegion *address_space;
@@ -33,6 +34,8 @@ struct omap_l4_s *omap_l4_init(MemoryRegion *address_space,
     struct omap_l4_s *bus = g_malloc0(
                     sizeof(*bus) + ta_num * sizeof(*bus->ta));
 
+    qdev_warn_deprecated_function_used();
+
     bus->address_space = address_space;
     bus->ta_num = ta_num;
     bus->base = base;
hw/misc/omap_sdrc.c +3 -0
index f2f72f6810..4f8440ea56 100644
@@ -19,6 +19,7 @@
  */
 #include "qemu/osdep.h"
 #include "hw/arm/omap.h"
+#include "hw/qdev-deprecated.h"
 
 /* SDRAM Controller Subsystem */
 struct omap_sdrc_s {
@@ -159,6 +160,8 @@ struct omap_sdrc_s *omap_sdrc_init(MemoryRegion *sysmem,
 {
     struct omap_sdrc_s *s = g_new0(struct omap_sdrc_s, 1);
 
+    qdev_warn_deprecated_function_used();
+
     omap_sdrc_reset(s);
 
     memory_region_init_io(&s->iomem, NULL, &omap_sdrc_ops, s, "omap.sdrc", 0x1000);
hw/sd/omap_mmc.c +5 -0
index 4088a8a80b..88fd20e17a 100644
@@ -24,6 +24,7 @@
 #include "hw/irq.h"
 #include "hw/arm/omap.h"
 #include "hw/sd/sd.h"
+#include "hw/qdev-deprecated.h"
 
 struct omap_mmc_s {
     qemu_irq irq;
@@ -599,6 +600,8 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base,
 {
     struct omap_mmc_s *s = g_new0(struct omap_mmc_s, 1);
 
+    qdev_warn_deprecated_function_used();
+
     s->irq = irq;
     s->dma = dma;
     s->clk = clk;
@@ -625,6 +628,8 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
 {
     struct omap_mmc_s *s = g_new0(struct omap_mmc_s, 1);
 
+    qdev_warn_deprecated_function_used();
+
     s->irq = irq;
     s->dma = dma;
     s->clk = fclk;
hw/ssi/omap_spi.c +3 -0
index 7c7e689707..276f963ae2 100644
@@ -25,6 +25,7 @@
 #include "hw/hw.h"
 #include "hw/irq.h"
 #include "hw/arm/omap.h"
+#include "hw/qdev-deprecated.h"
 
 /* Multichannel SPI */
 struct omap_mcspi_s {
@@ -353,6 +354,8 @@ struct omap_mcspi_s *omap_mcspi_init(struct omap_target_agent_s *ta, int chnum,
     struct omap_mcspi_s *s = g_new0(struct omap_mcspi_s, 1);
     struct omap_mcspi_ch_s *ch = s->ch;
 
+    qdev_warn_deprecated_function_used();
+
     s->irq = irq;
     s->chnum = chnum;
     while (chnum --) {
hw/timer/omap_synctimer.c +4 -0
index 72b997939b..4be24e970e 100644
@@ -20,6 +20,8 @@
 #include "qemu/osdep.h"
 #include "qemu/timer.h"
 #include "hw/arm/omap.h"
+#include "hw/qdev-deprecated.h"
+
 struct omap_synctimer_s {
     MemoryRegion iomem;
     uint32_t val;
@@ -101,6 +103,8 @@ struct omap_synctimer_s *omap_synctimer_init(struct omap_target_agent_s *ta,
 {
     struct omap_synctimer_s *s = g_malloc0(sizeof(*s));
 
+    qdev_warn_deprecated_function_used();
+
     omap_synctimer_reset(s);
     memory_region_init_io(&s->iomem, NULL, &omap_synctimer_ops, s, "omap.synctimer",
                           omap_l4_region_size(ta, 0));
Signature · 1 line
2.21.3
#4 lore raw

RFC PATCH 4/35 hw/arm/pxa2xx: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/arm/pxa2xx.c          | 3 +++
 hw/display/pxa2xx_lcd.c  | 3 +++
 hw/input/pxa2xx_keypad.c | 3 +++
 3 files changed, 9 insertions(+)
hw/arm/pxa2xx.c +3 -0
index e649f8930c..483003d161 100644
@@ -27,6 +27,7 @@
 #include "sysemu/qtest.h"
 #include "qemu/cutils.h"
 #include "qemu/log.h"
+#include "hw/qdev-deprecated.h"
 
 static struct {
     hwaddr io_base;
@@ -1768,6 +1769,8 @@ static PXA2xxI2SState *pxa2xx_i2s_init(MemoryRegion *sysmem,
 {
     PXA2xxI2SState *s = g_new0(PXA2xxI2SState, 1);
 
+    qdev_warn_deprecated_function_used();
+
     s->irq = irq;
     s->rx_dma = rx_dma;
     s->tx_dma = tx_dma;
hw/display/pxa2xx_lcd.c +3 -0
index ff90104b80..cf6241ff21 100644
@@ -20,6 +20,7 @@
 /* FIXME: For graphic_rotate. Should probably be done in common code.  */
 #include "sysemu/sysemu.h"
 #include "framebuffer.h"
+#include "hw/qdev-deprecated.h"
 
 struct DMAChannel {
     uint32_t branch;
@@ -1011,6 +1012,8 @@ PXA2xxLCDState *pxa2xx_lcdc_init(MemoryRegion *sysmem,
     PXA2xxLCDState *s;
     DisplaySurface *surface;
 
+    qdev_warn_deprecated_function_used();
+
     s = (PXA2xxLCDState *) g_malloc0(sizeof(PXA2xxLCDState));
     s->invalidated = 1;
     s->irq = irq;
hw/input/pxa2xx_keypad.c +3 -0
index 62aa6f6b15..6de1e9e4bb 100644
@@ -17,6 +17,7 @@
 #include "migration/vmstate.h"
 #include "hw/arm/pxa.h"
 #include "ui/console.h"
+#include "hw/qdev-deprecated.h"
 
 /*
  * Keypad
@@ -316,6 +317,8 @@ PXA2xxKeyPadState *pxa27x_keypad_init(MemoryRegion *sysmem,
 {
     PXA2xxKeyPadState *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = (PXA2xxKeyPadState *) g_malloc0(sizeof(PXA2xxKeyPadState));
     s->irq = irq;
 
Signature · 1 line
2.21.3
#5 lore raw

RFC PATCH 5/35 hw/arm/nseries: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/arm/nseries.c | 2 ++
 1 file changed, 2 insertions(+)
hw/arm/nseries.c +2 -0
index eae800b5c1..bd0c3f39a9 100644
@@ -44,6 +44,7 @@
 #include "hw/sysbus.h"
 #include "qemu/log.h"
 #include "exec/address-spaces.h"
+#include "hw/qdev-deprecated.h"
 
 /* Nokia N8x0 support */
 struct n800_s {
@@ -703,6 +704,7 @@ static void *mipid_init(void)
 {
     struct mipid_s *s = (struct mipid_s *) g_malloc0(sizeof(*s));
 
+    qdev_warn_deprecated_function_used();
     s->id = 0x838f03;
     mipid_reset(s);
 
Signature · 1 line
2.21.3
#6 lore raw

RFC PATCH 6/35 hw/timer/arm_timer: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/timer/arm_timer.c | 3 +++
 1 file changed, 3 insertions(+)
hw/timer/arm_timer.c +3 -0
index 9607366d78..e23e6b4b31 100644
@@ -16,6 +16,7 @@
 #include "hw/qdev-properties.h"
 #include "qemu/module.h"
 #include "qemu/log.h"
+#include "hw/qdev-deprecated.h"
 
 /* Common timer implementation.  */
 
@@ -175,6 +176,8 @@ static arm_timer_state *arm_timer_init(uint32_t freq)
 {
     arm_timer_state *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = (arm_timer_state *)g_malloc0(sizeof(arm_timer_state));
     s->freq = freq;
     s->control = TIMER_CTRL_IE;
Signature · 1 line
2.21.3
#7 lore raw

Re: [RFC PATCH 06/35] hw/timer/arm_timer: Emit warning when old code is used

Quoted 21 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/timer/arm_timer.c | 3 +++
 1 file changed, 3 insertions(+)
hw/timer/arm_timer.c +1 -0
index 9607366d78..e23e6b4b31 100644
@@ -16,6 +16,7 @@
 #include "hw/qdev-properties.h"
 #include "qemu/module.h"
 #include "qemu/log.h"
+#include "hw/qdev-deprecated.h"
 
 /* Common timer implementation.  */
 

hw/timer/arm_timer.c static arm_timer_state *arm_timer_init(uint32_t freq) · line 183

Quoted 8 lines
hw/timer/arm_timer.c +2 -0
@@ -175,6 +176,8 @@ static arm_timer_state *arm_timer_init(uint32_t freq)
 {
     arm_timer_state *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = (arm_timer_state *)g_malloc0(sizeof(arm_timer_state));
     s->freq = freq;
     s->control = TIMER_CTRL_IE;

This one is okay, the devices that use arm_timer_init are all QOM.

Paolo

#8 lore raw

RFC PATCH 7/35 hw/char/parallel: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/char/parallel.c | 3 +++
 1 file changed, 3 insertions(+)
hw/char/parallel.c +3 -0
index 8dd67d1375..0ee577d420 100644
@@ -35,6 +35,7 @@
 #include "hw/char/parallel.h"
 #include "sysemu/reset.h"
 #include "sysemu/sysemu.h"
+#include "hw/qdev-deprecated.h"
 #include "trace.h"
 
 //#define DEBUG_PARALLEL
@@ -601,6 +602,8 @@ bool parallel_mm_init(MemoryRegion *address_space,
 {
     ParallelState *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_malloc0(sizeof(ParallelState));
     s->irq = irq;
     qemu_chr_fe_init(&s->chr, chr, &error_abort);
Signature · 1 line
2.21.3
#9 lore raw

RFC PATCH 8/35 hw/display/blizzard: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/display/blizzard.c | 3 +++
 1 file changed, 3 insertions(+)
hw/display/blizzard.c +3 -0
index 105241577d..74557b152b 100644
@@ -23,6 +23,7 @@
 #include "ui/console.h"
 #include "hw/display/blizzard.h"
 #include "ui/pixel_ops.h"
+#include "hw/qdev-deprecated.h"
 
 typedef void (*blizzard_fn_t)(uint8_t *, const uint8_t *, unsigned int);
 
@@ -1010,6 +1011,8 @@ void *s1d13745_init(qemu_irq gpio_int)
     BlizzardState *s = (BlizzardState *) g_malloc0(sizeof(*s));
     DisplaySurface *surface;
 
+    qdev_warn_deprecated_function_used();
+
     s->fb = g_malloc(0x180000);
 
     s->con = graphic_console_init(NULL, 0, &blizzard_ops, s);
Signature · 1 line
2.21.3
#10 lore raw

RFC PATCH 9/35 hw/display/ramfb: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/display/ramfb.c | 3 +++
 1 file changed, 3 insertions(+)
hw/display/ramfb.c +3 -0
index 79b9754a58..a4a427e5c7 100644
@@ -18,6 +18,7 @@
 #include "hw/display/bochs-vbe.h" /* for limits */
 #include "ui/console.h"
 #include "sysemu/reset.h"
+#include "hw/qdev-deprecated.h"
 
 struct QEMU_PACKED RAMFBCfg {
     uint64_t addr;
@@ -120,6 +121,8 @@ RAMFBState *ramfb_setup(Error **errp)
     FWCfgState *fw_cfg = fw_cfg_find();
     RAMFBState *s;
 
+    qdev_warn_deprecated_function_used();
+
     if (!fw_cfg || !fw_cfg->dma_enabled) {
         error_setg(errp, "ramfb device requires fw_cfg with DMA");
         return NULL;
Signature · 1 line
2.21.3
#11 lore raw

RFC PATCH 10/35 hw/display/tc6393xb: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/display/tc6393xb.c | 3 +++
 1 file changed, 3 insertions(+)
hw/display/tc6393xb.c +3 -0
index 49a676d1b0..e4900e9502 100644
@@ -21,6 +21,7 @@
 #include "ui/console.h"
 #include "ui/pixel_ops.h"
 #include "sysemu/blockdev.h"
+#include "hw/qdev-deprecated.h"
 
 #define IRQ_TC6393_NAND		0
 #define IRQ_TC6393_MMC		1
@@ -556,6 +557,8 @@ TC6393xbState *tc6393xb_init(MemoryRegion *sysmem, uint32_t base, qemu_irq irq)
         },
     };
 
+    qdev_warn_deprecated_function_used();
+
     s = (TC6393xbState *) g_malloc0(sizeof(TC6393xbState));
     s->irq = irq;
     s->gpio_in = qemu_allocate_irqs(tc6393xb_gpio_set, s, TC6393XB_GPIOS);
Signature · 1 line
2.21.3
#12 lore raw

RFC PATCH 11/35 hw/display/vga-isa-mm: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/display/vga-isa-mm.c | 5 +++++
 hw/display/vga.c        | 3 +++
 2 files changed, 8 insertions(+)
hw/display/vga-isa-mm.c +5 -0
index 7321b7a06d..3e62389b63 100644
@@ -29,6 +29,7 @@
 #include "hw/display/vga.h"
 #include "vga_int.h"
 #include "ui/pixel_ops.h"
+#include "hw/qdev-deprecated.h"
 
 #define VGA_RAM_SIZE (8 * MiB)
 
@@ -71,6 +72,8 @@ static void vga_mm_init(ISAVGAMMState *s, hwaddr vram_base,
 {
     MemoryRegion *s_ioport_ctrl, *vga_io_memory;
 
+    qdev_warn_deprecated_function_used();
+
     s->it_shift = it_shift;
     s_ioport_ctrl = g_malloc(sizeof(*s_ioport_ctrl));
     memory_region_init_io(s_ioport_ctrl, NULL, &vga_mm_ctrl_ops, s,
@@ -99,6 +102,8 @@ int isa_vga_mm_init(hwaddr vram_base,
 
     s = g_malloc0(sizeof(*s));
 
+    qdev_warn_deprecated_function_used();
+
     s->vga.vram_size_mb = VGA_RAM_SIZE / MiB;
     s->vga.global_vmstate = true;
     vga_common_init(&s->vga, NULL);
hw/display/vga.c +3 -0
index 061fd9ab8f..d59a9c896b 100644
@@ -35,6 +35,7 @@
 #include "hw/xen/xen.h"
 #include "migration/vmstate.h"
 #include "trace.h"
+#include "hw/qdev-deprecated.h"
 
 //#define DEBUG_VGA_MEM
 //#define DEBUG_VGA_REG
@@ -2262,6 +2263,8 @@ MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
 {
     MemoryRegion *vga_mem;
 
+    qdev_warn_deprecated_function_used();
+
     *vga_ports = vga_portio_list;
     *vbe_ports = vbe_portio_list;
 
Signature · 1 line
2.21.3
#13 lore raw

RFC PATCH 12/35 hw/dma/etraxfs_dma: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/dma/etraxfs_dma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/dma/etraxfs_dma.c +3 -1
index c4334e87bf..d2f7e7ca9d 100644
@@ -28,7 +28,7 @@
 #include "qemu/main-loop.h"
 #include "sysemu/runstate.h"
 #include "exec/address-spaces.h"
-
+#include "hw/qdev-deprecated.h"
 #include "hw/cris/etraxfs_dma.h"
 
 #define D(x)
@@ -765,6 +765,8 @@ void *etraxfs_dmac_init(hwaddr base, int nr_channels)
 {
 	struct fs_dma_ctrl *ctrl = NULL;
 
+    qdev_warn_deprecated_function_used();
+
 	ctrl = g_malloc0(sizeof *ctrl);
 
         ctrl->bh = qemu_bh_new(DMA_run, ctrl);
Signature · 1 line
2.21.3
#14 lore raw

RFC PATCH 13/35 hw/dma/soc_dma: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/dma/soc_dma.c | 3 +++
 1 file changed, 3 insertions(+)
hw/dma/soc_dma.c +3 -0
index 3a430057f5..22fd8c38b0 100644
@@ -21,6 +21,7 @@
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
 #include "hw/arm/soc_dma.h"
+#include "hw/qdev-deprecated.h"
 
 static void transfer_mem2mem(struct soc_dma_ch_s *ch)
 {
@@ -242,6 +243,8 @@ struct soc_dma_s *soc_dma_init(int n)
     int i;
     struct dma_s *s = g_malloc0(sizeof(*s) + n * sizeof(*s->ch));
 
+    qdev_warn_deprecated_function_used();
+
     s->chnum = n;
     s->soc.ch = s->ch;
     for (i = 0; i < n; i ++) {
Signature · 1 line
2.21.3
#15 lore raw

RFC PATCH 14/35 hw/i386/pc: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/i386/pc.c | 3 +++
 1 file changed, 3 insertions(+)
hw/i386/pc.c +3 -0
index 2128f3d6fe..c71809fd28 100644
@@ -94,6 +94,7 @@
 #include "vmport.h"
 #include "fw_cfg.h"
 #include "trace.h"
+#include "hw/qdev-deprecated.h"
 
 GlobalProperty pc_compat_5_0[] = {};
 const size_t pc_compat_5_0_len = G_N_ELEMENTS(pc_compat_5_0);
@@ -348,6 +349,8 @@ GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled)
 {
     GSIState *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_new0(GSIState, 1);
     if (kvm_ioapic_in_kernel()) {
         kvm_pc_setup_irq_routing(pci_enabled);
Signature · 1 line
2.21.3
#16 lore raw

Re: [RFC PATCH 14/35] hw/i386/pc: Emit warning when old code is used

Quoted 21 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/i386/pc.c | 3 +++
 1 file changed, 3 insertions(+)
hw/i386/pc.c +1 -0
index 2128f3d6fe..c71809fd28 100644
@@ -94,6 +94,7 @@
 #include "vmport.h"
 #include "fw_cfg.h"
 #include "trace.h"
+#include "hw/qdev-deprecated.h"
 
 GlobalProperty pc_compat_5_0[] = {};
 const size_t pc_compat_5_0_len = G_N_ELEMENTS(pc_compat_5_0);

hw/i386/pc.c GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled) · line 356

Quoted 8 lines
hw/i386/pc.c +2 -0
@@ -348,6 +349,8 @@ GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled)
 {
     GSIState *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_new0(GSIState, 1);
     if (kvm_ioapic_in_kernel()) {
         kvm_pc_setup_irq_routing(pci_enabled);

This one is okay, GSIState is just an array of qemu_irqs.

Paolo

#17 lore raw

RFC PATCH 15/35 hw/i386/xen/xen-hvm: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/i386/xen/xen-hvm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/i386/xen/xen-hvm.c +3 -1
index 82ece6b9e7..a1163b1529 100644
@@ -31,7 +31,7 @@
 #include "sysemu/xen-mapcache.h"
 #include "trace.h"
 #include "exec/address-spaces.h"
-
+#include "hw/qdev-deprecated.h"
 #include <xen/hvm/ioreq.h>
 #include <xen/hvm/e820.h>
 
@@ -1401,6 +1401,8 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
     xen_pfn_t ioreq_pfn;
     XenIOState *state;
 
+    qdev_warn_deprecated_function_used();
+
     state = g_malloc0(sizeof (XenIOState));
 
     state->xce_handle = xenevtchn_open(NULL, 0);
Signature · 1 line
2.21.3
#18 lore raw

RE: [RFC PATCH 15/35] hw/i386/xen/xen-hvm: Emit warning when old code is used

Quoted 20 lines

-----Original Message-----
From: Philippe Mathieu-Daudé <[email protected]>
Sent: 08 June 2020 17:00
To: [email protected]
Cc: [email protected]; Markus Armbruster <[email protected]>; Max Filippov <[email protected]>; Marcel Apfelbaum <[email protected]>; Peter Maydell <[email protected]>; Michael Walle <[email protected]>; Edgar E. Iglesias <[email protected]>; Aurelien Jarno <[email protected]>; Gerd Hoffmann <[email protected]>; Stafford Horne <[email protected]>; Andrzej Zaborowski <[email protected]>; [email protected]; Alistair Francis <[email protected]>; Richard Henderson <[email protected]>; Mark Cave-Ayland <[email protected]>; Marc-André Lureau <[email protected]>; Daniel P . Berrange <[email protected]>; qemu- [email protected]; Michael S. Tsirkin <[email protected]>; [email protected]; Sagar Karandikar <[email protected]>; Anthony Perard <[email protected]>; Palmer Dabbelt <[email protected]>; Stefano Stabellini <[email protected]>; Paul Durrant <[email protected]>; Paolo Bonzini <[email protected]>; Alistair Francis <[email protected]>; Eduardo Habkost <[email protected]>; Thomas Huth <[email protected]>; Bastian Koppelmann <[email protected] paderborn.de>; David Gibson <[email protected]>; Magnus Damm <[email protected]>; Philippe Mathieu-Daudé <[email protected]>
Subject: [RFC PATCH 15/35] hw/i386/xen/xen-hvm: Emit warning when old code is used

Quoted 1 line

This code hasn't been QOM'ified yet. Warn the user.

"Based on today's IRC chat, this is a trivial RFC series to anotate pre-qdev/QOM devices so developers using them without knowing they are not QOM'ified yet can realize it and convert them if they have time."

So, how should this be coded then? The XenIOState doesn't really qualify as a 'device', does it?

Paul

Quoted 30 lines
---
 hw/i386/xen/xen-hvm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/i386/xen/xen-hvm.c +3 -2
index 82ece6b9e7..a1163b1529 100644
@@ -31,7 +31,7 @@
 #include "sysemu/xen-mapcache.h"
 #include "trace.h"
 #include "exec/address-spaces.h"
-
+#include "hw/qdev-deprecated.h"
 #include <xen/hvm/ioreq.h>
 #include <xen/hvm/e820.h>
 
@@ -1401,6 +1401,8 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
     xen_pfn_t ioreq_pfn;
     XenIOState *state;
 
+    qdev_warn_deprecated_function_used();
+
     state = g_malloc0(sizeof (XenIOState));
 
     state->xce_handle = xenevtchn_open(NULL, 0);
--

2.21.3

#19 lore raw

Re: [RFC PATCH 15/35] hw/i386/xen/xen-hvm: Emit warning when old code is used

Quoted 11 lines · Paul Durrant
Quoted 4 lines

-----Original Message-----
From: Philippe Mathieu-Daudé <[email protected]>

This code hasn't been QOM'ified yet. Warn the user.

"Based on today's IRC chat, this is a trivial RFC series to anotate pre-qdev/QOM devices so developers using them without knowing they are not QOM'ified yet can realize it and convert them if they have time."

So, how should this be coded then? The XenIOState doesn't really qualify as a 'device', does it?

There is a pending question whether Machines are Devices or not.

Xen is a tricky case, it is created as a Q35 machine overloaded with Xen features.

Quoted 7 lines

hw/i386/xen/xen-hvm.c void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) · line 1406

Quoted 7 lines
hw/i386/xen/xen-hvm.c +2 -0
@@ -1401,6 +1401,8 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
     xen_pfn_t ioreq_pfn;
     XenIOState *state;
 
+    qdev_warn_deprecated_function_used();
+
     state = g_malloc0(sizeof (XenIOState));

XenIOState is indeed not a device, it is allocated once, we won't gain anything making it a QOM object... so this patch is incorrect.

Sorry for the noise :S

Regards,

Phil.

Quoted 6 lines
Quoted 4 lines
(quoted diff) +0 -1
     state->xce_handle = xenevtchn_open(NULL, 0);
--

2.21.3

#20 lore raw

RFC PATCH 16/35 hw/input/lasips2: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/input/lasips2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/input/lasips2.c +3 -1
index 0786e57338..452244f037 100644
@@ -34,7 +34,7 @@
 #include "exec/address-spaces.h"
 #include "migration/vmstate.h"
 #include "hw/irq.h"
-
+#include "hw/qdev-deprecated.h"
 
 struct LASIPS2State;
 typedef struct LASIPS2Port {
@@ -269,6 +269,8 @@ void lasips2_init(MemoryRegion *address_space,
 {
     LASIPS2State *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_malloc0(sizeof(LASIPS2State));
 
     s->irq = irq;
Signature · 1 line
2.21.3
#21 lore raw

RFC PATCH 17/35 hw/input/pckbd: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/input/pckbd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/input/pckbd.c +3 -1
index 60a4130320..c7f42be63b 100644
@@ -31,7 +31,7 @@
 #include "hw/input/i8042.h"
 #include "sysemu/reset.h"
 #include "sysemu/runstate.h"
-
+#include "hw/qdev-deprecated.h"
 #include "trace.h"
 
 /*	Keyboard Controller Commands */
@@ -467,6 +467,8 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
 {
     KBDState *s = g_malloc0(sizeof(KBDState));
 
+    qdev_warn_deprecated_function_used();
+
     s->irq_kbd = kbd_irq;
     s->irq_mouse = mouse_irq;
     s->mask = mask;
Signature · 1 line
2.21.3
Reviewed-by on v1 17/35
#22 lore raw

Re: [RFC PATCH 17/35] hw/input/pckbd: Emit warning when old code is used

Quoted 22 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/input/pckbd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/input/pckbd.c +1 -1
index 60a4130320..c7f42be63b 100644
@@ -31,7 +31,7 @@
 #include "hw/input/i8042.h"
 #include "sysemu/reset.h"
 #include "sysemu/runstate.h"
-
+#include "hw/qdev-deprecated.h"
 #include "trace.h"
 
 /*	Keyboard Controller Commands */

hw/input/pckbd.c void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, · line 474

Quoted 8 lines
hw/input/pckbd.c +2 -0
@@ -467,6 +467,8 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
 {
     KBDState *s = g_malloc0(sizeof(KBDState));
 
+    qdev_warn_deprecated_function_used();
+
     s->irq_kbd = kbd_irq;
     s->irq_mouse = mouse_irq;
     s->mask = mask;

The ISA variant is QOM-ified, but you placed the warning in the right place.

Paolo

#23 lore raw

RFC PATCH 18/35 hw/input/ps2: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/input/ps2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/input/ps2.c +5 -1
index f8746d2f52..0d84061cae 100644
@@ -30,7 +30,7 @@
 #include "ui/input.h"
 #include "sysemu/reset.h"
 #include "sysemu/runstate.h"
-
+#include "hw/qdev-deprecated.h"
 #include "trace.h"
 
 /* debug PC keyboard */
@@ -1136,6 +1136,8 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg)
 {
     PS2KbdState *s = (PS2KbdState *)g_malloc0(sizeof(PS2KbdState));
 
+    qdev_warn_deprecated_function_used();
+
     trace_ps2_kbd_init(s);
     s->common.update_irq = update_irq;
     s->common.update_arg = update_arg;
@@ -1158,6 +1160,8 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg)
 {
     PS2MouseState *s = (PS2MouseState *)g_malloc0(sizeof(PS2MouseState));
 
+    qdev_warn_deprecated_function_used();
+
     trace_ps2_mouse_init(s);
     s->common.update_irq = update_irq;
     s->common.update_arg = update_arg;
Signature · 1 line
2.21.3
#24 lore raw

Re: [RFC PATCH 18/35] hw/input/ps2: Emit warning when old code is used

Quoted 31 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/input/ps2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/input/ps2.c +3 -1
index f8746d2f52..0d84061cae 100644
@@ -30,7 +30,7 @@
 #include "ui/input.h"
 #include "sysemu/reset.h"
 #include "sysemu/runstate.h"
-
+#include "hw/qdev-deprecated.h"
 #include "trace.h"
 
 /* debug PC keyboard */
@@ -1136,6 +1136,8 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg)
 {
     PS2KbdState *s = (PS2KbdState *)g_malloc0(sizeof(PS2KbdState));
 
+    qdev_warn_deprecated_function_used();
+
     trace_ps2_kbd_init(s);
     s->common.update_irq = update_irq;
     s->common.update_arg = update_arg;

hw/input/ps2.c void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) · line 1167

Quoted 8 lines
hw/input/ps2.c +2 -0
@@ -1158,6 +1160,8 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg)
 {
     PS2MouseState *s = (PS2MouseState *)g_malloc0(sizeof(PS2MouseState));
 
+    qdev_warn_deprecated_function_used();
+
     trace_ps2_mouse_init(s);
     s->common.update_irq = update_irq;
     s->common.update_arg = update_arg;

While the keyboard and mouse are not QOM-ified, of the controllers (i8042, lasips2, pl050) only lasips2 is not. I would warn there.

Paolo

#25 lore raw

RFC PATCH 19/35 hw/input/tsc2005: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/input/tsc2005.c | 3 +++
 1 file changed, 3 insertions(+)
hw/input/tsc2005.c +3 -0
index 55d61cc843..1f97b82379 100644
@@ -27,6 +27,7 @@
 #include "hw/irq.h"
 #include "migration/vmstate.h"
 #include "trace.h"
+#include "hw/qdev-deprecated.h"
 
 #define TSC_CUT_RESOLUTION(value, p)	((value) >> (16 - (p ? 12 : 10)))
 
@@ -489,6 +490,8 @@ void *tsc2005_init(qemu_irq pintdav)
 {
     TSC2005State *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = (TSC2005State *)
             g_malloc0(sizeof(TSC2005State));
     s->x = 400;
Signature · 1 line
2.21.3
#26 lore raw

RFC PATCH 20/35 hw/intc/i8259: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/intc/i8259.c | 3 +++
 1 file changed, 3 insertions(+)
hw/intc/i8259.c +3 -0
index 51b27f6a34..9d9609cdab 100644
@@ -30,6 +30,7 @@
 #include "qemu/log.h"
 #include "hw/isa/i8259_internal.h"
 #include "trace.h"
+#include "hw/qdev-deprecated.h"
 
 /* debug PIC */
 //#define DEBUG_PIC
@@ -414,6 +415,8 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
     ISADevice *isadev;
     int i;
 
+    qdev_warn_deprecated_function_used();
+
     irq_set = g_new0(qemu_irq, ISA_NUM_IRQS);
 
     isadev = i8259_init_chip(TYPE_I8259, bus, true);
Signature · 1 line
2.21.3
#27 lore raw

Re: [RFC PATCH 20/35] hw/intc/i8259: Emit warning when old code is used

Quoted 21 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/intc/i8259.c | 3 +++
 1 file changed, 3 insertions(+)
hw/intc/i8259.c +1 -0
index 51b27f6a34..9d9609cdab 100644
@@ -30,6 +30,7 @@
 #include "qemu/log.h"
 #include "hw/isa/i8259_internal.h"
 #include "trace.h"
+#include "hw/qdev-deprecated.h"
 
 /* debug PIC */
 //#define DEBUG_PIC

hw/intc/i8259.c qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq) · line 422

Quoted 8 lines
hw/intc/i8259.c +2 -0
@@ -414,6 +415,8 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
     ISADevice *isadev;
     int i;
 
+    qdev_warn_deprecated_function_used();
+
     irq_set = g_new0(qemu_irq, ISA_NUM_IRQS);
 
     isadev = i8259_init_chip(TYPE_I8259, bus, true);

This one is okay too.

Paolo

#28 lore raw

RFC PATCH 21/35 hw/lm32/lm32_hwsetup: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/lm32/lm32_hwsetup.h | 3 +++
 1 file changed, 3 insertions(+)
hw/lm32/lm32_hwsetup.h +3 -0
index de94de177a..f4a4d8fe4b 100644
@@ -27,6 +27,7 @@
 
 #include "qemu/cutils.h"
 #include "hw/loader.h"
+#include "hw/qdev-deprecated.h"
 
 typedef struct {
     void *data;
@@ -57,6 +58,8 @@ static inline HWSetup *hwsetup_init(void)
 {
     HWSetup *hw;
 
+    qdev_warn_deprecated_function_used();
+
     hw = g_malloc(sizeof(HWSetup));
     hw->data = g_malloc0(TARGET_PAGE_SIZE);
     hw->ptr = hw->data;
Signature · 1 line
2.21.3
#29 lore raw

Re: [RFC PATCH 21/35] hw/lm32/lm32_hwsetup: Emit warning when old code is used

Quoted 21 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/lm32/lm32_hwsetup.h | 3 +++
 1 file changed, 3 insertions(+)
hw/lm32/lm32_hwsetup.h +1 -0
index de94de177a..f4a4d8fe4b 100644
@@ -27,6 +27,7 @@
 
 #include "qemu/cutils.h"
 #include "hw/loader.h"
+#include "hw/qdev-deprecated.h"
 
 typedef struct {
     void *data;

hw/lm32/lm32_hwsetup.h static inline HWSetup *hwsetup_init(void) · line 65

Quoted 8 lines
hw/lm32/lm32_hwsetup.h +2 -0
@@ -57,6 +58,8 @@ static inline HWSetup *hwsetup_init(void)
 {
     HWSetup *hw;
 
+    qdev_warn_deprecated_function_used();
+
     hw = g_malloc(sizeof(HWSetup));
     hw->data = g_malloc0(TARGET_PAGE_SIZE);
     hw->ptr = hw->data;

This one is okay.

Paolo

#30 lore raw

RFC PATCH 22/35 hw/m68k/mcf520x: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/m68k/mcf5206.c | 5 +++++
 hw/m68k/mcf5208.c | 3 +++
 2 files changed, 8 insertions(+)
hw/m68k/mcf5206.c +5 -0
index a2fef04f8e..ec0d176674 100644
@@ -16,6 +16,7 @@
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
 #include "sysemu/sysemu.h"
+#include "hw/qdev-deprecated.h"
 
 /* General purpose timer module.  */
 typedef struct {
@@ -144,6 +145,8 @@ static m5206_timer_state *m5206_timer_init(qemu_irq irq)
 {
     m5206_timer_state *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_new0(m5206_timer_state, 1);
     s->timer = ptimer_init(m5206_timer_trigger, s, PTIMER_POLICY_DEFAULT);
     s->irq = irq;
@@ -566,6 +569,8 @@ qemu_irq *mcf5206_init(MemoryRegion *sysmem, uint32_t base, M68kCPU *cpu)
     m5206_mbar_state *s;
     qemu_irq *pic;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_new0(m5206_mbar_state, 1);
 
     memory_region_init_io(&s->iomem, NULL, &m5206_mbar_ops, s,
hw/m68k/mcf5208.c +3 -0
index 2ab9701ad6..72627f6833 100644
@@ -26,6 +26,7 @@
 #include "hw/sysbus.h"
 #include "elf.h"
 #include "exec/address-spaces.h"
+#include "hw/qdev-deprecated.h"
 
 #define SYS_FREQ 166666666
 
@@ -191,6 +192,8 @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic)
     m5208_timer_state *s;
     int i;
 
+    qdev_warn_deprecated_function_used();
+
     /* SDRAMC.  */
     memory_region_init_io(iomem, NULL, &m5208_sys_ops, NULL, "m5208-sys", 0x00004000);
     memory_region_add_subregion(address_space, 0xfc0a8000, iomem);
Signature · 1 line
2.21.3
#31 lore raw

Re: [RFC PATCH 22/35] hw/m68k/mcf520x: Emit warning when old code is used

Am Mon, 8 Jun 2020 18:00:31 +0200
schrieb Philippe Mathieu-Daudé <[email protected]>:

Quoted 30 lines

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/m68k/mcf5206.c | 5 +++++
 hw/m68k/mcf5208.c | 3 +++
 2 files changed, 8 insertions(+)
hw/m68k/mcf5206.c +3 -0
index a2fef04f8e..ec0d176674 100644
@@ -16,6 +16,7 @@
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
 #include "sysemu/sysemu.h"
+#include "hw/qdev-deprecated.h"
 
 /* General purpose timer module.  */
 typedef struct {
@@ -144,6 +145,8 @@ static m5206_timer_state
 *m5206_timer_init(qemu_irq irq) {
     m5206_timer_state *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_new0(m5206_timer_state, 1);
     s->timer = ptimer_init(m5206_timer_trigger, s,
 PTIMER_POLICY_DEFAULT); s->irq = irq;

hw/m68k/mcf5206.c qemu_irq *mcf5206_init(MemoryRegion *sysmem, · line 574

Quoted 6 lines
hw/m68k/mcf5206.c +2 -0
@@ -566,6 +569,8 @@ qemu_irq *mcf5206_init(MemoryRegion *sysmem,
 uint32_t base, M68kCPU *cpu) m5206_mbar_state *s;
     qemu_irq *pic;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_new0(m5206_mbar_state, 1);

Ok, it's quite obvious what you refer to here...

Quoted 22 lines
hw/m68k/mcf5206.c +0 -0
     memory_region_init_io(&s->iomem, NULL, &m5206_mbar_ops, s,
hw/m68k/mcf5208.c +3 -0
index 2ab9701ad6..72627f6833 100644
@@ -26,6 +26,7 @@
 #include "hw/sysbus.h"
 #include "elf.h"
 #include "exec/address-spaces.h"
+#include "hw/qdev-deprecated.h"
 
 #define SYS_FREQ 166666666
 
@@ -191,6 +192,8 @@ static void mcf5208_sys_init(MemoryRegion
 *address_space, qemu_irq *pic) m5208_timer_state *s;
     int i;
 
+    qdev_warn_deprecated_function_used();
+
     /* SDRAMC.  */
     memory_region_init_io(iomem, NULL, &m5208_sys_ops, NULL,
 "m5208-sys", 0x00004000); memory_region_add_subregion(address_space,
Quoted 1 line

0xfc0a8000, iomem);

... but it is not so obvious what you refer to here. I think that new function should maybe have a "char *what" parameter that contains the name of the struct you refer to. Or at least add a comment in front of the function with a short description?

Thomas

#32 lore raw

RFC PATCH 23/35 hw/misc/applesmc: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/misc/applesmc.c | 3 +++
 1 file changed, 3 insertions(+)
hw/misc/applesmc.c +3 -0
index 1c4addb201..d63f19038d 100644
@@ -36,6 +36,7 @@
 #include "ui/console.h"
 #include "qemu/module.h"
 #include "qemu/timer.h"
+#include "hw/qdev-deprecated.h"
 
 /* #define DEBUG_SMC */
 
@@ -253,6 +254,8 @@ static void applesmc_add_key(AppleSMCState *s, const char *key,
 {
     struct AppleSMCData *def;
 
+    qdev_warn_deprecated_function_used();
+
     def = g_malloc0(sizeof(struct AppleSMCData));
     def->key = key;
     def->len = len;
Signature · 1 line
2.21.3
#33 lore raw

Re: [RFC PATCH 23/35] hw/misc/applesmc: Emit warning when old code is used

Quoted 21 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/misc/applesmc.c | 3 +++
 1 file changed, 3 insertions(+)
hw/misc/applesmc.c +1 -0
index 1c4addb201..d63f19038d 100644
@@ -36,6 +36,7 @@
 #include "ui/console.h"
 #include "qemu/module.h"
 #include "qemu/timer.h"
+#include "hw/qdev-deprecated.h"
 
 /* #define DEBUG_SMC */
 

hw/misc/applesmc.c static void applesmc_add_key(AppleSMCState *s, const char *key, · line 261

Quoted 8 lines
hw/misc/applesmc.c +2 -0
@@ -253,6 +254,8 @@ static void applesmc_add_key(AppleSMCState *s, const char *key,
 {
     struct AppleSMCData *def;
 
+    qdev_warn_deprecated_function_used();
+
     def = g_malloc0(sizeof(struct AppleSMCData));
     def->key = key;
     def->len = len;

This one is okay.

Paolo

#34 lore raw

RFC PATCH 24/35 hw/misc/cbus: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/misc/cbus.c | 3 +++
 1 file changed, 3 insertions(+)
hw/misc/cbus.c +3 -0
index 3c3721ad2d..24e197684f 100644
@@ -25,6 +25,7 @@
 #include "hw/irq.h"
 #include "hw/misc/cbus.h"
 #include "sysemu/runstate.h"
+#include "hw/qdev-deprecated.h"
 
 //#define DEBUG
 
@@ -135,6 +136,8 @@ CBus *cbus_init(qemu_irq dat)
 {
     CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s));
 
+    qdev_warn_deprecated_function_used();
+
     s->dat_out = dat;
     s->cbus.clk = qemu_allocate_irq(cbus_clk, s, 0);
     s->cbus.dat = qemu_allocate_irq(cbus_dat, s, 0);
Signature · 1 line
2.21.3
#35 lore raw

RFC PATCH 25/35 hw/nvram/eeprom93xx: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/nvram/eeprom93xx.c | 3 +++
 1 file changed, 3 insertions(+)
hw/nvram/eeprom93xx.c +3 -0
index ca6f591c84..56603ea42b 100644
@@ -39,6 +39,7 @@
 #include "hw/nvram/eeprom93xx.h"
 #include "migration/qemu-file-types.h"
 #include "migration/vmstate.h"
+#include "hw/qdev-deprecated.h"
 
 /* Debug EEPROM emulation. */
 //~ #define DEBUG_EEPROM
@@ -300,6 +301,8 @@ eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords)
     eeprom_t *eeprom;
     uint8_t addrbits;
 
+    qdev_warn_deprecated_function_used();
+
     switch (nwords) {
     case 16:
     case 64:
Signature · 1 line
2.21.3
#36 lore raw

RFC PATCH 26/35 hw/openrisc/cputimer: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/openrisc/cputimer.c | 3 +++
 1 file changed, 3 insertions(+)
hw/openrisc/cputimer.c +3 -0
index 93268815d8..60f2c9667f 100644
@@ -22,6 +22,7 @@
 #include "cpu.h"
 #include "migration/vmstate.h"
 #include "qemu/timer.h"
+#include "hw/qdev-deprecated.h"
 
 #define TIMER_PERIOD 50 /* 50 ns period for 20 MHz timer */
 
@@ -135,6 +136,8 @@ static const VMStateDescription vmstate_or1k_timer = {
 
 void cpu_openrisc_clock_init(OpenRISCCPU *cpu)
 {
+    qdev_warn_deprecated_function_used();
+
     cpu->env.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &openrisc_timer_cb, cpu);
     cpu->env.ttmr = 0x00000000;
 
Signature · 1 line
2.21.3
#37 lore raw

Re: [RFC PATCH 26/35] hw/openrisc/cputimer: Emit warning when old code is used

Quoted 21 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/openrisc/cputimer.c | 3 +++
 1 file changed, 3 insertions(+)
hw/openrisc/cputimer.c +1 -0
index 93268815d8..60f2c9667f 100644
@@ -22,6 +22,7 @@
 #include "cpu.h"
 #include "migration/vmstate.h"
 #include "qemu/timer.h"
+#include "hw/qdev-deprecated.h"
 
 #define TIMER_PERIOD 50 /* 50 ns period for 20 MHz timer */
 

hw/openrisc/cputimer.c static const VMStateDescription vmstate_or1k_timer = { · line 143

Quoted 8 lines
hw/openrisc/cputimer.c +2 -0
@@ -135,6 +136,8 @@ static const VMStateDescription vmstate_or1k_timer = {
 
 void cpu_openrisc_clock_init(OpenRISCCPU *cpu)
 {
+    qdev_warn_deprecated_function_used();
+
     cpu->env.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &openrisc_timer_cb, cpu);
     cpu->env.ttmr = 0x00000000;
 

I was about to give this a pass, but if we did so it should be the CPU itself that calls cpu_openrisc_clock_init (not openrisc_sim_init).

Paolo

#38 lore raw

RFC PATCH 27/35 hw/ppc/ppc: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/ppc/ppc.c | 3 +++
 1 file changed, 3 insertions(+)
hw/ppc/ppc.c +3 -0
index 4a11fb1640..39fcf746c5 100644
@@ -37,6 +37,7 @@
 #include "kvm_ppc.h"
 #include "migration/vmstate.h"
 #include "trace.h"
+#include "hw/qdev-deprecated.h"
 
 //#define PPC_DEBUG_IRQ
 //#define PPC_DEBUG_TB
@@ -1114,6 +1115,8 @@ clk_setup_cb cpu_ppc_tb_init (CPUPPCState *env, uint32_t freq)
     PowerPCCPU *cpu = env_archcpu(env);
     ppc_tb_t *tb_env;
 
+    qdev_warn_deprecated_function_used();
+
     tb_env = g_malloc0(sizeof(ppc_tb_t));
     env->tb_env = tb_env;
     tb_env->flags = PPC_DECR_UNDERFLOW_TRIGGERED;
Signature · 1 line
2.21.3
#39 lore raw

Re: [RFC PATCH 27/35] hw/ppc/ppc: Emit warning when old code is used

Quoted 21 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/ppc/ppc.c | 3 +++
 1 file changed, 3 insertions(+)
hw/ppc/ppc.c +1 -0
index 4a11fb1640..39fcf746c5 100644
@@ -37,6 +37,7 @@
 #include "kvm_ppc.h"
 #include "migration/vmstate.h"
 #include "trace.h"
+#include "hw/qdev-deprecated.h"
 
 //#define PPC_DEBUG_IRQ
 //#define PPC_DEBUG_TB

hw/ppc/ppc.c clk_setup_cb cpu_ppc_tb_init (CPUPPCState *env, uint32_t freq) · line 1122

Quoted 8 lines
hw/ppc/ppc.c +2 -0
@@ -1114,6 +1115,8 @@ clk_setup_cb cpu_ppc_tb_init (CPUPPCState *env, uint32_t freq)
     PowerPCCPU *cpu = env_archcpu(env);
     ppc_tb_t *tb_env;
 
+    qdev_warn_deprecated_function_used();
+
     tb_env = g_malloc0(sizeof(ppc_tb_t));
     env->tb_env = tb_env;
     tb_env->flags = PPC_DECR_UNDERFLOW_TRIGGERED;

This one is okay.

Paolo

#40 lore raw

RFC PATCH 28/35 hw/ppc/ppc4xx: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/ppc/ppc405_boards.c |  5 +++++
 hw/ppc/ppc405_uc.c     | 21 +++++++++++++++++++++
 hw/ppc/ppc4xx_devs.c   |  7 +++++++
 3 files changed, 33 insertions(+)
hw/ppc/ppc405_boards.c +5 -0
index 6198ec1035..eb1216b5f0 100644
@@ -41,6 +41,7 @@
 #include "hw/loader.h"
 #include "exec/address-spaces.h"
 #include "qemu/cutils.h"
+#include "hw/qdev-deprecated.h"
 
 #define BIOS_FILENAME "ppc405_rom.bin"
 #define BIOS_SIZE (2 * MiB)
@@ -129,6 +130,8 @@ static void ref405ep_fpga_init(MemoryRegion *sysmem, uint32_t base)
     ref405ep_fpga_t *fpga;
     MemoryRegion *fpga_memory = g_new(MemoryRegion, 1);
 
+    qdev_warn_deprecated_function_used();
+
     fpga = g_malloc0(sizeof(ref405ep_fpga_t));
     memory_region_init_io(fpga_memory, NULL, &ref405ep_fpga_ops, fpga,
                           "fpga", 0x00000100);
@@ -408,6 +411,8 @@ static void taihu_cpld_init(MemoryRegion *sysmem, uint32_t base)
     taihu_cpld_t *cpld;
     MemoryRegion *cpld_memory = g_new(MemoryRegion, 1);
 
+    qdev_warn_deprecated_function_used();
+
     cpld = g_malloc0(sizeof(taihu_cpld_t));
     memory_region_init_io(cpld_memory, NULL, &taihu_cpld_ops, cpld, "cpld", 0x100);
     memory_region_add_subregion(sysmem, base, cpld_memory);
hw/ppc/ppc405_uc.c +21 -0
index 381720aced..160604c62e 100644
@@ -36,6 +36,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/log.h"
 #include "exec/address-spaces.h"
+#include "hw/qdev-deprecated.h"
 
 //#define DEBUG_OPBA
 //#define DEBUG_SDRAM
@@ -182,6 +183,8 @@ void ppc4xx_plb_init(CPUPPCState *env)
 {
     ppc4xx_plb_t *plb;
 
+    qdev_warn_deprecated_function_used();
+
     plb = g_malloc0(sizeof(ppc4xx_plb_t));
     ppc_dcr_register(env, PLB3A0_ACR, plb, &dcr_read_plb, &dcr_write_plb);
     ppc_dcr_register(env, PLB4A0_ACR, plb, &dcr_read_plb, &dcr_write_plb);
@@ -267,6 +270,8 @@ static void ppc4xx_pob_init(CPUPPCState *env)
 {
     ppc4xx_pob_t *pob;
 
+    qdev_warn_deprecated_function_used();
+
     pob = g_malloc0(sizeof(ppc4xx_pob_t));
     ppc_dcr_register(env, POB0_BEAR, pob, &dcr_read_pob, &dcr_write_pob);
     ppc_dcr_register(env, POB0_BESR0, pob, &dcr_read_pob, &dcr_write_pob);
@@ -351,6 +356,8 @@ static void ppc4xx_opba_init(hwaddr base)
 {
     ppc4xx_opba_t *opba;
 
+    qdev_warn_deprecated_function_used();
+
     opba = g_malloc0(sizeof(ppc4xx_opba_t));
 #ifdef DEBUG_OPBA
     printf("%s: offset " TARGET_FMT_plx "\n", __func__, base);
@@ -549,6 +556,8 @@ void ppc405_ebc_init(CPUPPCState *env)
 {
     ppc4xx_ebc_t *ebc;
 
+    qdev_warn_deprecated_function_used();
+
     ebc = g_malloc0(sizeof(ppc4xx_ebc_t));
     qemu_register_reset(&ebc_reset, ebc);
     ppc_dcr_register(env, EBC0_CFGADDR,
@@ -632,6 +641,8 @@ static void ppc405_dma_init(CPUPPCState *env, qemu_irq irqs[4])
 {
     ppc405_dma_t *dma;
 
+    qdev_warn_deprecated_function_used();
+
     dma = g_malloc0(sizeof(ppc405_dma_t));
     memcpy(dma->irqs, irqs, 4 * sizeof(qemu_irq));
     qemu_register_reset(&ppc405_dma_reset, dma);
@@ -735,6 +746,8 @@ static void ppc405_gpio_init(hwaddr base)
 {
     ppc405_gpio_t *gpio;
 
+    qdev_warn_deprecated_function_used();
+
     gpio = g_malloc0(sizeof(ppc405_gpio_t));
 #ifdef DEBUG_GPIO
     printf("%s: offset " TARGET_FMT_plx "\n", __func__, base);
@@ -897,6 +910,8 @@ static void ppc405_ocm_init(CPUPPCState *env)
 {
     ppc405_ocm_t *ocm;
 
+    qdev_warn_deprecated_function_used();
+
     ocm = g_malloc0(sizeof(ppc405_ocm_t));
     /* XXX: Size is 4096 or 0x04000000 */
     memory_region_init_ram(&ocm->isarc_ram, NULL, "ppc405.ocm", 4 * KiB,
@@ -1142,6 +1157,8 @@ static void ppc4xx_gpt_init(hwaddr base, qemu_irq irqs[5])
     ppc4xx_gpt_t *gpt;
     int i;
 
+    qdev_warn_deprecated_function_used();
+
     gpt = g_malloc0(sizeof(ppc4xx_gpt_t));
     for (i = 0; i < 5; i++) {
         gpt->irqs[i] = irqs[i];
@@ -1410,6 +1427,8 @@ static void ppc405cr_cpc_init (CPUPPCState *env, clk_setup_t clk_setup[7],
 {
     ppc405cr_cpc_t *cpc;
 
+    qdev_warn_deprecated_function_used();
+
     cpc = g_malloc0(sizeof(ppc405cr_cpc_t));
     memcpy(cpc->clk_setup, clk_setup,
            PPC405CR_CLK_NB * sizeof(clk_setup_t));
@@ -1755,6 +1774,8 @@ static void ppc405ep_cpc_init (CPUPPCState *env, clk_setup_t clk_setup[8],
 {
     ppc405ep_cpc_t *cpc;
 
+    qdev_warn_deprecated_function_used();
+
     cpc = g_malloc0(sizeof(ppc405ep_cpc_t));
     memcpy(cpc->clk_setup, clk_setup,
            PPC405EP_CLK_NB * sizeof(clk_setup_t));
hw/ppc/ppc4xx_devs.c +7 -0
index f1651e04d9..b09d7ab5c6 100644
@@ -33,6 +33,7 @@
 #include "qemu/log.h"
 #include "exec/address-spaces.h"
 #include "qemu/error-report.h"
+#include "hw/qdev-deprecated.h"
 
 /*#define DEBUG_UIC*/
 
@@ -303,6 +304,8 @@ qemu_irq *ppcuic_init (CPUPPCState *env, qemu_irq *irqs,
     ppcuic_t *uic;
     int i;
 
+    qdev_warn_deprecated_function_used();
+
     uic = g_malloc0(sizeof(ppcuic_t));
     uic->dcr_base = dcr_base;
     uic->irqs = irqs;
@@ -647,6 +650,8 @@ void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq irq, int nbanks,
 {
     ppc4xx_sdram_t *sdram;
 
+    qdev_warn_deprecated_function_used();
+
     sdram = g_malloc0(sizeof(ppc4xx_sdram_t));
     sdram->irq = irq;
     sdram->nbanks = nbanks;
@@ -908,6 +913,8 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum,
     ppc4xx_mal_t *mal;
     int i;
 
+    qdev_warn_deprecated_function_used();
+
     assert(txcnum <= 32 && rxcnum <= 32);
     mal = g_malloc0(sizeof(*mal));
     mal->txcnum = txcnum;
Signature · 1 line
2.21.3
#41 lore raw

RFC PATCH 29/35 hw/ppc/ppc_booke: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/ppc/ppc_booke.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/ppc_booke.c +3 -1
index 652a21b806..a9e5e68578 100644
@@ -31,7 +31,7 @@
 #include "qemu/log.h"
 #include "hw/loader.h"
 #include "kvm_ppc.h"
-
+#include "hw/qdev-deprecated.h"
 
 /* Timer Control Register */
 
@@ -338,6 +338,8 @@ void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags)
     booke_timer_t *booke_timer;
     int ret = 0;
 
+    qdev_warn_deprecated_function_used();
+
     tb_env      = g_malloc0(sizeof(ppc_tb_t));
     booke_timer = g_malloc0(sizeof(booke_timer_t));
 
Signature · 1 line
2.21.3
#42 lore raw

Re: [RFC PATCH 29/35] hw/ppc/ppc_booke: Emit warning when old code is used

Quoted 22 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/ppc/ppc_booke.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/ppc_booke.c +1 -1
index 652a21b806..a9e5e68578 100644
@@ -31,7 +31,7 @@
 #include "qemu/log.h"
 #include "hw/loader.h"
 #include "kvm_ppc.h"
-
+#include "hw/qdev-deprecated.h"
 
 /* Timer Control Register */
 

hw/ppc/ppc_booke.c void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags) · line 345

Quoted 8 lines
hw/ppc/ppc_booke.c +2 -0
@@ -338,6 +338,8 @@ void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags)
     booke_timer_t *booke_timer;
     int ret = 0;
 
+    qdev_warn_deprecated_function_used();
+
     tb_env      = g_malloc0(sizeof(ppc_tb_t));
     booke_timer = g_malloc0(sizeof(booke_timer_t));
 

This one is okay.

Paolo

#43 lore raw

RFC PATCH 30/35 hw/ppc/virtex_ml507: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/ppc/virtex_ml507.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/virtex_ml507.c +3 -1
index 0dacfcd236..17b8036c38 100644
@@ -40,7 +40,7 @@
 #include "qemu/log.h"
 #include "qemu/option.h"
 #include "exec/address-spaces.h"
-
+#include "hw/qdev-deprecated.h"
 #include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
 #include "hw/qdev-properties.h"
@@ -95,6 +95,8 @@ static PowerPCCPU *ppc440_init_xilinx(const char *cpu_type, uint32_t sysclk)
     CPUPPCState *env;
     qemu_irq *irqs;
 
+    qdev_warn_deprecated_function_used();
+
     cpu = POWERPC_CPU(cpu_create(cpu_type));
     env = &cpu->env;
 
Signature · 1 line
2.21.3
#44 lore raw

Re: [RFC PATCH 30/35] hw/ppc/virtex_ml507: Emit warning when old code is used

Quoted 22 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/ppc/virtex_ml507.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/virtex_ml507.c +1 -1
index 0dacfcd236..17b8036c38 100644
@@ -40,7 +40,7 @@
 #include "qemu/log.h"
 #include "qemu/option.h"
 #include "exec/address-spaces.h"
-
+#include "hw/qdev-deprecated.h"
 #include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
 #include "hw/qdev-properties.h"

hw/ppc/virtex_ml507.c static PowerPCCPU *ppc440_init_xilinx(const char *cpu_type, uint32_t sysclk) · line 102

Quoted 8 lines
hw/ppc/virtex_ml507.c +2 -0
@@ -95,6 +95,8 @@ static PowerPCCPU *ppc440_init_xilinx(const char *cpu_type, uint32_t sysclk)
     CPUPPCState *env;
     qemu_irq *irqs;
 
+    qdev_warn_deprecated_function_used();
+
     cpu = POWERPC_CPU(cpu_create(cpu_type));
     env = &cpu->env;
 

This one is okay.

Paolo

#45 lore raw

RFC PATCH 31/35 hw/sh4: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/char/sh_serial.c | 3 +++
 hw/intc/sh_intc.c   | 3 +++
 hw/sh4/r2d.c        | 3 +++
 hw/sh4/sh7750.c     | 4 ++++
 hw/timer/sh_timer.c | 5 +++++
 5 files changed, 18 insertions(+)
hw/char/sh_serial.c +3 -0
index 167f4d8cb9..9366a23dd2 100644
@@ -31,6 +31,7 @@
 #include "chardev/char-fe.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
+#include "hw/qdev-deprecated.h"
 
 //#define DEBUG_SERIAL
 
@@ -382,6 +383,8 @@ void sh_serial_init(MemoryRegion *sysmem,
 {
     sh_serial_state *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_malloc0(sizeof(sh_serial_state));
 
     s->feat = feat;
hw/intc/sh_intc.c +3 -0
index 72a55e32dd..c90fbf47bb 100644
@@ -13,6 +13,7 @@
 #include "hw/sh4/sh_intc.h"
 #include "hw/irq.h"
 #include "hw/sh4/sh.h"
+#include "hw/qdev-deprecated.h"
 
 //#define DEBUG_INTC
 //#define DEBUG_INTC_SOURCES
@@ -444,6 +445,8 @@ int sh_intc_init(MemoryRegion *sysmem,
 {
     unsigned int i, j;
 
+    qdev_warn_deprecated_function_used();
+
     desc->pending = 0;
     desc->nr_sources = nr_sources;
     desc->mask_regs = mask_regs;
hw/sh4/r2d.c +3 -0
index 72bb5285cc..22bbbe7d3c 100644
@@ -43,6 +43,7 @@
 #include "hw/usb.h"
 #include "hw/block/flash.h"
 #include "exec/address-spaces.h"
+#include "hw/qdev-deprecated.h"
 
 #define FLASH_BASE 0x00000000
 #define FLASH_SIZE (16 * MiB)
@@ -187,6 +188,8 @@ static qemu_irq *r2d_fpga_init(MemoryRegion *sysmem,
 {
     r2d_fpga_t *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_malloc0(sizeof(r2d_fpga_t));
 
     s->irl = irl;
hw/sh4/sh7750.c +4 -0
index d660714443..379822e0c2 100644
@@ -32,6 +32,7 @@
 #include "hw/sh4/sh_intc.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
+#include "hw/qdev-deprecated.h"
 
 #define NB_DEVICES 4
 
@@ -756,6 +757,8 @@ SH7750State *sh7750_init(SuperHCPU *cpu, MemoryRegion *sysmem)
 {
     SH7750State *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = g_malloc0(sizeof(SH7750State));
     s->cpu = cpu;
     s->periph_freq = 60000000;	/* 60MHz */
@@ -866,6 +869,7 @@ SH7750State *sh7750_init(SuperHCPU *cpu, MemoryRegion *sysmem)
 
 qemu_irq sh7750_irl(SH7750State *s)
 {
+    qdev_warn_deprecated_function_used();
     sh_intc_toggle_source(sh_intc_source(&s->intc, IRL), 1, 0); /* enable */
     return qemu_allocate_irq(sh_intc_set_irl, sh_intc_source(&s->intc, IRL), 0);
 }
hw/timer/sh_timer.c +5 -0
index 13c4051808..d5e33507b0 100644
@@ -14,6 +14,7 @@
 #include "hw/sh4/sh.h"
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
+#include "hw/qdev-deprecated.h"
 
 //#define DEBUG_TIMER
 
@@ -199,6 +200,8 @@ static void *sh_timer_init(uint32_t freq, int feat, qemu_irq irq)
 {
     sh_timer_state *s;
 
+    qdev_warn_deprecated_function_used();
+
     s = (sh_timer_state *)g_malloc0(sizeof(sh_timer_state));
     s->freq = freq;
     s->feat = feat;
@@ -319,6 +322,8 @@ void tmu012_init(MemoryRegion *sysmem, hwaddr base,
     tmu012_state *s;
     int timer_feat = (feat & TMU012_FEAT_EXTCLK) ? TIMER_FEAT_EXTCLK : 0;
 
+    qdev_warn_deprecated_function_used();
+
     s = (tmu012_state *)g_malloc0(sizeof(tmu012_state));
     s->feat = feat;
     s->timer[0] = sh_timer_init(freq, timer_feat, ch0_irq);
Signature · 1 line
2.21.3
#46 lore raw

RFC PATCH 32/35 hw/riscv: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/riscv/riscv_htif.c  | 4 ++++
 hw/riscv/sifive_uart.c | 4 ++++
 2 files changed, 8 insertions(+)
hw/riscv/riscv_htif.c +4 -0
index ca87a5cf9f..bd080dbefb 100644
@@ -30,6 +30,7 @@
 #include "hw/riscv/riscv_htif.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
+#include "hw/qdev-deprecated.h"
 
 #define RISCV_DEBUG_HTIF 0
 #define HTIF_DEBUG(fmt, ...)                                                   \
@@ -238,6 +239,9 @@ HTIFState *htif_mm_init(MemoryRegion *address_space, MemoryRegion *main_mem,
     uint64_t fromhost_offset = fromhost_addr - base;
 
     HTIFState *s = g_malloc0(sizeof(HTIFState));
+
+    qdev_warn_deprecated_function_used();
+
     s->address_space = address_space;
     s->main_mem = main_mem;
     s->main_mem_ram_ptr = memory_region_get_ram_ptr(main_mem);
hw/riscv/sifive_uart.c +4 -0
index 9350482662..1a5890d5f7 100644
@@ -25,6 +25,7 @@
 #include "hw/hw.h"
 #include "hw/irq.h"
 #include "hw/riscv/sifive_uart.h"
+#include "hw/qdev-deprecated.h"
 
 /*
  * Not yet implemented:
@@ -183,6 +184,9 @@ SiFiveUARTState *sifive_uart_create(MemoryRegion *address_space, hwaddr base,
     Chardev *chr, qemu_irq irq)
 {
     SiFiveUARTState *s = g_malloc0(sizeof(SiFiveUARTState));
+
+    qdev_warn_deprecated_function_used();
+
     s->irq = irq;
     qemu_chr_fe_init(&s->chr, chr, &error_abort);
     qemu_chr_fe_set_handlers(&s->chr, uart_can_rx, uart_rx, uart_event,
Signature · 1 line
2.21.3
Reviewed-by on v1 32/35
#47 lore raw

Re: [RFC PATCH 32/35] hw/riscv: Emit warning when old code is used

Quoted 44 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/riscv/riscv_htif.c  | 4 ++++
 hw/riscv/sifive_uart.c | 4 ++++
 2 files changed, 8 insertions(+)
hw/riscv/riscv_htif.c +4 -0
index ca87a5cf9f..bd080dbefb 100644
@@ -30,6 +30,7 @@
 #include "hw/riscv/riscv_htif.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
+#include "hw/qdev-deprecated.h"
 
 #define RISCV_DEBUG_HTIF 0
 #define HTIF_DEBUG(fmt, ...)                                                   \
@@ -238,6 +239,9 @@ HTIFState *htif_mm_init(MemoryRegion *address_space, MemoryRegion *main_mem,
     uint64_t fromhost_offset = fromhost_addr - base;
 
     HTIFState *s = g_malloc0(sizeof(HTIFState));
+
+    qdev_warn_deprecated_function_used();
+
     s->address_space = address_space;
     s->main_mem = main_mem;
     s->main_mem_ram_ptr = memory_region_get_ram_ptr(main_mem);
hw/riscv/sifive_uart.c +1 -0
index 9350482662..1a5890d5f7 100644
@@ -25,6 +25,7 @@
 #include "hw/hw.h"
 #include "hw/irq.h"
 #include "hw/riscv/sifive_uart.h"
+#include "hw/qdev-deprecated.h"
 
 /*
  * Not yet implemented:

hw/riscv/sifive_uart.c SiFiveUARTState *sifive_uart_create(MemoryRegion *address_space, hwaddr base, · line 192

Quoted 9 lines
hw/riscv/sifive_uart.c +3 -0
@@ -183,6 +184,9 @@ SiFiveUARTState *sifive_uart_create(MemoryRegion *address_space, hwaddr base,
     Chardev *chr, qemu_irq irq)
 {
     SiFiveUARTState *s = g_malloc0(sizeof(SiFiveUARTState));
+
+    qdev_warn_deprecated_function_used();
+
     s->irq = irq;
     qemu_chr_fe_init(&s->chr, chr, &error_abort);
     qemu_chr_fe_set_handlers(&s->chr, uart_can_rx, uart_rx, uart_event,

Not sure why this code was accepted, furthermore it should have been in hw/char.

Paolo

#48 lore raw

RFC PATCH 33/35 hw/timer/slavio_timer: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/timer/slavio_timer.c | 3 +++
 1 file changed, 3 insertions(+)
hw/timer/slavio_timer.c +3 -0
index 4c5d65e391..16f21669bf 100644
@@ -31,6 +31,7 @@
 #include "migration/vmstate.h"
 #include "trace.h"
 #include "qemu/module.h"
+#include "hw/qdev-deprecated.h"
 
 /*
  * Registers of hardware timer in sun4m.
@@ -392,6 +393,8 @@ static void slavio_timer_init(Object *obj)
     unsigned int i;
     TimerContext *tc;
 
+    qdev_warn_deprecated_function_used();
+
     for (i = 0; i <= MAX_CPUS; i++) {
         uint64_t size;
         char timer_name[20];
Signature · 1 line
2.21.3
#49 lore raw

Re: [RFC PATCH 33/35] hw/timer/slavio_timer: Emit warning when old code is used

Quoted 21 lines · Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/timer/slavio_timer.c | 3 +++
 1 file changed, 3 insertions(+)
hw/timer/slavio_timer.c +1 -0
index 4c5d65e391..16f21669bf 100644
@@ -31,6 +31,7 @@
 #include "migration/vmstate.h"
 #include "trace.h"
 #include "qemu/module.h"
+#include "hw/qdev-deprecated.h"
 
 /*
  * Registers of hardware timer in sun4m.

hw/timer/slavio_timer.c static void slavio_timer_init(Object *obj) · line 400

Quoted 8 lines
hw/timer/slavio_timer.c +2 -0
@@ -392,6 +393,8 @@ static void slavio_timer_init(Object *obj)
     unsigned int i;
     TimerContext *tc;
 
+    qdev_warn_deprecated_function_used();
+
     for (i = 0; i <= MAX_CPUS; i++) {
         uint64_t size;
         char timer_name[20];

This one is okay.

Paolo

#50 lore raw

RFC PATCH 34/35 hw/usb/hcd-musb: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/usb/hcd-musb.c | 3 +++
 1 file changed, 3 insertions(+)
hw/usb/hcd-musb.c +3 -0
index c29fbef6fc..9b3cf1ca8f 100644
@@ -25,6 +25,7 @@
 #include "hw/usb.h"
 #include "hw/irq.h"
 #include "hw/hw.h"
+#include "hw/qdev-deprecated.h"
 
 /* Common USB registers */
 #define MUSB_HDRC_FADDR		0x00	/* 8-bit */
@@ -377,6 +378,8 @@ struct MUSBState *musb_init(DeviceState *parent_device, int gpio_base)
     MUSBState *s = g_malloc0(sizeof(*s));
     int i;
 
+    qdev_warn_deprecated_function_used();
+
     for (i = 0; i < musb_irq_max; i++) {
         s->irqs[i] = qdev_get_gpio_in(parent_device, gpio_base + i);
     }
Signature · 1 line
2.21.3
#51 lore raw

RFC PATCH 35/35 hw/xtensa/xtfpga: Emit warning when old code is used

In reply to Philippe Mathieu-Daudé

This code hasn't been QOM'ified yet. Warn the user.

---
 hw/xtensa/xtfpga.c | 3 +++
 1 file changed, 3 insertions(+)
hw/xtensa/xtfpga.c +3 -0
index 60ccc74f5f..a3c82dc81a 100644
@@ -50,6 +50,7 @@
 #include "xtensa_memory.h"
 #include "hw/xtensa/mx_pic.h"
 #include "migration/vmstate.h"
+#include "hw/qdev-deprecated.h"
 
 typedef struct XtfpgaFlashDesc {
     hwaddr base;
@@ -129,6 +130,8 @@ static XtfpgaFpgaState *xtfpga_fpga_init(MemoryRegion *address_space,
 {
     XtfpgaFpgaState *s = g_malloc(sizeof(XtfpgaFpgaState));
 
+    qdev_warn_deprecated_function_used();
+
     memory_region_init_io(&s->iomem, NULL, &xtfpga_fpga_ops, s,
                           "xtfpga.fpga", 0x10000);
     memory_region_add_subregion(address_space, base, &s->iomem);
Signature · 1 line
2.21.3
#52 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Based on today's IRC chat, this is a trivial RFC series to anotate pre-qdev/QOM devices so developers using them without knowing they are not QOM'ified yet can realize it and convert them if they have time.

What mechanism did you use for identifying non-QOM devices?

thanks
-- PMM

#53 lore raw
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Philippe Mathieu-Daudé

Based on today's IRC chat, this is a trivial RFC series to anotate pre-qdev/QOM devices so developers using them without knowing they are not QOM'ified yet can realize it and convert them if they have time.

What mechanism did you use for identifying non-QOM devices?

I don't think this is the complete list, this is only all the one I could find with:

  $ git grep "g_new|g_malloc" hw/

Then on each match I manually reviewed (so I might have incorrectly flagged code too).

#54 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Philippe Mathieu-Daudé

Based on today's IRC chat, this is a trivial RFC series to anotate pre-qdev/QOM devices so developers using them without knowing they are not QOM'ified yet can realize it and convert them if they have time.

What mechanism did you use for identifying non-QOM devices?

Quoted 7 lines

I don't think this is the complete list, this is only all the one I could find with:

  $ git grep "g_new|g_malloc" hw/

Then on each match I manually reviewed (so I might have incorrectly flagged code too).

Yes, you did, but I guess for an RFC it was a good bang for the buck. I went through the patch and noticed both a few false positives and a couple blatant violations in recent code.

Paolo