Re: [PATCH v18 2/4] vfio-pci/zdev: Add a device feature for error information

From: Farhan Ali

Date: Wed Jun 03 2026 - 19:40:50 EST



On 6/3/2026 3:37 PM, Alex Williamson wrote:
On Wed, 3 Jun 2026 11:24:13 -0700
Farhan Ali <alifm@xxxxxxxxxxxxx> wrote:
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 5de618a3a5ee..3eead86a00ab 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -1534,6 +1534,36 @@ struct vfio_device_feature_dma_buf {
*/
#define VFIO_DEVICE_FEATURE_MIG_PRECOPY_INFOv2 12
+/**
+ * VFIO_DEVICE_FEATURE_ZPCI_ERROR feature provides PCI error information to
+ * userspace for vfio-pci devices on s390. On s390, PCI error recovery
+ * involves platform firmware and notification to operating systems is done
+ * by architecture specific mechanism. Exposing this information to
+ * userspace allows it to take appropriate actions to handle an
+ * error on the device. The ioctl returns -ENOMSG if there are no pending
+ * PCI errors.
+ */
+
+struct vfio_device_feature_zpci_err {
+ __u32 feature_flags; /* Indicate future features */
+ __u32 reserved1;
+ __u32 fh; /* function handle */
+ __u32 fid; /* function id */
+ __u32 ett : 4; /* expected table type */
+ __u32 mvn : 12; /* MSI vector number */
+ __u32 dmaas : 8; /* DMA address space */
+ __u32 reserved2 : 6;
+ __u32 q : 1; /* event qualifier */
+ __u32 rw : 1; /* read/write */
There's a 4-byte hole here.

+ __u64 faddr; /* failing address */
+ __u32 reserved3;
+ __u16 reserved4;
+ __u16 pec; /* PCI event code */
+ __u8 reserved5[28]; /* Allow for future expansion */
+};
+
+#define VFIO_DEVICE_FEATURE_ZPCI_ERROR 13
Based on the discussion with Omar and FMB reporting, I don't suppose
this could also be copied to a user buffer as opaque data with size
reported elsewhere, could it? Thanks,

Alex

We currently don't expose any PCI error data to userspace and so userspace has no way of knowing the size of the buffer. Unless we provide the size, i don't think we can copy the user buffer as opaque data.

Thanks

Farhan