From patchwork Tue Aug 13 15:14:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762219 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010010.outbound.protection.outlook.com [52.101.69.10]) (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 08A281A00D4 for ; Tue, 13 Aug 2024 15:15:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.10 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562128; cv=fail; b=NgrHbi9fw5cyqK+CyOICgueekAkVPL7jHH2UPX5CQmM7jZyfySX+LMyTgs0awfcoMvMHP/oAeHlvBM0xMRV/vy0IqepT6/q1UXn0EJlSHprbH2J8QC8K1xSkujc6E/Uaqa7X0vAIp2ErFJQcBB2M6ZfABX9sgEc59/IYKoGrT/I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562128; c=relaxed/simple; bh=/JI8s94ok2z+hT6L0BfTNT5ICOc99IOP4jbZmyhmqiE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=u1x07CsDwQ3jl4/kKKWSn4IkcJycq9QtHr14IFCrFtGjI6XIHwT8O7rMX1Ksom2H7ZNHgoGVQAZA1mYzMdiaBsr1CceY9GV6hhpx3Rfit4J3Y1UqNbZ51ZxW26YhyqMzabLImfx5lw/VZnBh+6GQWVEx434P0lDYVxdQNtr6Cc8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=OVRF+nNX; arc=fail smtp.client-ip=52.101.69.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="OVRF+nNX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CBNoGK1wOQS8ud95bPNZhi0Na5s4ZKXqg6D6KPM0WPh4+t6E2Vs7WOaxSgz/N3i0U85vlrBr2v4ULFIBlAQSxFU0KydANKpgqpeY80h577WH/Fxs/bXzHivSjwr7Vh+fgqHqjaYn1aeVOJ2pl5bMsdt+5ZVBf2LUOwA4D833MSb7gJ9ITt63hflVXuh8AiWMte3fhF0l62PXYvjy4Kh5CVjJMHTVHXhUx5TL7SaYQcUMwwx2m18o0MC3NGxHG0C+b4cnNf+9o630X+I8OpZdKGu4TQa/euzvoxCXO5Q/YZeux8i778q1miW6PuGjqTJJAmKYGbvxyGjeumZqVp7NHQ== 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=iEH3AqOKfHzxwLjQgVs3Ok5rqhSw+ALKLhi5IuDAIjI=; b=UlAAoemUynI13Uu7KomUIBlkCnVTNv7RdFzaNWlLiv0qB8yq0e5riJgLzd3doE2JI7SS8ztbRwHWy58+WgG4tPtmSF4ITfvpF4TgdvrM9lWJ3rnYp91xeYze3L3+LVRq5l8k88avyLosXexb3caH702ZFQUvSGUxcp+1TX7OiIHP+YOZcIbDwtzm3Xf3I8LxUzzGuY7Z5jcol1IHH3CZCNTNlqXMwwyYfHdIYsDjtdFCSjRcY298xJAAcltdcYPfQVbF2MfGjIWtga755AkZBdhr6rHw1gr7rDwQMiAUwxcj6OCZe3gOATTacj9jyvCSAGj8pHC9JDOGAAyAEKTKPw== 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=iEH3AqOKfHzxwLjQgVs3Ok5rqhSw+ALKLhi5IuDAIjI=; b=OVRF+nNXq5xiY6xpOWZDOnopBWDK03/ZC7JH4b9fwxHyS/4Vh3PI7ZppaxCnJPxEb9uOxAOEVvP8ovz1DgnSvrswqlGpoX7cShByRlS8/jizX0nPohfbCkn1c1XrAwfK5XPBrlhdutKEtCmYVQSZ7dQRUX+OuJqnP8c33UBoZiJFFnkYp731drBPDJwatF+lGSkAuQaQkA1Mtak5bmVemsS6LBiYASKtS3WOgO439oN1Yd0q6E0RzzFoHKB1eASpfjJSc9+ujnxsNojLCq2t69yD7P+MdrY9L+EKWPvLBpewBdzeACahab+UHn0ERiA1QWAdhJzNQ1hRhWtfU2UnMg== 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 AM9PR04MB8416.eurprd04.prod.outlook.com (2603:10a6:20b:3b7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:22 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:22 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:14:59 -0400 Subject: [PATCH v2 01/11] i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin Message-Id: <20240813-i3c_fix-v2-1-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=1374; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=/JI8s94ok2z+hT6L0BfTNT5ICOc99IOP4jbZmyhmqiE=; b=k+hcRgKRsY1SW+/ssQ/u3lmwyi7D60jBG6mT4m/rVcTv+BRIKr1ZEv0HDmSLSs4UUUa6BG3cD /hEz/Zhv9hlBnrCB/QEh/2ISubU+Bk0lICxlV93Dy8F4woNYMdHdSGb X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM9PR04MB8416:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ec55771-8990-4e0e-7330-08dcbbaac076 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|366016|1800799024|376014|52116014|7416014|38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utf-8?q?RbNrCPime4GtSn/aRyxriUcsGLcp/5asoQCcqxG5SRj4QegDej0RxpGCj8quh4J1V?= =?utf-8?q?Hp7iCvqXxtUg7q37rhqLA2jWwfsvadUO61VE+DTyiNZ49hda9/uTb31GqPSvXuORr?= =?utf-8?q?yIw6oVcz6a4/CzMcrNKeqZsf0hmgf0DBOfhpiAB1TgCj3G4qWhzZMggRxyRLOYmZD?= =?utf-8?q?4yG3CI+FQrB78tx5XV2Woza8gic84qHeVmsJfLRyhN70vzmU8UHxemZ8eTf5k0s7f?= =?utf-8?q?kC9G2POqulYjmZOSkFbz26w76Kmgeh3QEOAC4gWR83rL7Q1yYUmr0MbXiEv0dCskp?= =?utf-8?q?vhRbmAoGKHTs5cWIzO/p/o57bGLSTSvNIZqWU+0moZ9MTeemWKqHuRcQstwiIAJY/?= =?utf-8?q?a2bXYpOYXECR3zl4p71KWWJlIfJBkzAvXvKRijXJEYOhGczfqCbJnLrSZAtMb9+vG?= =?utf-8?q?kJSx+x6mu89cJHvF2ZTSmrt0sXEu7T/0wtvy79CeHVUWOjMP2DqUZ5A7LrUL+HK5Z?= =?utf-8?q?ggtXVNRuMOsxWnQ/XJEht3vlb3Dwqih5Yg=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)(366016)(1800799024)(376014)(52116014)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?f0sefltuwNAQ09Cm0Q2ct/EvkURY?= =?utf-8?q?5B9y6dBnVg4mIBu/VIE3HckC4BsEmuc5+uEokEYpI/yUKazYFn7c7B6PehEwbPVeh?= =?utf-8?q?qXCSG6nlaYLBLimwdNnx+alyIVzRnY6rsHLdINsnjqOXAlmjrQcYvhlIjMDJ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1M4SpeQ0l8Oce8j/oF/M?= =?utf-8?q?Wy9qU8pvaeEdUNi+RKJApYgvQrfFbMnCtie/anm9uZgnZqRY3LNGu9P9PvDbw+Loh?= =?utf-8?q?tnIde9pNcfgad4u7Gc9it3QPEYTxgVt+3u7xo8IjhyUpnsMjaYD/GoRcERV//S0cS?= =?utf-8?q?d+EZhkobppcSQgCcYRjx2n46EU4bYEufhVjJ3WXHqFUd28ppDj3vpYf6zY3kTZy9C?= =?utf-8?q?mTL8lXwHMXP+LVcpJzjknhZcsZ2fwSvXO2ltP6G9Jz3JwZoy09Jkm7paVoZcIpux3?= =?utf-8?q?zga0hLgNt5z7zb4TY3wSsvr5ME+9B4iK+BdlAwhriICszSbfAryvN79JEyPcKMhz7?= =?utf-8?q?lPc8ZbsIB6bRjtdRKoZwYWtLfLFAn3Q6KN06dzxoGE+OPQDeWgCOmpzg2CjvhlSZ3?= =?utf-8?q?rGadgeegydIZ+3WlrIo1S+fUZ/HrYnMQ0oZrEnCPpwedbYYjeC6d4niArFsTl4kGr?= =?utf-8?q?2VWWf4QdYkVR0VHygf9fH/nH9czSDlzcLVjHqj+lRSUedMsCs57jCMHs=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ec55771-8990-4e0e-7330-08dcbbaac076 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:22.8705 (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: mBba6ev70Gm2b/WQoF1ki7ddPJgBKGGNVatrJYpFGlQKdGlAEirtj3F4g+kG6Cf6B6/GvVrMYb9KI6bcIkRjiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8416 When a new device hotjoins, a new dynamic address is assigned. i3c_master_add_i3c_dev_locked() identifies that the device was previously attached to the bus and locates the olddev. i3c_master_add_i3c_dev_locked() { ... olddev = i3c_master_search_i3c_dev_duplicate(newdev); ... if (olddev) { ... i3c_dev_disable_ibi_locked(olddev); ^^^^^^ The olddev should not receive any commands on the i3c bus as it does not exist and has been assigned a new address. This will result in NACK or timeout. So remove it. } } Fixes: 317bacf960a4 ("i3c: master: add enable(disable) hot join in sys entry") Signed-off-by: Frank Li --- drivers/i3c/master.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 7028f03c2c42e..852b32178b722 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2039,10 +2039,8 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, ibireq.max_payload_len = olddev->ibi->max_payload_len; ibireq.num_slots = olddev->ibi->num_slots; - if (olddev->ibi->enabled) { + if (olddev->ibi->enabled) enable_ibi = true; - i3c_dev_disable_ibi_locked(olddev); - } i3c_dev_free_ibi_locked(olddev); } From patchwork Tue Aug 13 15:15:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762220 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013008.outbound.protection.outlook.com [52.101.67.8]) (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 0FB9C1A0703 for ; Tue, 13 Aug 2024 15:15:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.8 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562132; cv=fail; b=O5nUWLbahZlppiusuS3bk/DIoIGJQrAQTd2AdUE3fth8GjuxQghVv5B46jpyyD4XEy1pUBBopPxf51AIPdSYFCQHUbAswE7DyPkiEb5KRHvysONsbQhzWaGaE3YydTMQsbhBMMd9acdbxYs3BAZgccHNM0mpdZvkbn3BN9aEw2w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562132; c=relaxed/simple; bh=/8gjfrLEbeqdvh2UWIsUOXSQLlEPInExNiw2wP5o2A0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Rplddnz/PNX6EYgS42NTCBsOafuLthPlrBqxdHqPSlEP00ibo81kBHtZNHj+q5mgRi1fOTA7IVonQWAxoC7z/sYd39N4KbTu1ZzmLslmyKb3k2ljTEkNYW4yTKiiIOQMqu9cdTkW8mw1xmvIdPygvHPFdM6QwEwYBfLp6YHnyB8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=iWprLadK; arc=fail smtp.client-ip=52.101.67.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="iWprLadK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jS1jTjR6UlTF2GBx/6XDFvWUuDVIZmcDG9/V9ZZM7danR+hULrivJ5iWr19DlUnupZvJY2AqAXAxcPfqKzIkQJzb4kOHVlWF7SN9dkLfj8si1FxSXpAs37xgi0+0hT6kf2iXW4QJoUPFuSGdvrmdjgdPb5E8Dp+B1cazPJtXAOoEA0617/EiuSmNz5fKZgiImdMUEiBY00VCP6wWK/Eu8jcCwMrjAcQd6wjlZzViwcroaj4tN6jCVv4S2tH5QTb7Pudj5zJIFS0tdAyL+VDrjCb6yuCmdjzCjbVUXwp5q2cUuGutqf+Jg24Wn546TD/IEnxY7gPMQEjfDv2XFmHOVw== 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=/H5YFp3nwDhvmKVPeBWxGQWI1IbbbTbtrRrxup0oAxQ=; b=w15lF//nMWZoaV/9/vEfzJmsKXsSAgv6Y87JOhFLC2Wyg58axFwnvWq7PoPWSXnDvdQYAvRQL7fpLLjG4ya09X2Gj7Do33Emqf3NiqBZAPuTKCC7RWK1JDvu6aq6GNiOBIVEmkOdlU6o1yLv/m5jFybNR5dKunbSumi5d828ddZQpML5M74+8B3BU2ZM8NkPorYQkA1fhysq9UUezGMAZZO6CNh5gsb0dXrrm3ejGIneNZG5cwPvIOhoHzhgsyGE34XxjHLrs45dT4P/w58RyVadFbETC+yAN4NTvPeqkflhlpholLj9CkStWjujcONHpJeKiKizYomWfVUzAOc04Q== 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=/H5YFp3nwDhvmKVPeBWxGQWI1IbbbTbtrRrxup0oAxQ=; b=iWprLadKXRs6i29YiCF4/JRDxul5jUi7LSSlcX6NQnbObgk2+eTGWxOJGnzYD31p93QDhuMIW2pD80XnY9a0FgcK76A3H7HqxwnuCqQMKkdaVSjFB8gOP+KsrZE4kbUj7Yy73IrPIPi5f/OsviuVLQojHCdOGZPCkizipDTRxIbQWInB7r3jzmGodxlLQg13VLrLPGVL3aHCZsUUD++BRmJtUgXOTYtOgJfL9FL46XNFexmWfE6KMyku22HgosHDiawopBtmyery3ppy9Sa3dAFB1fiXeTDT9mdTmzq8Rd6kFHoF60hrYeXPcfN4WD72iOW39Z9wTveQBNHRy5tNMQ== 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 AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:26 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:26 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:00 -0400 Subject: [PATCH v2 02/11] i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_BITS Message-Id: <20240813-i3c_fix-v2-2-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=1901; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=/8gjfrLEbeqdvh2UWIsUOXSQLlEPInExNiw2wP5o2A0=; b=aAI64uSk6gehOExiLMjcxc+d4R6RvosZUcMgzFIqERXuQK4d7uTDbYP+5jo+gh5C8vj9v1Rr8 7sRCuTPYDXdCyE6jvkHohlLWDLjYiZtkSVYOZcfsA4WjeNQZBxy+nie X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8404:EE_ X-MS-Office365-Filtering-Correlation-Id: c8589006-8752-4995-0a0e-08dcbbaac267 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|366016|7416014|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Uuu/dF9/kmMdKK6TZSZwR97CWxyYUIN?= =?utf-8?q?LO9Ygmi3IFe/nZwQNL+m+8kNNTHxc1o8j2wmKhkpJq1Fd4IwVCsO+n3CUFCXsAeC8?= =?utf-8?q?+RltYPJZyRNFYF6nSTMpQ1I/caFyVqVYnJIkZb/U7zuf44vauRl6Kwq+AnRi8q/B8?= =?utf-8?q?nY/+4esipRAzyo/N5M4+46pECiVuA3ShMcelZwUIpnec3D/UYKsVNOK8YgCMTw5uI?= =?utf-8?q?8kmwg4P7HMJicSGyHXk7lAKhN5n/8WGmwiWzUd0Kk+ZUaT7cTzy02JOJ6QObI/Swx?= =?utf-8?q?NATzUNM2YZ8UmmWSZ50cJa8JFWctmL689IDRtZ+U55DKal7yVFfqHa1ruBG4I1FKX?= =?utf-8?q?IPiU/Q1GaJszkRQ8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YWgrlZaW5AEL6aj5P9Jf8MmeewL+AkO4zB/m2tYoCs7PNrEYa?= =?utf-8?q?7eoIFQ57FViYWKC3f7Iy8PRIVd9BbCVzauTQ2tMgyY5kFqoRuecQHKOAqx8jmtXg/?= =?utf-8?q?x+7ur1HVqbOAN2TSndZ2y7Mf4fJNSgu5+g=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)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+R3TVwQer6WUGNnIKAg9hJjfOsaK?= =?utf-8?q?M9K1X4aKZwZ4n0oRyrEyaWM+I0kYJ4V1doiN6BogbutGIIgZ4u2llz83sdhAVTNqx?= =?utf-8?q?DOGA/AIhnVv8Ek6mnMRzNDE+DLaP2iYODYRdrHUL9WyyNMlhEYMLLtX9FfMaq2YvE?= =?utf-8?q?apcTBWyOOAULBzh+/+OL+hpZHMMyWH+BDzBpCTIwqm1GjCACqUNkzUJtx7KoeS1zn?= =?utf-8?q?5a+RPQbU6DJ2784ge0MIC4QsJgEL+wg9pa2Wsrv2SapSFLpJ5IhgGRcHsfQsIOkIo?= =?utf-8?q?1tisqZER/Wy1WsK+hnEj5/rGlwm4r8h+v4pMViXbd40pYpXc0dhp0QxTCyi6Bx+N0?= =?utf-8?q?7wFD6uDNV8ievgMOPc8ZT47CBL2sD37c0QP9arQBfFTjdQxEuOmAt8UTaYxEQxDPu?= =?utf-8?q?g5aQKtWbESeBfLOirjeNlwck/YDPFbptQfriSCC111JCoD8QizZcVVKhJYCd867gn?= =?utf-8?q?jKrafhMww7oXbpoYbcRk2VGTb4bX6a07o/6u8Fa5TsS9LWryHHbJa0H8mQHSWgV68?= =?utf-8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ZTykbdvILgPwQQ/j+CIfD+w+pw1yzU6EBAxytUbDRqJnk9vlYC6mT8ndqX?= =?utf-8?q?LAwZ/x/xIiyzHFZMqaqYFZEGPw+idJ9R93tXuWBCqSZn+UF6oQitlksU=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8589006-8752-4995-0a0e-08dcbbaac267 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:26.1093 (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: mtLy2DjpBPWAz4RdHbY2/R1mua+Oy0x+ZRaln3VR//TGGGPUQjzT/nRcEXP+H1sM8HjX076uTxH0Mgvs8HY+JQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8404 Replace the hardcoded value 2, which indicates 2 bits for I3C address status, with the predefined macro I3C_ADDR_SLOT_BITS. Improve maintainability and extensibility of the code. Signed-off-by: Frank Li --- drivers/i3c/master.c | 4 ++-- include/linux/i3c/master.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 852b32178b722..85c737554c940 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -348,7 +348,7 @@ static enum i3c_addr_slot_status i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) { unsigned long status; - int bitpos = addr * 2; + int bitpos = addr * I3C_ADDR_SLOT_BITS; if (addr > I2C_MAX_ADDR) return I3C_ADDR_SLOT_RSVD; @@ -362,7 +362,7 @@ i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr, enum i3c_addr_slot_status status) { - int bitpos = addr * 2; + int bitpos = addr * I3C_ADDR_SLOT_BITS; unsigned long *ptr; if (addr > I2C_MAX_ADDR) diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index 074f632868d98..4601b6957f799 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -299,6 +299,8 @@ enum i3c_addr_slot_status { I3C_ADDR_SLOT_STATUS_MASK = 3, }; +#define I3C_ADDR_SLOT_BITS 2 + /** * struct i3c_bus - I3C bus object * @cur_master: I3C master currently driving the bus. Since I3C is multi-master @@ -340,7 +342,7 @@ enum i3c_addr_slot_status { struct i3c_bus { struct i3c_dev_desc *cur_master; int id; - unsigned long addrslots[((I2C_MAX_ADDR + 1) * 2) / BITS_PER_LONG]; + unsigned long addrslots[((I2C_MAX_ADDR + 1) * I3C_ADDR_SLOT_BITS) / BITS_PER_LONG]; enum i3c_bus_mode mode; struct { unsigned long i3c; From patchwork Tue Aug 13 15:15:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762221 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013008.outbound.protection.outlook.com [52.101.67.8]) (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 4E1631A0716 for ; Tue, 13 Aug 2024 15:15:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.8 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562134; cv=fail; b=sxrDB8L1s/rViDpw+Tk83DREevNpIhw6ONVphBXCo9Q+FDEJA57HEuj8AwRFsrl3WJfaOVwNFHq1USVrdo6LzUxLFyX5hH6mN9Pq9SgcA5muVCZUkI/qSFts3KSW1Ykkqf8mh09HXSN0esbt5BZgNYIjLYJd6B1YfSG7TTS7iwM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562134; c=relaxed/simple; bh=nvcmTWDJj+SrtpBzaB8l8keUZ2F8Z2oCpFCzJlzH9us=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=sJIH0rdp/TpyyAuaDYf0PpSs5xOyAmWI9H6hiLEc274t6x06vJDuHGQwdIOLMMW0sEdrwkX+yFd0DTsUjWc8t+dgwlkcpb/dYaWOuQG7fn903UsSratFm6gQmEX2ym7kJ6wR8TqJLYlAsytB7qE8LPvF7f6c4uKwF9xrb502usE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Pxyb3Wz/; arc=fail smtp.client-ip=52.101.67.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Pxyb3Wz/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QUySjTbPCaDi9BVxnyT5GCLJ/SLB35nTPLdSdaNe/Ioj5YsrxTeUQjk3jAYwsyiEA747m815kPzSe6EPGBAeiJQDixLF5oQmqkQYlE1fK8vO+Vn3DM+Kp2VJPfKP87MJhsg7+JFOJ1mXcPCBULq3rb2QvbA13Kzm3Hic2RV7S48o6HbzngVb9g06LxcAhHDmpo5QTy3EnU8C2pkXBzPjN9X3O9tKL9V1ZTs7XrYFHBO8oYXUoQDZImQaDYb+qDzh/LF+4cFdT4TlkEuqIOZOJm32pa8OBCWJneQJ+O/yMjw9+dsTJrtwPjt89WEySQPr2C1RvWjFOJc34J8VP2fYOw== 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=Jk3Sg8K892J5LLK9qnygB0m2WRCfBM/GY0tQ0z2NeDw=; b=aoroXpYg78M5cnYZaU+aiYb4osHvKA0JQ29nrO90Jj14GWnSmObArQHNg74KG4heMg9y37U7SbcY+dgfKS71JwpfCA/soO8RbH47rb+xzP+M6rPYy5Bv2Nf2zDzfb4bLJ1+CNLoXWsLC5rOQkERC+hthHZ30Z7tIQ8F4lDFA4D5xtnq6mONmOmkwxmBmBtiz8D1C1IZ+3FHp6LmM0yQYycvm/LgL8WPWg4JDGvfDHX5yv2c9OuwG8a9zZo1e/zuCVy3z9repY1Cc1jPZYP8rYrljokpgFaKW4BWRZK/pqyUTgWqX2BW9Pm6k8lJ5u3mY4IrU49/aj8udRUGZWxF23Q== 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=Jk3Sg8K892J5LLK9qnygB0m2WRCfBM/GY0tQ0z2NeDw=; b=Pxyb3Wz/EOpHMAZPPGGxlpejPg65BcLMIa90/r6FjrWuOgmKHXpn/q8F3mBDUATvwPDMeJXDDNMvUy7HUdpm2YqcLa6VC4KznmzXAZhrFaswT4dOp8Z0HHZgFKUCNqAUb6WIPiLTUz+lqmRN9UNkaruhymsJ6aVywZ0nsU0G1IXbvrs6o1PtwUpoAQa+DVVmw2EQJ38bJL7ifeXFmpzXnvHrUkwelYp2G6offIgLWeBeJlHXGaD6Me/04JhFJSAxvGOcnzh+j2Vgr/OEC980noVQZvYqJd86kxHClCCNS6N0jT636VKHiYtC/hgWMcGazkEN4t4P6+0Eoh5M1sEnkg== 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 AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:29 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:29 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:01 -0400 Subject: [PATCH v2 03/11] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT Message-Id: <20240813-i3c_fix-v2-3-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=5289; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=nvcmTWDJj+SrtpBzaB8l8keUZ2F8Z2oCpFCzJlzH9us=; b=x5XiFTV1Fax58n9YQ6RD5YTd7QDCwA5yVOOZt5k2+oYaM3D0toNZ9ZPMesddvRrd/5HrGwOyG +LcwritCa9gBBWN+GYobInDb8536jgwnCVR2/HB/6l/+Aj0XcC19D3G X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8404:EE_ X-MS-Office365-Filtering-Correlation-Id: 29e9eede-6f01-4f81-3dfa-08dcbbaac455 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|366016|7416014|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?rmqhAJ55KdOIOQbwcVbk16QB4sFR99k?= =?utf-8?q?spWCfNDVombLhtEHGnVOmg9w64lQebQRG73DoJoCyYfJcN6IIEkSBHc4a0IOqwoE6?= =?utf-8?q?3rpuUSleabJioZjdWZdI5VeGeSHP59EWVYasABLHjOhARuzF/bV83rTVeWKxMf7S2?= =?utf-8?q?wJhMGNTtT4KQQLsbgxI3TAtXTYHisYF50w/B1fGtkydsqxXD835bDlTir01ZG1yJA?= =?utf-8?q?EJtks6arkNHeCu2FV0tmiTe3TQVb54PN00Y3l/QjwOcq03ue+3oSRzy1mXamIabCx?= =?utf-8?q?W2Q/n9UCSyauI10ZOjDCmRmvb3XWi9YwzOkhC6ZwjwN3YV3ZJOV2MW35KsdgFh428?= =?utf-8?q?sFhofyZHNHMysssQPMueYSfbEMTwOiTFZFKUu3JCh9OzFrPl8430QFOJjZZjIJMd3?= =?utf-8?q?esl8SU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22Q2fOYSfSOSbRekDSDE7tE13yqO1t7TLsapLtC3bD+YaPd8Xy?= =?utf-8?q?QVMzoWoWxz510UXisNyHr2o580rJlrQrAw=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)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?cXfyrfUAGcp27Y3rBd5ZOmeThtNE?= =?utf-8?q?jThjnjZaH1UsI+92mtW/xA9WoCFlmmHxcc82zdHir5oT7wQ66v12PDWshauTHPVaS?= =?utf-8?q?zsqrKXod3nrApZ3jvTuaVBs3ZgLzAIzBXOMtJCEPRRc1IkmkV1NfSeIHVYbZCgj9D?= =?utf-8?q?zY8tn6YUqiYJchVi/To5TVStSEwijFgZ0UdGuFZxbMg8cZ9wgGUF/7P6MwBj4xmEA?= =?utf-8?q?9wPF0TbrkLuLRnQGvUM1cVRc70+3JpHI+PXmefEKHWoolBz9kOtZ6huatwFV2ER6g?= =?utf-8?q?FRT3awuvxWFbBX5CYWFYoSo7CWfRRLcnnGFDpRs6bmlMGOYFdIywaXCfq3LLc85Bm?= =?utf-8?q?xnlRZS++0WvRRnpQyRebjVVW5J0j7WVc3+nu/OorY8AyEdH5EN7VX45gfJn7fd49m?= =?utf-8?q?f834DLa6BzWNRnDaZurhMDgSrSAAR070e3XfM6/jxHPx7buXEpfbyW0Ax7FxZPWC0?= =?utf-8?q?Z/0krlnN21jwjKHZuHy47Y9ANrF96jjgxTes3ZuMLrEfaOJt7d0kXSADYeapk2dmp?= =?utf-8?q?G691MG2i/cGcQ635kb0yMfskh14V2UZx4MtIH3jwjwxbVfrUjTzG1x49mgv44Hie/?= =?utf-8?q?mOSucJp27XDLG8zP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oz01hF2AI3EAi/H6Gzkgo4smd4q6WZFn1iZtg=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29e9eede-6f01-4f81-3dfa-08dcbbaac455 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:29.3427 (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: kS15Mq+/IwEW8EDy+F/J4h5osrWefahFHsJKiQo6g6OVpWcngDQEeEoBiKmiluCdVrI9df3x0/0BpINaYSMGGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8404 Extend the address status bit to 4 and introduce the I3C_ADDR_SLOT_EXT_INIT macro to indicate that a device prefers a specific address. This is generally set by the 'assigned-address' in the device tree source (dts) file. When an i3c device is removed from the bus, the old address status is set to FREE, allowing other devices to use the address during hotjoin. The I3C_ADDR_SLOT_EXT_INIT status indicates that an address is preferred by some devices. The function i3c_bus_get_free_addr() will first attempt to use unassigned addresses before searching for assigned addresses of devices that have been removed from the bus, trying to best match the 'assigned-address'. Signed-off-by: Frank Li --- drivers/i3c/master.c | 43 ++++++++++++++++++++++++++++++++++--------- include/linux/i3c/master.h | 6 +++++- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 85c737554c940..4281f673e08d8 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -345,7 +345,7 @@ const struct bus_type i3c_bus_type = { EXPORT_SYMBOL_GPL(i3c_bus_type); static enum i3c_addr_slot_status -i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) +i3c_bus_get_addr_slot_status_ext(struct i3c_bus *bus, u16 addr) { unsigned long status; int bitpos = addr * I3C_ADDR_SLOT_BITS; @@ -356,11 +356,17 @@ i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) status = bus->addrslots[bitpos / BITS_PER_LONG]; status >>= bitpos % BITS_PER_LONG; - return status & I3C_ADDR_SLOT_STATUS_MASK; + return status & I3C_ADDR_SLOT_EXT_STATUS_MASK; } -static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr, - enum i3c_addr_slot_status status) +static enum i3c_addr_slot_status +i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) +{ + return i3c_bus_get_addr_slot_status_ext(bus, addr) & I3C_ADDR_SLOT_STATUS_MASK; +} + +static void i3c_bus_set_addr_slot_status_mask(struct i3c_bus *bus, u16 addr, + enum i3c_addr_slot_status status, int mask) { int bitpos = addr * I3C_ADDR_SLOT_BITS; unsigned long *ptr; @@ -369,11 +375,22 @@ static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr, return; ptr = bus->addrslots + (bitpos / BITS_PER_LONG); - *ptr &= ~((unsigned long)I3C_ADDR_SLOT_STATUS_MASK << - (bitpos % BITS_PER_LONG)); + *ptr &= ~((unsigned long)mask << (bitpos % BITS_PER_LONG)); *ptr |= (unsigned long)status << (bitpos % BITS_PER_LONG); } +static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr, + enum i3c_addr_slot_status status) +{ + i3c_bus_set_addr_slot_status_mask(bus, addr, status, I3C_ADDR_SLOT_STATUS_MASK); +} + +static void i3c_bus_set_addr_slot_status_ext(struct i3c_bus *bus, u16 addr, + enum i3c_addr_slot_status status) +{ + i3c_bus_set_addr_slot_status_mask(bus, addr, status, I3C_ADDR_SLOT_EXT_STATUS_MASK); +} + static bool i3c_bus_dev_addr_is_avail(struct i3c_bus *bus, u8 addr) { enum i3c_addr_slot_status status; @@ -388,6 +405,14 @@ static int i3c_bus_get_free_addr(struct i3c_bus *bus, u8 start_addr) enum i3c_addr_slot_status status; u8 addr; + /* try find an address, which have not pre-allocated by assigned-address */ + for (addr = start_addr; addr < I3C_MAX_ADDR; addr++) { + status = i3c_bus_get_addr_slot_status_ext(bus, addr); + if (status == I3C_ADDR_SLOT_FREE) + return addr; + } + + /* use pre-allocoated by assigned-address because such device was removed at bus*/ for (addr = start_addr; addr < I3C_MAX_ADDR; addr++) { status = i3c_bus_get_addr_slot_status(bus, addr); if (status == I3C_ADDR_SLOT_FREE) @@ -1906,9 +1931,9 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) goto err_rstdaa; } - i3c_bus_set_addr_slot_status(&master->bus, - i3cboardinfo->init_dyn_addr, - I3C_ADDR_SLOT_I3C_DEV); + i3c_bus_set_addr_slot_status_ext(&master->bus, + i3cboardinfo->init_dyn_addr, + I3C_ADDR_SLOT_I3C_DEV | I3C_ADDR_SLOT_EXT_INIT); /* * Only try to create/attach devices that have a static diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index 4601b6957f799..c923b76bbc321 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -284,6 +284,8 @@ enum i3c_bus_mode { * @I3C_ADDR_SLOT_I2C_DEV: address is assigned to an I2C device * @I3C_ADDR_SLOT_I3C_DEV: address is assigned to an I3C device * @I3C_ADDR_SLOT_STATUS_MASK: address slot mask + * @I3C_ADDR_SLOT_EXT_INIT: the bit mask display of addresses is preferred by some devices, + * such as the "assigned-address" in device tree source (dts). * * On an I3C bus, addresses are assigned dynamically, and we need to know which * addresses are free to use and which ones are already assigned. @@ -297,9 +299,11 @@ enum i3c_addr_slot_status { I3C_ADDR_SLOT_I2C_DEV, I3C_ADDR_SLOT_I3C_DEV, I3C_ADDR_SLOT_STATUS_MASK = 3, + I3C_ADDR_SLOT_EXT_STATUS_MASK = 7, + I3C_ADDR_SLOT_EXT_INIT = BIT(2), }; -#define I3C_ADDR_SLOT_BITS 2 +#define I3C_ADDR_SLOT_BITS 4 /** * struct i3c_bus - I3C bus object From patchwork Tue Aug 13 15:15:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762222 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011063.outbound.protection.outlook.com [52.101.70.63]) (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 971821A0AF0 for ; Tue, 13 Aug 2024 15:15:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562145; cv=fail; b=CuYXTWrJ8ol/H6QMnJUmL7sZYqTwF4CnvY3flJX5iS2Cy850S9nXfyvm7udOUJp5CyVa6uRpzFhrOzdQ4RuVD7plW41fr4O9E7AO6R+6v1MWvCzQZFtuHEztJW27fEBT1gnn6frT9cJ19DSiW+dhwlLBJZ9Wgsi4W3ncEB7nLCY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562145; c=relaxed/simple; bh=phlwJ/9jw9NpeTB7NJPyHYpdTuYWHApnsz953oBcxmA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=N9e2JEom0KP/2qUF9nL4GhJH+Ab+LUYK3aKtkfPz5FKO+VdoYmw9//x2avvaMWxJxQ5dLYx97OCnMeQ4hlh5y0f5abwrWg+7bOhiO+OtMR37+NKD440AnZOW32002lKz8u2SI129DAHARZz9sfAjCzco6RnlwfribHwv0HfH+Q4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=mgh+NriZ; arc=fail smtp.client-ip=52.101.70.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="mgh+NriZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TxXzihG7ID8i63Qb4T2n53zqrcIuZcuhjCzPv7akcMRxpNK/RKpRjQCAVp0HF+DnNy4hsvnpswzlYOlBnmE7Nplh8qzq1k31RyE1IN266aQmDiUl+jk1x9I9zzSmjFVAps1CI2rBT/UZh1n9cbPUuc+DtXkFFdLb6UR2j+feei3M2bkR1R9ti1Y9sQLBzVkvbBJiKG8DSXc2nyeuobmpbSwOTzs353rUus5Yxcp2pKtOgRPD7RdRtlVA+dwwORr8L5KXuaQHQveZFSto6SYKuMt494YCMICyx4p1qwXyHE5MDlVhwXzP8ARA/pLA9uXkSe2OIxwvOmftE+4r/r+s7A== 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=khB9K849nl/MU67dxO7G2LRxt5J+Bs0EnkTKFa+J0gI=; b=VK3PEGAJYXvtRbUb4mRXwD7T6ZwsMgyCFnaMo7HKAVVs+D5b2tRC4Qjau4C/0v7UZbMr7Lui1Up6duHBoZCz8SkjZUnx1Uf8n5btmV0EBsz6Zwp+Y2Mkuc7APcNCQDCWgIO8ev5ZsPOUSRiMJ2f4J7e3Ypv2w5S4YJFbrl1ZfrSiT7kC5S7bN0wmSc1SIBQidfGIH5uAw7fVwoG6ZWQuhxBg4YMoBSS1HUpMvnrv/kNSCQmuB7iHdRQBsKNzfBQZMrWwUhcyO8blEZIuosLOmrId3kRkpxaqtyafnjgt1hbKKOLD1syUJuXYus/Ku63Xk5D3FqmKlSUg/Nsn+J87EQ== 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=khB9K849nl/MU67dxO7G2LRxt5J+Bs0EnkTKFa+J0gI=; b=mgh+NriZdhkdWQGVszXiFQVjz4gCazZiavTrgqF8zmhkCexMxSIPm5k91DUeJx0pPHwTVLuTi2lj/JR8WsHBxX+IfsRDQU2Csr923Li9WxMkM/DAAyfWuSbwGdBOcHVmEX7ycp6yGibAVY9aHX9bKdrd0TSszN2QMweF/iXK6G/mWSCY2ElqIja0A74GDs+FCMZs+nqqpDQZRwShKPZoZ6IIqDHVvgXYMNRBcmij0nJeUHq3HYryeZQmharMBr3Ctkot9HSaxLHhBitAm7buPz0bckRpqngN3/+8pX8zZaAecB51UpEe7EXB2617ufVz1Oc5o7GZ0W9aFGTZH1Nf7w== 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 AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:33 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:32 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:02 -0400 Subject: [PATCH v2 04/11] i3c: master: Fix dynamic address leak when 'assigned-address' is present Message-Id: <20240813-i3c_fix-v2-4-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li , stable@kernel.org X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=3637; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=phlwJ/9jw9NpeTB7NJPyHYpdTuYWHApnsz953oBcxmA=; b=XkorDuHTQIQc2YaB/J76du/s/4YMDMHc9QxrNWTnndZq4FUTVLhRQHnMxHi9vJrPd+WCNwetc KRTC4kuH2UNAXmVZkFNSDUSYYCEbRPXXFN8Cl6yvWtOmOIFBKYvYXTg X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8404:EE_ X-MS-Office365-Filtering-Correlation-Id: d19db243-70db-488c-5e14-08dcbbaac663 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|366016|7416014|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?mNFLLHTkmKrcg+4znyFZZp33IgUxm4i?= =?utf-8?q?5pidilEkdexXXVpBStaatOuUPHsyfvO5SW3W0BgzPLrkjoYdf75r5kIZQFUs0s1u4?= =?utf-8?q?mwOJAiwSmlLPf/B+5oYy4Fwilkeg/8XBg20uhNoUP/zUtxtXD3MHlzj40rzoGfykG?= =?utf-8?q?6xF6c21V2c3MEAr7py29GWgq/qr2pGWlyUShN09cnlGzxnXf15AZzjMuNN6M3YZV+?= =?utf-8?q?xgzAP1S27NVKygZlJ0TGIms/rdX5Kn9eGm8ghDK+q/s++2+VksjcUg8IGgh7wY0xD?= =?utf-8?q?b7pANPEYsRNuqqFkn+Df1nbl36YL+LoUIPETTc4Q/bCdc5bOKrimajkaPjsNRqeBk?= =?utf-8?q?T9J0SPbKgmUivDTAgWKArlVfqWgtDz6EFDKVInZAq5r6Oo1zjwxjMQjNnISVnutKX?= =?utf-8?q?c16YdQqdh0LnH7SmLn4O0MeikOhWqZFqWQ7PwIK/hY5o948wIXKERkfYr1A7wkW0w?= =?utf-8?q?J32ZudOiUOHSWEdl5+vUai/ufKrqErFNdof1L06pzKQp343fbT4dey0RAgM2r+936?= =?utf-8?q?iJtkwAEl98Pvy7ZrLXKz+4Is9Nky2uUumx8uBrRrJJ/r1RrOxAdyL9fWF/Jj331Gm?= =?utf-8?q?agl68t/oAYq496o2dtyuTye1o5SV3l7w1Kh8ivrihkf96mYV2LTGyCntOzalMf5lr?= =?utf-8?q?mrsMcUfCtkBa+Lg7IIkzCYglktYeIKK1sVQgz1JKHNbFcR6RAx+YGvfxqYHJ4KHsV?= =?utf-8?q?jY0GJiVuCLriS+2SyxbDTNpnkUiqfBP7DETZCx2t65peLlYyCtG8gsfPTHtUQUxJo?= =?utf-8?q?zO+qRegWQfoo5FxfjyoU+ldp0nP/N979JH85JEnuzq2WRGazvSw7T+q281LcbVRb2?= =?utf-8?q?C/G24lsFgCNk3hlpeEBpVdE8TQdilzrL/Uhjsq4r4uCpJg8yQpBKhhf+hIc1yPkp6?= =?utf-8?q?L+HZgGUweXU1jSL6YH94tUlp8aTLWjP8fXnVOejJKAjREkYDQfYmD0cSA9w/H5QiY?= =?utf-8?q?cO1HRSMzkL1gQbdcRTeoc1YX0Z1b4k/SX4NbNWOxu9n1jCaNjSxznaFC9HkOZH2/K?= =?utf-8?q?8vD7z4mQ/OG12gtRoRKvUlnSAs1e0GTeHk75RW8OlP/LzTW/w1JcotfKbcDaDvZH5?= =?utf-8?q?snllIKbcLLKIXOFn7Hmk7zXOjkYl14gw9HfZPVMFAv97wW7cgqldgATMdcm+5qRlp?= =?utf-8?q?Mn8LlvrdpVKZipbAzOl4sKtinwR7vY3gVG5SAelVe1Kajv1jFzqgyI+631p6+lo4p?= =?utf-8?q?Au8BeTiJ58qLqsss3nbbmUhHKDFxfW8HPCVX3bcCZXZuj9U89xeCUPpAJpnfZIRxj?= =?utf-8?q?8GKq/tR9L98G1I+9IQnLRl1G6xVgg4GZAuDMGfU/hb2P69KY52+2MeGQZzI0qMqcA?= =?utf-8?q?HMxD/SBv3jW8fi1RLWZIGhgMLKbMBCD7/g=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)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?mdXk+KnxO9ezdZ64k9yFJIu6JO25?= =?utf-8?q?mZicaMCUYMpnX/NnV2S1victnWQpcwvzp0BLwPU6nKVh3+brGoeb19gwertnhq0Jm?= =?utf-8?q?Lds/Jo6P4n2JUMcc64DgTXXeNMR566e+J3ckyMwhORSoimR5pl1ZaMqCSN2ny+daP?= =?utf-8?q?lKc61mIcniCMFcSnE1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ZS3JUp1uIfCC5uR1xI2PwKc0d4qWUwNuADoB?= =?utf-8?q?+Ks8Gl/sghQdhczQysBN2geYDO8ZRm1iZuNUn8+1eVBSnG7NuP8fbVAdyWNJNeGA5?= =?utf-8?q?AW4Ok2D21fRjguoRWByyZipLSRiMspMdqcOLGe8RYS6tonIudgtokEElYnsZ0qpVS?= =?utf-8?q?rZMJgZFoQW+ac9oOacijF0GDmqNERVZK6lv1C+1ZkwijvzjAInWqCaBcbM2mSB2U5?= =?utf-8?q?ChohB6BUi9EQ7rUQQ+mKBfyVTgxIeIVhqaaJS5CirnmTEywoTbUNxl6pVGPAsF1Tw?= =?utf-8?q?PQcZzBg/X60sik00xCf6XzCs6mgEQAjhDBVU4BsPlIATe+RnB3/vHiUARLM1nLkBJ?= =?utf-8?q?iH5upeSgBAfROYiMa69RbZDkGICjKosewsLJil7qreoHIKfHMq3KncRe5G9b27AE9?= =?utf-8?q?FRjHanr25lGVbmNdKCyydftx+JfCC4dJ9RROt6hkGOsvtyxyLtZgmEBE=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d19db243-70db-488c-5e14-08dcbbaac663 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:32.8442 (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: O5T3FpzSUd4eWub+nl7NzZ3fkMawjLN9iDKILNeFp9n4A90Rdx/+x4AG0u0ZX1FZfJsj0s2wvyJBcsEjoSDDoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8404 If the DTS contains 'assigned-address', a dynamic address leak occurs during hotjoin events. Assume a device have assigned-address 0xb. - Device issue Hotjoin - Call i3c_master_do_daa() - Call driver xxx_do_daa() - Call i3c_master_get_free_addr() to get dynamic address 0x9 - i3c_master_add_i3c_dev_locked(0x9) - expected_dyn_addr = newdev->boardinfo->init_dyn_addr (0xb); - i3c_master_reattach_i3c_dev(newdev(0xb), old_dyn_addr(0x9)); - if (dev->info.dyn_addr != old_dyn_addr && ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0xb != 0x9 -> TRUE (!dev->boardinfo || ^^^^^^^^^^^^^^^ -> FALSE dev->info.dyn_addr != dev->boardinfo->init_dyn_addr)) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0xb != 0xb -> FALSE ... i3c_bus_set_addr_slot_status(&master->bus, old_dyn_addr, I3C_ADDR_SLOT_FREE); ^^^ This will be skipped. So old_dyn_addr never free } - i3c_master_get_free_addr() will return increased sequence number. Remove dev->info.dyn_addr != dev->boardinfo->init_dyn_addr condition check. dev->info.dyn_addr should be checked before calling this function because i3c_master_setnewda_locked() has already been called and the target device has already accepted dyn_addr. It is too late to check if dyn_addr is free in i3c_master_reattach_i3c_dev(). Add check to ensure expected_dyn_addr is free before i3c_master_setnewda_locked(). Fixes: cc3a392d69b6 ("i3c: master: fix for SETDASA and DAA process") Cc: stable@kernel.org Signed-off-by: Frank Li --- drivers/i3c/master.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 4281f673e08d8..c8eaeada54781 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1531,16 +1531,9 @@ static int i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev, u8 old_dyn_addr) { struct i3c_master_controller *master = i3c_dev_get_master(dev); - enum i3c_addr_slot_status status; int ret; - if (dev->info.dyn_addr != old_dyn_addr && - (!dev->boardinfo || - dev->info.dyn_addr != dev->boardinfo->init_dyn_addr)) { - status = i3c_bus_get_addr_slot_status(&master->bus, - dev->info.dyn_addr); - if (status != I3C_ADDR_SLOT_FREE) - return -EBUSY; + if (dev->info.dyn_addr != old_dyn_addr) { i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, I3C_ADDR_SLOT_I3C_DEV); @@ -1931,9 +1924,10 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) goto err_rstdaa; } + /* Not mark as occupied until real device exist in bus */ i3c_bus_set_addr_slot_status_ext(&master->bus, i3cboardinfo->init_dyn_addr, - I3C_ADDR_SLOT_I3C_DEV | I3C_ADDR_SLOT_EXT_INIT); + I3C_ADDR_SLOT_EXT_INIT); /* * Only try to create/attach devices that have a static @@ -2094,7 +2088,8 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, else expected_dyn_addr = newdev->info.dyn_addr; - if (newdev->info.dyn_addr != expected_dyn_addr) { + if (newdev->info.dyn_addr != expected_dyn_addr && + i3c_bus_get_addr_slot_status(&master->bus, expected_dyn_addr) == I3C_ADDR_SLOT_FREE) { /* * Try to apply the expected dynamic address. If it fails, keep * the address assigned by the master. From patchwork Tue Aug 13 15:15:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762223 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011063.outbound.protection.outlook.com [52.101.70.63]) (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 CC2221A0AF0 for ; Tue, 13 Aug 2024 15:15:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562147; cv=fail; b=FnaIFKlOHw065xe/O38Xvg7xxZ9zp5oY7FNXpwZd8n0W+WrM9bfAhUwNXjXQRP5obIDw01GVR1DxgdTbACdcC0dPFL38PN2UwmUIdVClSNNbPqCDRXL2T0jEM/HtLxD6mzRESP0ELMnj0SjCpVDWM2eNtJYYhkrbI7VGfHjUFXE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562147; c=relaxed/simple; bh=EgTA/bzPVGwsyEemXX3hWkQUEBTDZOU6gFrO4erNl9A=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=afH1+0baTs3TqkRfm5smyiHyWgrSHnCPvfpkg4R4i9xVICq5D+7n2wENIUykrVGbA/thW/WMzK2LIWLxf1eqiE0Rn2gObt76Do55GledeHvt6XcHm/Q51WqOrzPYM9ETTUfaX0Qcz1P0ChXjWrSaEr1ubs8KsfLPW/WWo9T5yFg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=av/+KPl/; arc=fail smtp.client-ip=52.101.70.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="av/+KPl/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N54LHIJBi4gBsgxheopBM33C0jujZ3uhryNmucyIF/JWsL1oCMSLPvxSLoNhE/iRbkRgHmMeh79iO8cLu3AAVc8bXDLEAuL/H48Ab3hyYeJurVOCpulOmji2x9fkHqAzhMTOub+LBKUhOj+k5GVwfvn2/UzCa0USl0Yl79zTrvdRxt2NnpAMVc6dK4MNsQwyCjP1kUWsw26js4WnrSH58sgqF6sNPGq+7DKiCp2zb18lPjrUuGU6Tjpf7ESpks7o8WhCpRES/2uAXBVoLxwDXyBBtnMWH1kznTDriDxWCDaGbbe41ugB8gynzZGje7WIPTWEBka7WfvMh+3mXxDW8A== 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=PZHzogEyoKA0FrCgQ8jcF7EjjYfhLpLTAtbn8jWUYd0=; b=rwen0AVrNMDJdIQvBYNqSR1+8Og7r+zLtLZbxGpRDGsYXNAGatLtp/gD00E3zW3YWkbwyeVmkxGXQqIEQx6cdOBVLStFgcso+fYBYgzgAa+0srfPmAoGCTNpBW/VJfqq7wkvfqOxap/C/yfcsormp1qHhYWEi/2POkB9m07WKUILfPNf7y7orMueXC0ZHsc8+KfyPkhHSEcW8ToZ7+O8k+0PHRyevHwXUd73xNmNiRd6wg+BQv/McZhcUG2IaN3QkUmARL24kJpCCq0vEwbGGizB94atX5K70OTJ04Qev+SHdr7wSGw1fC8wlalnh5c+IEq6zTVYPkeG3CRecDTfLw== 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=PZHzogEyoKA0FrCgQ8jcF7EjjYfhLpLTAtbn8jWUYd0=; b=av/+KPl/CBKGG4ecG9MgfMQuYxxyWLeWxZKkrLg5VRxE1b/waiNgTZ/PiewYNHs4ucRu88O0dN9MqhZAuWMoZsHHufmaf51FIxAQ4chaZrV8CH399Exyiz5vcrQnUrUEtuzoCIFDuGLX/lcWIFqBb3UUcc/10+plWNn3atf9QwUxoG6p2wmGE5WVD7lLUU5/ZqqCP8MnuvFBUMqXMTLlv+8vAe0Wk/JEhH10QjiWFFf4pChis7JfH5kHJkKoGtUI/4poyaRg32Kn6xU87E+at5I0zHIzCIuScUvyHzcJZuLj4gZWy6BZWa8YX484PC0Zu2Um1FoKfVJKR3hmb8oqwQ== 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 AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:36 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:36 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:03 -0400 Subject: [PATCH v2 05/11] i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs() Message-Id: <20240813-i3c_fix-v2-5-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li , stable@kernel.org X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=1049; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=EgTA/bzPVGwsyEemXX3hWkQUEBTDZOU6gFrO4erNl9A=; b=hAyCF0YFRChaiv4lpD1eZFkklFLhkx9di+Z7RRgXgHdEd1oR1LfWRPDbFWb5htqhitnhuMBpw NgIixKn1c8NAxnTZ0YyAcu7h4Y/VY69pvSbgKhDQKjjJiUJeXdtTLAm X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8404:EE_ X-MS-Office365-Filtering-Correlation-Id: 143c2f17-ecec-4e42-2a28-08dcbbaac880 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|366016|7416014|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?cRQDKWZGkULRXhUYlsq7AUxAjr+UO/q?= =?utf-8?q?U6WbTvze30b7Yo+fhtyaBLIsacedgBKa7oUjoAlnxdfAtpFa5cdAjaiaDizy8SFdb?= =?utf-8?q?OGx5sgwrPNivT3LuThy5R/aUT69D3icfNvNq4XwxYCYJhCt6ZA5ZSI8kpwytUoniU?= =?utf-8?q?1yrGLyptoJ1xVydJzeghuek9MXGisdRVCFhPVEJxojw3lqQpRKtTcANKIT7ZE63WQ?= =?utf-8?q?gtmW+izeJ54ubFPRT0xfslqdF7fdQZ2a6EJdECim9OA5A7La76mQOZCEuFLdIhqcL?= =?utf-8?q?l4KKmj/k8l0PRBu1mXXlHuNVZTMOE7rGOI7Zkot2pTehXHjGO80iLbahKOrxob7Hy?= =?utf-8?q?1+RCS8n9nXHBj23dKAInsWh1F6zKGE/luh+j3Xxr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MWJlWuiqzkjmCwfvAT4p9H4mI7TGQ?= =?utf-8?q?9feV9FIQOSrAnW4gBQshg7zRwAi+3YzIc+5+ZHYpeP+GJJIOyK9CgyCMnNh/cyS0b?= =?utf-8?q?epXu103qH2VHjGwQX9HBbVIn/ytEjSAm9A=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)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?oucNMllILr0EDG+zVa8l8wUV4wuN?= =?utf-8?q?MH/zmm49vND75T58bKjbA7PkrxKEkFWWQwDvILgeCpDyQM8/L5rUsIgb+YecPZAmm?= =?utf-8?q?+PIePlVkSSz0c6y3hI0sqs7wqp/RmGNuN00gG+xFt0NPiK0kuPgGYvjrUh4JqfhmE?= =?utf-8?q?66GhjNqBCOp61kQUdvNZYF8NQYFMFrm0eg9Xn/s3kh5o3586f4OIo3hDBW1JRueV4?= =?utf-8?q?rvWqLOeRhyzl1SA7Z0dyQF2AmBXS67nYDH2JzSa18cH6GAmjlt5iLrLFPzeVdEtTv?= =?utf-8?q?8MEQU7a6P/RJ0KrJCoxMWXPc2lMOgvTBZHPU16mX0qbMl3/fwD73qR/X6eMwQU/2Y?= =?utf-8?q?30IQImgBc3fblFpiqqSkQ3xTNn8uuwQUmrIrGImpwKG8NGqJx54cCNpjK+CEOSH7a?= =?utf-8?q?zh6iKak4unfjVPr92OQk/qFFgPrAhSz+B1QVR0rEKcSRrvdac91/+UU//0BkI8iQB?= =?utf-8?q?veNmVjSC6xpptJOMbc7jDIp7WbrCQ1FjCE193hsXOPfmqD0EGgxotQiAlxqt4HC2H?= =?utf-8?q?LU/sz+Qbo9wpGluTyprGYoNwB5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9nHhi5XQf2m5GsKdKXJPkkjJeAbqaBNbDT4JVAxr6py?= =?utf-8?q?mj2hFNodYYFnqd9wBBoxpkGoOU7Kb1wa/f0l25gAY0C4sUa9gYssuXFI=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 143c2f17-ecec-4e42-2a28-08dcbbaac880 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:36.3539 (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: mGP9IvjK7pKiApvUiP5rIRfHvCgEsL5VYQynwGuby0p/Oj+06aO4FWUrhD9e7feyOwLOwgQOp7emY+MQhJZr1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8404 if (dev->boardinfo && dev->boardinfo->init_dyn_addr) ^^^ here check "init_dyn_addr" i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, ...) ^^^^ free "dyn_addr" Fix typo "dyn_addr" by replacing it with "init_dyn_addr". Cc: stable@kernel.org Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure") Signed-off-by: Frank Li --- drivers/i3c/master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index c8eaeada54781..65642e5afdcfb 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1442,7 +1442,7 @@ static void i3c_master_put_i3c_addrs(struct i3c_dev_desc *dev) I3C_ADDR_SLOT_FREE); if (dev->boardinfo && dev->boardinfo->init_dyn_addr) - i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, + i3c_bus_set_addr_slot_status(&master->bus, dev->boardinfo->init_dyn_addr, I3C_ADDR_SLOT_FREE); } From patchwork Tue Aug 13 15:15:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762224 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011063.outbound.protection.outlook.com [52.101.70.63]) (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 C37C21A0AF0 for ; Tue, 13 Aug 2024 15:15:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562149; cv=fail; b=IALsM7aQ2XgnH8Ua9a3s/fa2d4jwZXvlS7rZr8y4p7/ZMS17a7xfKrClSD6NxfHscPsW2w8yhNFeBVWy1kLAesHoazkdx3CELVKnxNgq3Z/q27VVfAQKW6fo1jg4Q3BYVcPYdxDSKt9h2S7s5skeQJkog13l8+wBy+MOkLJ+kME= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562149; c=relaxed/simple; bh=An63rdNKf8siEFmhpUTOtrd2drbSwaCzp/D7qZONW80=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=AAo46xgoevFfxUezQ4SX72if7/lR0OXTftQaFZ3YmlYVFqce1hzVgBMY+fbQoN8pTIBNKxE34bcRl8NhXyUWorOYr/AjNjRT52e6lHKD4GBiz6fSNqIcIp3oCo7eVEBW38bHdS6KGNcH7trFzTxF7OZMATzP4vRLn0FDzYGxGHw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=buYRvvH7; arc=fail smtp.client-ip=52.101.70.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="buYRvvH7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IPauQw4BIFSzfCwqqEC8WKgcjJuP64L9ALR8BlR/jT+ZLnWj0shV1WCkAbshOEJ41NYLIlb+Pe72pd9vhvYJptQ+j9QHxrWAtOc3uF6f9Z4uIdI6EmgsCgPsCGAPaYaHz6K7WsaH0riLbaETWt4FLY2uzw6RQi4qOSZdoRNlHCMHEVErsN1yCB7s07ku0Ve+oUEnY5ZJ9bFLI4xD8pL/7ASSAbtDYVI2d8ALP8553cWWxI69SvlPTOZ1IJCm67gJq3AZaUAUmFR84ZO7uDNTj1tK9GOxrBFYIKsk1vfHqtZ2HCX+gDN/KleUZjrFV5KkIlADswE+7IW0WWdfx/nRrg== 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=DDbmmbFgBxhKaOhHOUp/UpYi2/c+KPJaw5dvLjPdxrI=; b=t6rWn0/UxNUY1VJHt0XYTN431SF2niS2PpwvFgDN4wn3BXmVjZmYT4gxzNJE2ux0gIl1BuTG6txnoPetqge1Nc9xjTcxwa5wCOcqEiAVgUDfjFC3YtNLEQdEKrVnP5/Gf1TK3fe89pouTWwy4JphJMFwWTRzB9gMQ/PGRTgAg14fK3us/GAJDEzXdkDHIN/iC/I7yzYCeAURG5GH/3oQ6Q04BdOsyOBk9TX8kKKgd6cWlTzxcXTebVrAqR6QASVAcf4a10eXPbpvxiu1NiRyeRhi79PFk/Qx9YGwBLupjT+WC1oNYereRtslghsgmkI8HtGHB2dOBP7jyoK9+gpolQ== 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=DDbmmbFgBxhKaOhHOUp/UpYi2/c+KPJaw5dvLjPdxrI=; b=buYRvvH7fP32ZJURl+KNcepblO2k6vRVYAJC1zTFIikXy8L2dZnWpt1rV1xrIQ0wlSg6zXXzMN0EAFJxemtW4PjAo4EgzEr7562E4LdR+k/vRI1kCotftYhh9RAa/bJjxA8Kc9Y+QHbRWH3Yitei/4puY6OpJyD4UqmpNE5Yfv0epgoq8F24th8kmnhL5fWyHFF2f/SpmcRDHx0SihNcpF4rS+nmCKeQik9oVDMZZ5nbdsOwtBAO7uePXMya9cZxBsY80MnUOeG8wC1thCymsFw8FGQgTz183F2hvY/LF6UYhAZEy0Xwbuq+Y/cgXxkMRzhzSwyztfHGgk6H0DLNhA== 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 AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:39 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:39 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:04 -0400 Subject: [PATCH v2 06/11] i3c: master: svc: use repeat start when IBI WIN happens Message-Id: <20240813-i3c_fix-v2-6-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=3542; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=An63rdNKf8siEFmhpUTOtrd2drbSwaCzp/D7qZONW80=; b=GSS/gw4GojrWatSW1LvUBE9BTakbtuHGDQlwuo4o99k6ZGQ60UuOoY5oYQqbmC03xloO/SQrR GFYNL4yb2WFCXdjSvRCpurSuBGhYaeU4N+4/DwpKYIq2LfSdqP2Enwj X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8404:EE_ X-MS-Office365-Filtering-Correlation-Id: 8990f59e-35e6-499e-232a-08dcbbaaca6a 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|366016|7416014|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?OZhLYnicra+JQOL49FhYySndRc8rTaD?= =?utf-8?q?NsL9RwFBjAws0LAcxJUNKKVkrIw5Qooc9HpID8xznzDVWxJCXeUFhq7u8Ri5H+lOn?= =?utf-8?q?2GpH8VBaLOtWk1tRPX1L2MjEjQ+z2eCbfKmV4GbGQMh1t4Fcsc9qaZN1U71aIcuTA?= =?utf-8?q?u/zKxGFMgECuXMkMsISOpQ3tFPrY5W/0ZWk2FJlGjOKFvg9DroZNCWEAnCeJ1bPqG?= =?utf-8?q?5NGh+PEHv3HCy8grd1d9+LveezRg3RI9lyrn12KnBNv6Td1pO7vEPcd9W4SBFzjDf?= =?utf-8?q?BjXNh9uhkyMVaN/aYwIAFoWnJ7fouHIn1lhwqoITESAPO8/QMSNqou7ie1gC4ram1?= =?utf-8?q?CyXgL3K00ngH+oDJDq8f2SPRHFIF9bGPu+aaIbPP8IljAbILasZ4RoHYkE6WL4RZM?= =?utf-8?q?SB3IPIIEOIzxMSNikEQnnvDUfq4l5lVVC6ljjrQgnkFEcXqx3nO0uHZ6Eqgz9si2n?= =?utf-8?q?jr9vfYj1F3QNjpQX0nDgPxqAVDZaIRNgtHAOXykTiDX7exbAsQwFHXAm4ZpqRwiPp?= =?utf-8?q?PhNXtkQzI0xSfxfJqx52JzoSFQkeKIC6zfalfQ3iBZ8lHYSyzqSX8Qn1axYxA6Ec+?= =?utf-8?q?I1OlrKodjMr+5gwZi7WVZSkFUHK/GVDOizoWt+JxH1PBcG1drhp/TFhiR276dgpxv?= =?utf-8?q?b8W4eeL91RmrtgrERoe3prUbBzG1TeSdHcJizCmHGWnAS3sdDyDuk3Nt+SC9yc59Y?= =?utf-8?q?cQ9UDkssVaVxm7x9pG8BeVO6HmQuNDdKa/MY4i3+LgZwawylWzpjoIepir7Blrgvt?= =?utf-8?q?2ABKFbo77qs6Qd6xmkYLSujd1SkVPwaVzHWEuybedwcNqSFTsakvbX+j1QW1qlQGh?= =?utf-8?q?QXVci1RC2rVjz3TcuFqQ50f75gV5MCPHGds37aQHODrzXNO5OTdUnfERNBVMBYtz7?= =?utf-8?q?dZAU8CCCmWeUh8QbIFHRsZs+mlbHeSeuBT25rT8hDGVIzFRHA3YeuNnzx/KFp6fHw?= =?utf-8?q?4egJfKLckg8qJ33B2yU0PBvrrdXFr9SLlG8FjoifDg1YexsDg17fVFzPwPsagbgRR?= =?utf-8?q?SDG1BXebKsQAtm9yfeaGNc8o9hO/QOvlIN7Atg0QIQ+d8vrUhk1VweXk/k0HIXe+0?= =?utf-8?q?vmzXTzTpS70b7NcYHO0GBqIrj03BaoMt5p0rcKu1dW5h783KUj94NAWmObdAIfi97?= =?utf-8?q?gC7TqgDy5xCbvLx4sXDElCrWi08B3PRQ2LnD0EpUzAsXCwdvBz4XuOeYvhav55+OI?= =?utf-8?q?tK5MFmcpptV6i1N3BAUelbPAydvgK8v+SKPMAiOvhwc/KpJOu2/pTjxD2IOZ2Sf+p?= =?utf-8?q?RoIK0JSbTtlLZWNLJoUItIxHpaVqbO9/vlsFl1jN7V6MlI8svWPdl7ivo5ug1+qqu?= =?utf-8?q?j9lxRFiqQWg+6ab0MZjRDV+Sk+1KjTVxlA=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)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?dreb9sKe2NBxGIlQYHQP3uBA4LRG?= =?utf-8?q?UXZA3zDpBPLwj/pE0r8EhnzorfeMeNalKbuFBci1r9YV2MKBW7ViPI1sYCkSfM76+?= =?utf-8?q?wqIs58UoJ/8fh+PbU20V2M2x7PUPO3zq4osvK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uU6iN765v1L8qW3f1FGuBWT1c02nMYqZh?= =?utf-8?q?3vHIXrzGBTO4SaJ6ZfylT5iDx2KONcUA6GZ54MgbJgrLDK8SB0l2YXf1Zzo5LbQHo?= =?utf-8?q?qKDlN0zS+qJw6+oQP4qZ5ojVh7B74uzYzGIDwhjd9LOPYvnTQbynFRDlWlLy4IdB6?= =?utf-8?q?vC9gCm+PmxSig26572PHG6Av6ABbRQL7uWiJT8CSODS/5VWtwRN+Z4dbrDAGx83pB?= =?utf-8?q?L886jCcAhIXuzEdL4LBxzGf9ptyXm9DjITb6Qfs+t23atuqtq5JP6kSFvuSJVKlO0?= =?utf-8?q?+h1v0AFprxIZPYaQCRe305LkLfp7MlOEVUZzCUKl6qnpRL8D3BAYpNQocWo1R7Z8K?= =?utf-8?q?k+pdDlyIm+VEtZwahiRJkIWH7cjQFdEMvGBqh1Dsb52VxrTCREELiuI+UfkNIvcx8?= =?utf-8?q?75XYLxfSOg5tX/cLNMqjefkxA4+j6q6IOIZGWyFAgrncGWHai1HSAUrqn5kOLswaJ?= =?utf-8?q?xqY/j4VvFUX6BH0JxiTaFrc9xITD19TUpG6BDTrk1NKnsKkbs+Tzk84c=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8990f59e-35e6-499e-232a-08dcbbaaca6a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:39.5414 (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: BDk9XidUxZzH7CGiOTIPxUS4Ifa8P/wIpkp2pjkTAIX2DknUVu56HwDjdLLXShddwBg1viopkgN3RwI3fEIDLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8404 There is a possibility of an IBI WIN occurring when addressing issues, even when sending CCC commands. Most of the time, returning -EAGAIN is acceptable, but the case below becomes highly complex. When a Hotjoin event occurs: - i3c_master_do_daa() - i3c_master_add_i3c_dev_locked() - A dynamic address (e.g., 0x9) is already set during DAA. - i3c_master_getpid_locked() - Another device issues HJ or IBI here. Returning -EAGAIN causes failure in adding the new device. However, the dynamic address(0x9) has already been assigned to this device. If another device issues HJ, it will get this address 0x9 again, causing two devices on the bus to use the same dynamic address 0x9. - Attempting to send RSTDAA when the first device fails at i3c_master_getpid_locked() could also fail when sending RSTDAA for the same reason. According to the I3C spec, address arbitration only happens at START, never at REPEAT start. Using repeat start when an IBI WIN occurs simplifies this case, as i3c_master_getpid_locked() will not return an error when another device tries to send HJ or IBI. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index e80c002991f75..5d19251238ff8 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1099,6 +1099,24 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, if (ret) goto emit_stop; + /* + * According to I3C spec ver 1.1.1, 5.1.2.2.3 Consequence of Controller Starting a + * Frame with I3C Target Address. + * + * The I3C Controller normally should start a Frame, the Address may be arbitrated, + * and so the Controller shall monitor to see whether an In-Band Interrupt request, + * a Controller Role Request (i.e., Secondary Controller requests to become the + * Active Controller), or a Hot-Join Request has been made. + * + * If missed IBIWON check, the wrong data will be return. When IBIWON happen, issue + * repeat start. Address arbitrate only happen at START, never happen at REPEAT + * start. + */ + if (SVC_I3C_MSTATUS_IBIWON(reg)) { + writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + continue; + } + if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) { /* * According to I3C Spec 1.1.1, 11-Jun-2021, section: 5.1.2.2.3. @@ -1132,24 +1150,6 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, } } - /* - * According to I3C spec ver 1.1.1, 5.1.2.2.3 Consequence of Controller Starting a Frame - * with I3C Target Address. - * - * The I3C Controller normally should start a Frame, the Address may be arbitrated, and so - * the Controller shall monitor to see whether an In-Band Interrupt request, a Controller - * Role Request (i.e., Secondary Controller requests to become the Active Controller), or - * a Hot-Join Request has been made. - * - * If missed IBIWON check, the wrong data will be return. When IBIWON happen, return failure - * and yield the above events handler. - */ - if (SVC_I3C_MSTATUS_IBIWON(reg)) { - ret = -EAGAIN; - *actual_len = 0; - goto emit_stop; - } - if (rnw) ret = svc_i3c_master_read(master, in, xfer_len); else From patchwork Tue Aug 13 15:15:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762225 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011063.outbound.protection.outlook.com [52.101.70.63]) (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 DC3171A0AF0 for ; Tue, 13 Aug 2024 15:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562151; cv=fail; b=Ej/O8n+EzcrWvdjpUnoQQn2hK38dgtAnEt4syu7G+Fwo75OH4hbL6OK388An+5uLCoNjEyGM489YxDe4J7ak79rkO0cRA/agWiiy1h77rKpolO0vkiiZudI9QrXlI6G2LRE6UJOVtMXEATtzcR2YAlrrL+5hAet/bnWcmRF0o3Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562151; c=relaxed/simple; bh=wdMOaxvdED4nYxZmlnJu7BdBDpzKEEzpzk8ZMhb0ahU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=u/IaVK0nDv7344xKKr6qfQ8rrtTKAjXfXFZJjUZvwVYTqb9nVeYD8l8tDG5BVMbuPR1XYRFCcc55KSCU8nnQiLQvUEyD8FwzquhhA2Wk34rGwd/biCajVUUHvHNpXnmGZ+4dbWTbMfGQyijQ4pYJVMHoIkdFlyZ21Slxid3g638= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=XM4VfFk8; arc=fail smtp.client-ip=52.101.70.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="XM4VfFk8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KxsUMbL5agChusyNig9RMxGSm8btWIIybk73PtjpLq+z3uRIPyqW3akrSB07UuUHE7VrMjiOceWyD3Y3L1Y3SPkQeGG8oOS7iEJsRCMIISDO8cMp8shc15BFdeycloJD45WGLzFJfasvb6PmCdAoN+cOv9PhK1MeuBKGYmQJSZfBEJlRx5p+/0hl/dZTOlr4mwDyFLNMRcwqWFxSHmx6fRDRke+GNp/8WYJ2pZTPfOZZxJF/2jSGdUdNEd/EV90J5Efjs5yXyWsHh2jpdTxNOE42AczrVBFyqHjcgxnktQ8fHUF78LrqDCNXcRpxdI9PiMmwcmC9FXplYqzr63EcKQ== 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=7cmOmx2TRWp/2Uy3nWsX2Ky5UGNNorgOPghwcI1aG9c=; b=vxMARKmhWmk9USpXNG2EpcUFSX/+hfaChyg2cd7koLpM92c4Ia3kxm5A0nCBjOGH8ktUcfPthdSTl26iehVs8pl2QE/ca11XmLrCE6m/uZy+Ckkmr8vcMKmD+0FLSoLlugS6Wz+ZuLLx9SvJXuIFRERsleaVKbHzkrM5DXJxIt14C9QYn4ixUD21UHoZDxWkPIgoEGVh37N+Gb/y6yodC6zoQfEu2HPaon/+LWucwfsQuEgUZ4gcp/c+QiPmvYAZO6T7fjngEXhOrX8Yb/zdMxkiu03bSwufrCYnuVR42+ROVeq7/xU0hq96QNHrjTgjCenkFMAZTZT35aLSceySPQ== 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=7cmOmx2TRWp/2Uy3nWsX2Ky5UGNNorgOPghwcI1aG9c=; b=XM4VfFk88cp6IsaHIJQ9kzODEww3st8yf2DOmMUD+8vaLdyVTnTQndrbJB0hLXjjLYwF/bi1Su1oP5U3YKz4gIZVZv6WMqOAMjMxZhyn7vo3ntmAt/BCpInGUeKIjrysP/64t+gqaUw3b2QtGERZglssGVg7pbFWMWEDUwU2j94lyzvXWo0UvfQjI/XVtiQVZ80KFJ3+sX/kRZM+aarIa5v16L07S/8IaiI7M4053mhhR0Z+V5l3NchwUqa7i6U6qwRU7GlXp4mP/OqQvow+1XtxLLCcPc+kLSu3fdokkkDEdI+BGIH42BG7OSL4naryC6Fl5ouBQ7RagGNLyz5tYw== 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 AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:42 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:42 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:05 -0400 Subject: [PATCH v2 07/11] i3c: master: svc: manually emit NACK/ACK for hotjoin Message-Id: <20240813-i3c_fix-v2-7-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=1762; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=wdMOaxvdED4nYxZmlnJu7BdBDpzKEEzpzk8ZMhb0ahU=; b=R24unpZV65f6GitW3gBYzE3DRfrhLKsqwD4i6ayIdG6CyoGGtPNBgpuX/FPj4DKC2/d+M7PbF OXNZ5iTyDuwA4YKFnhW1n+G8PRwT3DK2BOW6gmpFfd2IzV7TXEPpmhi X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8404:EE_ X-MS-Office365-Filtering-Correlation-Id: 77bac5ff-445c-4825-7537-08dcbbaacc54 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|366016|7416014|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?7LsjzKFTjHQPM4MBmzVBybk8zQVxEby?= =?utf-8?q?1UoxvjoSVDPj/fbWkDpsO8FpQ9y4+qCyH40OQbp2Ndgl2hEauWx+7ZkrKHCzHxwTO?= =?utf-8?q?KkcDFdGCjUt6IqdCUKGj1vTxovqd8jmuzq5HgWNVNaNYgGsvU32to0rkAOAzA6N2O?= =?utf-8?q?RpDLWRr/98g9fYLgnzni8qxsd/vL6AqOCITwXzKnB6z5Ayvo8/SduIhNq34CLdw1O?= =?utf-8?q?61d7MUVw2jFvk+g3Ew6rUHle/anIVZTmNJwgTNSSqLMF8qe11jHQT0eNf5zdfJr5L?= =?utf-8?q?h28HRlcernF4w2HxYAGRZz79XCqEXZ6jewFuZvIK94zIWgk47uWaBh77JfS7zghxu?= =?utf-8?q?amgA8xtbRhS108aU6XxocGv/N0UZLFBGR3ybbQJsSRHxObh0CQ+O9KaHzAedAruK5?= =?utf-8?q?xobNYufYr77hPudINXSbTohPAb1CEEjdc4U85j/AwpvcviyzNlkP0yA4JVT8/TxyQ?= =?utf-8?q?qHjNbbYVrhAIzc45/4+dmz91PesxcHTAXgcnuhNRjyQRnzRiAR3tL7rd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= 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)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?O6osl+ZsqzzE0UUkAkEWQzpT1FhE?= =?utf-8?q?zXsffzYvmaJbi5te1F72xWA4fBStTM5LJe0OByonLRhQmJQmFTbL1tyBK3cpcjttT?= =?utf-8?q?U/arQt+SBN2Sdrliirrim6qYYfLVBgTwIVCQncPjJuPtUPT+m6si1/0VNQ4QMvQIj?= =?utf-8?q?S05CvdJKOiF3hXwQEeb/3lMIVhAE5BKWaHWV3rQn++8PVqaAAb5VeUNCwKIeiDTfM?= =?utf-8?q?674s2rDkUmsQgICqMuDuSiHrVah1okLUkWuDPDJGQrHKJqhF49RUZUGDKZyuSV5Ut?= =?utf-8?q?OKa8UJ+tpau//fbSWqUmv8wSfxA5IZNr6NvoKt3FXbBf4yCEXyNfAJN1Qg7ujyvz4?= =?utf-8?q?j9T/dCqkhOBWuUUEKcuxSyASg/ZQcN5BONdABHDVoa6QoRsi+IpC/9QFatOGnjXgz?= =?utf-8?q?/GkEuS+vzZxKma2XscdYGe7B/VEAMnyuvWl53vMp4MeTknCjkuxPK6Rd8/Z9L872D?= =?utf-8?q?b89iSblRalysA0DTMXyYZrKyHXrC6q2nE28N/GJDUe7pV7P9KgRy7KJqSMZZvds+j?= =?utf-8?q?hOeLEFvvRzrzcHgKHg94IchiFQ/kNRgrsrftdcYDow/ltf2fYjxiUAzEsRhCAbRkQ?= =?utf-8?q?feP5CrRwE2w+Rwl9+MMl8dgqmCSJeMDBC7n4w4lTvDy7w0X6nWi62oiwTpzS/4iWG?= =?utf-8?q?S8gBt2u89qbfNI45U1ZytRgpWb+Rog3LfsHCXuJ75K1OyFaVp+ouy5XiHviWQps7e?= =?utf-8?q?Ewrcc3fYZAtwco9psfJvHFd07m2xL7tg1RfAifWpcO5kZEsGxQ4nmvzh918uAzoGn?= =?utf-8?q?DoJlWTOda8BR/yBoFKhu21aTbfGSiNcfwUSCGGplLIfXYn+ytr3YnwBPZx8yhnwN1?= =?utf-8?q?jSBqxwTxL4B4wdLrJhhK36cU4uhVb+eAIJjn4boITEQvkHrTdyQLdTABvbEXMMM7L?= =?utf-8?q?fzEuaar+w2FouumKTfzpP0bAvwg1wTXBFDpVm32Xqn6ia5rmDa8n32yZjria0YBtE?= =?utf-8?q?IV9n8ki9gLCZHT7Bpl2Eps/w+bAuptbs4QafszRjghaImIoHurec3fGT6W7p4mw86?= =?utf-8?q?0I5NyPPGLVk9aouFY96kDr484BxeFljV8ghhzdb89MVfb7ETc0himLaZwMl7o6ox9?= =?utf-8?q?ZeWrZiXY6f3OU0t3vKDSgq+4CddT5a7JnL+HdvNEUbaJaGf7jYGNzS3c/4I3xFh8T?= =?utf-8?q?rDKuty92/49kTzLTkE5oOwECA+bvpkVD21jBSd4Z1BbXq74RgwKfNy91LqwdZB6Ru?= =?utf-8?q?ToPVtBiI61tPEy8mJ0YtBmoKtnrEt7L8ItV3aSJ4BcEfHBhs7fVQojXcHcfnde2y0?= =?utf-8?q?+f6WaYlftG8sJ5BdplAbVQc0i2ReI4QILOKAc+reyR5xyTk4bQjLcO52KCNa11ycQ?= =?utf-8?q?mMFWMK8stYB3+FeMsd7cnfgGhx3r2udfkhcZ/ZLs107FcpbvOQJpwMHV9S8A0UF95?= =?utf-8?q?pqIT0V7aebsQUm0kmRQlFG1F0eDnuJNEIdt/5zhpt6f1k1L17SHkZ9aiNXq1luSAu?= =?utf-8?q?OqEW81dkc9+9YrtQ0j8nYKu+tE3pz7alV0CDOVc8h/ljShhX1s+W83FM=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77bac5ff-445c-4825-7537-08dcbbaacc54 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:42.7747 (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: vcJqCt58PO4OzxexIk3V1hzsELXfyY9cVq4dEwU6MEXUf1Odsko8DDGF+FlJNJndm26l2N1bS1UjpXxFnZBWcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8404 When the address is arbitrated at send address, the hardware can auto-send NACK if it is an IBI. However, manual emission of NACK/ACK is needed for hot join or controller request events. Add help function svc_i3c_master_handle_ibi_won() to check event type and send out NACK if the event is not an IBI. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 5d19251238ff8..d665639523e3c 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -405,6 +405,24 @@ static void svc_i3c_master_nack_ibi(struct svc_i3c_master *master) master->regs + SVC_I3C_MCTRL); } +static int svc_i3c_master_handle_ibi_won(struct svc_i3c_master *master, u32 mstatus) +{ + u32 ibitype; + + ibitype = SVC_I3C_MSTATUS_IBITYPE(mstatus); + + writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + + /* Hardware can't auto emit NACK for hot join and master request */ + switch (ibitype) { + case SVC_I3C_MSTATUS_IBITYPE_HOT_JOIN: + case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST: + svc_i3c_master_nack_ibi(master); + } + + return 0; +} + static void svc_i3c_master_ibi_work(struct work_struct *work) { struct svc_i3c_master *master = container_of(work, struct svc_i3c_master, ibi_work); @@ -1113,7 +1131,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, * start. */ if (SVC_I3C_MSTATUS_IBIWON(reg)) { - writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + svc_i3c_master_handle_ibi_won(master, reg); continue; } From patchwork Tue Aug 13 15:15:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762226 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011063.outbound.protection.outlook.com [52.101.70.63]) (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 22FC4433BC for ; Tue, 13 Aug 2024 15:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562153; cv=fail; b=uJLS/I/geBdbpQgbBW9wHjuGgPqmqwgMKP8URse2lUQFkTHqpkfZ9wN+Qp/xKT3iXrbe93/UIN4tYE5u+7UMuIx/E2hAMxXrXyGBrExJaMMl7npx/JX+Hyx3Zebg/1kFhQsQ4LGwi+0erqb7OJ86EpkfAT8g458cQDBpyXzDQYY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562153; c=relaxed/simple; bh=L9feF7xb9MUyRMKZRWW6AUoqHkDTiS9UlH84igh2U64=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=CLn363IGBmrx1w8yvc9+A7uXy96ZfSzrxkFegyyPs0ah+SxLuLUWfb/pgr5NwTJ0Xuv9Y8Rl15FIw+sOjf4+OBd+ILfvp6leHdcozPH4xW60C79VOWze0yxjsCFU29ZqftXq9ix+E9GHQvmIeNkKh4f9H8WMDBBGimSDb1ikS4k= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=aQ1Q+oH+; arc=fail smtp.client-ip=52.101.70.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="aQ1Q+oH+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zMvWkm3aUNNv8nrot85BYUBxgX7Du5m/tTVOMK8Xspqwh232RmSGTJnu3XXaZmTbb8A+RPbTJnB9XCHCGXAdTpI2tlnEsLR1xv0YLbNTXWkVIE+8u/sA6udwoTUPqiPqXAPXT1HSwjTJrfAxFx1S+L42X2TOCoGjg+eClk8wj6GQ7HH78jyVcqSl326Jhtnsj10JINMQGv9yVHP1oiWT5MGxd7BnnwZuU0z0v89/g5dVayJE0/iXmuTG1ifzmntr1Kb++gsSw84/49Ppfjin11ekj0kjIFghH3/LOxWH42IJMPq/iO17Dfnkrww8WiDJFSqsNDosVKitW8z0sV5cGg== 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=360E7KWnJTn4U5WkC5jXkR+B4Fj8KMcaMAGe2L9lXhU=; b=O9zQQi/7zWtBxTSoI4eFgfYIx1UamGUvB7maujy1PXy0fKAG6He71p+MOJ1/wKjSrgQ8R2S4bLkFMoBKteke1lsXIeTMKnbeEevr+V1ML1KiCvynQyTrImsVPDn71WLs07Y+DMf8dzmUXLSAgNYwoF91fU6QsDzAqLrUZ8vxSrHrLZnQtxeUcM4T5Kz9TlylPGUtF0Hn4wpGR8rpbL0ENdQyU8ukC1Jp1G0lYJ7LjPmNIUPYboo9ftCkI4l048jOBxyP8DEEGy7EWeyRAujAC5q4uejAUhHxt/QtoSMrYRNvD8EegSGNjs/H6h5uFoIiLjVxIwPamPdygo87eia/iQ== 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=360E7KWnJTn4U5WkC5jXkR+B4Fj8KMcaMAGe2L9lXhU=; b=aQ1Q+oH+BvlTO8VsN2Aj4VVU1LAaIJ5+qEG3W6yiMAvAtwxXHoSombc6ltW216eW8MT7mpm7mdszTTWhl/tbleUcRHr8IbMqPMyKfNgSK8HoX0DX/JLWS1zo6Td9OOKKTGZgC379ZbJ90YzeSW5YQ8/rx3+lygzt+u1eQlzdnqcaUTak4oaSak+BmtjvbOL8R51SxeVALo58AZ/+UCp8VYttG+/wQNwvHy7aVuWa5+gctaVHbKXfbXqRK+izRK5AnNwFh9yIQMnq/l2JCvSIskUmG1/scW4CmQsWJt27s0CNYERTKoTEdC+R0bfq6RE+JY4lJHVnRN0Pa/7yrMPGfA== 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 AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:46 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:46 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:06 -0400 Subject: [PATCH v2 08/11] i3c: master: svc: need check IBIWON for dynamtica address assign Message-Id: <20240813-i3c_fix-v2-8-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=1408; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=L9feF7xb9MUyRMKZRWW6AUoqHkDTiS9UlH84igh2U64=; b=UDwBfzr23I8HaFqu/tax2yXLxmI1iuaYPNObWFXG9XL/3LwtCqLlOYq9VLnBPaSnNOtXjyV4R leLCPzpj2XyAAJBygabreCbe6WCSZZgCMvqZ/NxUuF5cN5rV4uryXia X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8404:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d63bab2-049b-4b89-b42b-08dcbbaace70 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|366016|7416014|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?qB+v2SEsBECzdgqG1+Fesv4eSkk6q1Q?= =?utf-8?q?3Lgz7zaCcmYJba48tJe8Gb7NrP5wsdimmcgratL7BOrwnMMnYM0WEgneA8ue0wf+1?= =?utf-8?q?s0zlY+mcAG1MVkND+UTjvl9EjFT2ZWePU82nMrJS3wA2thkMagzcddkl15AoC4PbW?= =?utf-8?q?wSOd3cLJMrtqglR+FrQv4gmVpfi5aq9vVk4MyjR/XFrdKA2Z3vwpz5a+1hdoyL6a1?= =?utf-8?q?kB3aChy32iaY0JOoBBEjz1vLDigCnGNojixeW/4tC4Z5smSFPtEKBTiej6EIxeW/x?= =?utf-8?q?fvRr4YZLW3QYFaEt+04YR0ilv91wjP5yNN6pVUaXuwccE9vgiyaSIGOgGiBWA9k9K?= =?utf-8?q?8OmhdJHXtG6aOk31PBZLtMAjFDmQ/tQaAqvt4CGkxxyyGC4ZLFqdRq/n9ABSFp0Fi?= =?utf-8?q?xQZtr3Ru44b/DpKS9b12ZDJwJ6joEE5re2YpfEIv+SXa2j0FS3jNQZXNQvWSzdZEe?= =?utf-8?q?W3OBgwJ4H6f5mnqOWStp/mF52du9uXE4sJmlZFFLqj6NHhybj+KVutr+/63Qh5OOJ?= =?utf-8?q?Iu4GDLXInlcrSw0DrAXzfvqNVsbYIlL5xcIOHMl9q3o6MTWEMJF6uP7KfDJGazPGo?= =?utf-8?q?GalFFlSqQowwdeauCeoaU3m5Yil0A7K3xUg0PvbYLmmR8O3rGR2lpzt/+M9lXD5NC?= =?utf-8?q?T+Gl0zYh+Rq9bNW47M3EQUuc/31DNBac6IYr5y6h98dqqWGRnTYjI7jAsfOJQ98mp?= =?utf-8?q?FPaL14Lp2mc1js2WSBDBXRHUSoskenM5sYho/dOuCHm6Ujt++B9Y8VJvjisV7fwfE?= =?utf-8?q?esFoHhJgY0oZeUX/S4sZCi+FBDnXqqXRR/mQDaVz7FSCcuqh/WXj10ZCpZNoWxgX3?= =?utf-8?q?bmdarV0/hs6vvXHkcEDqWV++AektgPb5sYAWClsHsyP83MIL0w/S028Jzdzs1x6Y+?= =?utf-8?q?nlpzSDC4rGnmC9flHCzeAzOAxtt4vOOpqAYWHqZ7BnXM3NLDkped7tXGVb+fw45qM?= =?utf-8?q?/wsSkgLVjeM/Q4Jrd9bFskD6sNJ5C8YTjp7ec2D8uScUder2f6unkAEUTuJQDM5ip?= =?utf-8?q?6kmVfveGreQEmZ+wu8az4p0lgyKbNH/dn/JsFPigG3UUhBeNNpfDr929KsXB78JfP?= =?utf-8?q?Gbx5lgdgGvM8X0kLPR+Sz/2PpGcn+1wFG1ycDejWGCC3bwzSJxkdOSg5MU19mtX01?= =?utf-8?q?h/mtlc0OoukVt9gNdHBjLYB1eLyB0MS+KzM9XIoTyXUTF6rPk6N8/5uwOGdr7O5wK?= =?utf-8?q?Kslo3PYt+QxoLnbbbsjnQJNE5tS4shx91hKXxvJ/YHDdCSS1v7G3hE7sZkUYl/Px8?= =?utf-8?q?vXpbFvmvlneXNBAFDYBpASw76RQtgNIkYp8TatjrKDl17ubG9M5oirToeBGTdVqaV?= =?utf-8?q?6hmI2zdQGCP3AeL1nsoFj84L17IpwA+VKw=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)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Mess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5BbFDhndWUSzUIs57o1XRoK5K65rrIYp?= =?utf-8?q?z5v9qpbReL8s1Nz1Bgd63V8+OOYcq530K3b4QpFQGASjJjnxjQsH9tanLe4PMrsPM?= =?utf-8?q?uNvaADjsM9PhxPFvTpN77Kw6tTSmENRE8ykRwSJTX0wcrovIhtX7ddTVg9qehaH9j?= =?utf-8?q?ht7RPhPWFhpiUgyr14FortrtmSFWayr31c98QrYzNnoWkq0MCq1QsIzWHKDEQ1e8Z?= =?utf-8?q?4+MVVFoa9yNBN1VaF87IKrOiRhItwmfNLNaxmf/P8+CANtj3M48DgRQcKX/CAResu?= =?utf-8?q?rrQpohctIbhYjJMFHlZzyNecOCUFSRBzGWXymYtfMdpwZ/9a0cZBoR5nqVyQ9JJfA?= =?utf-8?q?jQavf5S9bEffLhtj8Z9yQPFTCs7eS9DrD7BMB4IglfB95dgTQ73d9cl8LTcciGmMy?= =?utf-8?q?HNIrLLHWUMqKQtKkkJKantc13Hotkj5LImg/OACnhE0d51FvrwG0Cn9neeVGnlLqs?= =?utf-8?q?FmCuJB9eS2QHQPrX48dMOxBfEB9yXWrQ11jhJgK0EOn8bnUrunfuOwZbRUqDgVWpV?= =?utf-8?q?ocw5ep0yRB75bKXMffXeMKJPPUCarZpm5oGlWlhPqO10fWEEppXi2ZC2PSet1cXwe?= =?utf-8?q?2cq94cdnnsZAviJsM1CTO3dXyyaSiWPdC7M/D75qCdC9prXFSzbgx0jM=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d63bab2-049b-4b89-b42b-08dcbbaace70 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:46.2917 (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: r5ZozFdg8d/khlv1BdZHCu6wWzaHeeR0N/r6T7PFPBfP3dLi5mM1laBWnJDeJ+no7pFY9VHRqEBhpyMgTKwQkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8404 When sending REQUEST_PROC_DAA, emit START and address 7E. Address arbitration may occur at this time if other devices trigger HJ, IBI, or CR events. When IBIWON happen at REQUEST_PROC_DAA, nack IBI request then use repeat start to continue current dynamtica address assign. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index d665639523e3c..161ccd824443b 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -808,6 +808,9 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master, int ret, i; while (true) { + /* clean SVC_I3C_MINT_IBIWON w1c bits */ + writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + /* SVC_I3C_MCTRL_REQUEST_PROC_DAA have two mode, ENTER DAA or PROCESS DAA. * * ENTER DAA: @@ -859,6 +862,9 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master, ret = svc_i3c_master_readb(master, data, 2); if (ret) break; + } else if (SVC_I3C_MSTATUS_IBIWON(reg)) { + svc_i3c_master_handle_ibi_won(master, reg); + continue; } else if (SVC_I3C_MSTATUS_MCTRLDONE(reg)) { if (SVC_I3C_MSTATUS_STATE_IDLE(reg) && SVC_I3C_MSTATUS_COMPLETE(reg)) { From patchwork Tue Aug 13 15:15:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762227 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011063.outbound.protection.outlook.com [52.101.70.63]) (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 31B661A256E for ; Tue, 13 Aug 2024 15:15:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562156; cv=fail; b=vElYZtYrDR374y49m3xSQO9eCIpdudAiq6y8wY2nDMVDpvE8H0aq5YRDW+jaqbXOWS5djnPWCHQG/DKKQ/IbJomQMRAusT7OiCMknxJrLF+wLPrnnhLukWFPv49nNKQmA0jTrcpPokyINR4oiI+V62qJUJseA9jNLA/kkpKacEk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562156; c=relaxed/simple; bh=eh2E0Be8sY7V85u59um2EkSafUz25sxM0/X2fX2jZpI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=hIu6e7xccggYph8YWJKDpayxiYlm36Zs2qFA2gz5eq60p2F/hT/AAjEdQakpYNZXtPEBWCAteaS0WYiidlmd6cfDSzQ0/s6b5zrmeARdS8qVKoeKdkmhP9HxZIYZvpaT1kBKAgNF3d6oW1E1xk8aBEQo0NoAyPcHb6CQaI12KJA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=LwTvsyxQ; arc=fail smtp.client-ip=52.101.70.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="LwTvsyxQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GFQtB3Dz2KiNzwqWcdQ3Rk9CyIR0FXVeuQs6WWTMN/U1XvIMTZqPhwYxdSHLDWwc9bV955snJr0aGvySn7bYerCONxDe31LuKEawdQW5jX6auKaajBiW1byH5bHJo14/XuGF6cwRZYtzqDbbSIs3Z4jgwfotBijp2udtsDQb3tmp2MTaPgj5hf/rxITlMOZEPMcjna7qVIRUFwEJeR/QnW0m3hyt3y95yCrU+9iMibfoZBhXI5OI0cs8AHiBSPUdinh6We1v0udcLI7BXN36Zy6QoYTtw7iK5C1xcGC0bxnIyYlLjoDzWOtOExbmXJVMz9ospV2NDcr5ybPo41c+YQ== 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=X2ZAcKNPuQ4Cy7AYm+SAGciuweTjZACn9ZhCaMcypok=; b=m7UgVRutpj9uCbFcNL4HBiWCV4zxAvmbMQ5NJuL0okHar7BkEcKUIC6P1OLdd/HcR17Jf4xL8kKfxYsvuiIx6qJDfS2JUjBam4cW+yf0sbJ4N3sD1L2DleHQO4mkjUyVv4B6MkqehxD+I36R9Rk9KoLxbr7LshFUKGisSlGFOzH6G1W1cT+rnXqnbqZkITK8cnO34G/ZyG/jN+d/fb2zbI+sWyVatkly1Nvu6SItK1WsrGJ/2facJSKDfeWLWsir5h1ngSXZSZGawi12KRVZCaPJDECZ+xF8oMG3+k54y41UTe18bRoNqqqKmgY4L/Fkzg3ve7gLlplhysGQOQ55YA== 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=X2ZAcKNPuQ4Cy7AYm+SAGciuweTjZACn9ZhCaMcypok=; b=LwTvsyxQF96aHqNLG/xGKqyDbskce7/tKB8/zGBjbhMLxIiJAbuLyDix0xoO8SWURabRyF02SXKCMjgGfZbKaaoAojVytRq18d/RvoByY+pmFWp/kht3vvmFCT/KAglVkuT8yV/VtdXhD9w8CeKXItkbsG+tiKlrPVvJm/jXGeCRbfLQhw/IPOfPeV7vNqpSA7sFw5ohf7ENwAoKCafhbTp1jlcR7eW3aVfIYg5uFmsuf2SLnoNtXdoIJR3IMi6WSJeEq7f5VfkF7p+Y4rf/N7Cf0/H3h5IHeUxUtJ6+gVzqm0wdBYormlHctoXsSxwG2wqE8+MJEzPoGO8lAS4Rrg== 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 AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:49 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:49 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:07 -0400 Subject: [PATCH v2 09/11] i3c: master: svc: use spinlock_saveirq at svc_i3c_master_ibi_work() Message-Id: <20240813-i3c_fix-v2-9-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=2350; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=eh2E0Be8sY7V85u59um2EkSafUz25sxM0/X2fX2jZpI=; b=KVffYwONNtB61AwYdgCAIBUQG1jaeTJPQMAjzDh+ru/mTbBsHvs3e4+U4uKHDbeXf7nmCEPTy PrFWUKWmKjvAYr+aBMxsiAnghPVV1kBpdFri7AfsAvWaIElrrx137nI X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8404:EE_ X-MS-Office365-Filtering-Correlation-Id: 44c5e51f-8aa2-4ed9-8168-08dcbbaad05c 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|366016|7416014|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ZWGZ1e4209fTRtQmtTFMdNYhiHrFi3i?= =?utf-8?q?INcVYJtEDL8NDk5aK3J2XbxZF/kBVDjSnYlW/a17D+V6V3ZSFTynzoDLk+0o/Tl4t?= =?utf-8?q?ZGUd4BBoAriG1B9uXree9vzPsEUBQy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jhUL/AATRq8JcH3Hx3n77e0OxhBspdSOezp+?= =?utf-8?q?kOcnzdojcUOl+0RCNi31lp4F5bGnGhUIIqtu7bBCheplB/ySjy2xLa03Aod5D9ST+?= =?utf-8?q?GhkQ/ar9SmPiOkoF82VgJfuQdhmc7HrmNjRny7dJC9Hul5QC/1dyJ1LRIii1p+XAV?= =?utf-8?q?+IPyUUIG39ICrrUv1Ee13SZU6Qo825X5LQc8qXK1ECFRp9VIXSd5G870IsjQ9dMbk?= =?utf-8?q?3oqH2E+saoxfiZ7ciAj+Hv/QbG+pFGZ1rWPrKpJvZKnO8L21yToqEx0l5mdZDiv73?= =?utf-8?q?G3zoiiloHVu1bs53K+UuA33KKKmOCTqvv+zi3ePXp6QohEaUW2mPlljywRSxthJv6?= =?utf-8?q?J7oQmZbWTNIJ5ENuKa5C/y1shxnnV+0yeA=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)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?WlTJPv10uoGKBGyQTL8DLjHXFYz9?= =?utf-8?q?HYfehGS5fXuIxEeukSCYTGBpUdBdyYmTdr4/0/1hzYOH3BIxLGEG1WgfOU9Yhg8rH?= =?utf-8?q?DSrSptFMHJR8Dis/kMYZLug4XSKWfFsU8ShCDdJWvIPv9Gzb9oDUHiQQi2dHNTn0p?= =?utf-8?q?i2z/fF5jy5x7ncCe29RK9To9Yf7PpE1tfkzQZp6+6Yj0DZ8mXyfrQThmYb07KYy+g?= =?utf-8?q?G6lGq4U8QuKY8TODp/d/+Q1S41iMKtpaPPeYZ2iVyqmZcgHGt4cmVT+yOgZ76Wwt6?= =?utf-8?q?XKR/ukWj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DvtEXBshPj9Kqqg0tury2HGqrIfzFqmGiPtQtf?= =?utf-8?q?10mQmBxLp9p0KibOFy9tg1coiHke+YiE/zn7i4ChbKvBAqjrQ2KxVX4I0kz3/NPCv?= =?utf-8?q?4txvbvBuEG+PZceoTmB6XuipBcDhNnVP7NxYxpDebL086NCqERzLF/U56lD63AIxl?= =?utf-8?q?m/2YTWTvthHZCsvS348oQK1q08/VIvKbs/1dwdyP0yi0Gc6Y/FSms8LC6RQuI6Zyo?= =?utf-8?q?yoJuvHZ9NNW/F1p70cxtvCQqjawt0CS7BUo39Bv/xKmE3BmdlaSLUC9ESfa0Z+gYg?= =?utf-8?q?N6vBHgtUL0LiQd/YH6aIjuB/vCoOkPL60ecghH2wOdutZC68tWXA5Xsw=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44c5e51f-8aa2-4ed9-8168-08dcbbaad05c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:49.5226 (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: 0Tq/qbQdZboThQLEV6Xiw70pkISKpE4TsFpyQHL2F0olXVwBpEAV15uIJf7yc9aMYz9vaaLxrgq5y9+iAdN09w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8404 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 I3C/I2C Transfer, ACK/NACK Phase. But maximum stall time is 100us. We have to disable irq and schedule during whole I3C transaction, otherwise, I3C bus timeout will happen if any irq or schedule happen during transaction. Replace mutex with spinlock_saveirq() to make sure finish whole i3c transaction without stall SCL more than 100us. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 161ccd824443b..fbb6cef405577 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 I3C/I2C Transfer, ACK/NACK + * Phase. But maximum stall time is 100us. We have to disable irq and schedule during whole + * I3C transaction, otherwise, I3C bus timeout will happen if any irq or schedule happen + * between 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) From patchwork Tue Aug 13 15:15:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762228 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012012.outbound.protection.outlook.com [52.101.66.12]) (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 438E41A2C06 for ; Tue, 13 Aug 2024 15:15:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562158; cv=fail; b=j3dZJSo7/TmD3fnm6/70ZE00TUwff+ggOA2UQtCNNB8B77y/Yi6tvxtgYWxw8rpt7c3ZeGgxrcDixZ9IvXZ8yBvJxrA5MykXkH6YCJLw1nr1tiejdagE82BYGPgXnNmrj0T3MzZ59qLgKUpTyom9c9rF6IwVuVEVcYONG029+SY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562158; c=relaxed/simple; bh=AMTPnbXTPolpzXHYUs+QhAi1wFjOHFjoAF8ZsoKsfw4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=GkZZWfV4Tto0l/0AghJD6uDTfxjEKGgXFFWXRgi3+RYD29MyiFZkEufg7ruzGtkeexXl+3dLfweo6kkO27eAG/RaFvLeVbwwF3fmaem8KgkYjIM9BSBwLcOdkHaWA9VuUBrww8kkFKsnQEQh96PljTXiNMjWCOMPQITPfV9kJ4Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=m97DvH6I; arc=fail smtp.client-ip=52.101.66.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="m97DvH6I" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Rm0PdZMoQ0683DEm+/9gq1nZYP5sfk4331q4t2BvRz4gBslGkfurf9LQJlDHvZTZ5JID6vGpMm7CfqAbD9cxU4XE2EVm8zHlXuvvdZO9V1AB0QflZFktFXGGqbRk/ESm2bp0sLIJpgoVTi+BIBR4Fu5hinAi+acxDbjrjxoE7tm7Mvaxy8RGa94yKPkHQEyX/YpjkuVCgFXsvU7oKXEQXpNc3ft4v3zw9EP07vjJw3+IAGs621SQkgUm6VPMJ04kCXhCKKxJmzseuLKyEpnCmM1700PTgEGeUeK/cn6kPCAjw7RE9HUjWUfRPbdTQfuViVnVDH4WdaX+Z26egTzh3w== 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=oC5qMOvDsNYDhyMbU1awxVhjBYex/SQ12ahjS1n1Eqo=; b=MRDlfkTjbfbPe2z9q5YiPkF6EFIEYqaVtbfctGNJv2jEGezQ0eQonHAveaewL6zXI7YPtja6mbQ8qN43Ps+AAQqWWQO9zmFHecmKjmWHvtiNJMGhtsOl4fyprkn91RhpsHGhE7bfM7HuZyz1TEWCpz97bsK5WKghNLdZq1gOnIhPTgf7mCDjBQWYOwIUjcOeBZbFnbtsnVTaqLH5gZ+jQGMD1ktUe8AlGUAOrPQ53S5lr/pPoyjFuKtXxRIXkjYVp8RL/qgfes7tqarkvuzhCmzrHm3gMUQZ2JvERFhRIvYUCdDRUEgCreLbGwFIy3+DqjJhFET6L389+vNQAHTfIA== 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=oC5qMOvDsNYDhyMbU1awxVhjBYex/SQ12ahjS1n1Eqo=; b=m97DvH6I6Rrgo4EQEsW41P7Qs72Q/9i7f118+d8J3bkQLU36EmH0gg0vvggTM7LAgjB/eKL8/gllbk8xyR53dFSwmQLj9WM95E5E3f5qNZq91vaw0CgV34OME21s6FVoTVlwltFzFSHsPpBBvGVOocQvB5u71POLF3zN0ZagFBqgEZaTAPrZb0A87xhIUtK+ykw2TjknKlGbfmgrwyDhuSfAfsy84U8MhRJgFOoUy9dET/r815AjYFqQ9fKlXKnQgyJaxoWlHIZwQccxK2H0frs8oPbb9nfGCt8ZPGb/91BxXd89XJ12/+4t3l3MtpokY0TIMOgTvtvbwpnrCeYrQw== 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 DU4PR04MB10623.eurprd04.prod.outlook.com (2603:10a6:10:580::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.20; Tue, 13 Aug 2024 15:15:53 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:53 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:08 -0400 Subject: [PATCH v2 10/11] i3c: master: svc: wait for Manual ACK/NACK Done before next step Message-Id: <20240813-i3c_fix-v2-10-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=3116; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=AMTPnbXTPolpzXHYUs+QhAi1wFjOHFjoAF8ZsoKsfw4=; b=pb8vKftqEcjI7lnZGcpOwloHzr7ggeIr4lRIHTgWrQSDvhmuKOWGszesMsjGrBGoM9ilpBk1p yD+1yu0vtzDDXArVTWD35Sst2+37CyO7HUpqzzNd5Rxy9vMdTcdrhLU X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU4PR04MB10623:EE_ X-MS-Office365-Filtering-Correlation-Id: 2306c555-2115-49dc-bb5f-08dcbbaad26b 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|1800799024|366016|52116014|7416014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?y3vwmMcW9NI8UT7Jf4m2uOKCU3mcu8r?= =?utf-8?q?dwOOVVP3ewTNKB/JFyeU+26FoszjnGoBsMABa+WZoVb+nkud73NBYxwaKRGxlJq1x?= =?utf-8?q?A9Q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TTmDJMZEuGmNc226SLWdQUnyCTYT/yykZIfeBvF5cpQRoRepr2gUTAhP4D?= =?utf-8?q?XgSy290p39v1QQz1wFOyz3veTviWbsGuCnw9Ilv9jsvL0LORI6Od081n2QtF/pPLQ?= =?utf-8?q?vjTB5FMsUsdoe5yqkDAKNGOeh1E1W7c4QSN8IgBoL79vxnnh6C8dbSr7c+HgfBxcK?= =?utf-8?q?3zubyVPq1r5ghrSxEbYqbMnDPIm+N9HpyjytCdqutSYnF85yj5NcEWEQ4MaW6OTh+?= =?utf-8?q?j2iL1xCB/ptEe/PAL+bnGOT7Xt7yBmmqLIk17mFO8VAFn0Ja0RgrMzY8r2QTuqrJq?= =?utf-8?q?M4YqgIjriFjSiu/VHQKQbreaOKdQ1K5lNARm363JOd+yl58Xvu5bxSuIEjkcBYkll?= =?utf-8?q?cI4G+zvdIgVB1R2uIyZ9qQT5aDKlOTCReA=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)(1800799024)(366016)(52116014)(7416014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?9FhpG3O7b3KcJwBLTXelQ6V3GWPH?= =?utf-8?q?MkT3aCwBLMrpO8FwCi+6aXopuLjnNVvGPCNskSSGODyTFznugO7CRc3993Tm32fz0?= =?utf-8?q?/i7XyA4+LoMQCKWeWN+ZsmNU5cz5FFdxlV0VOeuHUdvWHQAo3T5hb4kshS0UnVyGU?= =?utf-8?q?8PXpTci4+9L6xoZtUmZqV2aRhu5VrpxlMCgksMk7aN/1KEt+ufKwi8oQEyMsqLcXf?= =?utf-8?q?KM9cnVZmCZ3l2vo8Hj+H1HnmVy5HvmpZ3Ps1cZzgO6jvIU7o6K1M/7wd4gaE0sm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zWQrE7nL?= =?utf-8?q?J2xe8YSPp5s69/NxOLTzy9brKaXDip4/2bLfEuvqBBpTcOiOk6Co105RDuy+BDkF+?= =?utf-8?q?8bcub91SkCwaPcbhBTkqGLPmCELhrQ8FMan0nFrVIGSWNch2UBh8D+FYshR8QXIKA?= =?utf-8?q?X5lIxUHMEEFppEgQM+bVj0POQwIPhHitL4lqbCC/8ksUEHmnTlJ+Ll4l7r8OLGWUP?= =?utf-8?q?21jk9+R6mye2Kzj2vjMaD6pF2GFtOR7Axo434pB1zCtDbtT/uRc5noHLR9zMpqZmX?= =?utf-8?q?SFCAvblguD/Wqmn16HHq5UoEDzBsJkBLkB7/X+gbhHkgth9eIrmrI5W5GFAD57daM?= =?utf-8?q?nQ47rmFUP3NB7AyuHpan3p54qWDc+ZLrrV3PhGHkzAGcRdq6KgR2wYOY=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2306c555-2115-49dc-bb5f-08dcbbaad26b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:53.0303 (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: k78ry2i9Nu/pu9P7WKtueN2lrLyq0ueZOg/lcdBy6rONDFIQxP2bMEx27aUtkL0uqQfEugx/kl2wsXOogbBMiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU4PR04MB10623 Wait for the controller to complete emitting ACK/NACK, otherwise the next command may be omitted by the hardware. Add command done check at svc_i3c_master_nack(ack)_ibi() and change return type to int to indicate wait done timeout. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index fbb6cef405577..0de95f406c95b 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -384,10 +384,12 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master, return 0; } -static void svc_i3c_master_ack_ibi(struct svc_i3c_master *master, +static int svc_i3c_master_ack_ibi(struct svc_i3c_master *master, bool mandatory_byte) { unsigned int ibi_ack_nack; + int ret; + u32 reg; ibi_ack_nack = SVC_I3C_MCTRL_REQUEST_IBI_ACKNACK; if (mandatory_byte) @@ -396,18 +398,31 @@ static void svc_i3c_master_ack_ibi(struct svc_i3c_master *master, ibi_ack_nack |= SVC_I3C_MCTRL_IBIRESP_ACK_WITHOUT_BYTE; writel(ibi_ack_nack, master->regs + SVC_I3C_MCTRL); + + ret = readl_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, reg, + SVC_I3C_MSTATUS_MCTRLDONE(reg), 1, 1000); + return ret; + } -static void svc_i3c_master_nack_ibi(struct svc_i3c_master *master) +static int svc_i3c_master_nack_ibi(struct svc_i3c_master *master) { + int ret; + u32 reg; + writel(SVC_I3C_MCTRL_REQUEST_IBI_ACKNACK | SVC_I3C_MCTRL_IBIRESP_NACK, master->regs + SVC_I3C_MCTRL); + + ret = readl_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, reg, + SVC_I3C_MSTATUS_MCTRLDONE(reg), 1, 1000); + return ret; } static int svc_i3c_master_handle_ibi_won(struct svc_i3c_master *master, u32 mstatus) { u32 ibitype; + int ret = 0; ibitype = SVC_I3C_MSTATUS_IBITYPE(mstatus); @@ -417,10 +432,10 @@ static int svc_i3c_master_handle_ibi_won(struct svc_i3c_master *master, u32 msta switch (ibitype) { case SVC_I3C_MSTATUS_IBITYPE_HOT_JOIN: case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST: - svc_i3c_master_nack_ibi(master); + ret = svc_i3c_master_nack_ibi(master); } - return 0; + return ret; } static void svc_i3c_master_ibi_work(struct work_struct *work) @@ -871,7 +886,8 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master, if (ret) break; } else if (SVC_I3C_MSTATUS_IBIWON(reg)) { - svc_i3c_master_handle_ibi_won(master, reg); + if (svc_i3c_master_handle_ibi_won(master, reg)) + break; continue; } else if (SVC_I3C_MSTATUS_MCTRLDONE(reg)) { if (SVC_I3C_MSTATUS_STATE_IDLE(reg) && @@ -1145,7 +1161,8 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, * start. */ if (SVC_I3C_MSTATUS_IBIWON(reg)) { - svc_i3c_master_handle_ibi_won(master, reg); + if (svc_i3c_master_handle_ibi_won(master, reg)) + goto emit_stop; continue; } From patchwork Tue Aug 13 15:15:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762229 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011031.outbound.protection.outlook.com [52.101.65.31]) (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 1F9451A0726 for ; Tue, 13 Aug 2024 15:16:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.31 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562166; cv=fail; b=FmJFaoHiCu8tUjP4fPZAuZzSbE/OaTmOrrbvpaEscdALQWRLjxC9VFPAsAEwIix5d06l6t36VmescSbr2zFa/I8Iyx4iOlcjDN4BJSe6kWc1QuqNeSzWviM8VkVS7dR3V/U7rmsUzqweWDQ0SDicwD7iSexm6dySyAaEpq6X4vo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723562166; c=relaxed/simple; bh=DaLGN7qQFvP6oGFtxS4SP64nZLiI2N6XmjBeOGjaOcQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=aPG9soWC89UMK1991jN0Z9W0vdVck/dMuDVd23eG5s2kJ94B7BHVAwQKCPohbAviQjbVXtbsxNVYxbA2gFNDDvD+VOeGTN8sPm3xChwS/1+EnTmbkr63JgANvxs4sJGIz0GbCYYLstjcm/fhq4nE2Q3vBqxEcssQJcax2fVA6fg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=c27DUjVg; arc=fail smtp.client-ip=52.101.65.31 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="c27DUjVg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PnM/YKQs+qbWLr92Ql4O/2Qh00vzLSgYqBSRDdJUWObNOd7SpPr189BsyPk7iikZzyrdrFzDHTmVqdPYzNmGMh9zjV+cFkkIywKTEH6l4ek5S8ZZbWB8hSzkQ4aTbbgWt/6dRvA173uETR/pmwmQrf9rWTFARuyJBcVWmH5fEjKYDwU8kyA2zYQ3dMZ02PSMureaJMyh0mfyR1SevWUIu5nsakI1dFg+dfo0WLGcQBmcDdXySgTiw4lI/zTSNyZAoCRvJ+RmZeXjsaJhxB0tvFj7GP1fKx4Gc87Aa/tIXrwlvYHhV8wF++0zAQ+AKxCYBrD2+mdc9ZtLBcEPLh4peg== 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=2/SVwfWRORhLiOwxpskuAqNJQ7ey0W3ly62qeO1Waoo=; b=Hwh7rQ9vWMcG80LS7RxBNyoHSFnXs0Otb7EXj0/TxPI3KmYAgExmmWMaGtF5yuKRDLJh/2rzLsIcjo/jG2NNM3doVofjBDcQY3aUNPczshoaiGvx/liRSsn+LYx9a8f0R1R4outf78Aw9inWxnVNgsthn8Qw3uc6QOGbhRQxlEI3VDnjP7KqRcObnfAQGRYfrvC7uPw5ln4zpbD9Kf95MoyNiIBKua1gxubXSk4K1SmqhHjEnICQI4lNsDbqnRewuZiJ2UZsie6G66qZtoSDgneMn85Z6ByozAJ3mKOehgoW2s+R4s2E7KX4GQWsm+G+p/hgFDY9eaPHA9ogWMwvxg== 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=2/SVwfWRORhLiOwxpskuAqNJQ7ey0W3ly62qeO1Waoo=; b=c27DUjVg0P/IAGIIybfGOVnxaUT2PVYml5WPp0CQEnEvhiR9DpzQ9yzjS/QrR3devDxgajYH1AuOl88JtQ6JdQkAOdq3vzjX3TQbs+B+sfs3llS4Ogxsj6q4GHsT/5Hebr55UiubFp9vPsl+lefF4vr5OMAC0sbMRCmQXyOkE/BN1s/u3J5Br+aKfGszbDmvs4qnpxxGHX157i7TjkgSQJ+f9X+n5OXTDg0LbxNrabZTLrPHddO1/2NArBc6V8BfwpvMRP3AmmjPTKc4MZB545XERyvYI6Gl3ydUR3sMGDCsoTZYr1K9EKtmo3k0ckfhhTCCNuPKsjQPusB0zxMcmQ== 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 DU4PR04MB10623.eurprd04.prod.outlook.com (2603:10a6:10:580::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.20; Tue, 13 Aug 2024 15:16:01 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 15:15:56 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:09 -0400 Subject: [PATCH v2 11/11] i3c: master: svc: fix possible assignment of the same address to two devices Message-Id: <20240813-i3c_fix-v2-11-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li , stable@kernel.org X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1723562115; l=1988; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=DaLGN7qQFvP6oGFtxS4SP64nZLiI2N6XmjBeOGjaOcQ=; b=GmVe6uM9oxyEhl6ZteKP2TVSycfDEG5HUkd65JC7G2Zy73mA4c1KYOodtFIOdzdceRSsCCj9B cvpTEUv0I3nDC2sIgB+dEyGHHxGqyl9+wrJBOIc8D0tiD9/leFhTr4+ X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU4PR04MB10623:EE_ X-MS-Office365-Filtering-Correlation-Id: 82908c0c-227a-4542-cfe7-08dcbbaad47f 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|1800799024|366016|52116014|7416014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?MygTRaGONudqQgu0yb50ggHJWmAywlb?= =?utf-8?q?29XdeeRxc/+mAD5d2Vkmoj7nPUdjYCm32VIUzvQDwvl+vXWYzULRlxZlfA0x0xXgV?= =?utf-8?q?NePxWujSaoMhs3BPk3JRK6DyppRmjeaMnltRrfzCga2rMzagBGY+lWAR9HRImMTIY?= =?utf-8?q?4KiE2FZcfa0jaFkIx4gs+qZ6klxcLJZH9PkYsKJ/hqK+/slaT9lZDduo++YfTXW9K?= =?utf-8?q?MLDn/DesOyKYrpS+BbHThzqmWC6yiPGS9tAyNHCJzHobmHV9hgjvEI3z7GZ178LFy?= =?utf-8?q?oDwuh1ThRjqHr8IsuR+bWKDDlxUYu9KZr2rdtnj4EMinnkLsH8q2MxaDhUoj3sMVD?= =?utf-8?q?uR1EdKz/0T/CLDNbtxmAxJ1fY4I6EU0aTqtB1eXIV7+kwMU96RejzgfeOU9M7h4uG?= =?utf-8?q?9uNf+qN8d/AxDssInbwAbidxXnuG52xtIBkqfLXbtoNd6ClfkfLxAWz9zwT2Xhc1R?= =?utf-8?q?r80jb1xywMvcYe7pRf7dGXgs6h1OV1WA3CJi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+yKQ+McA=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)(1800799024)(366016)(52116014)(7416014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?4/oTq6gElOxNhdkxIrkqcICjQYcN?= =?utf-8?q?aAjIw1B2XYjvd27lnRWchJkkoQdPNJj7lqEOTwtccZkiikY+w9vA5nqjYkvcMe0lK?= =?utf-8?q?e/PzoTNtv3ScrovMgkV5vJ/3SDWrhrJ+FvhsAndtbIN6h95FlmO03AfLemm+9O58j?= =?utf-8?q?wSR9AJHVWvM97tYr9HcSSvmPwiZWA9pHNegF3LJKqwbsusLk8HBHxnXWTiWmHWuwG?= =?utf-8?q?KkGuPKyBlEib1/cfTXVTpBHrGVp7r8e8FGy+f0UUxKDmaUqjCLNWYMjG/91mWKXqA?= =?utf-8?q?ORx7Co1Uix+wmYPSYLNmypyK+3B1zwrQYLeHPU+p6KQFjjiQYF6CnSmQ1ADN47QOK?= =?utf-8?q?QhD3Ch+LL2Xk9uni1n0x3QOXf0S+zMYrzLs+8WRmroScMT7dqE9IDvIsApBMytC7a?= =?utf-8?q?SDaklB1qQUxM6idsnujQimHuELPlYSyALEGinlP5m6mJ9dAuGx81OsOaBeHqwWj1q?= =?utf-8?q?zUv8B1K10FMcVrFWPKE9VOQ9E6LpJbG+hNw8OTY2j+BIxiWbsP1+68BcVu7epG+V5?= =?utf-8?q?uibOeMrrCWZOuLb75UPMmETwlqiPjMfNTJz3yY6+JBU2TE6k1GvfO/b9ZuiKWbk0n?= =?utf-8?q?XGaMo+rtOhj92G4bwKvw6ekjDSBi4OQ9V1r6xDnj5mR6cT5/9FQ9TVZpFka6ZRBva?= =?utf-8?q?1I9mpwEScR2dT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-CrossTenant-Network-Message-Id: 82908c0c-227a-4542-cfe7-08dcbbaad47f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:56.4539 (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: jMWJi6sxoONkt/rwkcAjeCKoZX/VOsGfbCnfL5veBpGyM3Oz5a3LokRup3dcHTfKcn/PjcguRmXtq6wZ5Donaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU4PR04MB10623 svc_i3c_master_do_daa() { ... for (i = 0; i < dev_nb; i++) { ret = i3c_master_add_i3c_dev_locked(m, addrs[i]); if (ret) goto rpm_out; } } If two devices (A and B) are detected in DAA and address 0xa is assigned to device A and 0xb to device B, a failure in i3c_master_add_i3c_dev_locked() for device A (addr: 0xa) could prevent device B (addr: 0xb) from being registered on the bus. The I3C stack might still consider 0xb a free address. If a subsequent Hotjoin occurs, 0xb might be assigned to Device A, causing both devices A and B to use the same address 0xb, violating the I3C specification. The return value for i3c_master_add_i3c_dev_locked() should not be checked because subsequent steps will scan the entire I3C bus, independent of whether i3c_master_add_i3c_dev_locked() returns success. If device A registration fails, there is still a chance to register device B. i3c_master_add_i3c_dev_locked() can reset DAA if a failure occurs while retrieving device information. Cc: stable@kernel.org Fixes: 317bacf960a4 ("i3c: master: add enable(disable) hot join in sys entry") Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 0de95f406c95b..f47e5f4af68c9 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1041,11 +1041,8 @@ static int svc_i3c_master_do_daa(struct i3c_master_controller *m) goto rpm_out; /* Register all devices who participated to the core */ - for (i = 0; i < dev_nb; i++) { - ret = i3c_master_add_i3c_dev_locked(m, addrs[i]); - if (ret) - goto rpm_out; - } + for (i = 0; i < dev_nb; i++) + i3c_master_add_i3c_dev_locked(m, addrs[i]); /* Configure IBI auto-rules */ ret = svc_i3c_update_ibirules(master);