diff options
author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2024-06-05 16:30:35 +0800 |
---|---|---|
committer | Cédric Le Goater <clg@redhat.com> | 2024-06-24 23:15:30 +0200 |
commit | ed92ed2d486e5fddacb1e611c57e976eb160d0a5 (patch) | |
tree | 9ff53c9808608e230398949a89764e816632c100 | |
parent | 930589520128a5f25e65f9f923ac8dc6fac32ff8 (diff) | |
download | qemu-ed92ed2d486e5fddacb1e611c57e976eb160d0a5.zip qemu-ed92ed2d486e5fddacb1e611c57e976eb160d0a5.tar.gz qemu-ed92ed2d486e5fddacb1e611c57e976eb160d0a5.tar.bz2 |
vfio/container: Implement HostIOMMUDeviceClass::get_cap() handler
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>
-rw-r--r-- | hw/vfio/container.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 2f62c13..99beeba 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[] = { |