[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::get_c
From: |
Zhenzhong Duan |
Subject: |
[PATCH v6 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler |
Date: |
Mon, 3 Jun 2024 14:10:15 +0800 |
Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
backends/iommufd.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/backends/iommufd.c b/backends/iommufd.c
index c7e969d6f7..f2f7a762a0 100644
--- a/backends/iommufd.c
+++ b/backends/iommufd.c
@@ -230,6 +230,28 @@ bool iommufd_backend_get_device_info(IOMMUFDBackend *be,
uint32_t devid,
return true;
}
+static int hiod_iommufd_get_cap(HostIOMMUDevice *hiod, int cap, Error **errp)
+{
+ HostIOMMUDeviceCaps *caps = &hiod->caps;
+
+ switch (cap) {
+ case HOST_IOMMU_DEVICE_CAP_IOMMU_TYPE:
+ return caps->type;
+ case HOST_IOMMU_DEVICE_CAP_AW_BITS:
+ return caps->aw_bits;
+ default:
+ error_setg(errp, "Not support get cap %x", cap);
+ return -EINVAL;
+ }
+}
+
+static void hiod_iommufd_class_init(ObjectClass *oc, void *data)
+{
+ HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
+
+ hioc->get_cap = hiod_iommufd_get_cap;
+};
+
static const TypeInfo types[] = {
{
.name = TYPE_IOMMUFD_BACKEND,
@@ -246,6 +268,7 @@ static const TypeInfo types[] = {
}, {
.name = TYPE_HOST_IOMMU_DEVICE_IOMMUFD,
.parent = TYPE_HOST_IOMMU_DEVICE,
+ .class_init = hiod_iommufd_class_init,
.abstract = true,
}
};
--
2.34.1
- [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, (continued)
- [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Zhenzhong Duan, 2024/06/03
- Re: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Eric Auger, 2024/06/03
- RE: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Duan, Zhenzhong, 2024/06/03
- Re: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Eric Auger, 2024/06/04
- RE: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Duan, Zhenzhong, 2024/06/04
- Re: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Eric Auger, 2024/06/04
- RE: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Duan, Zhenzhong, 2024/06/04
Re: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Eric Auger, 2024/06/06
[PATCH v6 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler,
Zhenzhong Duan <=
- Re: [PATCH v6 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler, Eric Auger, 2024/06/03
- Re: [PATCH v6 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler, Cédric Le Goater, 2024/06/03
- RE: [PATCH v6 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler, Duan, Zhenzhong, 2024/06/03
- Re: [PATCH v6 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler, Eric Auger, 2024/06/04
- RE: [PATCH v6 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler, Duan, Zhenzhong, 2024/06/04
- Re: [PATCH v6 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler, Eric Auger, 2024/06/04
[PATCH v6 10/19] vfio/container: Implement HostIOMMUDeviceClass::get_cap() handler, Zhenzhong Duan, 2024/06/03
[PATCH v6 12/19] vfio: Introduce VFIOIOMMUClass::hiod_typename attribute, Zhenzhong Duan, 2024/06/03
[PATCH v6 13/19] vfio: Create host IOMMU device instance, Zhenzhong Duan, 2024/06/03