A follow-up patch adds a new variant driver for s390 ISM devices. Since this device uses a 256 TiB BAR 0 that is never mapped, the variant driver needs its own ISM_VFIO_PCI_OFFSET_MASK. To minimally mirror the functionality of vfio_pci_config_rw() with such a custom mask, export vfio_config_do_rw(). To better distinguish the now exported function from vfio_pci_config_rw(), rename it to vfio_pci_config_rw_single() emphasizing that it does a single config space read or write. Signed-off-by: Julian Ruess --- drivers/vfio/pci/vfio_pci_config.c | 8 +++++--- drivers/vfio/pci/vfio_pci_priv.h | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index b4e39253f98da61a5e2b6dd0089b2f6aef4b85a0..a724fdd8f4860bd529c5c7501beb1f7156fae9b0 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c @@ -1880,8 +1880,9 @@ static size_t vfio_pci_cap_remaining_dword(struct vfio_pci_core_device *vdev, return i; } -static ssize_t vfio_config_do_rw(struct vfio_pci_core_device *vdev, char __user *buf, - size_t count, loff_t *ppos, bool iswrite) +ssize_t vfio_pci_config_rw_single(struct vfio_pci_core_device *vdev, + char __user *buf, size_t count, loff_t *ppos, + bool iswrite) { struct pci_dev *pdev = vdev->pdev; struct perm_bits *perm; @@ -1970,6 +1971,7 @@ static ssize_t vfio_config_do_rw(struct vfio_pci_core_device *vdev, char __user return ret; } +EXPORT_SYMBOL(vfio_pci_config_rw_single); ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev, char __user *buf, size_t count, loff_t *ppos, bool iswrite) @@ -1981,7 +1983,7 @@ ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev, char __user *buf, pos &= VFIO_PCI_OFFSET_MASK; while (count) { - ret = vfio_config_do_rw(vdev, buf, count, &pos, iswrite); + ret = vfio_pci_config_rw_single(vdev, buf, count, &pos, iswrite); if (ret < 0) return ret; diff --git a/drivers/vfio/pci/vfio_pci_priv.h b/drivers/vfio/pci/vfio_pci_priv.h index 27ac280f00b975989f6cbc02c11aaca01f9badf3..28a3edf65aeecfa06cd1856637cd33eec1fa3006 100644 --- a/drivers/vfio/pci/vfio_pci_priv.h +++ b/drivers/vfio/pci/vfio_pci_priv.h @@ -37,6 +37,10 @@ int vfio_pci_set_irqs_ioctl(struct vfio_pci_core_device *vdev, uint32_t flags, ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev, char __user *buf, size_t count, loff_t *ppos, bool iswrite); +ssize_t vfio_pci_config_rw_single(struct vfio_pci_core_device *vdev, + char __user *buf, size_t count, loff_t *ppos, + bool iswrite); + ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf, size_t count, loff_t *ppos, bool iswrite); -- 2.51.0