Skip to content

vfio-pci/zdev: Improved zPCI Function Measurement Support

Omar Elghoul kvm linux-s390 lkml oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3s390/pci: Preserve FMB state in device re-enablementarch/s390/include/asm/pci.h arch/s390/pci/pci.c+59 -133 replies
2/3vfio-pci/zdev: Add VFIO FMB device featuredrivers/vfio/pci/vfio_pci_core.c drivers/vfio/pci/vfio_pci_priv.h drivers/vfio/pci/vfio_pci_zdev.c +1 more+131 -00 replies
3/3s390/pci: Fence FMB enable/disable via sysfs for passthrough devicesarch/s390/pci/pci_debug.c+3 -00 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchNiklas Schnelle
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

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

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(-)
Signature · 1 line
2.52.0