Hi Zhenzhong,
On 8/4/24 10:12, Zhenzhong Duan wrote:
Introduce HostIOMMUDevice as an abstraction of host IOMMU device.
get_host_iommu_info() is used to get host IOMMU info, different
backends can have different implementations and result format.
Introduce a macro CONFIG_HOST_IOMMU_DEVICE to define the usage
for VFIO, and VDPA in the future.
Suggested-by: Cédric Le Goater <c...@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com>
---
MAINTAINERS | 2 ++
include/sysemu/host_iommu_device.h | 19 +++++++++++++++++++
backends/host_iommu_device.c | 19 +++++++++++++++++++
backends/Kconfig | 5 +++++
backends/meson.build | 1 +
5 files changed, 46 insertions(+)
create mode 100644 include/sysemu/host_iommu_device.h
create mode 100644 backends/host_iommu_device.c
diff --git a/include/sysemu/host_iommu_device.h
b/include/sysemu/host_iommu_device.h
new file mode 100644
index 0000000000..22ccbe3a5d
--- /dev/null
+++ b/include/sysemu/host_iommu_device.h
@@ -0,0 +1,19 @@
+#ifndef HOST_IOMMU_DEVICE_H
+#define HOST_IOMMU_DEVICE_H
+
+#include "qom/object.h"
+
+#define TYPE_HOST_IOMMU_DEVICE "host-iommu-device"
+OBJECT_DECLARE_TYPE(HostIOMMUDevice, HostIOMMUDeviceClass, HOST_IOMMU_DEVICE)
+
+struct HostIOMMUDevice {
+ Object parent;
+};
+
+struct HostIOMMUDeviceClass {
+ ObjectClass parent_class;
+
+ int (*get_host_iommu_info)(HostIOMMUDevice *hiod, void *data, uint32_t len,
+ Error **errp);
Please document this new method (in particular return value and @data).
Since @len is sizeof(data), can we use the size_t type?
Thanks,
Phil.
+};
+#endif