[PATCH v5 00/37] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR

Marc-André Lureau posted 37 patches 4 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20191220134601.571905-1-marcandre.lureau@redhat.com
Test asan failed
Test checkpatch failed
Test FreeBSD failed
Test docker-mingw@fedora failed
Test docker-clang@ubuntu failed
Test docker-quick@centos7 failed
Maintainers: Paul Burton <pburton@wavecomp.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, Artyom Tarasenko <atar4qemu@gmail.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Aleksandar Markovic <amarkovic@wavecomp.com>, Corey Minyard <cminyard@mvista.com>, "Hervé Poussineau" <hpoussin@reactos.org>, Aurelien Jarno <aurelien@aurel32.net>, Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Peter Maydell <peter.maydell@linaro.org>, Laurent Vivier <laurent@vivier.eu>, Paolo Bonzini <pbonzini@redhat.com>, BALATON Zoltan <balaton@eik.bme.hu>, Eduardo Habkost <ehabkost@redhat.com>, Magnus Damm <magnus.damm@gmail.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Fabien Chouteau <chouteau@adacore.com>, KONRAD Frederic <frederic.konrad@adacore.com>, Richard Henderson <rth@twiddle.net>
chardev/char.c               |  32 ++++--
hw/arm/omap1.c               |   8 +-
hw/arm/omap2.c               |  25 ++---
hw/char/omap_uart.c          |   2 +-
hw/char/serial-isa.c         |  12 ++-
hw/char/serial-pci-multi.c   |  55 +++++++----
hw/char/serial-pci.c         |  18 +++-
hw/char/serial.c             | 182 +++++++++++++++++++++++++++++------
hw/core/qdev-properties.c    |  18 ----
hw/core/qdev.c               |  15 +--
hw/core/sysbus.c             |  32 ------
hw/cris/axis_dev88.c         |   4 -
hw/display/sm501.c           |  31 ++++--
hw/dma/sparc32_dma.c         |   2 +-
hw/gpio/omap_gpio.c          |  42 +++-----
hw/i2c/omap_i2c.c            |  19 ++--
hw/i2c/smbus_eeprom.c        |  18 ++--
hw/i386/pc.c                 |   7 +-
hw/i386/vmmouse.c            |   8 +-
hw/input/pckbd.c             |   8 +-
hw/intc/etraxfs_pic.c        |  26 +----
hw/intc/grlib_irqmp.c        |  35 +------
hw/intc/omap_intc.c          |  17 ++--
hw/m68k/q800.c               |   3 +-
hw/mips/boston.c             |   2 +-
hw/mips/cps.c                |   2 +-
hw/mips/mips_jazz.c          |   3 +-
hw/mips/mips_malta.c         |   2 +-
hw/mips/mips_mipssim.c       |  14 ++-
hw/net/dp8393x.c             |   7 +-
hw/net/etraxfs_eth.c         |  44 ++++++---
hw/net/lance.c               |   5 +-
hw/net/pcnet-pci.c           |   2 +-
hw/net/pcnet.h               |   2 +-
hw/sh4/r2d.c                 |   2 +-
hw/sparc/leon3.c             |  15 ++-
include/hw/arm/omap.h        |  52 ++++++++++
include/hw/char/serial.h     |  43 ++++++---
include/hw/cris/etraxfs.h    |  20 +---
include/hw/input/i8042.h     |   4 +-
include/hw/qdev-properties.h |  24 -----
include/hw/sysbus.h          |  13 +--
include/qemu/id.h            |   1 +
qom/qom-qmp-cmds.c           |  10 --
target/cris/cpu.c            |   8 ++
target/cris/cpu.h            |   1 +
util/id.c                    |   1 +
47 files changed, 507 insertions(+), 389 deletions(-)
[PATCH v5 00/37] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR
Posted by Marc-André Lureau 4 years, 4 months ago
Hi,

QDEV_PROP_PTR is marked in multiple places as "FIXME/TODO/remove
me". In most cases, it can be easily replaced with QDEV_PROP_LINK when
the pointer points to an Object.

There are a few places where such substitution isn't possible. For
those places, it seems reasonable to use a specific setter method
instead, and keep the user_creatable = false. In other places,
proper usage of qdev or other facilies is the solution.

The serial code wasn't converted to qdev, which makes it a bit more
archaic to deal with. Let's convert it first, so we can more easily
embed it from other devices, and re-export some properties and drop
QDEV_PROP_PTR usage.

List of patches missing reviews/ack:
- "chardev: generate an internal id when none given"
- "serial: register vmsd with DeviceClass"
- "serial: start making SerialMM a sysbus device"
- "sm501: make SerialMM a child, export chardev property"
- "qdev/qom: remove some TODO limitations now that PROP_PTR is gone"

v5:
 - dropped "qdev: remove unused qdev_prop_int64"
 - move qdev serial realize to serial_mm_realize()
 - fix "leon3: use qdev gpio facilities for the PIL", s/env/cpu
 - various comments / commit message tweaks
 - added r-b tags

v4: (after Peter & Philippe reviews)
 - replaced "self" variable names with abbreviations
 - split "mips: inline serial_init()"
 - new patches: "mips: use sysbus_mmio_get_region() instead of internal
   fields", "leon3: use qdev gpio facilities for the PIL", "qdev: use
   g_strcmp0() instead of open-coding it", "qdev/qom: remove some TODO
   limitations now that PROP_PTR is gone"
 - dropped patches: "sparc: move PIL irq handling to cpu.c" & "serial:
   add "instance-id" property"
 - various comments / commit message tweaks
 - added r-b tags

