[SRU][N][PATCH 0/1] [UBUNTU 24.04] vfio/pci: fix 8-byte PCI loads and stores (LP: #2121146)

Massimiliano Pellizzer massimiliano.pellizzer at canonical.com
Thu Aug 28 12:53:32 UTC 2025


BugLink: https://bugs.launchpad.net/bugs/2121146

[ Impact ]

Reading from or writing to 64 bit registers (I/O ports or MMIO) on a PCI adapter
attached via vfio with e.g. the pread()/pwrite() system calls may not work in
case the PCI adapter requires a full read or write that can not be broken up.

64 bit reads/writes are not implemented via the vfio I/O port or MMIO access,
even if the architecture supports 64 bit I/O reads and writes.

It is necessary to implement the use of 64 bit I/O reads and writes in the vfio
driver, so that such reads and writes are not broken up into multiple smaller
operations if the architecture supports such bigger operations.

[ Fix ]

Backport the following commits in Noble:
- 186bfe44ea41 vfio/pci: Extract duplicated code into macro
- 4df13a6871d9 vfio/pci: Support 8-byte PCI loads and stores
- abe8103da3c5 vfio/pci: Fix typo in macro to declare accessors

[ Test Case ]

Bind a PCI device to vfio-pci and open it via /dev/vfio/<group>.
>From user space, issue pread()/pwrite() calls with size 64-bit on the device’s
registers.
Use ftrace or similar tools to confirm
vfio_pci_core_ioread64/vfio_pci_core_iowrite64 is invoked.
If available, check that a device requiring atomic 64-bit access now works
correctly.

[ Regression Potential ]

The fix affects how VFIO PCI handles 64-bit register accesses via pread() and
pwrite() from user-space.
A bug here could cause incorrect or partial reads and writes to device
registers, breaking atomicity guarantees required by some PCI adapters.
Users may see devices misconfiguration, inconsistent register values, unexpected
hardware behavior, or even system instability when using user-space drivers with
VFIO.




More information about the kernel-team mailing list