mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
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>
This commit is contained in:
parent
9305895201
commit
ed92ed2d48
1 changed files with 15 additions and 0 deletions
|
@ -1147,11 +1147,26 @@ static bool hiod_legacy_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
|
||||||
return true;
|
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)
|
static void hiod_legacy_vfio_class_init(ObjectClass *oc, void *data)
|
||||||
{
|
{
|
||||||
HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
|
HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
|
||||||
|
|
||||||
hioc->realize = hiod_legacy_vfio_realize;
|
hioc->realize = hiod_legacy_vfio_realize;
|
||||||
|
hioc->get_cap = hiod_legacy_vfio_get_cap;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const TypeInfo types[] = {
|
static const TypeInfo types[] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue