Re: [PATCH for-6.2 11/12] [automated] Use OBJECT_DECLARE_TYPE when possible
On 8/6/21 11:11 PM, Eduardo Habkost wrote: > Replace typedefs + DECLARE_OBJ_CHECKERS with equivalent > OBJECT_DECLARE_TYPE macro. > > Generated using: > > $ ./scripts/codeconverter/converter.py -i \ > --pattern=AddObjectDeclareType $(git grep -l '' -- '*.[ch]') > > Signed-off-by: Eduardo Habkost > --- > Cc: John Snow > Cc: Kevin Wolf > Cc: Max Reitz > Cc: Gerd Hoffmann > Cc: "Daniel P. Berrangé" > Cc: David Gibson > Cc: Greg Kurz > Cc: "Cédric Le Goater" > Cc: Richard Henderson > Cc: Paolo Bonzini > Cc: qemu-block@nongnu.org > Cc: qemu-de...@nongnu.org > Cc: qemu-...@nongnu.org > --- > hw/usb/u2f.h| 6 +- > include/crypto/tlscreds.h | 5 + > include/hw/ppc/spapr_drc.h | 5 + > include/hw/ppc/spapr_xive.h | 5 + > include/qemu/accel.h| 4 +--- > hw/block/fdc-sysbus.c | 5 + > 6 files changed, 6 insertions(+), 24 deletions(-) Reviewed-by: Philippe Mathieu-Daudé
Re: [PATCH for-6.2 12/12] [automated] Use OBJECT_DECLARE_SIMPLE_TYPE when possible
On 8/6/21 11:11 PM, Eduardo Habkost wrote: > Replace typedef + DECLARE_INSTANCE_CHECKER with > equivalent OBJECT_DECLARE_SIMPLE_TYPE macro. > > Generated using: > > $ ./scripts/codeconverter/converter.py -i \ > --pattern=AddObjectDeclareSimpleType $(git grep -l '' -- '*.[ch]') > > Signed-off-by: Eduardo Habkost > --- > Cc: Thomas Huth > Cc: Paul Burton > Cc: Aleksandar Rikalo > Cc: "Philippe Mathieu-Daudé" > Cc: Aurelien Jarno > Cc: Jiaxun Yang > Cc: Havard Skinnemoen > Cc: Tyrone Ting > Cc: Pavel Pisa > Cc: Vikram Garhwal > Cc: Jason Wang > Cc: Keith Busch > Cc: Klaus Jensen > Cc: "Michael S. Tsirkin" > Cc: Richard Henderson > Cc: David Hildenbrand > Cc: Cornelia Huck > Cc: Halil Pasic > Cc: Christian Borntraeger > Cc: Gerd Hoffmann > Cc: Vijai Kumar K > Cc: Alistair Francis > Cc: Bin Meng > Cc: Palmer Dabbelt > Cc: "Edgar E. Iglesias" > Cc: Peter Maydell > Cc: Laurent Vivier > Cc: "Cédric Le Goater" > Cc: Andrew Jeffery > Cc: Joel Stanley > Cc: Andrew Baumann > Cc: Francisco Iglesias > Cc: David Gibson > Cc: Greg Kurz > Cc: Bastian Koppelmann > Cc: qemu-de...@nongnu.org > Cc: qemu-...@nongnu.org > Cc: qemu-block@nongnu.org > Cc: qemu-s3...@nongnu.org > Cc: qemu-ri...@nongnu.org > Cc: qemu-...@nongnu.org > --- > hw/nvme/nvme.h | 10 +++--- > hw/usb/hcd-xhci-pci.h | 4 +--- > hw/usb/hcd-xhci-sysbus.h| 4 +--- > include/hw/adc/npcm7xx_adc.h| 4 +--- > include/hw/char/shakti_uart.h | 4 +--- > include/hw/dma/sifive_pdma.h| 4 +--- > include/hw/dma/xlnx_csu_dma.h | 4 +--- > include/hw/gpio/sifive_gpio.h | 4 +--- > include/hw/intc/m68k_irqc.h | 4 +--- > include/hw/intc/sifive_clint.h | 4 +--- > include/hw/intc/sifive_plic.h | 4 +--- > include/hw/misc/aspeed_lpc.h| 4 +--- > include/hw/misc/bcm2835_cprman_internals.h | 12 > include/hw/misc/led.h | 3 +-- > include/hw/misc/mchp_pfsoc_dmc.h| 8 ++-- > include/hw/misc/mchp_pfsoc_ioscb.h | 4 +--- > include/hw/misc/mchp_pfsoc_sysreg.h | 4 +--- > include/hw/misc/npcm7xx_clk.h | 3 +-- > include/hw/misc/npcm7xx_gcr.h | 4 +--- > include/hw/misc/npcm7xx_mft.h | 4 +--- > include/hw/misc/npcm7xx_pwm.h | 3 +-- > include/hw/misc/sifive_e_prci.h | 4 +--- > include/hw/misc/sifive_test.h | 4 +--- > include/hw/misc/sifive_u_otp.h | 4 +--- > include/hw/misc/sifive_u_prci.h | 4 +--- > include/hw/misc/xlnx-versal-xramc.h | 4 +--- > include/hw/net/npcm7xx_emc.h| 4 +--- > include/hw/net/xlnx-zynqmp-can.h| 4 +--- > include/hw/ppc/spapr_drc.h | 4 +--- > include/hw/register.h | 3 +-- > include/hw/riscv/microchip_pfsoc.h | 4 +--- > include/hw/riscv/shakti_c.h | 8 ++-- > include/hw/riscv/sifive_e.h | 4 +--- > include/hw/riscv/sifive_u.h | 4 +--- > include/hw/sd/cadence_sdhci.h | 4 +--- > include/hw/ssi/sifive_spi.h | 4 +--- > include/hw/timer/npcm7xx_timer.h| 3 +-- > include/hw/tricore/tricore_testdevice.h | 4 +--- > include/hw/usb/hcd-dwc3.h | 4 +--- > include/hw/usb/xlnx-versal-usb2-ctrl-regs.h | 4 +--- > hw/m68k/mcf5206.c | 4 +--- > hw/mips/boston.c| 4 +--- > hw/misc/npcm7xx_clk.c | 9 +++-- > hw/net/can/ctucan_pci.c | 4 +--- > hw/s390x/vhost-user-fs-ccw.c| 4 +--- > hw/sensor/adm1272.c | 4 +--- > hw/sensor/max34451.c| 4 +--- > 47 files changed, 56 insertions(+), 154 deletions(-) > diff --git a/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h > b/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h > index 701302ad044..2576193e673 100644 > --- a/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h > +++ b/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h > @@ -29,9 +29,7 @@ > > #define TYPE_XILINX_VERSAL_USB2_CTRL_REGS "xlnx.versal-usb2-ctrl-regs" > > -typedef struct VersalUsb2CtrlRegs VersalUsb2CtrlRegs; > -DECLARE_INSTANCE_CHECKER(VersalUsb2CtrlRegs, XILINX_VERSAL_USB2_CTRL_REGS, > - TYPE_XILINX_VERSAL_USB2_CTRL_REGS) > +OBJECT_DECLARE_SIMPLE_TYPE(VersalUsb2CtrlRegs, XILINX_VERSAL_USB2_CTRL_REGS) Unrelated to this patch, we should remove the _regs suffix from this model. Reviewed-by: Philippe Mathieu-Daudé
Re: [PATCH for-6.2 05/12] [automated] Move QOM typedefs and add missing includes
On 8/6/21 11:11 PM, Eduardo Habkost wrote: > Some typedefs and macros are defined after the type check macros. > This makes it difficult to automatically replace their > definitions with OBJECT_DECLARE_TYPE. > > Patch generated using: > > $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \ > $(git grep -l '' -- '*.[ch]') > > which will: > - split "typdef struct { ... } TypedefName" declarations > - move the typedefs and #defines above the type check macros > - add missing #include "qom/object.h" lines if necessary > > Signed-off-by: Eduardo Habkost > --- > Cc: Richard Henderson > Cc: Paolo Bonzini > Cc: "Marc-André Lureau" > Cc: Peter Maydell > Cc: Andrew Baumann > Cc: "Philippe Mathieu-Daudé" > Cc: Thomas Huth > Cc: "Michael S. Tsirkin" > Cc: Igor Mammedov > Cc: Alexander Bulekov > Cc: Bandan Das > Cc: Stefan Hajnoczi > Cc: Huacai Chen > Cc: Jiaxun Yang > Cc: Aurelien Jarno > Cc: Aleksandar Rikalo > Cc: Havard Skinnemoen > Cc: Tyrone Ting > Cc: Pavel Pisa > Cc: Vikram Garhwal > Cc: Jason Wang > Cc: Keith Busch > Cc: Klaus Jensen > Cc: Cornelia Huck > Cc: Halil Pasic > Cc: Christian Borntraeger > Cc: David Hildenbrand > Cc: Gerd Hoffmann > Cc: Vijai Kumar K > Cc: Alistair Francis > Cc: Bin Meng > Cc: Palmer Dabbelt > Cc: "Edgar E. Iglesias" > Cc: Laurent Vivier > Cc: Corey Minyard > Cc: "Cédric Le Goater" > Cc: Andrew Jeffery > Cc: Joel Stanley > Cc: Francisco Iglesias > Cc: David Gibson > Cc: Greg Kurz > Cc: Alexey Kardashevskiy > Cc: "Hervé Poussineau" > Cc: Bastian Koppelmann > Cc: Juan Quintela > Cc: "Dr. David Alan Gilbert" > Cc: "Daniel P. Berrangé" > Cc: Eduardo Habkost > Cc: Stefan Berger > Cc: Taylor Simpson > Cc: qemu-de...@nongnu.org > Cc: qemu-...@nongnu.org > Cc: qemu-block@nongnu.org > Cc: qemu-s3...@nongnu.org > Cc: qemu-ri...@nongnu.org > Cc: qemu-...@nongnu.org > --- > hw/nvme/nvme.h | 6 -- > hw/usb/hcd-uhci.h | 1 + > hw/usb/hcd-xhci-pci.h | 6 -- > hw/usb/hcd-xhci-sysbus.h| 6 -- > hw/usb/u2f.h| 6 -- > include/hw/acpi/acpi_dev_interface.h| 2 +- > include/hw/adc/npcm7xx_adc.h| 1 + > include/hw/arm/linux-boot-if.h | 2 +- > include/hw/arm/npcm7xx.h| 11 +++ > include/hw/char/shakti_uart.h | 6 -- > include/hw/core/accel-cpu.h | 1 + > include/hw/dma/sifive_pdma.h| 1 + > include/hw/dma/xlnx_csu_dma.h | 1 + > include/hw/fw-path-provider.h | 2 +- > include/hw/gpio/npcm7xx_gpio.h | 1 + > include/hw/hotplug.h| 2 +- > include/hw/i2c/npcm7xx_smbus.h | 1 + > include/hw/intc/intc.h | 2 +- > include/hw/intc/m68k_irqc.h | 6 -- > include/hw/intc/sifive_clint.h | 6 -- > include/hw/ipmi/ipmi.h | 2 +- > include/hw/mem/memory-device.h | 2 +- > include/hw/mem/npcm7xx_mc.h | 1 + > include/hw/misc/aspeed_lpc.h| 6 -- > include/hw/misc/bcm2835_cprman.h| 1 + > include/hw/misc/bcm2835_cprman_internals.h | 1 + > include/hw/misc/mchp_pfsoc_dmc.h| 1 + > include/hw/misc/mchp_pfsoc_ioscb.h | 1 + > include/hw/misc/mchp_pfsoc_sysreg.h | 1 + > include/hw/misc/npcm7xx_clk.h | 1 + > include/hw/misc/npcm7xx_gcr.h | 1 + > include/hw/misc/npcm7xx_pwm.h | 1 + > include/hw/misc/npcm7xx_rng.h | 1 + > include/hw/misc/xlnx-versal-xramc.h | 6 -- > include/hw/net/npcm7xx_emc.h| 1 + > include/hw/net/xlnx-zynqmp-can.h| 6 -- > include/hw/nmi.h| 2 +- > include/hw/nvram/npcm7xx_otp.h | 1 + > include/hw/ppc/spapr_drc.h | 15 +-- > include/hw/ppc/spapr_xive.h | 11 +++ > include/hw/ppc/vof.h| 1 + > include/hw/rdma/rdma.h | 2 +- > include/hw/riscv/microchip_pfsoc.h | 1 + > include/hw/riscv/shakti_c.h | 11 +++ > include/hw/riscv/sifive_e.h | 6 -- > include/hw/riscv/sifive_u.h | 11 +++ > include/hw/rtc/m48t59.h | 2 +- > include/hw/sd/cadence_sdhci.h | 1 + > include/hw/ssi/npcm7xx_fiu.h| 1 + > include/hw/ssi/sifive_spi.h | 6 -- > include/hw/stream.h | 2 +- > include/hw/timer/npcm7xx_timer.h| 1 + > include/hw/tricore/tricore_testdevice.h | 6 -- > include/hw/usb/hcd-dwc3.h | 6 -- > include/hw/usb/msd.h| 1 + > in
Re: [PATCH v6 1/6] qmp: add QMP command x-debug-query-virtio
QAPI schema review only. Jonah Palmer writes: > From: Laurent Vivier > > This new command lists all the instances of VirtIODevice with > their path and virtio type. > > Signed-off-by: Laurent Vivier > Reviewed-by: Eric Blake > Signed-off-by: Jonah Palmer [...] > diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json > index 4912b97..0c89789 100644 > --- a/qapi/qapi-schema.json > +++ b/qapi/qapi-schema.json > @@ -91,5 +91,6 @@ > { 'include': 'misc.json' } > { 'include': 'misc-target.json' } > { 'include': 'audio.json' } > +{ 'include': 'virtio.json' } > { 'include': 'acpi.json' } > { 'include': 'pci.json' } > diff --git a/qapi/virtio.json b/qapi/virtio.json > new file mode 100644 > index 000..804adbe > --- /dev/null > +++ b/qapi/virtio.json > @@ -0,0 +1,72 @@ Please insert at the beginning # -*- Mode: Python -*- # vim: filetype=python # > +## > +# = Virtio devices > +## > + > +## > +# @VirtioType: > +# > +# An enumeration of Virtio device types. > +# > +# Since: 6.1 6.2 now, here and below. > +## > +{ 'enum': 'VirtioType', > + 'data': [ 'unknown', 'virtio-net', 'virtio-blk', 'virtio-console', > +'virtio-rng', 'virtio-balloon', 'virtio-iomem', 'virtio-rpmsg', > +'virtio-scsi', 'virtio-9p', 'virtio-mac80211-wlan', > +'virtio-serial', 'virtio-caif', 'virtio-memory-balloon', > +'unknown-14', 'unknown-15', 'virtio-gpu', 'virtio-clock', > +'virtio-input', 'vhost-vsock', 'virtio-crypto', > 'virtio-signal-dist', > +'virtio-pstore', 'virtio-iommu', 'virtio-mem', 'unknown-25', > +'vhost-user-fs', 'virtio-pmem', 'unknown-28', > 'virtio-mac80211-hwsim' ] Please limit line length to approximately 70 characters. > +} > + > +## > +# @VirtioInfo: > +# > +# Information about a given VirtIODevice > +# > +# @path: VirtIO device canonical path. Peeking ahead at the example, I conclude this is a QOM path. Please spell that out, e.g. "@path: the device's canonical QOM path". > +# > +# @type: VirtIO device type. > +# > +# Since: 6.1 > +# > +## > +{ 'struct': 'VirtioInfo', > + 'data': { > +'path': 'str', > +'type': 'VirtioType' > + } > +} > + > +## > +# @x-debug-query-virtio: > +# > +# Return the list of all VirtIO devices > +# > +# Returns: list of @VirtioInfo > +# > +# Since: 6.1 > +# > +# Example: > +# > +# -> { "execute": "x-debug-query-virtio" } > +# <- { "return": [ > +#{ > +#"path": "/machine/peripheral-anon/device[3]/virtio-backend", > +#"type": "virtio-net" > +#}, > +#{ > +#"path": "/machine/peripheral-anon/device[1]/virtio-backend", > +#"type": "virtio-serial" > +#}, > +#{ > +#"path": "/machine/peripheral-anon/device[0]/virtio-backend", > +#"type": "virtio-blk" > +#} > +# ] > +#} > +# > +## > + > +{ 'command': 'x-debug-query-virtio', 'returns': ['VirtioInfo'] } [...]
Re: [PATCH v6 2/6] qmp: add QMP command x-debug-virtio-status
Jonah Palmer writes: > From: Laurent Vivier > > This new command shows the status of a VirtIODevice > (features, endianness and number of virtqueues) > > Next patch will improve output by decoding feature bits. > > Signed-off-by: Laurent Vivier > Signed-off-by: Jonah Palmer [...] > diff --git a/qapi/virtio.json b/qapi/virtio.json > index 804adbe..4bd09c9 100644 > --- a/qapi/virtio.json > +++ b/qapi/virtio.json > @@ -70,3 +70,79 @@ > ## > > { 'command': 'x-debug-query-virtio', 'returns': ['VirtioInfo'] } > + > +## > +# @VirtioStatusEndianness: > +# > +# Enumeration of endianness for VirtioDevice > +# > +# Since: 6.1 6.2 now, here, below, and in the remainder of this series. > +## > +{ 'enum': 'VirtioStatusEndianness', > + 'data': [ 'unknown', 'little', 'big' ] > +} > + > +## > +# @VirtioStatus: > +# > +# @device-id: VirtIODevice status "status"? Really? > +# > +# @device-endian: VirtIODevice device_endian > +# > +# @guest-features: VirtIODevice guest_features > +# > +# @host-features: VirtIODevice host_features > +# > +# @backend-features: VirtIODevice backend_features > +# > +# @num-vqs: number of VirtIODevice queues > +# > +# Since: 6.1 > +# > +## > + > +{ 'struct': 'VirtioStatus', > + 'data': { > +'device-id': 'int', VirtIODevice member @device_id is uint64_t. Should this be 'uint16'? > +'device-endian': 'VirtioStatusEndianness', > +'guest-features': 'uint64', > +'host-features': 'uint64', > +'backend-features': 'uint64', > +'num-vqs': 'uint16' virtio_get_num_queues() returns int. Sure 'uint16' is the right type? > + } > +} > + > +## > +# @x-debug-virtio-status: > +# > +# Return the status of virtio device "of a virtio device" > +# > +# @path: QOBject path of the VirtIODevice "QOM path", please. > +# > +# Returns: status of the VirtIODevice > +# > +# Since: 6.1 > +# > +# Example: > +# > +# -> { "execute": "x-debug-virtio-status", > +# "arguments": { > +# "path": "/machine/peripheral-anon/device[3]/virtio-backend" > +# } > +# } > +# <- { "return": { > +# "backend-features": 0, > +# "guest-features": 5111807911, > +# "num-vqs": 3, > +# "host-features": 6337593319, > +# "device-endian": "little", > +# "device-id": 1 > +# } > +#} > +# > +## > + > +{ 'command': 'x-debug-virtio-status', > + 'data': { 'path': 'str' }, > + 'returns': 'VirtioStatus' > +}
Re: [PATCH v6 4/6] qmp: add QMP command x-debug-virtio-queue-status
Jonah Palmer writes: > From: Laurent Vivier > > This new command shows internal status of a VirtQueue. > (vrings and indexes). > > Signed-off-by: Laurent Vivier > Signed-off-by: Jonah Palmer [...] > diff --git a/qapi/virtio.json b/qapi/virtio.json > index 78873cd..7007e0c 100644 > --- a/qapi/virtio.json > +++ b/qapi/virtio.json > @@ -406,3 +406,105 @@ >'data': { 'path': 'str' }, >'returns': 'VirtioStatus' > } > + > +## > +# @VirtQueueStatus: > +# > +# Status of a VirtQueue > +# > +# @device-type: VirtIO device type > +# > +# @queue-index: VirtQueue queue_index > +# > +# @inuse: VirtQueue inuse > +# > +# @vring-num: VirtQueue vring.num > +# > +# @vring-num-default: VirtQueue vring.num_default > +# > +# @vring-align: VirtQueue vring.align > +# > +# @vring-desc: VirtQueue vring.desc > +# > +# @vring-avail: VirtQueue vring.avail > +# > +# @vring-used: VirtQueue vring.used > +# > +# @last-avail-idx: VirtQueue last_avail_idx > +# > +# @shadow-avail-idx: VirtQueue shadow_avail_idx > +# > +# @used-idx: VirtQueue used_idx > +# > +# @signalled-used: VirtQueue signalled_used > +# > +# @signalled-used-valid: VirtQueue signalled_used_valid > +# > +# Since: 6.1 > +# > +## > + > +{ 'struct': 'VirtQueueStatus', > + 'data': { > +'device-type': 'VirtioType', > +'queue-index': 'uint16', > +'inuse': 'uint32', > +'vring-num': 'int', > +'vring-num-default': 'int', > +'vring-align': 'int', > +'vring-desc': 'uint64', > +'vring-avail': 'uint64', > +'vring-used': 'uint64', > +'last-avail-idx': 'uint16', > +'shadow-avail-idx': 'uint16', > +'used-idx': 'uint16', > +'signalled-used': 'uint16', > +'signalled-used-valid': 'uint16' > + } > +} I can't check the member types like I did for VirtioStatus in PATCH 2 right now. Please double-check them. > + > +## > +# @x-debug-virtio-queue-status: > +# > +# Return the status of a given VirtQueue > +# > +# @path: QOBject path of the VirtIODevice > +# > +# @queue: queue number to examine > +# > +# Returns: Status of the VirtQueue > +# > +# Since: 6.1 > +# > +# Example: > +# > +# -> { "execute": "x-debug-virtio-queue-status", > +# "arguments": { > +# "path": "/machine/peripheral-anon/device[3]/virtio-backend", > +# "queue": 0 > +# } > +# } > +# <- { "return": { > +# "signalled-used": 373, > +# "inuse": 0, > +# "vring-align": 4096, > +# "vring-desc": 864411648, > +# "signalled-used-valid": 0, > +# "vring-num-default": 256, > +# "vring-avail": 864415744, > +# "queue-index": 0, > +# "last-avail-idx": 373, > +# "vring-used": 864416320, > +# "used-idx": 373, > +# "device-type": "virtio-net", > +# "shadow-avail-idx": 619, > +# "vring-num": 256 > +# } > +#} > +# > +## > + > +{ 'command': 'x-debug-virtio-queue-status', > + 'data': { 'path': 'str', 'queue': 'uint16' }, > + 'returns': 'VirtQueueStatus' > +}