[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/42] vfio/container: Implement HostIOMMUDeviceClass::get_cap() h
From: |
Cédric Le Goater |
Subject: |
[PULL 09/42] vfio/container: Implement HostIOMMUDeviceClass::get_cap() handler |
Date: |
Mon, 24 Jun 2024 23:24:23 +0200 |
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/vfio/container.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index
2f62c13214412618b412240b61efcbe1b1c79ed5..99beeba422ebfe49caed4fcd57afe5514dea8b39
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.45.2
- [PULL 00/42] vfio queue, Cédric Le Goater, 2024/06/24
- [PULL 01/42] backends: Introduce HostIOMMUDevice abstract, Cédric Le Goater, 2024/06/24
- [PULL 02/42] backends/host_iommu_device: Introduce HostIOMMUDeviceCaps, Cédric Le Goater, 2024/06/24
- [PULL 04/42] backends/iommufd: Introduce TYPE_HOST_IOMMU_DEVICE_IOMMUFD[_VFIO] devices, Cédric Le Goater, 2024/06/24
- [PULL 03/42] vfio/container: Introduce TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO device, Cédric Le Goater, 2024/06/24
- [PULL 05/42] range: Introduce range_get_last_bit(), Cédric Le Goater, 2024/06/24
- [PULL 06/42] vfio/container: Implement HostIOMMUDeviceClass::realize() handler, Cédric Le Goater, 2024/06/24
- [PULL 07/42] backends/iommufd: Introduce helper function iommufd_backend_get_device_info(), Cédric Le Goater, 2024/06/24
- [PULL 08/42] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Cédric Le Goater, 2024/06/24
- [PULL 09/42] vfio/container: Implement HostIOMMUDeviceClass::get_cap() handler,
Cédric Le Goater <=
- [PULL 10/42] backends/iommufd: Implement HostIOMMUDeviceClass::get_cap() handler, Cédric Le Goater, 2024/06/24
- [PULL 11/42] vfio: Create host IOMMU device instance, Cédric Le Goater, 2024/06/24
- [PULL 12/42] hw/pci: Introduce helper function pci_device_get_iommu_bus_devfn(), Cédric Le Goater, 2024/06/24
- [PULL 13/42] hw/pci: Introduce pci_device_[set|unset]_iommu_device(), Cédric Le Goater, 2024/06/24
- [PULL 14/42] vfio/pci: Pass HostIOMMUDevice to vIOMMU, Cédric Le Goater, 2024/06/24
- [PULL 15/42] intel_iommu: Extract out vtd_cap_init() to initialize cap/ecap, Cédric Le Goater, 2024/06/24
- [PULL 16/42] intel_iommu: Implement [set|unset]_iommu_device() callbacks, Cédric Le Goater, 2024/06/24
- [PULL 17/42] intel_iommu: Check compatibility with host IOMMU capabilities, Cédric Le Goater, 2024/06/24
- [PULL 18/42] HostIOMMUDevice: Store the VFIO/VDPA agent, Cédric Le Goater, 2024/06/24
- [PULL 19/42] virtio-iommu: Implement set|unset]_iommu_device() callbacks, Cédric Le Goater, 2024/06/24