mirror of https://github.com/xemu-project/xemu.git
HostIOMMUDevice: Store the VFIO/VDPA agent
Store the agent device (VFIO or VDPA) in the host IOMMU device. This will allow easy access to some of its resources. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
77f6efc0ab
commit
dc169694ca
|
@ -1145,6 +1145,7 @@ static bool hiod_legacy_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
|
||||||
|
|
||||||
hiod->name = g_strdup(vdev->name);
|
hiod->name = g_strdup(vdev->name);
|
||||||
hiod->caps.aw_bits = vfio_device_get_aw_bits(vdev);
|
hiod->caps.aw_bits = vfio_device_get_aw_bits(vdev);
|
||||||
|
hiod->agent = opaque;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -631,6 +631,8 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
|
||||||
struct iommu_hw_info_vtd vtd;
|
struct iommu_hw_info_vtd vtd;
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
|
hiod->agent = opaque;
|
||||||
|
|
||||||
if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid,
|
if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid,
|
||||||
&type, &data, sizeof(data), errp)) {
|
&type, &data, sizeof(data), errp)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -34,6 +34,7 @@ struct HostIOMMUDevice {
|
||||||
Object parent_obj;
|
Object parent_obj;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
|
void *agent; /* pointer to agent device, ie. VFIO or VDPA device */
|
||||||
HostIOMMUDeviceCaps caps;
|
HostIOMMUDeviceCaps caps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue