vfio: Rename VFIODevice related services

Rename these routines :

  vfio_disable_irqindex       -> vfio_device_irq_disable
  vfio_unmask_single_irqindex -> vfio_device_irq_unmask
  vfio_mask_single_irqindex   -> vfio_device_irq_mask
  vfio_set_irq_signaling      -> vfio_device_irq_set_signaling
  vfio_attach_device          -> vfio_device_attach
  vfio_detach_device          -> vfio_device_detach
  vfio_get_region_info        -> vfio_device_get_region_info
  vfio_get_dev_region_info    -> vfio_device_get_region_info_type
  vfio_has_region_cap         -> vfio_device_has_region_cap
  vfio_reset_handler          -> vfio_device_reset_hander

to better reflect the namespace they belong to.

Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-37-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:21 +01:00
parent 11b8b9d53d
commit e218ccf0c9
12 changed files with 112 additions and 112 deletions

View file

@ -117,8 +117,8 @@ static bool vfio_ap_register_irq_notifier(VFIOAPDevice *vapdev,
fd = event_notifier_get_fd(notifier); fd = event_notifier_get_fd(notifier);
qemu_set_fd_handler(fd, fd_read, NULL, vapdev); qemu_set_fd_handler(fd, fd_read, NULL, vapdev);
if (!vfio_set_irq_signaling(vdev, irq, 0, VFIO_IRQ_SET_ACTION_TRIGGER, fd, if (!vfio_device_irq_set_signaling(vdev, irq, 0, VFIO_IRQ_SET_ACTION_TRIGGER, fd,
errp)) { errp)) {
qemu_set_fd_handler(fd, NULL, NULL, vapdev); qemu_set_fd_handler(fd, NULL, NULL, vapdev);
event_notifier_cleanup(notifier); event_notifier_cleanup(notifier);
} }
@ -141,8 +141,8 @@ static void vfio_ap_unregister_irq_notifier(VFIOAPDevice *vapdev,
return; return;
} }
if (!vfio_set_irq_signaling(&vapdev->vdev, irq, 0, if (!vfio_device_irq_set_signaling(&vapdev->vdev, irq, 0,
VFIO_IRQ_SET_ACTION_TRIGGER, -1, &err)) { VFIO_IRQ_SET_ACTION_TRIGGER, -1, &err)) {
warn_reportf_err(err, VFIO_MSG_PREFIX, vapdev->vdev.name); warn_reportf_err(err, VFIO_MSG_PREFIX, vapdev->vdev.name);
} }
@ -162,7 +162,7 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)
return; return;
} }
if (!vfio_attach_device(vbasedev->name, vbasedev, if (!vfio_device_attach(vbasedev->name, vbasedev,
&address_space_memory, errp)) { &address_space_memory, errp)) {
goto error; goto error;
} }
@ -187,7 +187,7 @@ static void vfio_ap_unrealize(DeviceState *dev)
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(dev); VFIOAPDevice *vapdev = VFIO_AP_DEVICE(dev);
vfio_ap_unregister_irq_notifier(vapdev, VFIO_AP_REQ_IRQ_INDEX); vfio_ap_unregister_irq_notifier(vapdev, VFIO_AP_REQ_IRQ_INDEX);
vfio_detach_device(&vapdev->vdev); vfio_device_detach(&vapdev->vdev);
g_free(vapdev->vdev.name); g_free(vapdev->vdev.name);
} }

View file

