Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vfio/pci: rename and export do_io_rw()

do_io_rw() is used to read/write to the device MMIO. The grace hopper
VFIO PCI variant driver require this functionality to read/write to
its memory.

Rename this as vfio_pci_core functions and export as GPL.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
Link: https://lore.kernel.org/r/20240220115055.23546-2-ankita@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

authored by

Ankit Agrawal and committed by
Alex Williamson
4de676d4 77943f4d

+13 -8
+9 -7
drivers/vfio/pci/vfio_pci_rdwr.c
··· 96 96 * reads with -1. This is intended for handling MSI-X vector tables and 97 97 * leftover space for ROM BARs. 98 98 */ 99 - static ssize_t do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem, 100 - void __iomem *io, char __user *buf, 101 - loff_t off, size_t count, size_t x_start, 102 - size_t x_end, bool iswrite) 99 + ssize_t vfio_pci_core_do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem, 100 + void __iomem *io, char __user *buf, 101 + loff_t off, size_t count, size_t x_start, 102 + size_t x_end, bool iswrite) 103 103 { 104 104 ssize_t done = 0; 105 105 int ret; ··· 201 201 202 202 return done; 203 203 } 204 + EXPORT_SYMBOL_GPL(vfio_pci_core_do_io_rw); 204 205 205 206 int vfio_pci_core_setup_barmap(struct vfio_pci_core_device *vdev, int bar) 206 207 { ··· 280 279 x_end = vdev->msix_offset + vdev->msix_size; 281 280 } 282 281 283 - done = do_io_rw(vdev, res->flags & IORESOURCE_MEM, io, buf, pos, 284 - count, x_start, x_end, iswrite); 282 + done = vfio_pci_core_do_io_rw(vdev, res->flags & IORESOURCE_MEM, io, buf, pos, 283 + count, x_start, x_end, iswrite); 285 284 286 285 if (done >= 0) 287 286 *ppos += done; ··· 349 348 * probing, so we don't currently worry about access in relation 350 349 * to the memory enable bit in the command register. 351 350 */ 352 - done = do_io_rw(vdev, false, iomem, buf, off, count, 0, 0, iswrite); 351 + done = vfio_pci_core_do_io_rw(vdev, false, iomem, buf, off, count, 352 + 0, 0, iswrite); 353 353 354 354 vga_put(vdev->pdev, rsrc); 355 355
+4 -1
include/linux/vfio_pci_core.h
··· 130 130 int vfio_pci_core_setup_barmap(struct vfio_pci_core_device *vdev, int bar); 131 131 pci_ers_result_t vfio_pci_core_aer_err_detected(struct pci_dev *pdev, 132 132 pci_channel_state_t state); 133 - 133 + ssize_t vfio_pci_core_do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem, 134 + void __iomem *io, char __user *buf, 135 + loff_t off, size_t count, size_t x_start, 136 + size_t x_end, bool iswrite); 134 137 #define VFIO_IOWRITE_DECLATION(size) \ 135 138 int vfio_pci_core_iowrite##size(struct vfio_pci_core_device *vdev, \ 136 139 bool test_mem, u##size val, void __iomem *io);