58 lines
1.9 KiB
Diff
58 lines
1.9 KiB
Diff
|
|
From 35f33bf18826286c9e9fc739a893b9915c71f43c Mon Sep 17 00:00:00 2001
|
||
|
|
From: Eric Auger <eric.auger@redhat.com>
|
||
|
|
Date: Fri, 14 Jun 2024 11:52:51 +0200
|
||
|
|
Subject: [PATCH] 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>
|
||
|
|
---
|
||
|
|
hw/vfio/container.c | 1 +
|
||
|
|
hw/vfio/iommufd.c | 2 ++
|
||
|
|
include/sysemu/host_iommu_device.h | 1 +
|
||
|
|
3 files changed, 4 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
|
||
|
|
index 10f7635425..8a5a112b6b 100644
|
||
|
|
--- a/hw/vfio/container.c
|
||
|
|
+++ b/hw/vfio/container.c
|
||
|
|
@@ -1259,6 +1259,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 3b75cba26c..7a069ca576 100644
|
||
|
|
--- a/hw/vfio/iommufd.c
|
||
|
|
+++ b/hw/vfio/iommufd.c
|
||
|
|
@@ -735,6 +735,8 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
|
||
|
|
} data;
|
||
|
|
uint64_t hw_caps;
|
||
|
|
|
||
|
|
+ hiod->agent = opaque;
|
||
|
|
+
|
||
|
|
if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid,
|
||
|
|
&type, &data, sizeof(data),
|
||
|
|
&hw_caps, errp)) {
|
||
|
|
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;
|
||
|
|
};
|
||
|
|
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|