Skip to content

Commit 29afd0c

Browse files
juru1234awilliam
authored andcommitted
vfio/pci: Rename vfio_config_do_rw() to vfio_pci_config_rw_single() and export it
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> Link: https://lore.kernel.org/r/20260325-vfio_pci_ism-v8-1-ddc504cde914@linux.ibm.com Signed-off-by: Alex Williamson <alex@shazbot.org>
1 parent 555aa17 commit 29afd0c

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/vfio/pci/vfio_pci_config.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,8 +1880,9 @@ static size_t vfio_pci_cap_remaining_dword(struct vfio_pci_core_device *vdev,
18801880
return i;
18811881
}
18821882

1883-
static ssize_t vfio_config_do_rw(struct vfio_pci_core_device *vdev, char __user *buf,
1884-
size_t count, loff_t *ppos, bool iswrite)
1883+
ssize_t vfio_pci_config_rw_single(struct vfio_pci_core_device *vdev,
1884+
char __user *buf, size_t count, loff_t *ppos,
1885+
bool iswrite)
18851886
{
18861887
struct pci_dev *pdev = vdev->pdev;
18871888
struct perm_bits *perm;
@@ -1970,6 +1971,7 @@ static ssize_t vfio_config_do_rw(struct vfio_pci_core_device *vdev, char __user
19701971

19711972
return ret;
19721973
}
1974+
EXPORT_SYMBOL_GPL(vfio_pci_config_rw_single);
19731975

19741976
ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev, char __user *buf,
19751977
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,
19811983
pos &= VFIO_PCI_OFFSET_MASK;
19821984

19831985
while (count) {
1984-
ret = vfio_config_do_rw(vdev, buf, count, &pos, iswrite);
1986+
ret = vfio_pci_config_rw_single(vdev, buf, count, &pos, iswrite);
19851987
if (ret < 0)
19861988
return ret;
19871989

drivers/vfio/pci/vfio_pci_priv.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ int vfio_pci_set_irqs_ioctl(struct vfio_pci_core_device *vdev, uint32_t flags,
3737
ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev, char __user *buf,
3838
size_t count, loff_t *ppos, bool iswrite);
3939

40+
ssize_t vfio_pci_config_rw_single(struct vfio_pci_core_device *vdev,
41+
char __user *buf, size_t count, loff_t *ppos,
42+
bool iswrite);
43+
4044
ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
4145
size_t count, loff_t *ppos, bool iswrite);
4246

0 commit comments

Comments
 (0)