vfio/ccw: Use vfio_[attach/detach]_device

Let the vfio-ccw device use vfio_attach_device() and
vfio_detach_device(), hence hiding the details of the used
IOMMU backend.

Note that the migration reduces the following trace
"vfio: subchannel %s has already been attached" (featuring
cssid.ssid.devid) into "device is already attached"

Also now all the devices have been migrated to use the new
vfio_attach_device/vfio_detach_device API, let's turn the
legacy functions into static functions, local to container.c.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Eric Auger 2023-10-09 11:09:12 +02:00 committed by Cédric Le Goater
parent c95d128ee3
commit e08041ece7
3 changed files with 32 additions and 100 deletions

View file

@ -2335,7 +2335,7 @@ static void vfio_disconnect_container(VFIOGroup *group)
}
}
VFIOGroup *vfio_get_group(int groupid, AddressSpace *as, Error **errp)
static VFIOGroup *vfio_get_group(int groupid, AddressSpace *as, Error **errp)
{
VFIOGroup *group;
char path[32];
@ -2402,7 +2402,7 @@ free_group_exit:
return NULL;
}
void vfio_put_group(VFIOGroup *group)
static void vfio_put_group(VFIOGroup *group)
{
if (!group || !QLIST_EMPTY(&group->device_list)) {
return;
@ -2447,8 +2447,8 @@ retry:
return info;
}
int vfio_get_device(VFIOGroup *group, const char *name,
VFIODevice *vbasedev, Error **errp)
static int vfio_get_device(VFIOGroup *group, const char *name,
VFIODevice *vbasedev, Error **errp)
{
g_autofree struct vfio_device_info *info = NULL;
int fd;
@ -2506,7 +2506,7 @@ int vfio_get_device(VFIOGroup *group, const char *name,
return 0;
}
void vfio_put_base_device(VFIODevice *vbasedev)
static void vfio_put_base_device(VFIODevice *vbasedev)
{
if (!vbasedev->group) {
return;