diff options
| author | Ankit Agrawal <ankita@nvidia.com> | 2024-02-20 14:50:54 +0300 |
|---|---|---|
| committer | Alex Williamson <alex.williamson@redhat.com> | 2024-02-22 22:20:20 +0300 |
| commit | 30e920e1debb437e5aea7a4ccdab61634354297a (patch) | |
| tree | 96a84573b787371659fbb4edcc53c2a1147b2854 /include/linux | |
| parent | 4de676d494cd8fb2b4c65e58c19ebbdb36673957 (diff) | |
| download | linux-30e920e1debb437e5aea7a4ccdab61634354297a.tar.xz | |
vfio/pci: rename and export range_intersect_range
range_intersect_range determines an overlap between two ranges. If an
overlap, the helper function returns the overlapping offset and size.
The VFIO PCI variant driver emulates the PCI config space BAR offset
registers. These offset may be accessed for read/write with a variety
of lengths including sub-word sizes from sub-word offsets. The driver
makes use of this helper function to read/write the targeted part of
the emulated register.
Make this a vfio_pci_core function, rename and export as GPL. Also
update references in virtio driver.
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-3-ankita@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/vfio_pci_core.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h index cf9480a31f3e..a2c8b8bba711 100644 --- a/include/linux/vfio_pci_core.h +++ b/include/linux/vfio_pci_core.h @@ -134,6 +134,11 @@ ssize_t vfio_pci_core_do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem, void __iomem *io, char __user *buf, loff_t off, size_t count, size_t x_start, size_t x_end, bool iswrite); +bool vfio_pci_core_range_intersect_range(loff_t buf_start, size_t buf_cnt, + loff_t reg_start, size_t reg_cnt, + loff_t *buf_offset, + size_t *intersect_count, + size_t *register_offset); #define VFIO_IOWRITE_DECLATION(size) \ int vfio_pci_core_iowrite##size(struct vfio_pci_core_device *vdev, \ bool test_mem, u##size val, void __iomem *io); |
