[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 1/8] HostIOMMUDevice: Store the VFIO/VDPA agent
From: |
Eric Auger |
Subject: |
[PATCH v4 1/8] HostIOMMUDevice: Store the VFIO/VDPA agent |
Date: |
Fri, 14 Jun 2024 11:52:51 +0200 |
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>
---
include/sysemu/host_iommu_device.h | 1 +
hw/vfio/container.c | 1 +
hw/vfio/iommufd.c | 2 ++
3 files changed, 4 insertions(+)
diff --git a/include/sysemu/host_iommu_device.h
b/include/sysemu/host_iommu_device.h
index a57873958b..3e5f058e7b 100644
--- a/include/sysemu/host_iommu_device.h
+++ b/include/sysemu/host_iommu_device.h
@@ -34,6 +34,7 @@ struct HostIOMMUDevice {
Object parent_obj;
char *name;
+ void *agent; /* pointer to agent device, ie. VFIO or VDPA device */
HostIOMMUDeviceCaps caps;
};
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 26e6f7fb4f..b728b978a2 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -1145,6 +1145,7 @@ static bool hiod_legacy_vfio_realize(HostIOMMUDevice
*hiod, void *opaque,
hiod->name = g_strdup(vdev->name);
hiod->caps.aw_bits = vfio_device_get_aw_bits(vdev);
+ hiod->agent = opaque;
return true;
}
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 409ed3dcc9..dbdae1adbb 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -631,6 +631,8 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice
*hiod, void *opaque,
struct iommu_hw_info_vtd vtd;
} data;
+ hiod->agent = opaque;
+
if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid,
&type, &data, sizeof(data), errp)) {
return false;
--
2.41.0
- [PATCH v4 0/8] VIRTIO-IOMMU/VFIO: Fix host iommu geometry handling for hotplugged devices, Eric Auger, 2024/06/14
- [PATCH v4 1/8] HostIOMMUDevice: Store the VFIO/VDPA agent,
Eric Auger <=
- [PATCH v4 2/8] virtio-iommu: Implement set|unset]_iommu_device() callbacks, Eric Auger, 2024/06/14
- [PATCH v4 3/8] HostIOMMUDevice: Introduce get_iova_ranges callback, Eric Auger, 2024/06/14
- [PATCH v4 4/8] HostIOMMUDevice: Store the aliased bus and devfn, Eric Auger, 2024/06/14
- [PATCH v4 6/8] virtio-iommu: Remove the implementation of iommu_set_iova_range, Eric Auger, 2024/06/14
- [PATCH v4 5/8] virtio-iommu: Compute host reserved regions, Eric Auger, 2024/06/14
- [PATCH v4 7/8] hw/vfio: Remove memory_region_iommu_set_iova_ranges() call, Eric Auger, 2024/06/14
- [PATCH v4 8/8] memory: Remove IOMMU MR iommu_set_iova_range API, Eric Auger, 2024/06/14
- RE: [PATCH v4 0/8] VIRTIO-IOMMU/VFIO: Fix host iommu geometry handling for hotplugged devices, Duan, Zhenzhong, 2024/06/17
- Re: [PATCH v4 0/8] VIRTIO-IOMMU/VFIO: Fix host iommu geometry handling for hotplugged devices, Michael S. Tsirkin, 2024/06/24