vfio: Introduce a new header file for helper services

Gather all helper routine declarations into "vfio-helpers.h" to reduce
exposure of VFIO internals in "hw/vfio/vfio-common.h".

Reviewed-by: John Levon <john.levon@nutanix.com>
Link: https://lore.kernel.org/qemu-devel/20250318095415.670319-16-clg@redhat.com
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-17-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Cédric Le Goater 2025-03-26 08:51:01 +01:00
parent 5cf52416e4
commit ac28680d5e
8 changed files with 32 additions and 7 deletions

26
hw/vfio/vfio-helpers.h Normal file
View file

@ -0,0 +1,26 @@
/*
* VFIO helpers
*
* Copyright Red Hat, Inc. 2025
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef HW_VFIO_VFIO_HELPERS_H
#define HW_VFIO_VFIO_HELPERS_H
#ifdef CONFIG_LINUX
#include <linux/vfio.h>
struct vfio_info_cap_header *
vfio_get_cap(void *ptr, uint32_t cap_offset, uint16_t id);
struct vfio_info_cap_header *
vfio_get_device_info_cap(struct vfio_device_info *info, uint16_t id);
struct vfio_info_cap_header *
vfio_get_region_info_cap(struct vfio_region_info *info, uint16_t id);
#endif
int vfio_bitmap_alloc(VFIOBitmap *vbmap, hwaddr size);
#endif /* HW_VFIO_VFIO_HELPERS_H */