[PATCH v2 00/28] vfio: improve naming conventions

Mark Cave-Ayland posted 28 patches 3 days, 3 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250925113159.1760317-1-mark.caveayland@nutanix.com
Maintainers: Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Richard Henderson <richard.henderson@linaro.org>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, John Levon <john.levon@nutanix.com>, Thanos Makatos <thanos.makatos@nutanix.com>, "Cédric Le Goater" <clg@redhat.com>, Alex Williamson <alex.williamson@redhat.com>, Steve Sistare <steven.sistare@oracle.com>
hw/vfio-user/container.h                |    4 +-
hw/vfio/pci.h                           |    2 +-
hw/vfio/types.h                         |    4 +-
hw/vfio/vfio-iommufd.h                  |    9 +-
hw/vfio/vfio-listener.h                 |    4 +-
include/hw/vfio/vfio-container-base.h   |  279 -----
include/hw/vfio/vfio-container-legacy.h |   39 +
include/hw/vfio/vfio-container.h        |  286 ++++-
include/hw/vfio/vfio-cpr.h              |   15 +-
include/hw/vfio/vfio-device.h           |   12 +-
hw/ppc/spapr_pci_vfio.c                 |   14 +-
hw/s390x/s390-pci-vfio.c                |   16 +-
hw/vfio-user/container.c                |   18 +-
hw/vfio-user/pci.c                      |   35 +-
hw/vfio/container-base.c                |  347 ------
hw/vfio/container-legacy.c              | 1277 ++++++++++++++++++++++
hw/vfio/container.c                     | 1325 ++++-------------------
hw/vfio/cpr-iommufd.c                   |    4 +-
hw/vfio/cpr-legacy.c                    |   43 +-
hw/vfio/device.c                        |    4 +-
hw/vfio/iommufd.c                       |   48 +-
hw/vfio/listener.c                      |   74 +-
hw/vfio/pci.c                           |   68 +-
hw/vfio/spapr.c                         |   52 +-
hw/vfio/meson.build                     |    2 +-
25 files changed, 1991 insertions(+), 1990 deletions(-)
delete mode 100644 include/hw/vfio/vfio-container-base.h
create mode 100644 include/hw/vfio/vfio-container-legacy.h
delete mode 100644 hw/vfio/container-base.c
create mode 100644 hw/vfio/container-legacy.c
[PATCH v2 00/28] vfio: improve naming conventions
Posted by Mark Cave-Ayland 3 days, 3 hours ago
This series aims to further improve the naming conventions for some
QOM-related parts of VFIO so that it is easier to understand the
object model.

The first part of the series renames VFIOContainer to VFIOLegacyContainer
as the existing name is misleading, particularly in the context of classes
that are derived from it. Following on from this the VFIOContainerBase
struct is now renamed to VFIOContainer as it represents the parent of
other VFIOFOOContainer types.

The next part of the series adds some extra QOM casts that were missed
from my last patchset, which then allows us to rename the QOM parent
object to parent_obj as per our current coding guidelines.

After this there are some more renames for various QOM/qdev declarations
so that the function names correspond with the underlying QOM type
name: this makes it easier to locate them within the source tree.

Finally there is also a rename of TYPE_VFIO_PCI_BASE to
TYPE_VFIO_PCI_DEVICE since that allows the QOM type (and cast) to match
the name of the underlying VFIOPCIDevice struct.

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>

(Patches still needing review: 28)


v2:
- Rebase onto master
- Add R-B tags from Cedric
- Update patches 3 and 4 to also correct the include header guard name
- Add patch 28 to correct the include header guard name for vfio-device.h


