52 lines
1.5 KiB
Diff
52 lines
1.5 KiB
Diff
|
|
From b6830d3caff821b2472e369042c169935c906ef2 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
|
||
|
|
Date: Wed, 5 Jun 2024 16:30:35 +0800
|
||
|
|
Subject: [PATCH] vfio/container: Implement HostIOMMUDeviceClass::get_cap()
|
||
|
|
handler
|
||
|
|
MIME-Version: 1.0
|
||
|
|
Content-Type: text/plain; charset=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
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 fbe2bc50d4..ed54ce6d0c 100644
|
||
|
|
--- a/hw/vfio/container.c
|
||
|
|
+++ b/hw/vfio/container.c
|
||
|
|
@@ -1261,11 +1261,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.41.0.windows.1
|
||
|
|
|