[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 09/17] vfio/container: Implement HostIOMMUDeviceClass::get_cap
From: |
Zhenzhong Duan |
Subject: |
[PATCH v7 09/17] vfio/container: Implement HostIOMMUDeviceClass::get_cap() handler |
Date: |
Wed, 5 Jun 2024 16:30:35 +0800 |
Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
hw/vfio/container.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 2f62c13214..99beeba422 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -1147,11 +1147,26 @@ static bool hiod_legacy_vfio_realize(HostIOMMUDevice
*hiod, void *opaque,
return true;
}
+static int hiod_legacy_vfio_get_cap(HostIOMMUDevice *hiod, int cap,
+ Error **errp)
+{
+ HostIOMMUDeviceCaps *caps = &hiod->caps;
+
+ switch (cap) {
+ case HOST_IOMMU_DEVICE_CAP_AW_BITS:
+ return caps->aw_bits;
+ default:
+ error_setg(errp, "%s: unsupported capability %x", hiod->name, cap);
+ return -EINVAL;
+ }
+}
+
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->get_cap = hiod_legacy_vfio_get_cap;
};
static const TypeInfo types[] = {
--
2.34.1
- [PATCH v7 00/17] Add a host IOMMU device abstraction to check with vIOMMU, Zhenzhong Duan, 2024/06/05
- [PATCH v7 01/17] backends: Introduce HostIOMMUDevice abstract, Zhenzhong Duan, 2024/06/05
- [PATCH v7 02/17] backends/host_iommu_device: Introduce HostIOMMUDeviceCaps, Zhenzhong Duan, 2024/06/05
- [PATCH v7 03/17] vfio/container: Introduce TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO device, Zhenzhong Duan, 2024/06/05
- [PATCH v7 04/17] backends/iommufd: Introduce TYPE_HOST_IOMMU_DEVICE_IOMMUFD[_VFIO] devices, Zhenzhong Duan, 2024/06/05
- [PATCH v7 05/17] range: Introduce range_get_last_bit(), Zhenzhong Duan, 2024/06/05
- [PATCH v7 06/17] vfio/container: Implement HostIOMMUDeviceClass::realize() handler, Zhenzhong Duan, 2024/06/05
- [PATCH v7 07/17] backends/iommufd: Introduce helper function iommufd_backend_get_device_info(), Zhenzhong Duan, 2024/06/05
- [PATCH v7 08/17] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Zhenzhong Duan, 2024/06/05
- [PATCH v7 09/17] vfio/container: Implement HostIOMMUDeviceClass::get_cap() handler,
Zhenzhong Duan <=
- [PATCH v7 10/17] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler, Zhenzhong Duan, 2024/06/05
- [PATCH v7 11/17] vfio: Create host IOMMU device instance, Zhenzhong Duan, 2024/06/05
- [PATCH v7 12/17] hw/pci: Introduce helper function pci_device_get_iommu_bus_devfn(), Zhenzhong Duan, 2024/06/05
- [PATCH v7 13/17] hw/pci: Introduce pci_device_[set|unset]_iommu_device(), Zhenzhong Duan, 2024/06/05
- [PATCH v7 14/17] vfio/pci: Pass HostIOMMUDevice to vIOMMU, Zhenzhong Duan, 2024/06/05
- [PATCH v7 15/17] intel_iommu: Extract out vtd_cap_init() to initialize cap/ecap, Zhenzhong Duan, 2024/06/05
- [PATCH v7 16/17] intel_iommu: Implement [set|unset]_iommu_device() callbacks, Zhenzhong Duan, 2024/06/05
- [PATCH v7 17/17] intel_iommu: Check compatibility with host IOMMU capabilities, Zhenzhong Duan, 2024/06/05
- Re: [PATCH v7 00/17] Add a host IOMMU device abstraction to check with vIOMMU, Eric Auger, 2024/06/07