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.
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Julian Ruess <julianr@linux.ibm.com>
---
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..fbb47b4ddb43d42b758b16778e6e701379d7e7db 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_GPL(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
On Mon, 2026-03-23 at 10:32 +0100, Julian Ruess wrote:
> 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.
>
> Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
> Signed-off-by: Julian Ruess <julianr@linux.ibm.com>
> ---
> 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..fbb47b4ddb43d42b758b16778e6e701379d7e7db 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_GPL(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)
Nit: The renaming results in formatting CHECKs when running
checkpatch.pl --strict. Sorry I missed this in my last review.
> @@ -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);
>
© 2016 - 2026 Red Hat, Inc.