v3:
 - introduce SerialMM and SerialIO sysbus devices
 - remove serial_mm_connect introduced in v2
 - replace "base" property introduced in v2, use "instance-id" for
   vmstate purpose only
 - add a few preliminary clean-ups

v2:
 - qom-ify serial
 - embed the serial from sm501, and expose a "chardev" property
 - add "leon3: use qemu_irq framework instead of callback as property"
 - add "sparc: move PIL irq handling to cpu.c"
 - add "cris: improve passing PIC interrupt vector to the CPU"
 - misc comment/todo changes, add r-b tags

Marc-André Lureau (36):
  sysbus: remove unused sysbus_try_create*
  sysbus: remove outdated comment
  chardev: generate an internal id when none given
  serial-pci-multi: factor out multi_serial_get_port_count()
  serial: initial qom-ification
  serial: register vmsd with DeviceClass
  serial: add "chardev" property
  serial: add "baudbase" property
  serial: realize the serial device
  serial: replace serial_exit_core() with unrealize
  serial: start making SerialMM a sysbus device
  serial-mm: add "regshift" property
  serial-mm: add endianness property
  serial-mm: use sysbus facilities
  serial: make SerialIO a sysbus device
  mips: inline serial_init()
  mips: baudbase is 115200 by default
  mips: use sysbus_add_io()
  mips: use sysbus_mmio_get_region() instead of internal fields
  sm501: make SerialMM a child, export chardev property
  vmmouse: replace PROP_PTR with PROP_LINK
  lance: replace PROP_PTR with PROP_LINK
  etraxfs: remove PROP_PTR usage
  dp8393x: replace PROP_PTR with PROP_LINK
  leon3: use qemu_irq framework instead of callback as property
  leon3: use qdev gpio facilities for the PIL
  qdev: use g_strcmp0() instead of open-coding it
  mips/cps: fix setting saar property
  cris: improve passing PIC interrupt vector to the CPU
  smbus-eeprom: remove PROP_PTR
  omap-intc: remove PROP_PTR
  omap-i2c: remove PROP_PTR
  omap-gpio: remove PROP_PTR
  qdev: remove PROP_MEMORY_REGION
  qdev: remove QDEV_PROP_PTR
  qdev/qom: remove some TODO limitations now that PROP_PTR is gone

Philippe Mathieu-Daudé (1):
  hw/display/sm501: Always map the UART0

 chardev/char.c               |  32 ++++--
 hw/arm/omap1.c               |   8 +-
 hw/arm/omap2.c               |  25 ++---
 hw/char/omap_uart.c          |   2 +-
 hw/char/serial-isa.c         |  12 ++-
 hw/char/serial-pci-multi.c   |  55 +++++++----
 hw/char/serial-pci.c         |  18 +++-
 hw/char/serial.c             | 182 +++++++++++++++++++++++++++++------
 hw/core/qdev-properties.c    |  18 ----
 hw/core/qdev.c               |  15 +--
 hw/core/sysbus.c             |  32 ------
 hw/cris/axis_dev88.c         |   4 -
 hw/display/sm501.c           |  31 ++++--
 hw/dma/sparc32_dma.c         |   2 +-
 hw/gpio/omap_gpio.c          |  42 +++-----
 hw/i2c/omap_i2c.c            |  19 ++--
 hw/i2c/smbus_eeprom.c        |  18 ++--
 hw/i386/pc.c                 |   7 +-
 hw/i386/vmmouse.c            |   8 +-
 hw/input/pckbd.c             |   8 +-
 hw/intc/etraxfs_pic.c        |  26 +----
 hw/intc/grlib_irqmp.c        |  35 +------
 hw/intc/omap_intc.c          |  17 ++--
 hw/m68k/q800.c               |   3 +-
 hw/mips/boston.c             |   2 +-
 hw/mips/cps.c                |   2 +-
 hw/mips/mips_jazz.c          |   3 +-
 hw/mips/mips_malta.c         |   2 +-
 hw/mips/mips_mipssim.c       |  14 ++-
 hw/net/dp8393x.c             |   7 +-
 hw/net/etraxfs_eth.c         |  44 ++++++---
 hw/net/lance.c               |   5 +-
 hw/net/pcnet-pci.c           |   2 +-
 hw/net/pcnet.h               |   2 +-
 hw/sh4/r2d.c                 |   2 +-
 hw/sparc/leon3.c             |  15 ++-
 include/hw/arm/omap.h        |  52 ++++++++++
 include/hw/char/serial.h     |  43 ++++++---
 include/hw/cris/etraxfs.h    |  20 +---
 include/hw/input/i8042.h     |   4 +-
 include/hw/qdev-properties.h |  24 -----
 include/hw/sysbus.h          |  13 +--
 include/qemu/id.h            |   1 +
 qom/qom-qmp-cmds.c           |  10 --
 target/cris/cpu.c            |   8 ++
 target/cris/cpu.h            |   1 +
 util/id.c                    |   1 +
 47 files changed, 507 insertions(+), 389 deletions(-)

-- 
2.24.0.308.g228f53135a