Re: [PATCH v1 0/3] vfio-pci/zdev: Improved zPCI Function Measurement Support

Omar Elghoul
2026-05-01T20:17:12Z

For illustration of example usage, linked below is the QEMU RFC that
proposes using the feature introduced in this patch series.

https://lore.kernel.org/all/20260501200026.22784-1-oelghoul@linux.ibm.com/

On 5/1/26 3:25 PM, Omar Elghoul wrote:
> Hi,
>
> This patch series improves support for function measurement for zPCI
> passthrough devices on s390x.
>
> Motivation
> ==========
> The firmware on s390x machines allows for tracking a variety of statistics
> relating to zPCI devices in a function measurement block (FMB). However,
> the kernel currently lacks a structured mechanism of sharing this
> information with userspace, beyond /sys/kernel/debug/pci/ID/statistics.
> This can lead to shortcomings when running a guest on KVM with PCI
> passthrough devices, as QEMU is unable to provide an accurate FMB snapshot
> to the guest.
>
> Proposal
> ========
> We propose adding a new VFIO device feature to zPCI passthrough devices,
> allowing userspace programs to read the latest FMB snapshot as it is
> written by the firmware. We ensure that function measurement enablement is
> preserved across device resets on the host. Furthermore, we guard against
> host tampering with the FMB via sysfs when the zPCI device is in
> passthrough to protect the VM's state.
>
> I'd appreciate some feedback on these patches.
>
> Thanks in advance.
>
> Omar Elghoul (3):
> s390/pci: Preserve FMB state in device re-enablement
> vfio-pci/zdev: Add VFIO FMB device feature
> s390/pci: Fence FMB enable/disable via sysfs for passthrough devices
>
> arch/s390/include/asm/pci.h | 1 +
> arch/s390/pci/pci.c | 71 +++++++++++++++++++++++------
> arch/s390/pci/pci_debug.c | 3 ++
> drivers/vfio/pci/vfio_pci_core.c | 2 +
> drivers/vfio/pci/vfio_pci_priv.h | 9 ++++
> drivers/vfio/pci/vfio_pci_zdev.c | 77 ++++++++++++++++++++++++++++++++
> include/uapi/linux/vfio.h | 43 ++++++++++++++++++
> 7 files changed, 193 insertions(+), 13 deletions(-)
>