@ -426,8 +426,8 @@ static bool vfio_ccw_register_irq_notifier(VFIOCCWDevice *vcdev,
fd = event_notifier_get_fd(notifier); fd = event_notifier_get_fd(notifier);
qemu_set_fd_handler(fd, fd_read, NULL, vcdev); qemu_set_fd_handler(fd, fd_read, NULL, vcdev);
if (!vfio_set_irq_signaling(vdev, irq, 0, if (!vfio_device_irq_set_signaling(vdev, irq, 0,
VFIO_IRQ_SET_ACTION_TRIGGER, fd, errp)) { VFIO_IRQ_SET_ACTION_TRIGGER, fd, errp)) {
qemu_set_fd_handler(fd, NULL, NULL, vcdev); qemu_set_fd_handler(fd, NULL, NULL, vcdev);
event_notifier_cleanup(notifier); event_notifier_cleanup(notifier);
} }
@ -456,8 +456,8 @@ static void vfio_ccw_unregister_irq_notifier(VFIOCCWDevice *vcdev,
return; return;
} }
if (!vfio_set_irq_signaling(&vcdev->vdev, irq, 0, if (!vfio_device_irq_set_signaling(&vcdev->vdev, irq, 0,
VFIO_IRQ_SET_ACTION_TRIGGER, -1, &err)) { VFIO_IRQ_SET_ACTION_TRIGGER, -1, &err)) {
warn_reportf_err(err, VFIO_MSG_PREFIX, vcdev->vdev.name); warn_reportf_err(err, VFIO_MSG_PREFIX, vcdev->vdev.name);
} }
@ -488,7 +488,7 @@ static bool vfio_ccw_get_region(VFIOCCWDevice *vcdev, Error **errp)
return false; return false;
} }
ret = vfio_get_region_info(vdev, VFIO_CCW_CONFIG_REGION_INDEX, &info); ret = vfio_device_get_region_info(vdev, VFIO_CCW_CONFIG_REGION_INDEX, &info);
if (ret) { if (ret) {
error_setg_errno(errp, -ret, "vfio: Error getting config info"); error_setg_errno(errp, -ret, "vfio: Error getting config info");
return false; return false;
@ -505,8 +505,8 @@ static bool vfio_ccw_get_region(VFIOCCWDevice *vcdev, Error **errp)
g_free(info); g_free(info);
/* check for the optional async command region */ /* check for the optional async command region */
ret = vfio_get_dev_region_info(vdev, VFIO_REGION_TYPE_CCW, ret = vfio_device_get_region_info_type(vdev, VFIO_REGION_TYPE_CCW,
VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD, &info); VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD, &info);
if (!ret) { if (!ret) {
vcdev->async_cmd_region_size = info->size; vcdev->async_cmd_region_size = info->size;
if (sizeof(*vcdev->async_cmd_region) != vcdev->async_cmd_region_size) { if (sizeof(*vcdev->async_cmd_region) != vcdev->async_cmd_region_size) {
@ -518,8 +518,8 @@ static bool vfio_ccw_get_region(VFIOCCWDevice *vcdev, Error **errp)
g_free(info); g_free(info);
} }
ret = vfio_get_dev_region_info(vdev, VFIO_REGION_TYPE_CCW, ret = vfio_device_get_region_info_type(vdev, VFIO_REGION_TYPE_CCW,
VFIO_REGION_SUBTYPE_CCW_SCHIB, &info); VFIO_REGION_SUBTYPE_CCW_SCHIB, &info);
if (!ret) { if (!ret) {
vcdev->schib_region_size = info->size; vcdev->schib_region_size = info->size;
if (sizeof(*vcdev->schib_region) != vcdev->schib_region_size) { if (sizeof(*vcdev->schib_region) != vcdev->schib_region_size) {
@ -531,8 +531,8 @@ static bool vfio_ccw_get_region(VFIOCCWDevice *vcdev, Error **errp)
g_free(info); g_free(info);
} }
ret = vfio_get_dev_region_info(vdev, VFIO_REGION_TYPE_CCW, ret = vfio_device_get_region_info_type(vdev, VFIO_REGION_TYPE_CCW,
VFIO_REGION_SUBTYPE_CCW_CRW, &info); VFIO_REGION_SUBTYPE_CCW_CRW, &info);
if (!ret) { if (!ret) {
vcdev->crw_region_size = info->size; vcdev->crw_region_size = info->size;
@ -583,7 +583,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
goto out_unrealize; goto out_unrealize;
} }
if (!vfio_attach_device(cdev->mdevid, vbasedev, if (!vfio_device_attach(cdev->mdevid, vbasedev,
&address_space_memory, errp)) { &address_space_memory, errp)) {
goto out_attach_dev_err; goto out_attach_dev_err;
} }
@ -620,7 +620,7 @@ out_irq_notifier_err:
out_io_notifier_err: out_io_notifier_err:
vfio_ccw_put_region(vcdev); vfio_ccw_put_region(vcdev);
out_region_err: out_region_err:
vfio_detach_device(vbasedev); vfio_device_detach(vbasedev);
out_attach_dev_err: out_attach_dev_err:
g_free(vbasedev->name); g_free(vbasedev->name);
out_unrealize: out_unrealize:
@ -639,7 +639,7 @@ static void vfio_ccw_unrealize(DeviceState *dev)
vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_CRW_IRQ_INDEX); vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_CRW_IRQ_INDEX);
vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX); vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX);
vfio_ccw_put_region(vcdev); vfio_ccw_put_region(vcdev);
vfio_detach_device(&vcdev->vdev); vfio_device_detach(&vcdev->vdev);
g_free(vcdev->vdev.name); g_free(vcdev->vdev.name);
if (cdc->unrealize) { if (cdc->unrealize) {

View file

@ -19,7 +19,7 @@
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "hw/vfio/vfio-container-base.h" #include "hw/vfio/vfio-container-base.h"
#include "hw/vfio/vfio-device.h" /* vfio_reset_handler */ #include "hw/vfio/vfio-device.h" /* vfio_device_reset_handler */
#include "system/reset.h" #include "system/reset.h"
#include "vfio-helpers.h" #include "vfio-helpers.h"
@ -44,7 +44,7 @@ VFIOAddressSpace *vfio_address_space_get(AddressSpace *as)
QLIST_INIT(&space->containers); QLIST_INIT(&space->containers);
if (QLIST_EMPTY(&vfio_address_spaces)) { if (QLIST_EMPTY(&vfio_address_spaces)) {
qemu_register_reset(vfio_reset_handler, NULL); qemu_register_reset(vfio_device_reset_handler, NULL);
} }
QLIST_INSERT_HEAD(&vfio_address_spaces, space, list); QLIST_INSERT_HEAD(&vfio_address_spaces, space, list);
@ -62,7 +62,7 @@ void vfio_address_space_put(VFIOAddressSpace *space)
g_free(space); g_free(space);
if (QLIST_EMPTY(&vfio_address_spaces)) { if (QLIST_EMPTY(&vfio_address_spaces)) {
qemu_unregister_reset(vfio_reset_handler, NULL); qemu_unregister_reset(vfio_device_reset_handler, NULL);
} }
} }

View file

@ -865,7 +865,7 @@ static int vfio_device_groupid(VFIODevice *vbasedev, Error **errp)
} }
/* /*
* vfio_attach_device: attach a device to a security context * vfio_device_attach: attach a device to a security context
* @name and @vbasedev->name are likely to be different depending * @name and @vbasedev->name are likely to be different depending
* on the type of the device, hence the need for passing @name * on the type of the device, hence the need for passing @name
*/ */
@ -881,7 +881,7 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev,
return false; return false;
} }
trace_vfio_attach_device(vbasedev->name, groupid); trace_vfio_device_attach(vbasedev->name, groupid);
if (!vfio_device_hiod_realize(vbasedev, errp)) { if (!vfio_device_hiod_realize(vbasedev, errp)) {
return false; return false;
@ -919,7 +919,7 @@ static void vfio_legacy_detach_device(VFIODevice *vbasedev)
QLIST_REMOVE(vbasedev, global_next); QLIST_REMOVE(vbasedev, global_next);
QLIST_REMOVE(vbasedev, container_next); QLIST_REMOVE(vbasedev, container_next);
vbasedev->bcontainer = NULL; vbasedev->bcontainer = NULL;
trace_vfio_detach_device(vbasedev->name, group->groupid); trace_vfio_device_detach(vbasedev->name, group->groupid);
vfio_put_base_device(vbasedev); vfio_put_base_device(vbasedev);
vfio_put_group(group); vfio_put_group(group);
} }