Mark Cave-Ayland (28):
  include/hw/vfio/vfio-container.h: rename VFIOContainer to
    VFIOLegacyContainer
  include/hw/vfio/vfio-container-base.h: rename VFIOContainerBase to
    VFIOContainer
  include/hw/vfio/vfio-container.h: rename file to
    vfio-container-legacy.h
  include/hw/vfio/vfio-container-base.h: rename file to vfio-container.h
  hw/vfio/container.c: rename file to container-legacy.c
  hw/vfio/container-base.c: rename file to container.c
  vfio/iommufd.c: use QOM casts where appropriate
  vfio/cpr-iommufd.c: use QOM casts where appropriate
  vfio/vfio-iommufd.h: rename VFIOContainer bcontainer field to
    parent_obj
  vfio/spapr.c: use QOM casts where appropriate
  vfio/spapr.c: rename VFIOContainer bcontainer field to parent_obj
  vfio/pci.c: rename vfio_instance_init() to vfio_pci_init()
  vfio/pci.c: rename vfio_instance_finalize() to vfio_pci_finalize()
  vfio/pci.c: rename vfio_pci_dev_class_init() to vfio_pci_class_init()
  vfio/pci.c: rename vfio_pci_dev_info to vfio_pci_info
  hw/vfio/types.h: rename TYPE_VFIO_PCI_BASE to TYPE_VFIO_PCI_DEVICE
  vfio/pci.c: rename vfio_pci_base_dev_class_init() to
    vfio_pci_device_class_init()
  vfio/pci.c: rename vfio_pci_base_dev_info to vfio_pci_device_info
  vfio/pci.c: rename vfio_pci_dev_properties[] to vfio_pci_properties[]
  vfio/pci.c: rename vfio_pci_dev_nohotplug_properties[] to
    vfio_pci_nohotplug_properties[]
  vfio/pci.c: rename vfio_pci_nohotplug_dev_class_init() to
    vfio_pci_nohotplug_class_init()
  vfio/pci.c: rename vfio_pci_nohotplug_dev_info to
    vfio_pci_nohotplug_info
  vfio-user/pci.c: rename vfio_user_pci_dev_class_init() to
    vfio_user_pci_class_init()
  vfio-user/pci.c: rename vfio_user_pci_dev_properties[] to
    vfio_user_pci_properties[]
  vfio-user/pci.c: rename vfio_user_instance_init() to
    vfio_user_pci_init()
  vfio-user/pci.c: rename vfio_user_instance_finalize() to
    vfio_user_pci_finalize()
  vfio-user/pci.c: rename vfio_user_pci_dev_info to vfio_user_pci_info
  include/hw/vfio/vfio-device.h: fix include header guard name

 hw/vfio-user/container.h                |    4 +-
 hw/vfio/pci.h                           |    2 +-
 hw/vfio/types.h                         |    4 +-
 hw/vfio/vfio-iommufd.h                  |    9 +-
 hw/vfio/vfio-listener.h                 |    4 +-
 include/hw/vfio/vfio-container-base.h   |  279 -----
 include/hw/vfio/vfio-container-legacy.h |   39 +
 include/hw/vfio/vfio-container.h        |  286 ++++-
 include/hw/vfio/vfio-cpr.h              |   15 +-
 include/hw/vfio/vfio-device.h           |   12 +-
 hw/ppc/spapr_pci_vfio.c                 |   14 +-
 hw/s390x/s390-pci-vfio.c                |   16 +-
 hw/vfio-user/container.c                |   18 +-
 hw/vfio-user/pci.c                      |   35 +-
 hw/vfio/container-base.c                |  347 ------
 hw/vfio/container-legacy.c              | 1277 ++++++++++++++++++++++
 hw/vfio/container.c                     | 1325 ++++-------------------
 hw/vfio/cpr-iommufd.c                   |    4 +-
 hw/vfio/cpr-legacy.c                    |   43 +-
 hw/vfio/device.c                        |    4 +-
 hw/vfio/iommufd.c                       |   48 +-
 hw/vfio/listener.c                      |   74 +-
 hw/vfio/pci.c                           |   68 +-
 hw/vfio/spapr.c                         |   52 +-
 hw/vfio/meson.build                     |    2 +-
 25 files changed, 1991 insertions(+), 1990 deletions(-)
 delete mode 100644 include/hw/vfio/vfio-container-base.h
 create mode 100644 include/hw/vfio/vfio-container-legacy.h
 delete mode 100644 hw/vfio/container-base.c
 create mode 100644 hw/vfio/container-legacy.c

