vfio/container: Implement HostIOMMUDeviceClass::realize() handler
authorZhenzhong Duan <zhenzhong.duan@intel.com>
Wed, 5 Jun 2024 08:30:32 +0000 (16:30 +0800)
committerCédric Le Goater <clg@redhat.com>
Mon, 24 Jun 2024 21:15:30 +0000 (23:15 +0200)
commitd441e05e26033eb0e49c4185293424a480ef750f
tree161736c20c432f0cb75030d3128867d4571706dc
parent6f274444c579305d14d355bab24af31ea2bef224
vfio/container: Implement HostIOMMUDeviceClass::realize() handler

The realize function populates the capabilities. For now only the
aw_bits caps is computed for legacy backend.

Introduce a helper function vfio_device_get_aw_bits() which calls
range_get_last_bit() to get host aw_bits and package it in
HostIOMMUDeviceCaps for query with .get_cap(). This helper will
also be used by iommufd backend.

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
hw/vfio/helpers.c
include/hw/vfio/vfio-common.h