diff options
| author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2025-06-04 14:21:15 +0800 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2025-06-05 10:40:38 +0200 |
| commit | 1ab3d93fd24b9ca0f415bb7ef38c4a4e2e9e62ef (patch) | |
| tree | 86707519443d257757bbc2d085fc73fb0b5bd2bd /hw/vfio/iommufd.c | |
| parent | e50a3ead976d23bd1b4fdf50baea8df2303128a5 (diff) | |
| download | focaccia-qemu-1ab3d93fd24b9ca0f415bb7ef38c4a4e2e9e62ef.tar.gz focaccia-qemu-1ab3d93fd24b9ca0f415bb7ef38c4a4e2e9e62ef.zip | |
vfio/iommufd: Save vendor specific device info
Some device information returned by ioctl(IOMMU_GET_HW_INFO) are vendor specific. Save them as raw data in a union supporting different vendors, then vendor IOMMU can query the raw data with its fixed format for capability directly. Because IOMMU_GET_HW_INFO is only supported in linux, so declare those capability related structures with CONFIG_LINUX. Suggested-by: Eric Auger <eric.auger@redhat.com> Suggested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Link: https://lore.kernel.org/qemu-devel/20250604062115.4004200-5-zhenzhong.duan@intel.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/iommufd.c')
| -rw-r--r-- | hw/vfio/iommufd.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index 5903302837..c4bbf36241 100644 --- a/hw/vfio/iommufd.c +++ b/hw/vfio/iommufd.c @@ -839,16 +839,14 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque, VFIODevice *vdev = opaque; HostIOMMUDeviceIOMMUFD *idev; HostIOMMUDeviceCaps *caps = &hiod->caps; + VendorCaps *vendor_caps = &caps->vendor_caps; enum iommu_hw_info_type type; - union { - struct iommu_hw_info_vtd vtd; - } data; uint64_t hw_caps; hiod->agent = opaque; - if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid, - &type, &data, sizeof(data), + if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid, &type, + vendor_caps, sizeof(*vendor_caps), &hw_caps, errp)) { return false; } |