[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::check
|
From: |
Zhenzhong Duan |
|
Subject: |
[PATCH v3 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::check_cap() handler |
|
Date: |
Mon, 29 Apr 2024 14:50:38 +0800 |
Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
backends/iommufd.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/backends/iommufd.c b/backends/iommufd.c
index d61209788a..28faec528e 100644
--- a/backends/iommufd.c
+++ b/backends/iommufd.c
@@ -233,6 +233,23 @@ int iommufd_backend_get_device_info(IOMMUFDBackend *be,
uint32_t devid,
return ret;
}
+static int hiod_iommufd_check_cap(HostIOMMUDevice *hiod, int cap, Error **errp)
+{
+ switch (cap) {
+ case HOST_IOMMU_DEVICE_CAP_IOMMUFD:
+ return 1;
+ default:
+ return host_iommu_device_check_cap_common(hiod, cap, errp);
+ }
+}
+
+static void hiod_iommufd_class_init(ObjectClass *oc, void *data)
+{
+ HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
+
+ hioc->check_cap = hiod_iommufd_check_cap;
+};
+
static const TypeInfo types[] = {
{
.name = TYPE_IOMMUFD_BACKEND,
@@ -251,6 +268,7 @@ static const TypeInfo types[] = {
.parent = TYPE_HOST_IOMMU_DEVICE,
.instance_size = sizeof(HostIOMMUDeviceIOMMUFD),
.class_size = sizeof(HostIOMMUDeviceIOMMUFDClass),
+ .class_init = hiod_iommufd_class_init,
.abstract = true,
}
};
--
2.34.1
[PATCH v3 15/19] hw/pci: Introduce pci_device_[set|unset]_iommu_device(), Zhenzhong Duan, 2024/04/29
[PATCH v3 14/19] hw/pci: Introduce helper function pci_device_get_iommu_bus_devfn(), Zhenzhong Duan, 2024/04/29