Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2197367/?format=api
{ "id": 2197367, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2197367/?format=api", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.0/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": "<20260217182257.1582-7-alifm@linux.ibm.com>", "date": "2026-02-17T18:22:54", "name": "[v9,6/9] s390/pci: Store PCI error information for passthrough devices", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "57c0ad786faddc400f8c9a86d44bd88116ebf46f", "submitter": { "id": 73785, "url": "http://patchwork.ozlabs.org/api/1.0/people/73785/?format=api", "name": "Farhan Ali", "email": "alifm@linux.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260217182257.1582-7-alifm@linux.ibm.com/mbox/", "series": [ { "id": 492470, "url": "http://patchwork.ozlabs.org/api/1.0/series/492470/?format=api", "date": "2026-02-17T18:22:49", "name": "Error recovery for vfio-pci devices on s390x", "version": 9, "mbox": "http://patchwork.ozlabs.org/series/492470/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2197367/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pci+bounces-47498-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=fPTq348a;\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-47498-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=\"fPTq348a\"", "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 4fFp1S1nyWz1xpl\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 18 Feb 2026 05:23:40 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id B45FD30488F9\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 18:23:20 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 1F309372B51;\n\tTue, 17 Feb 2026 18:23:18 +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 66183374177;\n\tTue, 17 Feb 2026 18:23:14 +0000 (UTC)", "from pps.filterd (m0353729.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 61HEUVkm2392296;\n\tTue, 17 Feb 2026 18:23:07 GMT", "from ppma22.wdc07v.mail.ibm.com\n (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92])\n\tby mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4caj6rwjfg-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tTue, 17 Feb 2026 18:23:07 +0000 (GMT)", "from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1])\n\tby ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 61HFnccr015670;\n\tTue, 17 Feb 2026 18:23:06 GMT", "from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8])\n\tby ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ccb4543k8-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tTue, 17 Feb 2026 18:23:05 +0000", "from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com\n [10.241.53.104])\n\tby smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 61HIN4HE31523334\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n\tTue, 17 Feb 2026 18:23:04 GMT", "from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id A574B58056;\n\tTue, 17 Feb 2026 18:23:04 +0000 (GMT)", "from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id D9B1F58052;\n\tTue, 17 Feb 2026 18:23:03 +0000 (GMT)", "from IBM-D32RQW3.ibm.com (unknown [9.61.242.249])\n\tby smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP;\n\tTue, 17 Feb 2026 18:23:03 +0000 (GMT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1771352598; cv=none;\n b=IC5/aTCsJCl6lXH88GfcowgYxV23fdZZaBXq5EU/RZntfk/51mLWKafLYeE5qpaKs7kIfcenoJz8svrGKy4sXotSqxXFm3SfKpIkpQDZxyYtlWh4IpBcqqYMZzQVA/MAdjvAP5G3Q+Ws0YitO2m1Pb52qcIjrNAKlb6Cvq+W6rY=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1771352598; c=relaxed/simple;\n\tbh=Tx2b5lfRhhMk7paCJmquplbWt2xL8rFkNh9AWCi0s7g=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=Gnc0GBgClyMcnMaDkUH2xHYGI7QsHmmz3+5rc/duAVFIXjozOQaw6v76MfM5+dayYTlgs3Z7pnzB1gEYjRrKQ/u9a+/vv0FyESV75vc5Yerkj0nG5NxfmFFPZGkcmIbvCJfN7GzLS4lO7e+r4MJbWtIr88m5nBrJqHKqWBQRdCM=", "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=fPTq348a; 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=VW/rkVDi1lqpakrO5\n\ty4VKV3NO8EEFq33TSGYTFobHoU=; b=fPTq348aKVPu77ptlzENZ2+28v5ecYV8o\n\tmUT8YJjLYsZ2yQ29r7oEG/42bV0PakfUPjfB4dvH868AiLa23yRo6O+ocOrCD9mD\n\t72Szz8X0IkySVQeIruy4HGaUP3iKVrw8ocmFzbFnpITJwT1zI6zl4rlrZaunO7Fy\n\tmoYHBgak5xHgMQvpVrF64/UzDzfCX4TBKShSwQNDXiF/fbkrn/9aZ/Pq5n7saJub\n\tuhrOI1l/IOYY8J0r+qdHa6eTpj8e7YB/LOMT3pXL2L3NF3D62wy+MEWAm5oZqod2\n\twlHCmYMJ5UphklCwYYAdN1WNe5RnZbs5c9WpAbbuE/9adwwrgamzA==", "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 stable@vger.kernel.org, alifm@linux.ibm.com, schnelle@linux.ibm.com,\n mjrosato@linux.ibm.com", "Subject": "[PATCH v9 6/9] s390/pci: Store PCI error information for passthrough\n devices", "Date": "Tue, 17 Feb 2026 10:22:54 -0800", "Message-ID": "<20260217182257.1582-7-alifm@linux.ibm.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260217182257.1582-1-alifm@linux.ibm.com>", "References": "<20260217182257.1582-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-Authority-Analysis": "v=2.4 cv=dvvWylg4 c=1 sm=1 tr=0 ts=6994b20b cx=c_pps\n a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17\n a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22\n a=GgsMoib0sEa3-_RKJdDe:22 a=VnNF1IyMAAAA:8 a=JwDFWkoFWNOLAMzFnh4A:9", "X-Proofpoint-GUID": "0gIzvLNjDi448JO4n5SyYpe7K0Sbq3oR", "X-Proofpoint-ORIG-GUID": "0gIzvLNjDi448JO4n5SyYpe7K0Sbq3oR", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMjE3MDE0OCBTYWx0ZWRfXxRBTz/WYRD8V\n Bgy9gcNnqYdIZyjwyANFpAgBRVSYl7yYzKAOJHpkwcyexZIbj47w6I0H572TBeA0SN8jKd+be92\n /ZV6hSq5ttI8bRCfTuCv68wte3HeUlX02z+br/t5iZVCnp5kkqSFAtymSTGX5xocwCghQQNU/Dz\n 4r1Y/fo3wowxSgasC+Shqy6lXs4tO0xNBk81qGueo/kF02Ch6C7PygBR0j4wOg4XOQaoSivJwOO\n SwD7JxTDDxa1H7dhyr3mWzY+acYTazy68hFYlFonlZRySpidYsBvJMc8yRigaLndKNYWd+10Aiw\n IdJWEcREZFosgWANjd2McCtVx5cWu89k18Q6JBthbBDlmnWAD76/L8y7INz8xnvNXOwatGV7wZi\n Vq0FWSRWSslu+qB3xBgEC9ml6wP/uZo8blnmuFBht9X3L5xHobo0J8PQO46KdLUCFPJYfY95kSS\n lRSSxu8H0+GcaxjVGhA==", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-02-17_03,2026-02-16_04,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n spamscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0\n priorityscore=1501 clxscore=1015 malwarescore=0 phishscore=0 suspectscore=0\n bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound\n adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000\n definitions=main-2602170148" }, "content": "For a passthrough device we need co-operation from user space to recover\nthe device. This would require to bubble up any error information to user\nspace. Let's store this error information for passthrough devices, so it\ncan be retrieved later.\n\nReviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>\nSigned-off-by: Farhan Ali <alifm@linux.ibm.com>\n---\n arch/s390/include/asm/pci.h | 28 ++++++++++\n arch/s390/pci/pci.c | 1 +\n arch/s390/pci/pci_event.c | 95 +++++++++++++++++++-------------\n drivers/vfio/pci/vfio_pci_zdev.c | 2 +\n 4 files changed, 88 insertions(+), 38 deletions(-)", "diff": "diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h\nindex ec8a772bf526..383f6483b656 100644\n--- a/arch/s390/include/asm/pci.h\n+++ b/arch/s390/include/asm/pci.h\n@@ -118,6 +118,31 @@ struct zpci_bus {\n \tenum pci_bus_speed\tmax_bus_speed;\n };\n \n+/* Content Code Description for PCI Function Error */\n+struct zpci_ccdf_err {\n+\tu32 reserved1;\n+\tu32 fh; /* function handle */\n+\tu32 fid; /* function id */\n+\tu32 ett : 4; /* expected table type */\n+\tu32 mvn : 12; /* MSI vector number */\n+\tu32 dmaas : 8; /* DMA address space */\n+\tu32 reserved2 : 6;\n+\tu32 q : 1; /* event qualifier */\n+\tu32 rw : 1; /* read/write */\n+\tu64 faddr; /* failing address */\n+\tu32 reserved3;\n+\tu16 reserved4;\n+\tu16 pec; /* PCI event code */\n+} __packed;\n+\n+#define ZPCI_ERR_PENDING_MAX 4\n+struct zpci_ccdf_pending {\n+\tu8 count;\n+\tu8 head;\n+\tu8 tail;\n+\tstruct zpci_ccdf_err err[ZPCI_ERR_PENDING_MAX];\n+};\n+\n /* Private data per function */\n struct zpci_dev {\n \tstruct zpci_bus *zbus;\n@@ -193,6 +218,8 @@ struct zpci_dev {\n \tstruct iommu_domain *s390_domain; /* attached IOMMU domain */\n \tstruct kvm_zdev *kzdev;\n \tstruct mutex kzdev_lock;\n+\tstruct zpci_ccdf_pending pending_errs;\n+\tstruct mutex pending_errs_lock;\n \tspinlock_t dom_lock;\t\t/* protect s390_domain change */\n };\n \n@@ -331,6 +358,7 @@ void zpci_debug_exit_device(struct zpci_dev *);\n int zpci_report_error(struct pci_dev *, struct zpci_report_error_header *);\n int zpci_clear_error_state(struct zpci_dev *zdev);\n int zpci_reset_load_store_blocked(struct zpci_dev *zdev);\n+void zpci_cleanup_pending_errors(struct zpci_dev *zdev);\n \n #ifdef CONFIG_NUMA\n \ndiff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c\nindex b2e6b53ea8e6..9f02c2bd29d4 100644\n--- a/arch/s390/pci/pci.c\n+++ b/arch/s390/pci/pci.c\n@@ -915,6 +915,7 @@ struct zpci_dev *zpci_create_device(u32 fid, u32 fh, enum zpci_state state)\n \tmutex_init(&zdev->state_lock);\n \tmutex_init(&zdev->fmb_lock);\n \tmutex_init(&zdev->kzdev_lock);\n+\tmutex_init(&zdev->pending_errs_lock);\n \n \treturn zdev;\n \ndiff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c\nindex de504925f709..9f4ccd79771a 100644\n--- a/arch/s390/pci/pci_event.c\n+++ b/arch/s390/pci/pci_event.c\n@@ -17,23 +17,6 @@\n #include \"pci_bus.h\"\n #include \"pci_report.h\"\n \n-/* Content Code Description for PCI Function Error */\n-struct zpci_ccdf_err {\n-\tu32 reserved1;\n-\tu32 fh;\t\t\t\t/* function handle */\n-\tu32 fid;\t\t\t/* function id */\n-\tu32 ett\t\t: 4;\t\t/* expected table type */\n-\tu32 mvn\t\t: 12;\t\t/* MSI vector number */\n-\tu32 dmaas\t: 8;\t\t/* DMA address space */\n-\tu32\t\t: 6;\n-\tu32 q\t\t: 1;\t\t/* event qualifier */\n-\tu32 rw\t\t: 1;\t\t/* read/write */\n-\tu64 faddr;\t\t\t/* failing address */\n-\tu32 reserved3;\n-\tu16 reserved4;\n-\tu16 pec;\t\t\t/* PCI event code */\n-} __packed;\n-\n /* Content Code Description for PCI Function Availability */\n struct zpci_ccdf_avail {\n \tu32 reserved1;\n@@ -75,6 +58,42 @@ static bool is_driver_supported(struct pci_driver *driver)\n \treturn true;\n }\n \n+static void zpci_store_pci_error(struct pci_dev *pdev,\n+\t\t\t\t struct zpci_ccdf_err *ccdf)\n+{\n+\tstruct zpci_dev *zdev = to_zpci(pdev);\n+\tint i;\n+\n+\tmutex_lock(&zdev->pending_errs_lock);\n+\tif (zdev->pending_errs.count >= ZPCI_ERR_PENDING_MAX) {\n+\t\tpr_err(\"%s: Maximum number (%d) of pending error events queued\",\n+\t\t pci_name(pdev), ZPCI_ERR_PENDING_MAX);\n+\t\tmutex_unlock(&zdev->pending_errs_lock);\n+\t\treturn;\n+\t}\n+\n+\ti = zdev->pending_errs.tail % ZPCI_ERR_PENDING_MAX;\n+\tmemcpy(&zdev->pending_errs.err[i], ccdf, sizeof(struct zpci_ccdf_err));\n+\tzdev->pending_errs.tail++;\n+\tzdev->pending_errs.count++;\n+\tmutex_unlock(&zdev->pending_errs_lock);\n+}\n+\n+void zpci_cleanup_pending_errors(struct zpci_dev *zdev)\n+{\n+\tstruct pci_dev *pdev = NULL;\n+\n+\tmutex_lock(&zdev->pending_errs_lock);\n+\tpdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);\n+\tif (zdev->pending_errs.count)\n+\t\tpr_info(\"%s: Unhandled PCI error events count=%d\",\n+\t\t\tpci_name(pdev), zdev->pending_errs.count);\n+\tmemset(&zdev->pending_errs, 0, sizeof(struct zpci_ccdf_pending));\n+\tpci_dev_put(pdev);\n+\tmutex_unlock(&zdev->pending_errs_lock);\n+}\n+EXPORT_SYMBOL_GPL(zpci_cleanup_pending_errors);\n+\n static pci_ers_result_t zpci_event_notify_error_detected(struct pci_dev *pdev,\n \t\t\t\t\t\t\t struct pci_driver *driver)\n {\n@@ -169,7 +188,8 @@ static pci_ers_result_t zpci_event_do_reset(struct pci_dev *pdev,\n * and the platform determines which functions are affected for\n * multi-function devices.\n */\n-static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)\n+static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev,\n+\t\t\t\t\t\t\t struct zpci_ccdf_err *ccdf)\n {\n \tpci_ers_result_t ers_res = PCI_ERS_RESULT_DISCONNECT;\n \tstruct zpci_dev *zdev = to_zpci(pdev);\n@@ -188,13 +208,6 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)\n \t}\n \tpdev->error_state = pci_channel_io_frozen;\n \n-\tif (needs_mediated_recovery(pdev)) {\n-\t\tpr_info(\"%s: Cannot be recovered in the host because it is a pass-through device\\n\",\n-\t\t\tpci_name(pdev));\n-\t\tstatus_str = \"failed (pass-through)\";\n-\t\tgoto out_unlock;\n-\t}\n-\n \tdriver = to_pci_driver(pdev->dev.driver);\n \tif (!is_driver_supported(driver)) {\n \t\tif (!driver) {\n@@ -210,12 +223,23 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)\n \t\tgoto out_unlock;\n \t}\n \n+\tif (needs_mediated_recovery(pdev))\n+\t\tzpci_store_pci_error(pdev, ccdf);\n+\n \ters_res = zpci_event_notify_error_detected(pdev, driver);\n \tif (ers_result_indicates_abort(ers_res)) {\n \t\tstatus_str = \"failed (abort on detection)\";\n \t\tgoto out_unlock;\n \t}\n \n+\tif (needs_mediated_recovery(pdev)) {\n+\t\tpr_info(\"%s: Leaving recovery of pass-through device to user-space\\n\",\n+\t\t\tpci_name(pdev));\n+\t\ters_res = PCI_ERS_RESULT_RECOVERED;\n+\t\tstatus_str = \"in progress\";\n+\t\tgoto out_unlock;\n+\t}\n+\n \tif (ers_res != PCI_ERS_RESULT_NEED_RESET) {\n \t\ters_res = zpci_event_do_error_state_clear(pdev, driver);\n \t\tif (ers_result_indicates_abort(ers_res)) {\n@@ -260,25 +284,20 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)\n * @pdev: PCI function for which to report\n * @es: PCI channel failure state to report\n */\n-static void zpci_event_io_failure(struct pci_dev *pdev, pci_channel_state_t es)\n+static void zpci_event_io_failure(struct pci_dev *pdev, pci_channel_state_t es,\n+\t\t\t\t struct zpci_ccdf_err *ccdf)\n {\n \tstruct pci_driver *driver;\n \n \tpci_dev_lock(pdev);\n \tpdev->error_state = es;\n-\t/**\n-\t * While vfio-pci's error_detected callback notifies user-space QEMU\n-\t * reacts to this by freezing the guest. In an s390 environment PCI\n-\t * errors are rarely fatal so this is overkill. Instead in the future\n-\t * we will inject the error event and let the guest recover the device\n-\t * itself.\n-\t */\n+\n \tif (needs_mediated_recovery(pdev))\n-\t\tgoto out;\n+\t\tzpci_store_pci_error(pdev, ccdf);\n \tdriver = to_pci_driver(pdev->dev.driver);\n \tif (driver && driver->err_handler && driver->err_handler->error_detected)\n \t\tdriver->err_handler->error_detected(pdev, pdev->error_state);\n-out:\n+\n \tpci_dev_unlock(pdev);\n }\n \n@@ -324,12 +343,12 @@ static void __zpci_event_error(struct zpci_ccdf_err *ccdf)\n \t\tbreak;\n \tcase 0x0040: /* Service Action or Error Recovery Failed */\n \tcase 0x003b:\n-\t\tzpci_event_io_failure(pdev, pci_channel_io_perm_failure);\n+\t\tzpci_event_io_failure(pdev, pci_channel_io_perm_failure, ccdf);\n \t\tbreak;\n \tdefault: /* PCI function left in the error state attempt to recover */\n-\t\ters_res = zpci_event_attempt_error_recovery(pdev);\n+\t\ters_res = zpci_event_attempt_error_recovery(pdev, ccdf);\n \t\tif (ers_res != PCI_ERS_RESULT_RECOVERED)\n-\t\t\tzpci_event_io_failure(pdev, pci_channel_io_perm_failure);\n+\t\t\tzpci_event_io_failure(pdev, pci_channel_io_perm_failure, ccdf);\n \t\tbreak;\n \t}\n \tpci_dev_put(pdev);\ndiff --git a/drivers/vfio/pci/vfio_pci_zdev.c b/drivers/vfio/pci/vfio_pci_zdev.c\nindex a7bc23ce8483..2be37eab9279 100644\n--- a/drivers/vfio/pci/vfio_pci_zdev.c\n+++ b/drivers/vfio/pci/vfio_pci_zdev.c\n@@ -168,6 +168,8 @@ void vfio_pci_zdev_close_device(struct vfio_pci_core_device *vdev)\n \n \tzdev->mediated_recovery = false;\n \n+\tzpci_cleanup_pending_errors(zdev);\n+\n \tif (!vdev->vdev.kvm)\n \t\treturn;\n \n", "prefixes": [ "v9", "6/9" ] }