On 7/15/25 11:25, Mark Cave-Ayland wrote:
This series attempts to improve use of QOM within the vfio subsystem which
appears to have been added at a later date. It's mostly mechanical changes
that do the following:
1) Format the QOM structs per our coding guidelines
2) Ensure the parent object is called parent_obj
3) Use QOM casts to access the parent object, instead of accessing
the parent struct member directly
The benefits of this are that the QOM casts included type checking to help
ensure the right object is being passed into the cast, and it also becomes
much easier to infer the class hierarchy from reading the code.
Having produced this series, it feels to me that the readability could be
further improved by renaming the structs as follows:
VFIOContainer -> VFIOLegacyContainer
VFIOContainerBase -> VFIOContainer
Yes.
However I have left this for now given how close that we are to freeze.
I think this is too much of a change to QEMU 10.1 too. Let's keep it
as the first QEMU 10.2 series. Feel free to extend it.
Thanks,
C.
Signed-off-by: Mark Cave-Ayland <mark.caveayl...@nutanix.com>
Mark Cave-Ayland (22):
vfio/vfio-container-base.h: update VFIOContainerBase declaration
vfio/vfio-container.h: update VFIOContainer declaration
hw/vfio/cpr-legacy.c: use QOM casts where appropriate
hw/vfio/container.c: use QOM casts where appropriate
ppc/spapr_pci_vfio.c: use QOM casts where appropriate
vfio/spapr.c: use QOM casts where appropriate
vfio/vfio-container.h: rename VFIOContainer bcontainer field to
parent_obj
vfio-user/container.h: update VFIOUserContainer declaration
vfio/container.c: use QOM casts where appropriate
vfio-user/container.h: rename VFIOUserContainer bcontainer field to
parent_obj
vfio-user/pci.c: update VFIOUserPCIDevice declaration
vfio-user/pci.c: use QOM casts where appropriate
vfio-user/pci.c: rename VFIOUserPCIDevice device field to parent_obj
vfio/pci.h: update VFIOPCIDevice declaration
vfio/pci.h: use QOM casts where appropriate
vfio/pci.c: use QOM casts where appropriate
vfio/pci-quirks.c: use QOM casts where appropriate
vfio/cpr.c: use QOM casts where appropriate
vfio/igd.c: use QOM casts where appropriate
vfio-user/pci.c: use QOM casts where appropriate
s390x/s390-pci-vfio.c: use QOM casts where appropriate
vfio/pci.h: rename VFIOPCIDevice pdev field to parent_obj
hw/ppc/spapr_pci_vfio.c | 2 +-
hw/s390x/s390-pci-vfio.c | 14 +-
hw/vfio-user/container.c | 26 ++--
hw/vfio-user/container.h | 7 +-
hw/vfio-user/pci.c | 16 +-
hw/vfio/container.c | 31 ++--
hw/vfio/cpr-legacy.c | 14 +-
hw/vfio/cpr.c | 10 +-
hw/vfio/igd.c | 38 ++---
hw/vfio/pci-quirks.c | 48 +++---
hw/vfio/pci.c | 206 +++++++++++++++-----------
hw/vfio/pci.h | 5 +-
hw/vfio/spapr.c | 16 +-
include/hw/vfio/vfio-container-base.h | 13 +-
include/hw/vfio/vfio-container.h | 7 +-
15 files changed, 249 insertions(+), 204 deletions(-)