[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 10/19] vfio/container: Implement HostIOMMUDeviceClass::check_c
From: |
Zhenzhong Duan |
Subject: |
[PATCH v3 10/19] vfio/container: Implement HostIOMMUDeviceClass::check_cap() handler |
Date: |
Mon, 29 Apr 2024 14:50:37 +0800 |
Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
hw/vfio/container.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 863eec3943..3683487605 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -1164,11 +1164,23 @@ static bool hiod_legacy_vfio_realize(HostIOMMUDevice
*hiod, void *opaque,
return true;
}
+static int hiod_legacy_vfio_check_cap(HostIOMMUDevice *hiod, int cap,
+ Error **errp)
+{
+ switch (cap) {
+ case HOST_IOMMU_DEVICE_CAP_IOMMUFD:
+ return 0;
+ default:
+ return host_iommu_device_check_cap_common(hiod, cap, errp);
+ }
+}
+
static void hiod_legacy_vfio_class_init(ObjectClass *oc, void *data)
{
HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
hioc->realize = hiod_legacy_vfio_realize;
+ hioc->check_cap = hiod_legacy_vfio_check_cap;
};
static const TypeInfo types[] = {
--
2.34.1
- RE: [PATCH v3 07/19] vfio/container: Implement HostIOMMUDeviceClass::realize() handler, (continued)
- [PATCH v3 10/19] vfio/container: Implement HostIOMMUDeviceClass::check_cap() handler,
Zhenzhong Duan <=
- [PATCH v3 13/19] vfio: Create host IOMMU device instance, Zhenzhong Duan, 2024/04/29
[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
[PATCH v3 17/19] intel_iommu: Extract out vtd_cap_init() to initialize cap/ecap, Zhenzhong Duan, 2024/04/29
[PATCH v3 16/19] vfio/pci: Pass HostIOMMUDevice to vIOMMU, Zhenzhong Duan, 2024/04/29
[PATCH v3 18/19] intel_iommu: Implement [set|unset]_iommu_device() callbacks, Zhenzhong Duan, 2024/04/29
[PATCH v3 19/19] intel_iommu: Check compatibility with host IOMMU capabilities, Zhenzhong Duan, 2024/04/29