vfio_get_device_info() is a low level routine. Move it with the other helpers.
Signed-off-by: Cédric Le Goater <c...@redhat.com> --- hw/vfio/helpers.h | 1 + include/hw/vfio/vfio-common.h | 1 - hw/vfio/common.c | 24 ------------------------ hw/vfio/helpers.c | 24 ++++++++++++++++++++++++ 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/hw/vfio/helpers.h b/hw/vfio/helpers.h index 397908735c6b285d3d9e012f30488589408235ae..8ac1f13c6e2a51983f69f81072cb134ff8969c70 100644 --- a/hw/vfio/helpers.h +++ b/hw/vfio/helpers.h @@ -25,6 +25,7 @@ bool vfio_get_info_dma_avail(struct vfio_iommu_type1_info *info, #endif int vfio_bitmap_alloc(VFIOBitmap *vbmap, hwaddr size); +struct vfio_device_info *vfio_get_device_info(int fd); int vfio_kvm_device_add_fd(int fd, Error **errp); int vfio_kvm_device_del_fd(int fd, Error **errp); diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 35b765357f85346ecfabfae782f3aa8d83d9e7ae..848412ea53ccd903313855fd30490d897c8681c0 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -121,7 +121,6 @@ void vfio_mask_single_irqindex(VFIODevice *vbasedev, int index); bool vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex, int action, int fd, Error **errp); -struct vfio_device_info *vfio_get_device_info(int fd); bool vfio_device_is_mdev(VFIODevice *vbasedev); bool vfio_device_hiod_realize(VFIODevice *vbasedev, Error **errp); bool vfio_attach_device(char *name, VFIODevice *vbasedev, diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 9c1b635a813ffff97426d2c3beec84de1b9afe63..e70e4c077ca27ce0d2f990d684196f2f74f6f07a 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1302,30 +1302,6 @@ const MemoryListener vfio_memory_listener = { .log_sync = vfio_listener_log_sync, }; -struct vfio_device_info *vfio_get_device_info(int fd) -{ - struct vfio_device_info *info; - uint32_t argsz = sizeof(*info); - - info = g_malloc0(argsz); - -retry: - info->argsz = argsz; - - if (ioctl(fd, VFIO_DEVICE_GET_INFO, info)) { - g_free(info); - return NULL; - } - - if (info->argsz > argsz) { - argsz = info->argsz; - info = g_realloc(info, argsz); - goto retry; - } - - return info; -} - bool vfio_attach_device(char *name, VFIODevice *vbasedev, AddressSpace *as, Error **errp) { diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c index cec9e2008ba146c15e54a2865d5a40984e7dfc8c..e9ad0c6792558a00f316baab40bf857c3306faaa 100644 --- a/hw/vfio/helpers.c +++ b/hw/vfio/helpers.c @@ -312,6 +312,30 @@ int vfio_kvm_device_del_fd(int fd, Error **errp) return 0; } +struct vfio_device_info *vfio_get_device_info(int fd) +{ + struct vfio_device_info *info; + uint32_t argsz = sizeof(*info); + + info = g_malloc0(argsz); + +retry: + info->argsz = argsz; + + if (ioctl(fd, VFIO_DEVICE_GET_INFO, info)) { + g_free(info); + return NULL; + } + + if (info->argsz > argsz) { + argsz = info->argsz; + info = g_realloc(info, argsz); + goto retry; + } + + return info; +} + int vfio_get_dev_region_info(VFIODevice *vbasedev, uint32_t type, uint32_t subtype, struct vfio_region_info **info) { -- 2.48.1