-- 
2.43.0
Re: [PATCH v2 00/28] vfio: improve naming conventions
Posted by Cédric Le Goater 2 days, 22 hours ago
On 9/25/25 13:31, Mark Cave-Ayland wrote:
> This series aims to further improve the naming conventions for some
> QOM-related parts of VFIO so that it is easier to understand the
> object model.
> 
> The first part of the series renames VFIOContainer to VFIOLegacyContainer
> as the existing name is misleading, particularly in the context of classes
> that are derived from it. Following on from this the VFIOContainerBase
> struct is now renamed to VFIOContainer as it represents the parent of
> other VFIOFOOContainer types.
> 
> The next part of the series adds some extra QOM casts that were missed
> from my last patchset, which then allows us to rename the QOM parent
> object to parent_obj as per our current coding guidelines.
> 
> After this there are some more renames for various QOM/qdev declarations
> so that the function names correspond with the underlying QOM type
> name: this makes it easier to locate them within the source tree.
> 
> Finally there is also a rename of TYPE_VFIO_PCI_BASE to
> TYPE_VFIO_PCI_DEVICE since that allows the QOM type (and cast) to match
> the name of the underlying VFIOPCIDevice struct.
> 
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> 
> (Patches still needing review: 28)
> 
> 
> v2:
> - Rebase onto master
> - Add R-B tags from Cedric
> - Update patches 3 and 4 to also correct the include header guard name
> - Add patch 28 to correct the include header guard name for vfio-device.h
> 
> 
> Mark Cave-Ayland (28):
>    include/hw/vfio/vfio-container.h: rename VFIOContainer to
>      VFIOLegacyContainer
>    include/hw/vfio/vfio-container-base.h: rename VFIOContainerBase to
>      VFIOContainer
>    include/hw/vfio/vfio-container.h: rename file to
>      vfio-container-legacy.h
>    include/hw/vfio/vfio-container-base.h: rename file to vfio-container.h
>    hw/vfio/container.c: rename file to container-legacy.c
>    hw/vfio/container-base.c: rename file to container.c
>    vfio/iommufd.c: use QOM casts where appropriate
>    vfio/cpr-iommufd.c: use QOM casts where appropriate
>    vfio/vfio-iommufd.h: rename VFIOContainer bcontainer field to
>      parent_obj
>    vfio/spapr.c: use QOM casts where appropriate
>    vfio/spapr.c: rename VFIOContainer bcontainer field to parent_obj
>    vfio/pci.c: rename vfio_instance_init() to vfio_pci_init()
>    vfio/pci.c: rename vfio_instance_finalize() to vfio_pci_finalize()
>    vfio/pci.c: rename vfio_pci_dev_class_init() to vfio_pci_class_init()
>    vfio/pci.c: rename vfio_pci_dev_info to vfio_pci_info
>    hw/vfio/types.h: rename TYPE_VFIO_PCI_BASE to TYPE_VFIO_PCI_DEVICE
>    vfio/pci.c: rename vfio_pci_base_dev_class_init() to
>      vfio_pci_device_class_init()
>    vfio/pci.c: rename vfio_pci_base_dev_info to vfio_pci_device_info
>    vfio/pci.c: rename vfio_pci_dev_properties[] to vfio_pci_properties[]
>    vfio/pci.c: rename vfio_pci_dev_nohotplug_properties[] to
>      vfio_pci_nohotplug_properties[]
>    vfio/pci.c: rename vfio_pci_nohotplug_dev_class_init() to
>      vfio_pci_nohotplug_class_init()
>    vfio/pci.c: rename vfio_pci_nohotplug_dev_info to
>      vfio_pci_nohotplug_info
>    vfio-user/pci.c: rename vfio_user_pci_dev_class_init() to
>      vfio_user_pci_class_init()
>    vfio-user/pci.c: rename vfio_user_pci_dev_properties[] to
>      vfio_user_pci_properties[]
>    vfio-user/pci.c: rename vfio_user_instance_init() to
>      vfio_user_pci_init()
>    vfio-user/pci.c: rename vfio_user_instance_finalize() to
>      vfio_user_pci_finalize()
>    vfio-user/pci.c: rename vfio_user_pci_dev_info to vfio_user_pci_info
>    include/hw/vfio/vfio-device.h: fix include header guard name
> 
>   hw/vfio-user/container.h                |    4 +-
>   hw/vfio/pci.h                           |    2 +-
>   hw/vfio/types.h                         |    4 +-
>   hw/vfio/vfio-iommufd.h                  |    9 +-
>   hw/vfio/vfio-listener.h                 |    4 +-
>   include/hw/vfio/vfio-container-base.h   |  279 -----
>   include/hw/vfio/vfio-container-legacy.h |   39 +
>   include/hw/vfio/vfio-container.h        |  286 ++++-
>   include/hw/vfio/vfio-cpr.h              |   15 +-
>   include/hw/vfio/vfio-device.h           |   12 +-
>   hw/ppc/spapr_pci_vfio.c                 |   14 +-
>   hw/s390x/s390-pci-vfio.c                |   16 +-
>   hw/vfio-user/container.c                |   18 +-
>   hw/vfio-user/pci.c                      |   35 +-
>   hw/vfio/container-base.c                |  347 ------
>   hw/vfio/container-legacy.c              | 1277 ++++++++++++++++++++++
>   hw/vfio/container.c                     | 1325 ++++-------------------
>   hw/vfio/cpr-iommufd.c                   |    4 +-
>   hw/vfio/cpr-legacy.c                    |   43 +-
>   hw/vfio/device.c                        |    4 +-
>   hw/vfio/iommufd.c                       |   48 +-
>   hw/vfio/listener.c                      |   74 +-
>   hw/vfio/pci.c                           |   68 +-
>   hw/vfio/spapr.c                         |   52 +-
>   hw/vfio/meson.build                     |    2 +-
>   25 files changed, 1991 insertions(+), 1990 deletions(-)
>   delete mode 100644 include/hw/vfio/vfio-container-base.h
>   create mode 100644 include/hw/vfio/vfio-container-legacy.h
>   delete mode 100644 hw/vfio/container-base.c
>   create mode 100644 hw/vfio/container-legacy.c
> 

Applied to vfio-next.

Thanks,

C.