From nobody Thu Apr 9 07:17:16 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39577396B83; Tue, 10 Mar 2026 14:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773151341; cv=none; b=RyA7h1H7jh0LFmaOZ1KYinlej2vCzOOeRAsEcOckD9iAbBLW6ZtRfCusIdMyfHURNAxTQSWhX9RwVS8D4F/mREZoovEJma6oz44RzwOGffWyj/DNJmF+tnhvAeCI52HMY7EKtN/NxEaiHcgfD2+2ApSHAcHvgGNKVfrWL5e2mp4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773151341; c=relaxed/simple; bh=edmDDU4cN1Ws9FOsj1VWeSrDdLhWCsAnDzCZhRGhVas=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fMv3k4rDsv9+sn+mEF9CzHQ5ADB/cZlA3V5g+SuM/gYtfHi3HUNtUMJJlXKo0iSYphRtXCYFLuL9bNkdhftzsZyt21rutvFd4Ugw1qJAz1UyXD3xHafnGsz80p16A4mEzgV2YrnAnV8FXpGD1qf4Wmzi35mldWO79Yz/msI5Res= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GSe55bPC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GSe55bPC" Received: by smtp.kernel.org (Postfix) with ESMTPS id 00D6FC2BC9E; Tue, 10 Mar 2026 14:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773151341; bh=edmDDU4cN1Ws9FOsj1VWeSrDdLhWCsAnDzCZhRGhVas=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=GSe55bPCDYa+ovAH+ER7/d3wXQSaf0faFiaHXuQm7GykBR0Swm0h6NF31czljzQMR IRhwZTN5sSA7QMxUGpM8ekNFXozCA8GvufM0vRyzuin6rWGeiqpFywDgwibVhWYAkF j/9Gydx+aADEvWUJQwbP4tmah1WJ0uFdHg5e3kvQ9vY3pLDkcHzZ7EYLE7Rhf24Cwb t8OQ67qSMC9wmio4JUDqyLbzWapw68Zexg7Kgy4leMm6cPE9/EOkZ8daMhBK4E41uN HILeblvuJLUOUG0OaDeGtb6di4pbBmqgc2fnWojTMfy3HRXusrc8n2LkMBWhp8CMVy k8JGnvEUEHUhg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E876DEA8550; Tue, 10 Mar 2026 14:02:20 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 10 Mar 2026 19:32:02 +0530 Subject: [PATCH v7 4/4] misc: pci_endpoint_test: Add AER error handlers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260310-pci-port-reset-v7-4-9dd00ccc25ab@oss.qualcomm.com> References: <20260310-pci-port-reset-v7-0-9dd00ccc25ab@oss.qualcomm.com> In-Reply-To: <20260310-pci-port-reset-v7-0-9dd00ccc25ab@oss.qualcomm.com> To: Bjorn Helgaas , Mahesh J Salgaonkar , Oliver O'Halloran , Will Deacon , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Heiko Stuebner , Philipp Zabel Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, Niklas Cassel , Wilfred Mallawa , Krishna Chaitanya Chundru , mani@kernel.org, Lukas Wunner , Richard Zhu , Brian Norris , Wilson Ding , Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1730; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=+inIWavtaRJNM7OF0f6BOjivOkjaJ84sX0AUbJFUxOQ=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpsCRqF3ko4N0ymgpexjeuogA2o6z3MOYvAQA08 ytkZacXUEuJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCabAkagAKCRBVnxHm/pHO 9X3qB/4tpolEHvIN/p5PLjjCjCIC25XWplRB+gVV5NjJ6DN5UiiI+xjy/VzC4vwEtEfMiM+L9s3 79nhdwb3gg4aOICVpxQ+AkP6RUfFDD19XGoYEwpqSiS/++1pN2DGrEWy/wJ4CuRPT3NZ3NGXrKe CTiyldjCVayhqrvNDwLOv6hlHX5HBxLif4gpZJgLSGIiBl+KSluToo/y0YGW+jarmLa1KlrqC1+ aVwUitoWo4N5tRh49OWSASn1QOjTOHekgBOoK6r4OonXTs/hB1X8U9ZIp4+debStkJO+d0ySyVE 6631LGw4yl7h6lX8ib6dVIJ8IpSqQ2AN24qFMgFACqX9Dyel X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam This Endpoint test driver doesn't need to do anything fancy in its error handlers, but just report the correct result. This helps in making sure that the AER recovery succeeds. Otherwise, AER recovery results in below log: AER: device recovery failed Signed-off-by: Manivannan Sadhasivam --- drivers/misc/pci_endpoint_test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_t= est.c index 74ab5b5b9011..4024fd72fc66 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -1422,12 +1422,32 @@ static const struct pci_device_id pci_endpoint_test= _tbl[] =3D { }; MODULE_DEVICE_TABLE(pci, pci_endpoint_test_tbl); =20 +static pci_ers_result_t pci_endpoint_test_error_detected(struct pci_dev *p= dev, + pci_channel_state_t state) +{ + if (state =3D=3D pci_channel_io_perm_failure) + return PCI_ERS_RESULT_DISCONNECT; + + return PCI_ERS_RESULT_NEED_RESET; +} + +static pci_ers_result_t pci_endpoint_test_slot_reset(struct pci_dev *pdev) +{ + return PCI_ERS_RESULT_RECOVERED; +} + +static const struct pci_error_handlers pci_endpoint_test_err_handler =3D { + .error_detected =3D pci_endpoint_test_error_detected, + .slot_reset =3D pci_endpoint_test_slot_reset, +}; + static struct pci_driver pci_endpoint_test_driver =3D { .name =3D DRV_MODULE_NAME, .id_table =3D pci_endpoint_test_tbl, .probe =3D pci_endpoint_test_probe, .remove =3D pci_endpoint_test_remove, .sriov_configure =3D pci_sriov_configure_simple, + .err_handler =3D &pci_endpoint_test_err_handler, }; module_pci_driver(pci_endpoint_test_driver); =20 --=20 2.51.0