[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFSPESVR3INE.HYERH8O05PYP@linux.ibm.com>
Date: Mon, 19 Jan 2026 17:24:53 +0100
From: "Julian Ruess" <julianr@...ux.ibm.com>
To: "Farhan Ali" <alifm@...ux.ibm.com>, <linux-s390@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-pci@...r.kernel.org>
Cc: <helgaas@...nel.org>, <lukas@...ner.de>, <alex@...zbot.org>,
<clg@...hat.com>, <stable@...r.kernel.org>, <schnelle@...ux.ibm.com>,
<mjrosato@...ux.ibm.com>
Subject: Re: [PATCH v7 7/9] vfio-pci/zdev: Add a device feature for error
information
On Wed Jan 7, 2026 at 7:32 PM CET, Farhan Ali 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@...ux.ibm.com>
> ---
> 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?
-- snip --
>
> static inline bool vfio_pci_is_vga(struct pci_dev *pdev)
> diff --git a/drivers/vfio/pci/vfio_pci_zdev.c b/drivers/vfio/pci/vfio_pci_zdev.c
> index 2be37eab9279..261954039aa9 100644
> --- a/drivers/vfio/pci/vfio_pci_zdev.c
> +++ b/drivers/vfio/pci/vfio_pci_zdev.c
> @@ -141,6 +141,40 @@ int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,
> return ret;
> }
>
> +int vfio_pci_zdev_feature_err(struct vfio_device *device, u32 flags,
> + void __user *arg, size_t argsz)
> +{
> + struct vfio_device_feature_zpci_err err;
> + struct vfio_pci_core_device *vdev =
> + container_of(device, struct vfio_pci_core_device, vdev);
> + struct zpci_dev *zdev = to_zpci(vdev->pdev);
> + int ret;
> + int head = 0;
Maybe we should use reverse x-mas notation:
struct vfio_device_feature_zpci_err err;
struct vfio_pci_core_device *vdev;
struct zpci_dev *zdev;
int head = 0;
int ret;
vdev = container_of(device, struct vfio_pci_core_device, vdev);
zdev = to_zpci(vdev->pdev);
-- snip --
Powered by blists - more mailing lists