Re: [PATCH v7 7/9] vfio-pci/zdev: Add a device feature for error information

From: Farhan Ali

Date: Tue Jan 20 2026 - 13:54:58 EST



On 1/19/2026 8:24 AM, Julian Ruess wrote:
For zPCI devices, we have platform specific error information. The platform
firmware provides this error information to the operating system in an
architecture specific mechanism. To enable recovery from userspace for
these devices, we want to expose this error information to userspace. Add a
new device feature to expose this information.

Signed-off-by: Farhan Ali<alifm@xxxxxxxxxxxxx>
---
drivers/vfio/pci/vfio_pci_core.c | 2 ++
drivers/vfio/pci/vfio_pci_priv.h | 9 +++++++++
drivers/vfio/pci/vfio_pci_zdev.c | 34 ++++++++++++++++++++++++++++++++
include/uapi/linux/vfio.h | 16 +++++++++++++++
4 files changed, 61 insertions(+)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 3a11e6f450f7..f677705921e6 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -1526,6 +1526,8 @@ int vfio_pci_core_ioctl_feature(struct vfio_device *device, u32 flags,
return vfio_pci_core_feature_token(vdev, flags, arg, argsz);
case VFIO_DEVICE_FEATURE_DMA_BUF:
return vfio_pci_core_feature_dma_buf(vdev, flags, arg, argsz);
+ case VFIO_DEVICE_FEATURE_ZPCI_ERROR:
+ return vfio_pci_zdev_feature_err(device, flags, arg, argsz);
Would it make sense to name this more generically, e.g.
VFIO_DEVICE_FEATURE_ERROR_RECOVERY, in case other architectures also want to
support something like this in the future?

The error recovery mechanism here and also the uapi structure exposed via this device feature is very specific to zPCI devices. Making this a generic device feature would mean having different uapi structure for zPCI devices vs PCI devices on other architectures. I am not sure that would be desirable and might be cleaner to have separate device feature and separate uapi constructs for zPCI vs other architectures.

Thanks

Farhan