vfio: add read/write to device IO ops vector

Now we have the region info cache, add ->region_read/write device I/O
operations instead of explicit pread()/pwrite() system calls.

Signed-off-by: John Levon <john.levon@nutanix.com>
Link: https://lore.kernel.org/qemu-devel/20250507152020.1254632-13-john.levon@nutanix.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
John Levon 2025-05-07 16:20:17 +01:00 committed by Cédric Le Goater
parent 95cdb02451
commit 776066ac90
4 changed files with 77 additions and 20 deletions

View file

@ -188,6 +188,24 @@ struct VFIODeviceIOOps {
* Configure IRQs as defined by @irqs.
*/
int (*set_irqs)(VFIODevice *vdev, struct vfio_irq_set *irqs);
/**
* @region_read
*
* Read @size bytes from the region @nr at offset @off into the buffer
* @data.
*/
int (*region_read)(VFIODevice *vdev, uint8_t nr, off_t off, uint32_t size,
void *data);
/**
* @region_write
*
* Write @size bytes to the region @nr at offset @off from the buffer
* @data.
*/
int (*region_write)(VFIODevice *vdev, uint8_t nr, off_t off, uint32_t size,
void *data);
};
void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainerBase *bcontainer,