Message ID | 20240829-i3c_fix-v4-9-ebcbd5efceba@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CDAE2CA0EC4 for <linux-i3c@archiver.kernel.org>; Thu, 29 Aug 2024 21:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=i4fWk6bsaZzUhzyO1gxxtsMBRgc+PXqDZCDO8RF/0Y0=; b=tUGIbmyZ9A58qGf87Pxz+5I8Gp +liXevz+xAGUjBCwFZF/5Yr3GGBSmLnHY6SmAZG8AovPkRunPRY1AoL1iGrXAzNFyF6iVnBCMFyQS aB2z7zx9r+K06FsdvgDH+h8F1XWCnQCfwSGSuxFbxCQNS7wpX1BWXvoGYy5S3oz0Lsi8Niuf79HLR FhXiTKqYlr9SA/7xveXYQdVBKYGDRhlcYNI/L7ci0UyuWfxBUgKD7dqlSafa+oOGb/ehpfXqJW2JV TzYyD7zBmURA+vUABlVW+RDoa0KjZRogTBc+cyTcPoDdiQ9DmbTIvx7M+a6HH2upeaw7sAAXveNl7 FkVfWAUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjmUE-00000003f0W-2G5G; Thu, 29 Aug 2024 21:15:22 +0000 Received: from mail-northeuropeazlp170110001.outbound.protection.outlook.com ([2a01:111:f403:c200::1] helo=DB3PR0202CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjmUA-00000003ev3-167e for linux-i3c@lists.infradead.org; Thu, 29 Aug 2024 21:15:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mmzREJ9U/uV7loBj03EKBTIoPWKXY0t3QhLgKVl9kkUilVg+175P+ubyEd4G6qbaA1omknPjyp3COPBUZfenKaolKDe88JFo3Q7fpUZDmxwo2Q1pCV//J9Nt1muW7LhIhibGPhsOnFtxEx0GCiZ0WbY1iFmCIe0tJDZSwBEwQi0y3SEKKvNOT79YvfIXBiINWaOeK9vGkqGOgd2yRhKRHsfBiqJAzDlsdyubbG3WTy9k4s1hNR2rhbALexpX2r05EkRPpZX/Jv6RjiStYHgM/lwzuLfnvha4ZY0PvbKV/ityrLhaI8K5lt8qMQS0iIy/KynHPuFA7ZQXtGbRtIpWSg== 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=OXODyE4M+mQV57wFyvfvGmCTZpGJ/QbF0kDJVOYsNqQ=; b=MODfhhn+77nRCqQcHUib0BC+fIDTZlNkB5nET2U/WR5w6HQzBVkoIvapHBcBo5N2UR1DsbUhkTbQNX5WiYtUO+9kpNtU6Uv5jorOe8hjCtKKZlTysTG40Y+XWp9LE3kCiVaFbcKjYZS+LrsoPuSjwqY8ZUIi9MKWC5Jvd9LCSMr1nqO3JlwB/jDhWm10ONJqKe6paXa8kPBc6j1ZTG9sUvUhE8LRcv0erQ1c7JPHhJiEj1WEVtODRFij61IbnN4ikAM1335cu7kEXQVQ/beXVAO2dO6GkdBwSCMENNjv9bohNzcBX4RNznZcC0kyhJ1Uj6X4gaG8bWJIvu6ZwGMAsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OXODyE4M+mQV57wFyvfvGmCTZpGJ/QbF0kDJVOYsNqQ=; b=BTe6Cf6VVW4seNrN0j+uroQvWYmWLgePqb8ZN+C/pVn2IqHvGkCsDAx4Gc4n3hwR66aHosL7+CbaVoq251KGHku07xvGPtk3l3p7vftwIc2pOiPwnAdV9ELbZy2mtZELbrVqeWP9PtAKRIgPpfzkwx7GjCpFEczXoTcw8ToQJsKwN8j0yYfok5ow2akEDOCuXxDNrvG6hcYzIdNSrGtvflc9Mp8HgYEZr4IaqrNYe09UTUEWqCsaIe2roOPhooYCf7lcEKKp77UAWilNKKMX7o44bN01H4sHdAuVs3Jv8CmMcjjHnz7A+kYGWQ5sHIQzMrg1Ij6to3MjG23eG0dd0w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AM9PR04MB8971.eurprd04.prod.outlook.com (2603:10a6:20b:40a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.20; Thu, 29 Aug 2024 21:15:15 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.7897.027; Thu, 29 Aug 2024 21:15:15 +0000 From: Frank Li <Frank.Li@nxp.com> Date: Thu, 29 Aug 2024 17:14:06 -0400 Subject: [PATCH v4 09/11] i3c: master: svc: use spin_lock_irqsave at svc_i3c_master_ibi_work() Message-Id: <20240829-i3c_fix-v4-9-ebcbd5efceba@nxp.com> References: <20240829-i3c_fix-v4-0-ebcbd5efceba@nxp.com> In-Reply-To: <20240829-i3c_fix-v4-0-ebcbd5efceba@nxp.com> To: Alexandre Belloni <alexandre.belloni@bootlin.com>, Boris Brezillon <boris.brezillon@collabora.com>, Parshuram Thombare <pthombar@cadence.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Boris Brezillon <bbrezillon@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Miquel Raynal <miquel.raynal@bootlin.com>, Conor Culhane <conor.culhane@silvaco.com> Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li <Frank.Li@nxp.com> X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1724966083; l=2497; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=8g39LLjNh6tgt2AoF/k4PMt/JQ4UPEhwPL8LAWtogv4=; b=yxdTXFHmhOc2CVduqHWpwSQ6h86NDCqImqQgbUCn+I+/GqB0N6Fdi/3RVzNBubcePafy4vIRZ bD24j/m1eJCBtpC0QCepojrjzHOnVBaFLMk1ErcZny2tQqV1nDZ+8Xg X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0219.namprd13.prod.outlook.com (2603:10b6:a03:2c1::14) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM9PR04MB8971:EE_ X-MS-Office365-Filtering-Correlation-Id: b242bd20-9255-4397-7a1c-08dcc86fad17 X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|52116014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?JYB33DHMhkn+1rDGhvFouFxIf9QZsRk?= =?utf-8?q?I7NnQ9mOqR8vePeI0ocIBAtJzT6tUJGBLeLB/ucxa6tEYDT/PZ3cOwq5P+G1Kp25q?= =?utf-8?q?hRVQxMPbZpPRIrlFws1MoMRr2DEy0MqqUG2hbqDALbvNSc1+curZE9xiKPDMuslAi?= =?utf-8?q?snYM+NRi5Ea5/m5GpeeEWhgwjuhsi7DEHQ65JqGkFPgTV2LGRblpQTMYjNpQXtMc7?= =?utf-8?q?7z+lXaArc7zBJqec9HWAS3pFp1yMH1RPLmuFKGstkjpc07/Sxr+1Cv9DG1+McCfCG?= =?utf-8?q?gIzH02w8aMrLtYASy7z+SNyt/wKHmc7EgO1hC5+0UsI5W+JDDVi/s/QFMUd7uOai4?= =?utf-8?q?VLCRlvK7BPniyNw1qE5qAwXbhjrKuRObZzWqe8H/D4xgr/T99gf5uH+eZDLUU6PbM?= =?utf-8?q?bjiPGUVSJe3BlL+ogzVnaYeWw3g96qU04lsA9jWotW+XGPp9s3KW/c4eEyBI4sLlW?= =?utf-8?q?HZ7/vVfn0V0QWwrFdtp2OUCoLqTAFk1EqMYWIWxnmPxyr99RNKPCYAR+dKVow2+Ou?= =?utf-8?q?ze0n65U9JcEx5bIcLoW3QenCX7leNMQiT1ml7XapIAUmYSPx0KADQCVzCYKKamhmT?= =?utf-8?q?2TUIirrvMVa+x4Yov5CtvWo93m3On0djRtpC1ixahpADe/89nU/3YxtLHK9nAN5AH?= =?utf-8?q?3mz2jPdwjdSGtkebaId9J9F1prQG6HyBIly5E4tRChoRmq7ea4RUOMLydknCHlZG6?= =?utf-8?q?E5WvF2itk1Fz/nOKval2qF3gE6JTrJD1jdrMGS0MTSUKiO/SttVYJigFWRWqAlQzo?= =?utf-8?q?JhYCW2O3DzmyaLqOUfhSrGMNhxPUDM6J1ESXPvvGgiyd5TKnZ6fHco/SYbLmgg7+k?= =?utf-8?q?eY2BkuOM9snmrMo1esVM+Up1OqX35gd5qgDqf5EUQgabgyZWTK/1MoMpCtGBVckOP?= =?utf-8?q?Qai4WbHlgiuJPzmKHLKK2HaGbX7zBGiARQtplGAX//AnK1f9Agbfvb2hhKSDqISSY?= =?utf-8?q?dfrCMQEPGwXgGhlrnF5SJrYnqAT0ARZRJf8H9G8CHOeK0aba4H8O5X4Vpv+SNrWru?= =?utf-8?q?lIqVRbzCUmcvdjbCYfFa1lNARRPwnd5Rn25l/xRUSiKzgm8YxFHoFOgXU18ld/9wu?= =?utf-8?q?TVR/6SKzgDbyHtsNmq8ucLowSRHe+XLHysmDqg8dooLlNI8QXKrIQmetHdYPwBu9t?= =?utf-8?q?bh8CNaKbgJu5nxcQdxAZ+gBLGFj4y7u92WVbS46h6XkGIGgAGydId5WDFxLjN0sVQ?= =?utf-8?q?S4JBnTOq76/R+IYAggVj5IplTkP+rv6BrIBti7oNS9dmt7W69I+TzujiOlFJ3hgJf?= =?utf-8?q?dk2Gcq8sNZmFdBGO63/GeVwpUHwTCDhFmHI40c30G79F7xtcgMeZgBEQY1tazlKdp?= =?utf-8?q?xFMzgIZj+tY/4jBdRDftS3lcf959AFfdzQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(52116014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wRcLr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= =?utf-8?q?buwUGxJHtb9y62znC0VpQUkb0xZ6vvQbqf2/Nvy4hjqnT3FMH/2OEpqjk7Zn3fn09?= =?utf-8?q?O/7MB6JeI+JguXilb/+217wznKBTVxyqjfnLkEzPF0klJu/1KOjNigO2qacPEx7Z+?= =?utf-8?q?bFIGx2hz7SMa/2CnEmMOQdVZGSMaEuqVzPCNXMqA8YMEcVvH2/xN+C9/7qb8SUzS/?= =?utf-8?q?qpMFMbAcLfbZ6nFF9kfBpxpHshFoxaebUmCbWoZ11CX3qcHfnghuxFgYAwTJ6WU8u?= =?utf-8?q?xqQRBlT/nk+ciS2mkYqcF8cLYe+zH1fVLnZjQvDuOOv4OplIND/Cvi0BD0Bdg155W?= =?utf-8?q?C+kJQgl8G/xRCRhvhBcZFcg1lc71MHBiV+Rf9arE/nLu3q/CWuUmzugIAjP8Dw2yk?= =?utf-8?q?xEX4wICfhfnyICh+SlLh6tSl2XrP6Yf5LXuhPhT4QWO0XZOZ/x/WuWGPawj91KUpa?= =?utf-8?q?a5C7vt3iN2bS8fUR16lfn0ovVghCirZg81Oi/FoyNkCzTAm7RVKkrzZ6i2QDxxr8O?= =?utf-8?q?m8DGP51S1TmCYOtn2GTjLVbP9UCcocCFk9jPdZGzUccyDSID+P0K8lC+mKQ4ccTuV?= =?utf-8?q?FFxCKlyUvea8yAgdoZmzCL0r7eFm7f9Fq/GYywcalZs0K6D8BBMQR9IxhBlldFPiA?= =?utf-8?q?R0GasdftrOgI?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b242bd20-9255-4397-7a1c-08dcc86fad17 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 21:15:15.1592 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Xnlt+6GOowj4yAugOqKe+ijCX9V1Ak+CIoaGj/eiS8rRTaoG+j4z23ZkiqM9wefmKub4LrDECkfBaBPh3MRBUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8971 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_141518_385219_DABFC35D X-CRM114-Status: GOOD ( 12.24 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-i3c.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-i3c>, <mailto:linux-i3c-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-i3c/> List-Post: <mailto:linux-i3c@lists.infradead.org> List-Help: <mailto:linux-i3c-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-i3c>, <mailto:linux-i3c-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-i3c" <linux-i3c-bounces@lists.infradead.org> Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org |
Series |
i3c: master: some fix and improvemnt for hotjoin
|
expand
|
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 9f456639d1aad..2b000f446f1cc 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -432,7 +432,16 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) u32 status, val; int ret; - mutex_lock(&master->lock); + /* + * According to I3C spec ver 1.1, 09-Jun-2021, section 5.1.2.5: + * + * The I3C Controller shall hold SCL low while the Bus is in ACK/NACK Phase of I3C/I2C + * transfer. But maximum stall time is 100us. The IRQs have to be disabled to prevent + * schedule during the whole I3C transaction, otherwise, the I3C bus timeout may happen if + * any irq or schedule happen during transaction. + */ + guard(spinlock_irqsave)(&master->xferqueue.lock); + /* * IBIWON may be set before SVC_I3C_MCTRL_REQUEST_AUTO_IBI, causing * readl_relaxed_poll_timeout() to return immediately. Consequently, @@ -452,7 +461,7 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) master->regs + SVC_I3C_MCTRL); /* Wait for IBIWON, should take approximately 100us */ - ret = readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val, + ret = readl_relaxed_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, val, SVC_I3C_MSTATUS_IBIWON(val), 0, 1000); if (ret) { dev_err(master->dev, "Timeout when polling for IBIWON\n"); @@ -525,7 +534,6 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) reenable_ibis: svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); - mutex_unlock(&master->lock); } static irqreturn_t svc_i3c_master_irq_handler(int irq, void *dev_id)
According to I3C spec ver 1.1, 09-Jun-2021, section 5.1.2.5: The I3C Controller shall hold SCL low while the Bus is in ACK/NACK Phase of I3C/I2C transfer. But maximum stall time is 100us. The IRQs have to be disabled to prevent schedule during the whole I3C transaction, otherwise, the I3C bus timeout may happen if any irq or schedule happen during transaction. Replace mutex with spin_lock_irqsave() to avoid stalling SCL more than 100us. Signed-off-by: Frank Li <Frank.Li@nxp.com> --- Change from v3-v4 - improve commit message - needn't mutex here, other place already use spin_lock_saveirq to protent i3c transfer. --- drivers/i3c/master/svc-i3c-master.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)