mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
vfio/container: Modify vfio_get_iommu_type() to use a container fd
The 'container' pointer has no other use than its 'fd' attribute. Simplify the prototype to ease future changes. Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
09181a8e97
commit
55974f35ea
1 changed files with 3 additions and 3 deletions
|
@ -354,7 +354,7 @@ static void vfio_kvm_device_del_group(VFIOGroup *group)
|
||||||
/*
|
/*
|
||||||
* vfio_get_iommu_type - selects the richest iommu_type (v2 first)
|
* vfio_get_iommu_type - selects the richest iommu_type (v2 first)
|
||||||
*/
|
*/
|
||||||
static int vfio_get_iommu_type(VFIOContainer *container,
|
static int vfio_get_iommu_type(int container_fd,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
int iommu_types[] = { VFIO_TYPE1v2_IOMMU, VFIO_TYPE1_IOMMU,
|
int iommu_types[] = { VFIO_TYPE1v2_IOMMU, VFIO_TYPE1_IOMMU,
|
||||||
|
@ -362,7 +362,7 @@ static int vfio_get_iommu_type(VFIOContainer *container,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(iommu_types); i++) {
|
for (i = 0; i < ARRAY_SIZE(iommu_types); i++) {
|
||||||
if (ioctl(container->fd, VFIO_CHECK_EXTENSION, iommu_types[i])) {
|
if (ioctl(container_fd, VFIO_CHECK_EXTENSION, iommu_types[i])) {
|
||||||
return iommu_types[i];
|
return iommu_types[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ static bool vfio_set_iommu(VFIOContainer *container, int group_fd,
|
||||||
int iommu_type;
|
int iommu_type;
|
||||||
const VFIOIOMMUClass *vioc;
|
const VFIOIOMMUClass *vioc;
|
||||||
|
|
||||||
iommu_type = vfio_get_iommu_type(container, errp);
|
iommu_type = vfio_get_iommu_type(container->fd, errp);
|
||||||
if (iommu_type < 0) {
|
if (iommu_type < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue