From nobody Sun Feb 8 22:24:51 2026 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2073.outbound.protection.outlook.com [40.107.237.73]) (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 11CA921D587 for ; Wed, 26 Feb 2025 16:18:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740586699; cv=fail; b=nldYcXOSAXA1us9WM8x0Sj7aA/OBeFPPCV3wEMBJuhw0JsWEmL8B6sHBGkCk2FQyT0qFPv6ovepJOhxDuFtkEv96Gi9NWeJurY+LRvowp4LH8L5V2a2adb6OKvy3RMaQlS11t00lBCB1njRxHEkowFCjuQrLxjlhIN3Ub/tI+Jg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740586699; c=relaxed/simple; bh=R4bWMzrwB/YkwAf0NNH33ZTH4QoteFihMqcQ1RJ+16U=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=TLJRB2HzA4dBnuB7uWoyzVmcf1u8g+vd5om/2idkvXTOeQfA022fa8HSu3K6U/yelUY0pZzwlbSkd/kbZlVj+2su/FhGOkEaDEhCngNIe+18VMbaqffSYExpvgYoUYgLQ3Gj1lYwPgc9HLBUTWyVdzPupOJHm0CGinP6K+DACUg= 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=vFS/ao43; arc=fail smtp.client-ip=40.107.237.73 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="vFS/ao43" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d2DSgFtZWVeoRzrDjgM1TmT3g7uwQi5g3yGbuYnWXA1mVjWv3fgvcGupBFbKwWeWpg0cI8T1j0ERgdWV2nVWNFIIDS5375unmoufbl8uZ+qAnCCw0GjvAfuoBsi44gu2MN/hlKEbhP/FT24f7roTDBGjkhr6xxH29imt6Z+Pam2o3RnUAMiF+O3z62OOVaRHPXDfBDOKxDlJ9Pq7PCXNVPi2UFBv3D4RFMjMNmN9QxBOwXH0iuB0r6tuSlUgfQYOrL9Dn3/OaZ8bFqMejZ+WK5eOJMeILpc2ND34UMG6xGXteUz5Tq8kDtGGsYSFNCrNCs4oenEyzeAljGw3mVlEQw== 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=vPhSzFnpa/2E3L78eVlox8lYx83YZDcAWI4SG1xpzJc=; b=m+b1gtIpd6ofNAfDF8niOxbU4/G7R6p47esNR6slCV0geQoSRL4wDk66Sfz7X9n3DgjY7vynllcsPzR9gXi75QSZ/iHn5dUS/dkJ9L//c1bZFObORETooH2KuxH52vvriSO+cRwC+fPHX3gru5kTUK/f0EKHL0PxlLAfDmBsl1fLrlpLdjwAR4nXMx8pqQbyPhgj/aT3gfRGVRg6nWEYpR7CAKUrjD7ftaEj+BP6yGVmTRpcxv7lqZ11PFnfkkasqnzAWqf4nv0Z4cOcVdUBu9IvObbWT2UOuYH7ntV3phpFMJcPqk+KAxuDg2FY05Iq0kZbr98SQMdPNs5JDLs0bg== 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=vPhSzFnpa/2E3L78eVlox8lYx83YZDcAWI4SG1xpzJc=; b=vFS/ao43UF1dBXpPNDiPxuMOJBaYPYgASW8iBNnib3LEEkFHNDN/XuW6KXKyW2P19yDtgGPJLoaK7xaIrRhR4Yvfy8rLc+2UhnGAWoM1KA9QPY0NT/oUPFRfq5qLQcz3crvnizm9q1QL1emuARugzMcK66mzKKWWr54XYwcZlFc= Received: from SJ0PR13CA0198.namprd13.prod.outlook.com (2603:10b6:a03:2c3::23) by MN0PR12MB5907.namprd12.prod.outlook.com (2603:10b6:208:37b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8489.18; Wed, 26 Feb 2025 16:18:14 +0000 Received: from MWH0EPF000971E7.namprd02.prod.outlook.com (2603:10b6:a03:2c3:cafe::f3) by SJ0PR13CA0198.outlook.office365.com (2603:10b6:a03:2c3::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8489.16 via Frontend Transport; Wed, 26 Feb 2025 16:18:14 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by MWH0EPF000971E7.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8489.16 via Frontend Transport; Wed, 26 Feb 2025 16:18:13 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 26 Feb 2025 10:18:12 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 26 Feb 2025 10:18:12 -0600 Received: from xsjlizhih51.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 26 Feb 2025 10:18:12 -0600 From: Lizhi Hou To: , , , , CC: Lizhi Hou , , , , , Subject: [PATCH V2] accel/amdxdna: Check interrupt register before mailbox_rx_worker exits Date: Wed, 26 Feb 2025 08:18:10 -0800 Message-ID: <20250226161810.4188334-1-lizhi.hou@amd.com> X-Mailer: git-send-email 2.34.1 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 Received-SPF: None (SATLEXMB05.amd.com: lizhi.hou@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E7:EE_|MN0PR12MB5907:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e3c5dbe-77c3-4df2-da56-08dd56812b9f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?t2c2Sb4siHSdkagrQTxi6h3oAG9y11Z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?Q?Ia/qISUWJNGtEwve7Y/83OZgJ5rEDjO+yuMfb8bdUv94x4LBoCgf8eovr93R?= =?us-ascii?Q?+OGRJGPaCU0rs+l4wk8H8mUKfFMx1tojGE4zT6YbNcJYWhzXUuieDzBaBdZX?= =?us-ascii?Q?ZcHCUgKqQnGEpJxk46ZusX84N8kBwW7VZU0Cmk7tBinPuh3kJUmAQF1oqBhg?= =?us-ascii?Q?AbISUuCrhz3Qk4LMVU7VrB5upXciTaU8VZO0dOUGEw4K6UgwOI5PlDccV6jI?= =?us-ascii?Q?wo0VTGjY7u0nuKhTz7OJepIryo9/RHgF7vbFWXWsU0ldkszN/0Z65SLNqkFN?= =?us-ascii?Q?Dewv4Sd6tMS3JMK853NY3ByT5NHtYdK05xRqYa9UT8IzDLlC4T0kE/hwhR4T?= =?us-ascii?Q?u1bh5Q8x8Uu2vDWwUptU/RA1KK5BzkFa6cnkAlJy9ngvVKrotKnzhFtvJCkG?= =?us-ascii?Q?kaVe9WjlQgwqVGvTMyvJBBITxz+pFDQTuaMlOwISad1h0CNjKvlkZCZk+yl4?= =?us-ascii?Q?FPjTBwXWQo6+A0q5BZ4BJ4XvrKBCWrSVoRq5Ux8B+vvT7B+4yIP6+jy4KB+y?= =?us-ascii?Q?oy8TNylcTRzXYrlt7NTRzSP1paNhxOB4kgTOt1ktk6+ph9+cwpdeg66sUPML?= =?us-ascii?Q?uj/3+iQftCoLvRY=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2025 16:18:13.7426 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e3c5dbe-77c3-4df2-da56-08dd56812b9f 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5907 Content-Type: text/plain; charset="utf-8" There is a timeout failure been found during stress tests. If the firmware generates a mailbox response right after driver clears the mailbox channel interrupt register, the hardware will not generate an interrupt for the response. This causes the unexpected mailbox command timeout. To handle this failure, driver checks the interrupt register before exiting mailbox_rx_worker(). If there is a new response, driver goes back to process it. Signed-off-by: Lizhi Hou Reviewed-by: Jacek Lawrynowicz --- drivers/accel/amdxdna/amdxdna_mailbox.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/accel/amdxdna/amdxdna_mailbox.c b/drivers/accel/amdxdn= a/amdxdna_mailbox.c index de7bf0fb4594..8651b1d3c3ab 100644 --- a/drivers/accel/amdxdna/amdxdna_mailbox.c +++ b/drivers/accel/amdxdna/amdxdna_mailbox.c @@ -348,8 +348,6 @@ static irqreturn_t mailbox_irq_handler(int irq, void *p) trace_mbox_irq_handle(MAILBOX_NAME, irq); /* Schedule a rx_work to call the callback functions */ queue_work(mb_chann->work_q, &mb_chann->rx_work); - /* Clear IOHUB register */ - mailbox_reg_write(mb_chann, mb_chann->iohub_int_addr, 0); =20 return IRQ_HANDLED; } @@ -366,6 +364,9 @@ static void mailbox_rx_worker(struct work_struct *rx_wo= rk) return; } =20 +again: + mailbox_reg_write(mb_chann, mb_chann->iohub_int_addr, 0); + while (1) { /* * If return is 0, keep consuming next message, until there is @@ -379,10 +380,18 @@ static void mailbox_rx_worker(struct work_struct *rx_= work) if (unlikely(ret)) { MB_ERR(mb_chann, "Unexpected ret %d, disable irq", ret); WRITE_ONCE(mb_chann->bad_state, true); - disable_irq(mb_chann->msix_irq); - break; + return; } } + + /* + * The hardware will not generate interrupt if firmware creates a new + * response right after driver clears interrupt register. Check + * the interrupt register to make sure there is not any new response + * before exiting. + */ + if (mailbox_reg_read(mb_chann, mb_chann->iohub_int_addr)) + goto again; } =20 int xdna_mailbox_send_msg(struct mailbox_channel *mb_chann, --=20 2.34.1