[PATCH v8 0/3] vfio/pci: Introduce vfio_pci driver for ISM devices

Julian Ruess
2026-03-25T13:31:52Z

Hi all,

This series adds a vfio_pci variant driver for the s390-specific
Internal Shared Memory (ISM) devices used for inter-VM communication
including SMC-D.

This is a prerequisite for an in-development open-source user space
driver stack that will allow to use ISM devices to provide remote
console and block device functionality. This stack will be part of
s390-tools.

This driver would also allow QEMU to mediate access to an ISM device,
enabling a form of PCI pass-through even for guests whose hardware
cannot directly execute PCI accesses, such as nested guests.

On s390, kernel primitives such as ioread() and iowrite() are switched
over from function-handle-based PCI load/stores instructions to PCI
memory-I/O (MIO) loads/stores when these are available and not
explicitly disabled. Since these instructions cannot be used with ISM
devices, ensure that classic function-handle-based PCI instructions are
used instead.

The driver is still required even when MIO instructions are disabled, as
the ISM device relies on the PCI store‑block (PCISTB) instruction to
perform write operations.

Thank you,
Julian

Signed-off-by: Julian Ruess <julianr@linux.ibm.com>
---
Changes in v8:
- Format vfio_pci_config_rw_single().
- Add () around the off macro argument in ISM_VFIO_PCI_OFFSET_TO_INDEX.
- Use function-handle-based wording consistently.
- Return -EINVAL in default case in ism_vfio_pci_ioctl_get_region_info().
- Change ssize_t to size_t in ISM_READ macro.
- Use kmem_cache_args with with kmem_cache_create() to prevent kernel
panic when using HARDENED_USERCOPY.
- Link to v7: https://lore.kernel.org/r/20260323-vfio_pci_ism-v7-0-abf537150408@linux.ibm.com

Changes in v7:
- Add 4k alignment and to kmem_cache_create() to do not cross the integral
boundary.
- Add SLAB_RECLAIM_ACCOUNT ans SLAB_ACCOUNT to kmem_cache_create() for memcg accounting.
- Link to v6: https://lore.kernel.org/r/20260319-vfio_pci_ism-v6-0-c6bab675bc0a@linux.ibm.com

Changes in v6:
- Introduce ism_vfio_pci_init_dev() and ism_vfio_pci_release_dev().
- Add early return for __zpci_load().
- Use kmem_cache_alloc() instead of kmem_cache_zalloc().
- Rename ivdev to ivpcd for consistency.
- Rename ism_pci_open_device() to ism_vfio_pci_open_device().
- Link to v5: https://lore.kernel.org/r/20260317-vfio_pci_ism-v5-0-b73248b4e576@linux.ibm.com

Changes in v5:
- Support reads < 8 bytes.
- Link to v4: https://lore.kernel.org/r/20260313-vfio_pci_ism-v4-0-4765ae056f71@linux.ibm.com

Changes in v4:
- Fix bug with < 8 byte reads. For code simplicity, only support 8 byte reads.
- Fix leak of ivpcd.
- Fix cache replacement by implementing a per-device kmem_cache.
- Link to v3: https://lore.kernel.org/r/20260305-vfio_pci_ism-v3-0-1217076c81d9@linux.ibm.com

Changes in v3:
- Add comments to ism_vfio_pci_do_io_r() and ism_vfio_pci_do_io_w().
- Format Kconfig.
- Add 4k boundary check to ism_vfio_pci_do_io_w().
- Use kmem_cache instead of kzalloc in ism_vfio_pci_do_io_w().
- Add error handler to struct ism_vfio_pci_driver.
- Link to v2: https://lore.kernel.org/r/20260224-vfio_pci_ism-v2-0-f010945373fa@linux.ibm.com

Changes in v2:
- Remove common code patch that sets VFIO_PCI_OFFSET_SHIFT to 48.
- Implement ism_vfio_pci_ioctl_get_region_info() to have own region
offsets.
- For config space accesses, rename vfio_config_do_rw() to
vfio_pci_config_rw_single() and export it.
- Use zdev->maxstbl instead of ZPCI_BOUNDARY_SIZE.
- Add comment that zPCI must not use MIO instructions for config space
access.
- Rework patch descriptions.
- Update license info.
- Link to v1: https://lore.kernel.org/r/20260212-vfio_pci_ism-v1-0-333262ade074@linux.ibm.com

---
Julian Ruess (3):
vfio/pci: Rename vfio_config_do_rw() to vfio_pci_config_rw_single() and export it
vfio/ism: Implement vfio_pci driver for ISM devices
MAINTAINERS: add VFIO ISM PCI DRIVER section

MAINTAINERS | 6 +
drivers/vfio/pci/Kconfig | 2 +
drivers/vfio/pci/Makefile | 2 +
drivers/vfio/pci/ism/Kconfig | 10 +
drivers/vfio/pci/ism/Makefile | 3 +
drivers/vfio/pci/ism/main.c | 408 +++++++++++++++++++++++++++++++++++++
drivers/vfio/pci/vfio_pci_config.c | 8 +-
drivers/vfio/pci/vfio_pci_priv.h | 4 +
8 files changed, 440 insertions(+), 3 deletions(-)
---
base-commit: c369299895a591d96745d6492d4888259b004a9e
change-id: 20250227-vfio_pci_ism-0ccc2e472247

Best regards,
--
Julian Ruess <julianr@linux.ibm.com>