View file

@ -51,11 +51,11 @@ VFIODeviceList vfio_device_list =
* reset for the one in-use devices case, calling _multi() will do * reset for the one in-use devices case, calling _multi() will do
* nothing if a _one() would have been sufficient. * nothing if a _one() would have been sufficient.
*/ */
void vfio_reset_handler(void *opaque) void vfio_device_reset_handler(void *opaque)
{ {
VFIODevice *vbasedev; VFIODevice *vbasedev;
trace_vfio_reset_handler(); trace_vfio_device_reset_handler();
QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) { QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
if (vbasedev->dev->realized) { if (vbasedev->dev->realized) {
vbasedev->ops->vfio_compute_needs_reset(vbasedev); vbasedev->ops->vfio_compute_needs_reset(vbasedev);
@ -72,7 +72,7 @@ void vfio_reset_handler(void *opaque)
/* /*
* Common VFIO interrupt disable * Common VFIO interrupt disable
*/ */
void vfio_disable_irqindex(VFIODevice *vbasedev, int index) void vfio_device_irq_disable(VFIODevice *vbasedev, int index)
{ {
struct vfio_irq_set irq_set = { struct vfio_irq_set irq_set = {
.argsz = sizeof(irq_set), .argsz = sizeof(irq_set),
@ -85,7 +85,7 @@ void vfio_disable_irqindex(VFIODevice *vbasedev, int index)
ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, &irq_set); ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, &irq_set);
} }
void vfio_unmask_single_irqindex(VFIODevice *vbasedev, int index) void vfio_device_irq_unmask(VFIODevice *vbasedev, int index)
{ {
struct vfio_irq_set irq_set = { struct vfio_irq_set irq_set = {
.argsz = sizeof(irq_set), .argsz = sizeof(irq_set),
@ -98,7 +98,7 @@ void vfio_unmask_single_irqindex(VFIODevice *vbasedev, int index)
ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, &irq_set); ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, &irq_set);
} }
void vfio_mask_single_irqindex(VFIODevice *vbasedev, int index) void vfio_device_irq_mask(VFIODevice *vbasedev, int index)
{ {
struct vfio_irq_set irq_set = { struct vfio_irq_set irq_set = {
.argsz = sizeof(irq_set), .argsz = sizeof(irq_set),
@ -147,8 +147,8 @@ static const char *index_to_str(VFIODevice *vbasedev, int index)
} }
} }
bool vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex, bool vfio_device_irq_set_signaling(VFIODevice *vbasedev, int index, int subindex,
int action, int fd, Error **errp) int action, int fd, Error **errp)
{ {
ERRP_GUARD(); ERRP_GUARD();
g_autofree struct vfio_irq_set *irq_set = NULL; g_autofree struct vfio_irq_set *irq_set = NULL;
@ -185,8 +185,8 @@ bool vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex,
return false; return false;
} }
int vfio_get_region_info(VFIODevice *vbasedev, int index, int vfio_device_get_region_info(VFIODevice *vbasedev, int index,
struct vfio_region_info **info) struct vfio_region_info **info)
{ {
size_t argsz = sizeof(struct vfio_region_info); size_t argsz = sizeof(struct vfio_region_info);
@ -212,8 +212,8 @@ retry:
return 0; return 0;
} }
int vfio_get_dev_region_info(VFIODevice *vbasedev, uint32_t type, int vfio_device_get_region_info_type(VFIODevice *vbasedev, uint32_t type,
uint32_t subtype, struct vfio_region_info **info) uint32_t subtype, struct vfio_region_info **info)
{ {
int i; int i;
@ -221,7 +221,7 @@ int vfio_get_dev_region_info(VFIODevice *vbasedev, uint32_t type,
struct vfio_info_cap_header *hdr; struct vfio_info_cap_header *hdr;
struct vfio_region_info_cap_type *cap_type; struct vfio_region_info_cap_type *cap_type;
if (vfio_get_region_info(vbasedev, i, info)) { if (vfio_device_get_region_info(vbasedev, i, info)) {
continue; continue;
} }
@ -233,8 +233,8 @@ int vfio_get_dev_region_info(VFIODevice *vbasedev, uint32_t type,
cap_type = container_of(hdr, struct vfio_region_info_cap_type, header); cap_type = container_of(hdr, struct vfio_region_info_cap_type, header);
trace_vfio_get_dev_region(vbasedev->name, i, trace_vfio_device_get_region_info_type(vbasedev->name, i,
cap_type->type, cap_type->subtype); cap_type->type, cap_type->subtype);
if (cap_type->type == type && cap_type->subtype == subtype) { if (cap_type->type == type && cap_type->subtype == subtype) {
return 0; return 0;
@ -247,12 +247,12 @@ int vfio_get_dev_region_info(VFIODevice *vbasedev, uint32_t type,
return -ENODEV; return -ENODEV;
} }
bool vfio_has_region_cap(VFIODevice *vbasedev, int region, uint16_t cap_type) bool vfio_device_has_region_cap(VFIODevice *vbasedev, int region, uint16_t cap_type)
{ {
g_autofree struct vfio_region_info *info = NULL; g_autofree struct vfio_region_info *info = NULL;
bool ret = false; bool ret = false;
if (!vfio_get_region_info(vbasedev, region, &info)) { if (!vfio_device_get_region_info(vbasedev, region, &info)) {
if (vfio_get_region_info_cap(info, cap_type)) { if (vfio_get_region_info_cap(info, cap_type)) {
ret = true; ret = true;
} }
@ -367,7 +367,7 @@ VFIODevice *vfio_get_vfio_device(Object *obj)
} }
} }
bool vfio_attach_device(char *name, VFIODevice *vbasedev, bool vfio_device_attach(char *name, VFIODevice *vbasedev,
AddressSpace *as, Error **errp) AddressSpace *as, Error **errp)
{ {
const VFIOIOMMUClass *ops = const VFIOIOMMUClass *ops =
@ -395,7 +395,7 @@ bool vfio_attach_device(char *name, VFIODevice *vbasedev,
return true; return true;
} }
void vfio_detach_device(VFIODevice *vbasedev) void vfio_device_detach(VFIODevice *vbasedev)
{ {
if (!vbasedev->bcontainer) { if (!vbasedev->bcontainer) {
return; return;

View file

@ -129,10 +129,10 @@ static bool vfio_display_edid_init(VFIOPCIDevice *vdev, Error **errp)
int fd = vdev->vbasedev.fd; int fd = vdev->vbasedev.fd;
int ret; int ret;
ret = vfio_get_dev_region_info(&vdev->vbasedev, ret = vfio_device_get_region_info_type(&vdev->vbasedev,
VFIO_REGION_TYPE_GFX, VFIO_REGION_TYPE_GFX,
VFIO_REGION_SUBTYPE_GFX_EDID, VFIO_REGION_SUBTYPE_GFX_EDID,
&dpy->edid_info); &dpy->edid_info);
if (ret) { if (ret) {
/* Failed to get GFX edid info, allow to go through without edid. */ /* Failed to get GFX edid info, allow to go through without edid. */
return true; return true;

View file

@ -200,7 +200,7 @@ static bool vfio_pci_igd_setup_opregion(VFIOPCIDevice *vdev, Error **errp)
return false; return false;
} }
ret = vfio_get_dev_region_info(&vdev->vbasedev, ret = vfio_device_get_region_info_type(&vdev->vbasedev,
VFIO_REGION_TYPE_PCI_VENDOR_TYPE | PCI_VENDOR_ID_INTEL, VFIO_REGION_TYPE_PCI_VENDOR_TYPE | PCI_VENDOR_ID_INTEL,
VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION, &opregion); VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION, &opregion);
if (ret) { if (ret) {
@ -385,7 +385,7 @@ static bool vfio_pci_igd_setup_lpc_bridge(VFIOPCIDevice *vdev, Error **errp)
* Check whether we have all the vfio device specific regions to * Check whether we have all the vfio device specific regions to
* support LPC quirk (added in Linux v4.6). * support LPC quirk (added in Linux v4.6).
*/ */
ret = vfio_get_dev_region_info(&vdev->vbasedev, ret = vfio_device_get_region_info_type(&vdev->vbasedev,
VFIO_REGION_TYPE_PCI_VENDOR_TYPE | PCI_VENDOR_ID_INTEL, VFIO_REGION_TYPE_PCI_VENDOR_TYPE | PCI_VENDOR_ID_INTEL,
VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG, &lpc); VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG, &lpc);
if (ret) { if (ret) {
@ -393,7 +393,7 @@ static bool vfio_pci_igd_setup_lpc_bridge(VFIOPCIDevice *vdev, Error **errp)
return false; return false;
} }
ret = vfio_get_dev_region_info(&vdev->vbasedev, ret = vfio_device_get_region_info_type(&vdev->vbasedev,
VFIO_REGION_TYPE_PCI_VENDOR_TYPE | PCI_VENDOR_ID_INTEL, VFIO_REGION_TYPE_PCI_VENDOR_TYPE | PCI_VENDOR_ID_INTEL,
VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG, &host); VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG, &host);
if (ret) { if (ret) {
@ -542,8 +542,8 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
* there's no ROM, there's no point in setting up this quirk. * there's no ROM, there's no point in setting up this quirk.
* NB. We only seem to get BIOS ROMs, so UEFI VM would need CSM support. * NB. We only seem to get BIOS ROMs, so UEFI VM would need CSM support.
*/ */
ret = vfio_get_region_info(&vdev->vbasedev, ret = vfio_device_get_region_info(&vdev->vbasedev,
VFIO_PCI_ROM_REGION_INDEX, &rom); VFIO_PCI_ROM_REGION_INDEX, &rom);
if ((ret || !rom->size) && !vdev->pdev.romfile) { if ((ret || !rom->size) && !vdev->pdev.romfile) {
error_setg(&err, "Device has no ROM"); error_setg(&err, "Device has no ROM");
goto error; goto error;

View file

@ -115,7 +115,7 @@ static void vfio_intx_eoi(VFIODevice *vbasedev)
vdev->intx.pending = false; vdev->intx.pending = false;
pci_irq_deassert(&vdev->pdev); pci_irq_deassert(&vdev->pdev);
vfio_unmask_single_irqindex(vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vfio_device_irq_unmask(vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
} }
static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp) static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
@ -131,7 +131,7 @@ static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
/* Get to a known interrupt state */ /* Get to a known interrupt state */
qemu_set_fd_handler(irq_fd, NULL, NULL, vdev); qemu_set_fd_handler(irq_fd, NULL, NULL, vdev);
vfio_mask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vfio_device_irq_mask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
vdev->intx.pending = false; vdev->intx.pending = false;
pci_irq_deassert(&vdev->pdev); pci_irq_deassert(&vdev->pdev);
@ -149,15 +149,15 @@ static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
goto fail_irqfd; goto fail_irqfd;
} }
if (!vfio_set_irq_signaling(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX, 0, if (!vfio_device_irq_set_signaling(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX, 0,
VFIO_IRQ_SET_ACTION_UNMASK, VFIO_IRQ_SET_ACTION_UNMASK,
event_notifier_get_fd(&vdev->intx.unmask), event_notifier_get_fd(&vdev->intx.unmask),
errp)) { errp)) {
goto fail_vfio; goto fail_vfio;
} }
/* Let'em rip */ /* Let'em rip */
vfio_unmask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vfio_device_irq_unmask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
vdev->intx.kvm_accel = true; vdev->intx.kvm_accel = true;
@ -172,7 +172,7 @@ fail_irqfd:
event_notifier_cleanup(&vdev->intx.unmask); event_notifier_cleanup(&vdev->intx.unmask);
fail: fail:
qemu_set_fd_handler(irq_fd, vfio_intx_interrupt, NULL, vdev); qemu_set_fd_handler(irq_fd, vfio_intx_interrupt, NULL, vdev);
vfio_unmask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vfio_device_irq_unmask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
return false; return false;
#else #else
return true; return true;
@ -190,7 +190,7 @@ static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev)
* Get to a known state, hardware masked, QEMU ready to accept new * Get to a known state, hardware masked, QEMU ready to accept new
* interrupts, QEMU IRQ de-asserted. * interrupts, QEMU IRQ de-asserted.
*/ */
vfio_mask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vfio_device_irq_mask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
vdev->intx.pending = false; vdev->intx.pending = false;
pci_irq_deassert(&vdev->pdev); pci_irq_deassert(&vdev->pdev);
@ -210,7 +210,7 @@ static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev)
vdev->intx.kvm_accel = false; vdev->intx.kvm_accel = false;
/* If we've missed an event, let it re-fire through QEMU */ /* If we've missed an event, let it re-fire through QEMU */
vfio_unmask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vfio_device_irq_unmask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
trace_vfio_intx_disable_kvm(vdev->vbasedev.name); trace_vfio_intx_disable_kvm(vdev->vbasedev.name);
#endif #endif
@ -299,7 +299,7 @@ static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
fd = event_notifier_get_fd(&vdev->intx.interrupt); fd = event_notifier_get_fd(&vdev->intx.interrupt);
qemu_set_fd_handler(fd, vfio_intx_interrupt, NULL, vdev); qemu_set_fd_handler(fd, vfio_intx_interrupt, NULL, vdev);
if (!vfio_set_irq_signaling(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX, 0, if (!vfio_device_irq_set_signaling(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX, 0,
VFIO_IRQ_SET_ACTION_TRIGGER, fd, errp)) { VFIO_IRQ_SET_ACTION_TRIGGER, fd, errp)) {
qemu_set_fd_handler(fd, NULL, NULL, vdev); qemu_set_fd_handler(fd, NULL, NULL, vdev);
event_notifier_cleanup(&vdev->intx.interrupt); event_notifier_cleanup(&vdev->intx.interrupt);
@ -322,7 +322,7 @@ static void vfio_intx_disable(VFIOPCIDevice *vdev)
timer_del(vdev->intx.mmap_timer); timer_del(vdev->intx.mmap_timer);
vfio_intx_disable_kvm(vdev); vfio_intx_disable_kvm(vdev);
vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vfio_device_irq_disable(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
vdev->intx.pending = false; vdev->intx.pending = false;
pci_irq_deassert(&vdev->pdev); pci_irq_deassert(&vdev->pdev);
vfio_mmap_set_enabled(vdev, true); vfio_mmap_set_enabled(vdev, true);
@ -578,7 +578,7 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
if (!vdev->defer_kvm_irq_routing) { if (!vdev->defer_kvm_irq_routing) {
if (vdev->msix->noresize && resizing) { if (vdev->msix->noresize && resizing) {
vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX); vfio_device_irq_disable(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX);
ret = vfio_enable_vectors(vdev, true); ret = vfio_enable_vectors(vdev, true);
if (ret) { if (ret) {
error_report("vfio: failed to enable vectors, %d", ret); error_report("vfio: failed to enable vectors, %d", ret);
@ -593,7 +593,7 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
fd = event_notifier_get_fd(&vector->interrupt); fd = event_notifier_get_fd(&vector->interrupt);
} }
if (!vfio_set_irq_signaling(&vdev->vbasedev, if (!vfio_device_irq_set_signaling(&vdev->vbasedev,
VFIO_PCI_MSIX_IRQ_INDEX, nr, VFIO_PCI_MSIX_IRQ_INDEX, nr,
VFIO_IRQ_SET_ACTION_TRIGGER, fd, VFIO_IRQ_SET_ACTION_TRIGGER, fd,
&err)) { &err)) {
@ -638,7 +638,7 @@ static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr)
int32_t fd = event_notifier_get_fd(&vector->interrupt); int32_t fd = event_notifier_get_fd(&vector->interrupt);
Error *err = NULL; Error *err = NULL;
if (!vfio_set_irq_signaling(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX, if (!vfio_device_irq_set_signaling(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX,
nr, VFIO_IRQ_SET_ACTION_TRIGGER, fd, nr, VFIO_IRQ_SET_ACTION_TRIGGER, fd,
&err)) { &err)) {
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name); error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
@ -835,7 +835,7 @@ static void vfio_msix_disable(VFIOPCIDevice *vdev)
* Always clear MSI-X IRQ index. A PF device could have enabled * Always clear MSI-X IRQ index. A PF device could have enabled
* MSI-X with no vectors. See vfio_msix_enable(). * MSI-X with no vectors. See vfio_msix_enable().
*/ */
vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX); vfio_device_irq_disable(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX);
vfio_msi_disable_common(vdev); vfio_msi_disable_common(vdev);
if (!vfio_intx_enable(vdev, &err)) { if (!vfio_intx_enable(vdev, &err)) {
@ -852,7 +852,7 @@ static void vfio_msi_disable(VFIOPCIDevice *vdev)
{ {
Error *err = NULL; Error *err = NULL;
vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSI_IRQ_INDEX); vfio_device_irq_disable(&vdev->vbasedev, VFIO_PCI_MSI_IRQ_INDEX);
vfio_msi_disable_common(vdev); vfio_msi_disable_common(vdev);
vfio_intx_enable(vdev, &err); vfio_intx_enable(vdev, &err);
if (err) { if (err) {
@ -886,8 +886,8 @@ static void vfio_pci_load_rom(VFIOPCIDevice *vdev)
off_t off = 0; off_t off = 0;
ssize_t bytes; ssize_t bytes;
if (vfio_get_region_info(&vdev->vbasedev, if (vfio_device_get_region_info(&vdev->vbasedev,
VFIO_PCI_ROM_REGION_INDEX, &reg_info)) { VFIO_PCI_ROM_REGION_INDEX, &reg_info)) {
error_report("vfio: Error getting ROM info: %m"); error_report("vfio: Error getting ROM info: %m");
return; return;
} }
@ -1380,8 +1380,8 @@ static void vfio_pci_fixup_msix_region(VFIOPCIDevice *vdev)
* If the host driver allows mapping of a MSIX data, we are going to * If the host driver allows mapping of a MSIX data, we are going to
* do map the entire BAR and emulate MSIX table on top of that. * do map the entire BAR and emulate MSIX table on top of that.
*/ */
if (vfio_has_region_cap(&vdev->vbasedev, region->nr, if (vfio_device_has_region_cap(&vdev->vbasedev, region->nr,
VFIO_REGION_INFO_CAP_MSIX_MAPPABLE)) { VFIO_REGION_INFO_CAP_MSIX_MAPPABLE)) {
return; return;
} }
@ -2673,7 +2673,7 @@ bool vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp)
g_autofree struct vfio_region_info *reg_info = NULL; g_autofree struct vfio_region_info *reg_info = NULL;
int ret; int ret;
ret = vfio_get_region_info(vbasedev, VFIO_PCI_VGA_REGION_INDEX, &reg_info); ret = vfio_device_get_region_info(vbasedev, VFIO_PCI_VGA_REGION_INDEX, &reg_info);
if (ret) { if (ret) {
error_setg_errno(errp, -ret, error_setg_errno(errp, -ret,
"failed getting region info for VGA region index %d", "failed getting region info for VGA region index %d",
@ -2771,8 +2771,8 @@ static bool vfio_populate_device(VFIOPCIDevice *vdev, Error **errp)
QLIST_INIT(&vdev->bars[i].quirks); QLIST_INIT(&vdev->bars[i].quirks);
} }
ret = vfio_get_region_info(vbasedev, ret = vfio_device_get_region_info(vbasedev,
VFIO_PCI_CONFIG_REGION_INDEX, &reg_info); VFIO_PCI_CONFIG_REGION_INDEX, &reg_info);
if (ret) { if (ret) {
error_setg_errno(errp, -ret, "failed to get config info"); error_setg_errno(errp, -ret, "failed to get config info");
return false; return false;
@ -2816,7 +2816,7 @@ static bool vfio_populate_device(VFIOPCIDevice *vdev, Error **errp)
static void vfio_pci_put_device(VFIOPCIDevice *vdev) static void vfio_pci_put_device(VFIOPCIDevice *vdev)
{ {
vfio_detach_device(&vdev->vbasedev); vfio_device_detach(&vdev->vbasedev);
g_free(vdev->vbasedev.name); g_free(vdev->vbasedev.name);
g_free(vdev->msix); g_free(vdev->msix);
@ -2868,8 +2868,8 @@ static void vfio_register_err_notifier(VFIOPCIDevice *vdev)
fd = event_notifier_get_fd(&vdev->err_notifier); fd = event_notifier_get_fd(&vdev->err_notifier);
qemu_set_fd_handler(fd, vfio_err_notifier_handler, NULL, vdev); qemu_set_fd_handler(fd, vfio_err_notifier_handler, NULL, vdev);
if (!vfio_set_irq_signaling(&vdev->vbasedev, VFIO_PCI_ERR_IRQ_INDEX, 0, if (!vfio_device_irq_set_signaling(&vdev->vbasedev, VFIO_PCI_ERR_IRQ_INDEX, 0,
VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err)) { VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err)) {
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name); error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
qemu_set_fd_handler(fd, NULL, NULL, vdev); qemu_set_fd_handler(fd, NULL, NULL, vdev);
event_notifier_cleanup(&vdev->err_notifier); event_notifier_cleanup(&vdev->err_notifier);
@ -2885,8 +2885,8 @@ static void vfio_unregister_err_notifier(VFIOPCIDevice *vdev)
return; return;
} }
if (!vfio_set_irq_signaling(&vdev->vbasedev, VFIO_PCI_ERR_IRQ_INDEX, 0, if (!vfio_device_irq_set_signaling(&vdev->vbasedev, VFIO_PCI_ERR_IRQ_INDEX, 0,
VFIO_IRQ_SET_ACTION_TRIGGER, -1, &err)) { VFIO_IRQ_SET_ACTION_TRIGGER, -1, &err)) {
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name); error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
} }
qemu_set_fd_handler(event_notifier_get_fd(&vdev->err_notifier), qemu_set_fd_handler(event_notifier_get_fd(&vdev->err_notifier),
@ -2933,8 +2933,8 @@ static void vfio_register_req_notifier(VFIOPCIDevice *vdev)
fd = event_notifier_get_fd(&vdev->req_notifier); fd = event_notifier_get_fd(&vdev->req_notifier);
qemu_set_fd_handler(fd, vfio_req_notifier_handler, NULL, vdev); qemu_set_fd_handler(fd, vfio_req_notifier_handler, NULL, vdev);
if (!vfio_set_irq_signaling(&vdev->vbasedev, VFIO_PCI_REQ_IRQ_INDEX, 0, if (!vfio_device_irq_set_signaling(&vdev->vbasedev, VFIO_PCI_REQ_IRQ_INDEX, 0,
VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err)) { VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err)) {
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name); error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
qemu_set_fd_handler(fd, NULL, NULL, vdev); qemu_set_fd_handler(fd, NULL, NULL, vdev);
event_notifier_cleanup(&vdev->req_notifier); event_notifier_cleanup(&vdev->req_notifier);
@ -2951,8 +2951,8 @@ static void vfio_unregister_req_notifier(VFIOPCIDevice *vdev)
return; return;
} }
if (!vfio_set_irq_signaling(&vdev->vbasedev, VFIO_PCI_REQ_IRQ_INDEX, 0, if (!vfio_device_irq_set_signaling(&vdev->vbasedev, VFIO_PCI_REQ_IRQ_INDEX, 0,
VFIO_IRQ_SET_ACTION_TRIGGER, -1, &err)) { VFIO_IRQ_SET_ACTION_TRIGGER, -1, &err)) {
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name); error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
} }
qemu_set_fd_handler(event_notifier_get_fd(&vdev->req_notifier), qemu_set_fd_handler(event_notifier_get_fd(&vdev->req_notifier),
@ -3015,7 +3015,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
name = g_strdup(vbasedev->name); name = g_strdup(vbasedev->name);
} }
if (!vfio_attach_device(name, vbasedev, if (!vfio_device_attach(name, vbasedev,
pci_device_iommu_address_space(pdev), errp)) { pci_device_iommu_address_space(pdev), errp)) {
goto error; goto error;
} }

View file

@ -119,8 +119,8 @@ static int vfio_set_trigger_eventfd(VFIOINTp *intp,
qemu_set_fd_handler(fd, (IOHandler *)handler, NULL, intp); qemu_set_fd_handler(fd, (IOHandler *)handler, NULL, intp);
if (!vfio_set_irq_signaling(vbasedev, intp->pin, 0, if (!vfio_device_irq_set_signaling(vbasedev, intp->pin, 0,
VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err)) { VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err)) {
error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name); error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name);
qemu_set_fd_handler(fd, NULL, NULL, NULL); qemu_set_fd_handler(fd, NULL, NULL, NULL);
return -EINVAL; return -EINVAL;
@ -301,7 +301,7 @@ static void vfio_platform_eoi(VFIODevice *vbasedev)
if (vfio_irq_is_automasked(intp)) { if (vfio_irq_is_automasked(intp)) {
/* unmasks the physical level-sensitive IRQ */ /* unmasks the physical level-sensitive IRQ */
vfio_unmask_single_irqindex(vbasedev, intp->pin); vfio_device_irq_unmask(vbasedev, intp->pin);
} }
/* a single IRQ can be active at a time */ /* a single IRQ can be active at a time */
@ -357,8 +357,8 @@ static int vfio_set_resample_eventfd(VFIOINTp *intp)
Error *err = NULL; Error *err = NULL;
qemu_set_fd_handler(fd, NULL, NULL, NULL); qemu_set_fd_handler(fd, NULL, NULL, NULL);
if (!vfio_set_irq_signaling(vbasedev, intp->pin, 0, if (!vfio_device_irq_set_signaling(vbasedev, intp->pin, 0,
VFIO_IRQ_SET_ACTION_UNMASK, fd, &err)) { VFIO_IRQ_SET_ACTION_UNMASK, fd, &err)) {
error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name); error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name);
return -EINVAL; return -EINVAL;
} }
@ -546,7 +546,7 @@ static bool vfio_base_device_init(VFIODevice *vbasedev, Error **errp)
return false; return false;
} }
if (!vfio_attach_device(vbasedev->name, vbasedev, if (!vfio_device_attach(vbasedev->name, vbasedev,
&address_space_memory, errp)) { &address_space_memory, errp)) {
return false; return false;
} }
@ -555,7 +555,7 @@ static bool vfio_base_device_init(VFIODevice *vbasedev, Error **errp)
return true; return true;
} }
vfio_detach_device(vbasedev); vfio_device_detach(vbasedev);
return false; return false;
} }

View file

@ -185,7 +185,7 @@ int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
g_autofree struct vfio_region_info *info = NULL; g_autofree struct vfio_region_info *info = NULL;
int ret; int ret;
ret = vfio_get_region_info(vbasedev, index, &info); ret = vfio_device_get_region_info(vbasedev, index, &info);
if (ret) { if (ret) {
return ret; return ret;
} }

View file

@ -37,8 +37,6 @@ vfio_pci_hot_reset_dep_devices(int domain, int bus, int slot, int function, int
vfio_pci_hot_reset_result(const char *name, const char *result) "%s hot reset: %s" vfio_pci_hot_reset_result(const char *name, const char *result) "%s hot reset: %s"
vfio_populate_device_config(const char *name, unsigned long size, unsigned long offset, unsigned long flags) "Device '%s' config: size: 0x%lx, offset: 0x%lx, flags: 0x%lx" vfio_populate_device_config(const char *name, unsigned long size, unsigned long offset, unsigned long flags) "Device '%s' config: size: 0x%lx, offset: 0x%lx, flags: 0x%lx"
vfio_populate_device_get_irq_info_failure(const char *errstr) "VFIO_DEVICE_GET_IRQ_INFO failure: %s" vfio_populate_device_get_irq_info_failure(const char *errstr) "VFIO_DEVICE_GET_IRQ_INFO failure: %s"
vfio_attach_device(const char *name, int group_id) " (%s) group %d"
vfio_detach_device(const char *name, int group_id) " (%s) group %d"
vfio_mdev(const char *name, bool is_mdev) " (%s) is_mdev %d" vfio_mdev(const char *name, bool is_mdev) " (%s) is_mdev %d"
vfio_add_ext_cap_dropped(const char *name, uint16_t cap, uint16_t offset) "%s 0x%x@0x%x" vfio_add_ext_cap_dropped(const char *name, uint16_t cap, uint16_t offset) "%s 0x%x@0x%x"
vfio_pci_reset(const char *name) " (%s)" vfio_pci_reset(const char *name) " (%s)"
@ -196,5 +194,7 @@ iommufd_cdev_device_info(char *name, int devfd, int num_irqs, int num_regions, i
iommufd_cdev_pci_hot_reset_dep_devices(int domain, int bus, int slot, int function, int dev_id) "\t%04x:%02x:%02x.%x devid %d" iommufd_cdev_pci_hot_reset_dep_devices(int domain, int bus, int slot, int function, int dev_id) "\t%04x:%02x:%02x.%x devid %d"
# device.c # device.c
vfio_get_dev_region(const char *name, int index, uint32_t type, uint32_t subtype) "%s index %d, %08x/%08x" vfio_device_get_region_info_type(const char *name, int index, uint32_t type, uint32_t subtype) "%s index %d, %08x/%08x"
vfio_reset_handler(void) "" vfio_device_reset_handler(void) ""
vfio_device_attach(const char *name, int group_id) " (%s) group %d"
vfio_device_detach(const char *name, int group_id) " (%s) group %d"

View file

@ -115,29 +115,29 @@ struct VFIODeviceOps {
int (*vfio_load_config)(VFIODevice *vdev, QEMUFile *f); int (*vfio_load_config)(VFIODevice *vdev, QEMUFile *f);
}; };
void vfio_disable_irqindex(VFIODevice *vbasedev, int index); void vfio_device_irq_disable(VFIODevice *vbasedev, int index);
void vfio_unmask_single_irqindex(VFIODevice *vbasedev, int index); void vfio_device_irq_unmask(VFIODevice *vbasedev, int index);
void vfio_mask_single_irqindex(VFIODevice *vbasedev, int index); void vfio_device_irq_mask(VFIODevice *vbasedev, int index);
bool vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex, bool vfio_device_irq_set_signaling(VFIODevice *vbasedev, int index, int subindex,
int action, int fd, Error **errp); int action, int fd, Error **errp);
void vfio_reset_handler(void *opaque); void vfio_device_reset_handler(void *opaque);
bool vfio_device_is_mdev(VFIODevice *vbasedev); bool vfio_device_is_mdev(VFIODevice *vbasedev);
bool vfio_device_hiod_realize(VFIODevice *vbasedev, Error **errp); bool vfio_device_hiod_realize(VFIODevice *vbasedev, Error **errp);
bool vfio_attach_device(char *name, VFIODevice *vbasedev, bool vfio_device_attach(char *name, VFIODevice *vbasedev,
AddressSpace *as, Error **errp); AddressSpace *as, Error **errp);
void vfio_detach_device(VFIODevice *vbasedev); void vfio_device_detach(VFIODevice *vbasedev);
VFIODevice *vfio_get_vfio_device(Object *obj); VFIODevice *vfio_get_vfio_device(Object *obj);
typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList; typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList;
extern VFIODeviceList vfio_device_list; extern VFIODeviceList vfio_device_list;
#ifdef CONFIG_LINUX #ifdef CONFIG_LINUX
int vfio_get_region_info(VFIODevice *vbasedev, int index, int vfio_device_get_region_info(VFIODevice *vbasedev, int index,
struct vfio_region_info **info); struct vfio_region_info **info);
int vfio_get_dev_region_info(VFIODevice *vbasedev, uint32_t type, int vfio_device_get_region_info_type(VFIODevice *vbasedev, uint32_t type,
uint32_t subtype, struct vfio_region_info **info); uint32_t subtype, struct vfio_region_info **info);
bool vfio_has_region_cap(VFIODevice *vbasedev, int region, uint16_t cap_type); bool vfio_device_has_region_cap(VFIODevice *vbasedev, int region, uint16_t cap_type);
#endif #endif
/* Returns 0 on success, or a negative errno. */ /* Returns 0 on success, or a negative errno. */