get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2222859/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2222859,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2222859/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260413210608.2912-6-alifm@linux.ibm.com/",
    "project": {
        "id": 28,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/28/?format=api",
        "name": "Linux PCI development",
        "link_name": "linux-pci",
        "list_id": "linux-pci.vger.kernel.org",
        "list_email": "linux-pci@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null
    },
    "msgid": "<20260413210608.2912-6-alifm@linux.ibm.com>",
    "date": "2026-04-13T21:06:06",
    "name": "[v13,5/7] vfio-pci/zdev: Add a device feature for error information",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "b209aa3335706806163f577b7b21922a5991a8a1",
    "submitter": {
        "id": 73785,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/73785/?format=api",
        "name": "Farhan Ali",
        "email": "alifm@linux.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260413210608.2912-6-alifm@linux.ibm.com/mbox/",
    "series": [
        {
            "id": 499754,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/499754/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=499754",
            "date": "2026-04-13T21:06:01",
            "name": "Error recovery for vfio-pci devices on s390x",
            "version": 13,
            "mbox": "http://patchwork.ozlabs.org/series/499754/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2222859/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2222859/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <linux-pci+bounces-52454-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-pci@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=k53uyMrg;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-52454-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com\n header.b=\"k53uyMrg\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=148.163.156.1",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.ibm.com"
        ],
        "Received": [
            "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvg783q3cz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 07:11:00 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 1F8513091833\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 21:07:30 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 6D42D399015;\n\tMon, 13 Apr 2026 21:06:46 +0000 (UTC)",
            "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n [148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id BA1D5395257;\n\tMon, 13 Apr 2026 21:06:31 +0000 (UTC)",
            "from pps.filterd (m0356517.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63DEGZlj3188928;\n\tMon, 13 Apr 2026 21:06:20 GMT",
            "from ppma13.dal12v.mail.ibm.com\n (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221])\n\tby mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dfe17sr4j-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tMon, 13 Apr 2026 21:06:20 +0000 (GMT)",
            "from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1])\n\tby ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 63DIVVV7025621;\n\tMon, 13 Apr 2026 21:06:19 GMT",
            "from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73])\n\tby ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dg2ujep68-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tMon, 13 Apr 2026 21:06:19 +0000",
            "from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com\n [10.39.53.230])\n\tby smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 63DL6HLM19202638\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n\tMon, 13 Apr 2026 21:06:17 GMT",
            "from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 9164958054;\n\tMon, 13 Apr 2026 21:06:17 +0000 (GMT)",
            "from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 58C365805A;\n\tMon, 13 Apr 2026 21:06:16 +0000 (GMT)",
            "from IBM-D32RQW3.ibm.com (unknown [9.61.254.131])\n\tby smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP;\n\tMon, 13 Apr 2026 21:06:16 +0000 (GMT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776114406; cv=none;\n b=UtxWcufdqbqojQIBLrx/t+yIqt1s85fozPqRQfNyT4WA+XJc7P4NdlzraQAFMKfL6sjnnAqCwK3V5rpiDtNkD/jexM1j7+FOok1ijOXZ0gEIb0BstusYVIgkc07wVu6wqXT+fg5fqtlfIgjrQ3ZALKNjIkO4Ri8rHrhN56Wc6k8=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776114406; c=relaxed/simple;\n\tbh=/uEggNkdsC/xW/ltN58wSyCWvJGMRnO5Hfsq66BzRf0=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=TdFLurJXB6CmwGl6yM11OstfteQHKJy0urGQn4Zi4qJIrC4NqJVwC8X4FExo/fAK/YWs9gIW8Pyy5wCsw5XpBya9gzxvU6Ms/6VEX9wGhBVsgNG24vKZ1X+oP6u+tvQlHR36L0I3nmeMfz6oVQEawbOeEfe3I+YVft0UP+OoxEo=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com;\n spf=pass smtp.mailfrom=linux.ibm.com;\n dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com\n header.b=k53uyMrg; arc=none smtp.client-ip=148.163.156.1",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n\t:content-transfer-encoding:date:from:in-reply-to:message-id\n\t:mime-version:references:subject:to; s=pp1; bh=FR64xQJYfeF4fne03\n\tnKK0mFsx4eY3xKNPjFcXnhPzoA=; b=k53uyMrgCK88OUsQmld5NzBKEqgEmPppY\n\txOpyG6R9/4h9Jd9dF6sEuzP5Nb3TgxSPcYAeNufEITB3+bXjzjdmJ+r1iORKcZVB\n\tzbQlWdfe7/933bG09U2xr6efdsh9oqQw0674yFpOkn4xvAzaaSe/gfiIGlzvQpIE\n\tEc7AyY1yXpMy0b2sRWEI061gJ+EX1ICAr2o4+tClEWZMdWv9/1PsdnrJmANv9OB+\n\tThVcFDH0OHtG//rwhyCzfv/DswlJG++CPPRXF7Kpol/U94iOaMiQct5RTno7aahl\n\t00aBv9ozq289H+hTYcTenM6S5uapjWARqqJvb0wTPfI1YhRqN98WQ==",
        "From": "Farhan Ali <alifm@linux.ibm.com>",
        "To": "linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,\n        linux-pci@vger.kernel.org",
        "Cc": "helgaas@kernel.org, lukas@wunner.de, alex@shazbot.org, clg@redhat.com,\n        kbusch@kernel.org, alifm@linux.ibm.com, schnelle@linux.ibm.com,\n        mjrosato@linux.ibm.com",
        "Subject": "[PATCH v13 5/7] vfio-pci/zdev: Add a device feature for error\n information",
        "Date": "Mon, 13 Apr 2026 14:06:06 -0700",
        "Message-ID": "<20260413210608.2912-6-alifm@linux.ibm.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260413210608.2912-1-alifm@linux.ibm.com>",
        "References": "<20260413210608.2912-1-alifm@linux.ibm.com>",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-pci@vger.kernel.org",
        "List-Id": "<linux-pci.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-TM-AS-GCONF": "00",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDEzMDIwNSBTYWx0ZWRfX7phLIbUIz97l\n +KyZyLAbt1Er+jeqxm98a7EbUS6tDDSTh3bNM1iDLezZ5KDrPPW+osURzt4am2wSyxxr8nxQbQn\n BdAJvMRIF8TnkftSv6Z9pO8vab1ezV5kXDwilT8DuLqofXVc305OGfCsqdx43rmTjzPHnQOWnek\n QMfB2eBs23EsyJjxLj/Dk52yeDL789+zRM73+kubl4OxCKRTCBlh6DMGvGp8MvyNqyHgBICeBFV\n 9H0LF/bKV2gO9TMvbKRijPMkPiQ6kHwO9e6ov7rCj4gUnkmdkZ+TuccVtg1+T2qCBCXu9hVuaF1\n Q7TE5nHoJ59EpB36OZdCNlwIY9cv1D5qSCCxii+flATSO5XWxZDyeT28m+f5ITOZBdRl4EsTbjm\n b9pwTfx47mB6JqsAFmtjDf07J5Ccqf3w3bLZA9LsGBziH0DZmKSirghTlKnYZ8J/lZBJJrFhDcp\n S/ZtytyjgmbU4TsjeQQ==",
        "X-Proofpoint-ORIG-GUID": "70RhArFj3c9qwd1en8y8QEPT4uTwdvRj",
        "X-Proofpoint-GUID": "70RhArFj3c9qwd1en8y8QEPT4uTwdvRj",
        "X-Authority-Analysis": "v=2.4 cv=SrOgLvO0 c=1 sm=1 tr=0 ts=69dd5acc cx=c_pps\n a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17\n a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=sIuuyFDGXZ7lsjPJAw8A:9",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-13_03,2026-04-13_04,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n adultscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 bulkscore=0\n phishscore=0 suspectscore=0 malwarescore=0 spamscore=0 impostorscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604130205"
    },
    "content": "For zPCI devices, we have platform specific error information. The platform\nfirmware provides this error information to the operating system in an\narchitecture specific mechanism. To enable recovery from userspace for\nthese devices, we want to expose this error information to userspace. Add a\nnew device feature to expose this information.\n\nReviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>\nSigned-off-by: Farhan Ali <alifm@linux.ibm.com>\n---\n arch/s390/include/asm/pci.h      |  3 +++\n arch/s390/pci/pci_event.c        | 19 +++++++++++++++++++\n drivers/vfio/pci/vfio_pci_core.c |  2 ++\n drivers/vfio/pci/vfio_pci_priv.h |  9 +++++++++\n drivers/vfio/pci/vfio_pci_zdev.c | 31 +++++++++++++++++++++++++++++++\n include/uapi/linux/vfio.h        | 20 ++++++++++++++++++++\n 6 files changed, 84 insertions(+)",
    "diff": "diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h\nindex 9a6a4eb9d7c1..9c8ee97d7e8a 100644\n--- a/arch/s390/include/asm/pci.h\n+++ b/arch/s390/include/asm/pci.h\n@@ -360,6 +360,9 @@ int zpci_clear_error_state(struct zpci_dev *zdev);\n int zpci_reset_load_store_blocked(struct zpci_dev *zdev);\n void zpci_start_mediated_recovery(struct zpci_dev *zdev);\n void zpci_stop_mediated_recovery(struct zpci_dev *zdev);\n+void zpci_get_pending_error_and_count(struct zpci_dev *zdev,\n+\t\t\t\t      struct zpci_ccdf_err *ccdf,\n+\t\t\t\t      int *count);\n \n #ifdef CONFIG_NUMA\n \ndiff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c\nindex c279a9f50a64..c8714d4a32fa 100644\n--- a/arch/s390/pci/pci_event.c\n+++ b/arch/s390/pci/pci_event.c\n@@ -74,6 +74,25 @@ static void zpci_store_pci_error(struct pci_dev *pdev,\n \tzdev->pending_errs.count++;\n }\n \n+void zpci_get_pending_error_and_count(struct zpci_dev *zdev,\n+\t\t\t\t      struct zpci_ccdf_err *ccdf,\n+\t\t\t\t      int *count)\n+{\n+\tint head = 0;\n+\t*count = 0;\n+\n+\tguard(mutex)(&zdev->pending_errs_lock);\n+\tif (zdev->pending_errs.count) {\n+\t\thead = zdev->pending_errs.head % ZPCI_ERR_PENDING_MAX;\n+\t\tmemcpy(ccdf, &zdev->pending_errs.err[head],\n+\t\t       sizeof(struct zpci_ccdf_err));\n+\t\tzdev->pending_errs.head++;\n+\t\tzdev->pending_errs.count--;\n+\t\t*count = zdev->pending_errs.count;\n+\t}\n+}\n+EXPORT_SYMBOL_GPL(zpci_get_pending_error_and_count);\n+\n void zpci_start_mediated_recovery(struct zpci_dev *zdev)\n {\n \tguard(mutex)(&zdev->pending_errs_lock);\ndiff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c\nindex ad52abc46c04..5403730786a1 100644\n--- a/drivers/vfio/pci/vfio_pci_core.c\n+++ b/drivers/vfio/pci/vfio_pci_core.c\n@@ -1534,6 +1534,8 @@ int vfio_pci_core_ioctl_feature(struct vfio_device *device, u32 flags,\n \t\treturn vfio_pci_core_feature_token(vdev, flags, arg, argsz);\n \tcase VFIO_DEVICE_FEATURE_DMA_BUF:\n \t\treturn vfio_pci_core_feature_dma_buf(vdev, flags, arg, argsz);\n+\tcase VFIO_DEVICE_FEATURE_ZPCI_ERROR:\n+\t\treturn vfio_pci_zdev_feature_err(device, flags, arg, argsz);\n \tdefault:\n \t\treturn -ENOTTY;\n \t}\ndiff --git a/drivers/vfio/pci/vfio_pci_priv.h b/drivers/vfio/pci/vfio_pci_priv.h\nindex fca9d0dfac90..4e7162234a2e 100644\n--- a/drivers/vfio/pci/vfio_pci_priv.h\n+++ b/drivers/vfio/pci/vfio_pci_priv.h\n@@ -93,6 +93,8 @@ int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,\n \t\t\t\tstruct vfio_info_cap *caps);\n int vfio_pci_zdev_open_device(struct vfio_pci_core_device *vdev);\n void vfio_pci_zdev_close_device(struct vfio_pci_core_device *vdev);\n+int vfio_pci_zdev_feature_err(struct vfio_device *device, u32 flags,\n+\t\t\t      void __user *arg, size_t argsz);\n #else\n static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,\n \t\t\t\t\t      struct vfio_info_cap *caps)\n@@ -107,6 +109,13 @@ static inline int vfio_pci_zdev_open_device(struct vfio_pci_core_device *vdev)\n \n static inline void vfio_pci_zdev_close_device(struct vfio_pci_core_device *vdev)\n {}\n+\n+static inline int vfio_pci_zdev_feature_err(struct vfio_device *device,\n+\t\t\t\t\t    u32 flags, void __user *arg,\n+\t\t\t\t\t    size_t argsz)\n+{\n+\treturn -ENOTTY;\n+}\n #endif\n \n static inline bool vfio_pci_is_vga(struct pci_dev *pdev)\ndiff --git a/drivers/vfio/pci/vfio_pci_zdev.c b/drivers/vfio/pci/vfio_pci_zdev.c\nindex 0658095ac5b1..ee1647f0ffe6 100644\n--- a/drivers/vfio/pci/vfio_pci_zdev.c\n+++ b/drivers/vfio/pci/vfio_pci_zdev.c\n@@ -141,6 +141,37 @@ int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,\n \treturn ret;\n }\n \n+int vfio_pci_zdev_feature_err(struct vfio_device *device, u32 flags,\n+\t\t\t      void __user *arg, size_t argsz)\n+{\n+\tstruct vfio_device_feature_zpci_err err = {};\n+\tstruct vfio_pci_core_device *vdev;\n+\tstruct zpci_ccdf_err ccdf = {};\n+\tstruct zpci_dev *zdev;\n+\tint pending_errors = 0;\n+\tint ret;\n+\n+\tvdev = container_of(device, struct vfio_pci_core_device, vdev);\n+\tzdev = to_zpci(vdev->pdev);\n+\tif (!zdev)\n+\t\treturn -ENODEV;\n+\n+\tret = vfio_check_feature(flags, argsz, VFIO_DEVICE_FEATURE_GET,\n+\t\t\t\t sizeof(err));\n+\tif (ret != 1)\n+\t\treturn ret;\n+\n+\tzpci_get_pending_error_and_count(zdev, &ccdf, &pending_errors);\n+\n+\terr.version = 1;\n+\terr.pec = ccdf.pec;\n+\terr.pending_errors = pending_errors;\n+\tif (copy_to_user(arg, &err, sizeof(err)))\n+\t\treturn -EFAULT;\n+\n+\treturn 0;\n+}\n+\n int vfio_pci_zdev_open_device(struct vfio_pci_core_device *vdev)\n {\n \tstruct zpci_dev *zdev = to_zpci(vdev->pdev);\ndiff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h\nindex 5de618a3a5ee..2980ca39dd38 100644\n--- a/include/uapi/linux/vfio.h\n+++ b/include/uapi/linux/vfio.h\n@@ -1534,6 +1534,26 @@ struct vfio_device_feature_dma_buf {\n  */\n #define VFIO_DEVICE_FEATURE_MIG_PRECOPY_INFOv2  12\n \n+/**\n+ * VFIO_DEVICE_FEATURE_ZPCI_ERROR feature provides PCI error information to\n+ * userspace for vfio-pci devices on s390x. On s390x, PCI error recovery\n+ * involves platform firmware and notification to operating system is done\n+ * by architecture specific mechanism. Exposing this information to\n+ * userspace allows it to take appropriate actions to handle an\n+ * error on the device. The pending_errors provide any additional errors\n+ * pending for the device, and userspace should read until zero. A value of\n+ * 0 for pending_errors and pec would indicate no pending errors that need\n+ * to be handled.\n+ */\n+\n+struct vfio_device_feature_zpci_err {\n+\t__u8 version;\n+\t__u8 pending_errors;\n+\t__u16 pec;\n+};\n+\n+#define VFIO_DEVICE_FEATURE_ZPCI_ERROR 13\n+\n /* -------- API for Type1 VFIO IOMMU -------- */\n \n /**\n",
    "prefixes": [
        "v13",
        "5/7"
    ]
}