Zhenzhong,

On 8/1/25 07:42, Cédric Le Goater wrote:
On 8/1/25 04:35, Zhenzhong Duan wrote:
Introduce helper vfio_pci_from_vfio_device() to transform from VFIODevice
to VFIOPCIDevice, also to hide low level VFIO_DEVICE_TYPE_PCI type check.

Suggested-by: Cédric Le Goater <c...@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com>
---
v3: add one line comment to the helper
v2: move helper to hw/vfio/pci.[hc]
     rename with vfio_pci_ prefix

  hw/vfio/pci.h       | 1 +
  hw/vfio/container.c | 4 ++--
  hw/vfio/device.c    | 2 +-
  hw/vfio/iommufd.c   | 4 ++--
  hw/vfio/listener.c  | 4 ++--
  hw/vfio/pci.c       | 9 +++++++++
  6 files changed, 17 insertions(+), 7 deletions(-)


Reviewed-by: Cédric Le Goater <c...@redhat.com>

Thanks,

C.

I have modified your patch with :

+/**
+  * vfio_pci_from_vfio_device: Transform from VFIODevice to
+  * VFIOPCIDevice
+  *
+  * This function checks if the given @vbasedev is a VFIO PCI device.
+  * If it is, it returns the containing VFIOPCIDevice.
+  *
+  * @vbasedev: The VFIODevice to transform
+  *
+  * Return: The VFIOPCIDevice on success, NULL on failure.
+  */

See https://github.com/legoater/qemu/tree/vfio-10.2.

I don't think it's really necessary, as these are internal APIs and
none are documented, but Philippe seems keen on it. I guess he plans
to volunteer to document the rest ;)

No need to resend a v4.

Thanks,

C.



Reply via email to