From nobody Thu Jun 11 13:35:43 2026 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012036.outbound.protection.outlook.com [40.107.200.36]) (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 4B6673546C4; Wed, 10 Jun 2026 18:28:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.200.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781116088; cv=fail; b=lA83wiHKum92VbBOvgtq9FyfD7RwWmezrdzCJzKUt8ciVY68Sts59nqOa7hKG3/hNSr6AqDy5VSHVYYzLb5+Arw5boUfIb2zmjmmND+NGl2iSHjVhYtNrQ2U1AzE5GBrnoOIumJU5h0QC7fTiK1PxYdFVWPSRrcNEWwxhq0G83M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781116088; c=relaxed/simple; bh=JeZWrAkpT28HlDYLafknjQUUJ3hLBjTUSCrJ+afgm9A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Rq88gmBgQywizoLz2qKyfwnJ/AepeSjHQEbSHLSf5P+/6uprpnl94XYW3WmqAp27sc4CElShszAqtJD1NtCbVkhqhAnODrIzDiTaLzTgba2kNzIywf19hp4lls7LygQbenbBxwn+HjzNLaEwllFFFROL2DANUXyseyWFP2IKvkw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=nMqwkyCe; arc=fail smtp.client-ip=40.107.200.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="nMqwkyCe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ki/eLnJdf3cNzysemjye64VVdE83i4qG2Ra0nPDRPec0cYn5PJOAEVgg8j5NqkcqY8biLksAYRxPjc2kd1If+B7ZCtOOCI8519QIGklc1cUEZccNzJ/+nxp96B2DUDmurp6UAbIgg8QYCIddAkYh7fFDEosNdn/Q4VS9XORgppNoGp+r72yWUcgwmn3YeYG8r5/yNqv5HErGv6ze9tzoOJoWpNvvQ2U/ebaUNrvJM8+mGbKs9W55hO5mkvN2cPC2q4X4HVdI2ZkwW13e5xypC+MHBTlkbEZYT4eq+hoROD1mbV/5r67r7jcjETQtF1PHiSYhAPoKjPh5uIaG4uhmnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NDrfqeXTeSDBhgdvSql2q2wxo6MasYkoo59Z5v/13Tg=; b=Ttx1tNmB5MJVKeAtJZmiIOoroAmjYE+aXXe1uFGXfUElFzaFkB4ZuSWdBbiUZ+u+miT3k56OOQxZWlbKA99pPfZ1qVR6/BC4wa6IZzu2zqQqjKHPU0GEd6hgRSbwCqyc6svTKA7Yd4fso3hQ/nFdHBqvoHES6lqXtIWbwAwZtFbveZ7/ineQoIY5ysEBYvFGshJLojjQ+g1ijS+ydGv1X3qDdttfcyYiW2ZGCcw0xHCTvWi7eepcQYdDWgPKCONBzvBfL1sX+TX2jkFJ7cx3O3eD/0JOquiuwgPCBWwGIMrqzBYQKgZ3OtyYHQRr5CQAOMMh6Mh1h5hZUC1gjxqDpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NDrfqeXTeSDBhgdvSql2q2wxo6MasYkoo59Z5v/13Tg=; b=nMqwkyCe69U3uUKMaWQq9VgvfqYDlW+HOxhS7citnmmUwLOUpj++BDI8Xc83ItexMBCC50KOIChteOK2denipkbhWe6K1YD1MXjLG1uh47NZ9aPZKTlfKmXPagkXoI1gk2SoMN9As8cXfORavESb9u70Y04DcMkgllwz1VrSwY8= Received: from SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) by SN7PR12MB7884.namprd12.prod.outlook.com (2603:10b6:806:343::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.13; Wed, 10 Jun 2026 18:28:03 +0000 Received: from SJ1PEPF00002321.namprd03.prod.outlook.com (2603:10b6:a03:2c5:cafe::a6) by SJ0PR13CA0097.outlook.office365.com (2603:10b6:a03:2c5::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.113.10 via Frontend Transport; Wed, 10 Jun 2026 18:28:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF00002321.mail.protection.outlook.com (10.167.242.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.7 via Frontend Transport; Wed, 10 Jun 2026 18:28:03 +0000 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Wed, 10 Jun 2026 13:28:01 -0500 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Wed, 10 Jun 2026 13:28:01 -0500 From: Tanmay Shah To: , CC: , , "Tanmay Shah" Subject: [PATCH v5 1/2] remoteproc: core: full attach detach during recovery Date: Wed, 10 Jun 2026 11:27:10 -0700 Message-ID: <20260610182711.1758544-2-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260610182711.1758544-1-tanmay.shah@amd.com> References: <20260610182711.1758544-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002321:EE_|SN7PR12MB7884:EE_ X-MS-Office365-Filtering-Correlation-Id: 79aea3aa-ecbf-4f72-6f53-08dec71e0225 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|23010399003|36860700016|376014|82310400026|18002099003|22082099003|11063799006|56012099006; X-Microsoft-Antispam-Message-Info: 9b0c3W1F6R92OqGNmp4ctSfG+VTh7FHuFgT4uIm0is4F1EtYa6X4UwoeFeACdb/5nLPQDJJRSCaM45LSH3TovMruSrJogDpLB2Qc7Ao7i0boOuASf63jQn96l3GffYKSq4utMu0OM1kvMOjUjVeKCNlDLDSjyuW4MvtYUM588WZDc+6y97yiKkxObXmzQ2Uk52o8g/NwhTUlrMelIKadKH4QQgvFm59rZr2+j8FP33mECo+mWegWGUCqAq29M2lr438A5bDBmUAI6jh1Qaxj6KDSUJWIYUvwXtow1sR1fAdxT3e374QiKNdVpAxyaeZ0kWAx5/JKerAJey7Tzg5HTZqu9I63/70h7tNfSa8VvSqLjpsJa6HOFAaLUFQ7rxEBZ/gkaJyGZAzXFtT17deHnUMZDYClJdFRQLq9cHkqQ3xHtcA+1anJU4hYpB3DocelyoC7RO9r0a01uDMM7wQmLjAiBjOJnLUvpr/OZNeMOBXrxC9Nm6jprl6nEkkRPbngC9ONM+bHDf5bSv7kpFAP0U6yCPoNVMr5OjOSJdBznZsgksFddnWv69vXrZGKpzZxwXdTr7D7NNRvHn3UTbzomca03hxR4wPjSwKQeorSwSNsgniVU1GGZRr9gHO4v+4EVMPl9TB9fON9Z154N9hinrxebQHyhuilke7jQ4wjyCYMGOwUGUrDJzXC7zvvVSXv2RfbER4KFm8kZRgMCGvNTSujX0W29LkmCJ3NPnZrZWA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(23010399003)(36860700016)(376014)(82310400026)(18002099003)(22082099003)(11063799006)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U1603k9sAUDQrMm2OK5Xx3CkkpLliHb3ZjUO4/ytVB/ckPXi/EvGAPYWDGhtJhZ2W+FnpycXaA+qvvdxiO4V7qQdzx6BvUGN/s/v0e8ZkR99uvOQdh/PHJ7jxBwmw7faofgJXXWbKizl8uecgePCBfkAYRKLOP2Lxr/DQVhpTWoVu2Q+NWY83MiICc2do7DDYYhg+EktOXUJ4u9Tm+tdtNNlX+EJy8jbhIjw799YpCzRJuSwNhQii5Z95BHeSEEI/5GEk7INrzGOCha8+SfLzE9kgAw9+I9yHqGXCt/B9v0ALjCos6DHnJ3bptCm8Hh5GjRY88tDalovbvd5UCbYrjgXHTi3EWBds0DC6HVR3KDZBWzONy8gKCu7jCAnBmb9EVs7rouxEX7qO0Fhfxc1CLB29NSXKDTGv/gUbNmTfd4CzjyO4iB6Y7qIRUtpsx5w X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2026 18:28:03.0793 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79aea3aa-ecbf-4f72-6f53-08dec71e0225 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002321.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7884 Content-Type: text/plain; charset="utf-8" Current attach on recovery mechanism loads the clean resource table during recovery, but doesn't re-allocate the resources. RPMsg communication will fail after recovery due to this. Fix this incorrect behavior by doing the full detach and attach of remote processor during the recovery. This will load the clean resource table and re-allocate all the resources, which will set up correct vring information in the resource table. Signed-off-by: Tanmay Shah --- drivers/remoteproc/remoteproc_core.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remo= teproc_core.c index f003be006b1b..8393468fa1ee 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1776,7 +1776,20 @@ static int rproc_attach_recovery(struct rproc *rproc) if (ret) return ret; =20 - return __rproc_attach(rproc); + /* clean up all acquired resources */ + rproc_resource_cleanup(rproc); + + /* release HW resources if needed */ + rproc_unprepare_device(rproc); + + rproc_disable_iommu(rproc); + + /* Free the copy of the resource table */ + kfree(rproc->cached_table); + rproc->cached_table =3D NULL; + rproc->table_ptr =3D NULL; + + return rproc_attach(rproc); } =20 static int rproc_boot_recovery(struct rproc *rproc) --=20 2.34.1 From nobody Thu Jun 11 13:35:43 2026 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010040.outbound.protection.outlook.com [52.101.201.40]) (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 4B856349AEA; Wed, 10 Jun 2026 18:28:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.201.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781116095; cv=fail; b=s6r1yXufORIQ3GGKY8B5OhBCQYdUlJ89Iwon3MEDDK3NqyXzy6LIlGddo5+2pXX6w/OzVdyL3/MOPumEpPRBdOx3xCqgk33tsHYwyW4XuAQ3X9QU6HjvrXLuRDj5UgZpJEhzQSHmVyj4P3LVSsa1Gsp5SChNkffKKr4CEBRsnqk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781116095; c=relaxed/simple; bh=4glupw8Cx+ntVYBtTUo3AMogQ5ItHp95+PrkYeeTnXc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LMkg5xjPku9wYMXM3unvwP1M5FTZWM931ad9/ophlTAkSeLohoBZZ23rru/TG4ctKwJwX17N9pN/pkapVcGaXhyddyGag1cdCIgq45saE5vamxVWfU8+mBDrS0WyBfADjtfggDQ2kGrWJeJRSpnOWt9tfqBC1FBroIMPp0D3fmg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Y91AhScR; arc=fail smtp.client-ip=52.101.201.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Y91AhScR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=j7JsJaFeh9HieRF1GTX1XC1LDvjabUnGS4OOt+BFLlHzdH2MynkpD1Rl7Li3fnypaJQaHoGXfO+GTpfnyXDcO7JAkdCSk/DofiND88zts2AhEOQN2aF0yKKTAZ+eRfX6FjC2m+Thd+eI7ESatxo9smzuE9BnbwbQTNTA0IFE9t9hbInl8GuqdShBzMd9jOpbrKLSfJC0luyJZ9G+bzu2jTIZk52PmT/AZO4aHwbEAKwcat2kQ40/5SlT4eNKaUASnn8xqVl7wY1xQSyRBjIeMB60Gh48IeA5eG89QCd+CfAqEC4ASYHt/Dcyvh+PkS/rtkafifm0a3cRQS5YHIRm3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nKYL7IM7TJKPNyIW7xLZfsKzEdK8Q0lZJCiBFT+tn1g=; b=eZ2sVYr7JvbHVoj5eusPaLx8r9tm85ImYheeymKXjNlvLbyJXspHgEnLqj2BpZmfhSIx1y4tHwanvWoJ5XxYf31VHH5W7dgg//rDegvrXr18D9yb0VtGW8TjZvh2v0e3xMsxtZ27F2H8XIUXc56HNkngNftE52v7MHeEIgTpQpEdr9fyUWbn9tzXm6f8FspbfO0m5X7Zo8VKWR7B8wvlzVgU4YjJgAgPuc5sWcdOfx0ODRRNKzGTF+kIpbgiZxDgaPOOGFsjp78a8EnHfchu2OamoWHyRf0O+OhwRJgF1vRL/ZnklC+NSVHas+HUDadiQzWztzkGhrZ76TIHZHs+4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nKYL7IM7TJKPNyIW7xLZfsKzEdK8Q0lZJCiBFT+tn1g=; b=Y91AhScR4TVyaa2YsPi95kPy0hmIxvBjRX2TbL3gqkW3pZcpZBfQx4ZLlQ0atuDyLZrC5mSncHtX6Cd6s15j3ApCS9LqAAkpl7tpYt2Hw1Jec+y3cjp/FVIyfYWSAkwMeZK8JTBQvTIljWS2AJp8JmMTYB5mlZF9AvCiO5IMfug= Received: from SJ0PR13CA0114.namprd13.prod.outlook.com (2603:10b6:a03:2c5::29) by EAYPR12MB999181.namprd12.prod.outlook.com (2603:10b6:303:2be::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9913.11; Wed, 10 Jun 2026 18:28:07 +0000 Received: from SJ1PEPF00002321.namprd03.prod.outlook.com (2603:10b6:a03:2c5::4) by SJ0PR13CA0114.outlook.office365.com (2603:10b6:a03:2c5::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.113.10 via Frontend Transport; Wed, 10 Jun 2026 18:28:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF00002321.mail.protection.outlook.com (10.167.242.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.7 via Frontend Transport; Wed, 10 Jun 2026 18:28:06 +0000 Received: from satlexmb10.amd.com (10.181.42.219) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Wed, 10 Jun 2026 13:28:02 -0500 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb10.amd.com (10.181.42.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Wed, 10 Jun 2026 13:28:01 -0500 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Wed, 10 Jun 2026 13:28:01 -0500 From: Tanmay Shah To: , CC: , , Tanmay Shah Subject: [PATCH v5 2/2] remoteproc: xlnx: add crash detection mechanism Date: Wed, 10 Jun 2026 11:27:11 -0700 Message-ID: <20260610182711.1758544-3-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260610182711.1758544-1-tanmay.shah@amd.com> References: <20260610182711.1758544-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002321:EE_|EAYPR12MB999181:EE_ X-MS-Office365-Filtering-Correlation-Id: b9332d8c-f596-4168-1db3-08dec71e045e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|82310400026|1800799024|376014|23010399003|22082099003|18002099003|6133799003|11063799006|56012099006; X-Microsoft-Antispam-Message-Info: HPOGKZ2u6LI0Wz7aofUellFtjONtdhAm7eB3FOQSHFVGbSjoEw7UwdMr8iSponaLMq5R2h12nkpc3E2LAU38fqFGPOBNfwwPyJyaPr8Zc/GX0EG78HTCkOxho9YuPHD0mDnANjC/RV+dIzk9J78QFe4hxSVsXGxnrr3LUI/uRW06eTBCRcFIWzMVJe/iV2AtoR4Xk4UO508MRmwPLg1mu2CzY394PvnVCt/hWEJA9+4yFQgZDgM/Sp5sicpov61snqTuhme0LUCdUpJtbHWalkLXsUjXBUvbmBnUcP8klwSwXrsRpQNjOn/n6t2RwLlyTIhjta3VYdM1ruYRfISEu+xACiy11EkO7yIEP37xN+pRWNgW/Bafz8RcXBS6m5SQxI8hMMuWjnDQHGOiXgCKbj/MeMKVXV0+Feq+3YhAhYv853G2ZySBiwdjLdM6Zp3Rcnr92IqNm2yhvU8YNrHo1Ac4ESZFjEnu6a9wu4fUy2X30me1zzbY+Cy63YK9jhTypAHud2Kdq9wiHEShNWtSMV0tTvq3w2mRFgrf5zKEXKAIEYIUt8JiYCjp7mTY5FiN0v7DU6SOSRnR5nhCwsY+YsrPsw605INxblh7XTxt+PhR/Uc+JhKAzDy1/Rp5uikbuaHDNbi3aV0kJXTcetqpvAjUBFF0avr8qFfyOSKEfPxWc5lRhqhxJxRUYkTA0O4obzEzLmLuI5rfb2j+Z/rMA4t3fFkyWUn+Ia8eeoXKVrY= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(82310400026)(1800799024)(376014)(23010399003)(22082099003)(18002099003)(6133799003)(11063799006)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +nmOyi3YRkcYMMZc1D+debu9zM0htp9CtBL8p5aYhjIbpRGHuPOjTEtan0PfLjqO1INLLeybfo/WJcaiV9cadoFHrDzdG4PU7cGsMYwWqxG44Je0cePDHsPyVStDLfHQ7TYQAvzOi0w6tIRFhtLGEFXYKTj34wB1GCEpH8bmESgB7Qpr4zLHVgCydaG5kBnN+FuKVIUw0TlqwCaPZ10KU3UNdIC7Xd2Q2n1bhrTMOopqmtVQIi4RiTlLZQtqAO59gEzGaJ7Br64xr3ZI+68lQQweFQ+Kr7DPbM/NqRxH9KuWC3KKnvjzOm1QZPcdneuDYvbTmFyJGF2d913m5yfHZbCsWTwb5x81qjxl/SECSdlvX2/88AOdyCF3Mtd4zFYUK8WDKIm6oH6DKUXFumPLo41egs4ktYPpvPGkK6ltpDANF3lDga7RTs+eyOtoDCQD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2026 18:28:06.8606 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9332d8c-f596-4168-1db3-08dec71e045e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002321.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: EAYPR12MB999181 Content-Type: text/plain; charset="utf-8" Remote processor will report the crash reason via the resource table and notify the host via mailbox notification. The host checks this crash reason on every mailbox notification from the remote and report to the rproc core framework. Then the rproc core framework will start the recovery process. Signed-off-by: Tanmay Shah --- changes in v5 - use local variable to access crash report pointer - End crash report string with '\0' without relying on fw drivers/remoteproc/xlnx_r5_remoteproc.c | 73 ++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/x= lnx_r5_remoteproc.c index 3349d1877751..86afff9f3b40 100644 --- a/drivers/remoteproc/xlnx_r5_remoteproc.c +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c @@ -112,6 +112,10 @@ struct rsc_tbl_data { const uintptr_t rsc_tbl; } __packed; =20 +enum xlnx_rproc_fw_rsc { + XLNX_RPROC_FW_CRASH_REASON =3D RSC_VENDOR_START, +}; + /* * Hardcoded TCM bank values. This will stay in driver to maintain backward * compatibility with device-tree that does not have TCM information. @@ -131,9 +135,27 @@ static const struct mem_bank_data zynqmp_tcm_banks_loc= kstep[] =3D { {0xffe30000UL, 0x30000, 0x10000UL, PD_R5_1_BTCM, "btcm1"}, }; =20 +#define CRASH_REASON_STR_LEN 16 + +/** + * struct xlnx_rproc_crash_report - resource to know crash status and reas= on + * + * @version: version of this resource + * @crash_state: if true, the rproc is notifying crash, time to recover + * @crash_reason: number to describe reason of crash + * @crash_reason_str: short string description of crash reason + */ +struct xlnx_rproc_crash_report { + u8 version; + u8 crash_state; + u8 crash_reason; + char crash_reason_str[CRASH_REASON_STR_LEN]; +} __packed; + /** * struct zynqmp_r5_core - remoteproc core's internal data * + * @crash_report: rproc crash state and reason * @rsc_tbl_va: resource table virtual address * @sram: Array of sram memories assigned to this core * @num_sram: number of sram for this core @@ -147,6 +169,7 @@ static const struct mem_bank_data zynqmp_tcm_banks_lock= step[] =3D { * @ipi: pointer to mailbox information */ struct zynqmp_r5_core { + struct xlnx_rproc_crash_report *crash_report; void __iomem *rsc_tbl_va; struct zynqmp_sram_bank *sram; int num_sram; @@ -204,11 +227,27 @@ static int event_notified_idr_cb(int id, void *ptr, v= oid *data) */ static void handle_event_notified(struct work_struct *work) { + struct xlnx_rproc_crash_report *report; + struct zynqmp_r5_core *r5_core; struct mbox_info *ipi; struct rproc *rproc; =20 ipi =3D container_of(work, struct mbox_info, mbox_work); rproc =3D ipi->r5_core->rproc; + r5_core =3D ipi->r5_core; + report =3D r5_core->crash_report; + + /* report crash only if expected */ + if (report && report->crash_state) { + if (rproc->state =3D=3D RPROC_ATTACHED || rproc->state =3D=3D RPROC_RUNN= ING) { + report->crash_reason_str[CRASH_REASON_STR_LEN - 1] =3D '\0'; + dev_warn(&rproc->dev, "crash reason id: %d %s\n", + report->crash_reason, report->crash_reason_str); + rproc_report_crash(rproc, RPROC_FATAL_ERROR); + report->crash_state =3D false; + return; + } + } =20 /* * We only use IPI for interrupt. The RPU firmware side may or may @@ -448,6 +487,13 @@ static int zynqmp_r5_rproc_stop(struct rproc *rproc) if (ret) dev_err(r5_core->dev, "core force power down failed\n"); =20 + /* + * Clear attach on recovery flag during stop operation. The next state + * of the remote processor is expected to be "Running" state. In this + * state boot recovery method must take place over attach on recovery. + */ + test_and_clear_bit(RPROC_FEAT_ATTACH_ON_RECOVERY, rproc->features); + return ret; } =20 @@ -869,6 +915,9 @@ static int zynqmp_r5_get_rsc_table_va(struct zynqmp_r5_= core *r5_core) =20 static int zynqmp_r5_attach(struct rproc *rproc) { + /* Enable attach on recovery method. Clear it during rproc stop. */ + rproc_set_feature(rproc, RPROC_FEAT_ATTACH_ON_RECOVERY); + dev_dbg(&rproc->dev, "rproc %d attached\n", rproc->index); =20 return 0; @@ -883,9 +932,30 @@ static int zynqmp_r5_detach(struct rproc *rproc) */ zynqmp_r5_rproc_kick(rproc, 0); =20 + clear_bit(RPROC_FEAT_ATTACH_ON_RECOVERY, rproc->features); + return 0; } =20 +static int zynqmp_r5_handle_rsc(struct rproc *rproc, u32 rsc_type, void *r= sc, + int offset, int avail) +{ + struct zynqmp_r5_core *r5_core =3D rproc->priv; + void *rsc_offset =3D (r5_core->rsc_tbl_va + offset); + + if (rsc_type =3D=3D XLNX_RPROC_FW_CRASH_REASON) { + r5_core->crash_report =3D rsc_offset; + /* reset all values */ + r5_core->crash_report->crash_state =3D false; + r5_core->crash_report->crash_reason =3D 0; + r5_core->crash_report->crash_reason_str[0] =3D '\0'; + } else { + return RSC_IGNORED; + } + + return RSC_HANDLED; +} + static const struct rproc_ops zynqmp_r5_rproc_ops =3D { .prepare =3D zynqmp_r5_rproc_prepare, .unprepare =3D zynqmp_r5_rproc_unprepare, @@ -900,6 +970,7 @@ static const struct rproc_ops zynqmp_r5_rproc_ops =3D { .get_loaded_rsc_table =3D zynqmp_r5_get_loaded_rsc_table, .attach =3D zynqmp_r5_attach, .detach =3D zynqmp_r5_detach, + .handle_rsc =3D zynqmp_r5_handle_rsc, }; =20 /** @@ -939,7 +1010,7 @@ static struct zynqmp_r5_core *zynqmp_r5_alloc_rproc_co= re(struct device *cdev) =20 rproc_coredump_set_elf_info(r5_rproc, ELFCLASS32, EM_ARM); =20 - r5_rproc->recovery_disabled =3D true; + r5_rproc->recovery_disabled =3D false; r5_rproc->has_iommu =3D false; r5_rproc->auto_boot =3D false; =20 --=20 2.34.1