mirror of https://github.com/xemu-project/xemu.git
HostIOMMUDevice: Introduce get_page_size_mask() callback
This callback will be used to retrieve the page size mask supported along a given Host IOMMU device. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
d59ca1ca17
commit
8fe0ebe15d
|
@ -1173,6 +1173,15 @@ hiod_legacy_vfio_get_iova_ranges(HostIOMMUDevice *hiod)
|
||||||
return vfio_container_get_iova_ranges(vdev->bcontainer);
|
return vfio_container_get_iova_ranges(vdev->bcontainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint64_t
|
||||||
|
hiod_legacy_vfio_get_page_size_mask(HostIOMMUDevice *hiod)
|
||||||
|
{
|
||||||
|
VFIODevice *vdev = hiod->agent;
|
||||||
|
|
||||||
|
g_assert(vdev);
|
||||||
|
return vfio_container_get_page_size_mask(vdev->bcontainer);
|
||||||
|
}
|
||||||
|
|
||||||
static void vfio_iommu_legacy_instance_init(Object *obj)
|
static void vfio_iommu_legacy_instance_init(Object *obj)
|
||||||
{
|
{
|
||||||
VFIOContainer *container = VFIO_IOMMU_LEGACY(obj);
|
VFIOContainer *container = VFIO_IOMMU_LEGACY(obj);
|
||||||
|
@ -1187,6 +1196,7 @@ static void hiod_legacy_vfio_class_init(ObjectClass *oc, void *data)
|
||||||
hioc->realize = hiod_legacy_vfio_realize;
|
hioc->realize = hiod_legacy_vfio_realize;
|
||||||
hioc->get_cap = hiod_legacy_vfio_get_cap;
|
hioc->get_cap = hiod_legacy_vfio_get_cap;
|
||||||
hioc->get_iova_ranges = hiod_legacy_vfio_get_iova_ranges;
|
hioc->get_iova_ranges = hiod_legacy_vfio_get_iova_ranges;
|
||||||
|
hioc->get_page_size_mask = hiod_legacy_vfio_get_page_size_mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const TypeInfo types[] = {
|
static const TypeInfo types[] = {
|
||||||
|
|
|
@ -652,12 +652,23 @@ hiod_iommufd_vfio_get_iova_ranges(HostIOMMUDevice *hiod)
|
||||||
return vfio_container_get_iova_ranges(vdev->bcontainer);
|
return vfio_container_get_iova_ranges(vdev->bcontainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint64_t
|
||||||
|
hiod_iommufd_vfio_get_page_size_mask(HostIOMMUDevice *hiod)
|
||||||
|
{
|
||||||
|
VFIODevice *vdev = hiod->agent;
|
||||||
|
|
||||||
|
g_assert(vdev);
|
||||||
|
return vfio_container_get_page_size_mask(vdev->bcontainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void hiod_iommufd_vfio_class_init(ObjectClass *oc, void *data)
|
static void hiod_iommufd_vfio_class_init(ObjectClass *oc, void *data)
|
||||||
{
|
{
|
||||||
HostIOMMUDeviceClass *hiodc = HOST_IOMMU_DEVICE_CLASS(oc);
|
HostIOMMUDeviceClass *hiodc = HOST_IOMMU_DEVICE_CLASS(oc);
|
||||||
|
|
||||||
hiodc->realize = hiod_iommufd_vfio_realize;
|
hiodc->realize = hiod_iommufd_vfio_realize;
|
||||||
hiodc->get_iova_ranges = hiod_iommufd_vfio_get_iova_ranges;
|
hiodc->get_iova_ranges = hiod_iommufd_vfio_get_iova_ranges;
|
||||||
|
hiodc->get_page_size_mask = hiod_iommufd_vfio_get_page_size_mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const TypeInfo types[] = {
|
static const TypeInfo types[] = {
|
||||||
|
|
|
@ -88,6 +88,13 @@ int vfio_container_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
|
||||||
|
|
||||||
GList *vfio_container_get_iova_ranges(const VFIOContainerBase *bcontainer);
|
GList *vfio_container_get_iova_ranges(const VFIOContainerBase *bcontainer);
|
||||||
|
|
||||||
|
static inline uint64_t
|
||||||
|
vfio_container_get_page_size_mask(const VFIOContainerBase *bcontainer)
|
||||||
|
{
|
||||||
|
assert(bcontainer);
|
||||||
|
return bcontainer->pgsizes;
|
||||||
|
}
|
||||||
|
|
||||||
#define TYPE_VFIO_IOMMU "vfio-iommu"
|
#define TYPE_VFIO_IOMMU "vfio-iommu"
|
||||||
#define TYPE_VFIO_IOMMU_LEGACY TYPE_VFIO_IOMMU "-legacy"
|
#define TYPE_VFIO_IOMMU_LEGACY TYPE_VFIO_IOMMU "-legacy"
|
||||||
#define TYPE_VFIO_IOMMU_SPAPR TYPE_VFIO_IOMMU "-spapr"
|
#define TYPE_VFIO_IOMMU_SPAPR TYPE_VFIO_IOMMU "-spapr"
|
||||||
|
|
|
@ -89,6 +89,14 @@ struct HostIOMMUDeviceClass {
|
||||||
* @hiod: handle to the host IOMMU device
|
* @hiod: handle to the host IOMMU device
|
||||||
*/
|
*/
|
||||||
GList* (*get_iova_ranges)(HostIOMMUDevice *hiod);
|
GList* (*get_iova_ranges)(HostIOMMUDevice *hiod);
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @get_page_size_mask: Return the page size mask supported along this
|
||||||
|
* @hiod Host IOMMU device
|
||||||
|
*
|
||||||
|
* @hiod: handle to the host IOMMU device
|
||||||
|
*/
|
||||||
|
uint64_t (*get_page_size_mask)(HostIOMMUDevice *hiod);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue