mbox series

[RFC,00/35] hw/qdev: Warn when using pre-qdev/QOM devices

Message ID 20200608160044.15531-1-philmd@redhat.com (mailing list archive)
Headers show
Series hw/qdev: Warn when using pre-qdev/QOM devices | expand

Message

Philippe Mathieu-Daudé June 8, 2020, 4 p.m. UTC
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

Comments

Peter Maydell June 8, 2020, 4:14 p.m. UTC | #1
On Mon, 8 Jun 2020 at 17:00, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> 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
Philippe Mathieu-Daudé June 8, 2020, 4:17 p.m. UTC | #2
On 6/8/20 6:14 PM, Peter Maydell wrote:
> On Mon, 8 Jun 2020 at 17:00, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> 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).
Paolo Bonzini June 9, 2020, 11:14 a.m. UTC | #3
On 08/06/20 18:17, Philippe Mathieu-Daudé wrote:
> On 6/8/20 6:14 PM, Peter Maydell wrote:
>> On Mon, 8 Jun 2020 at 17:00, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>>
>>> 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).

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