From nobody Thu Nov 28 08:40:44 2024 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2053.outbound.protection.outlook.com [40.107.20.53]) (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 86A781D0E3E for ; Wed, 2 Oct 2024 14:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880659; cv=fail; b=YQc7+gQZyo497evdfoR8uy4pfNA2DN7oyHx8R09GIUwEPqTA1cxw2KLbwSbJaZbh/gnqPzyOCJHk5bYbZ9Eg2sBISyIlwUbOhvq/I8L6+G5xAtyFEPN2Dk8t115Usp3u4Dg+23yN2P4TE+rnW+hjpAhsOVmYd6JgaShfb9/DZDQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880659; c=relaxed/simple; bh=PBBSfHDVYCdWWJVtSVLzuz59brGY1sY/p66hu57yrIo=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=doVVWnX8jyPI+j5VAqVRIMIMOg8T+tKeTh2SwnTAVErqdAhYecVHL/PBpkvdAK5VOq+a857/FIFulFd/JjTfuNDYIaSTfhYGk2DqV9R1YNqrO7PIvvqQHCwPslKZEDR8efxT/t2ivFvROQx18HkBa39KCnx6aRJrVGOF2x+x+gA= 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=gK6zHIDD; arc=fail smtp.client-ip=40.107.20.53 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="gK6zHIDD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mcqAXDoRfpbPsI54GXq03TzX0VQBfiT5ZCQ0LL9agOLnvPz7Uf/aYQ+dG0X1lEblO1CZk4B//nkRtoI4/ABpujInduq6BoduNcLWsZObUJnB8VBSmV1M5GIENeWdqH1wZlhpPkq9ZLivrListtoYYfenBjwqY8jAWBDpfId5aU5mU6iS1dC9UWWx0ImT8S7F8kDQAhDydIglHVvEpmINz6sZZW9bgvmysmVyx9AqWT3sJgE5Aelr9MZuMMtp47T50MaEbtdyDRjqY7XF3vHqZ//e+ZxZyL814XRs84oL0GO7+LY7SM9btyedW52g5Jx5+7XSbPKSs71tNA4JDObafA== 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=igRMisCW/2kVicUCWragCOXWuSz9w6K+xZKwl+FSnWA=; b=MoyRAvCs7ebSBBiP3vo08gOqWtbUu4IrLxnfEPfhv36rSWcC3ABceIFV1Zb0YusSyd3FzkroCaeHBcPldJoFDnnyvCeoV39IWBMP0NEEnMJA1qKub94Qkv6awoqGdLQLVYCyyKdZlBzYdcfPqumD0et7ja3RCLLZjAAPQUBkkJ3AQjuU9+F2XWzuZVUW5Y2Iz5tNe/78EB88fpt9qgKc5TOqw8mlp8dZOXaPJ/65vsxiMiJvPGL3sn6DjXXkMkxPKnSGKywVGbc3ax1JWlX2lze2DLXJUcwXG4wZALKzTgqjOrO/bsbRssQc1tVreak82YTbemkfq7lBCk+5aLsrVQ== 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=igRMisCW/2kVicUCWragCOXWuSz9w6K+xZKwl+FSnWA=; b=gK6zHIDDBdNjhJfxVjBNAeaMg65Yp+PVGznW+g0E+LDALYXkc+P22EziQhnBVW7aW71U8oxdMzJzUYxwa0MVmuOxylXuSE96K+v8OeUfftCPcy256tLLTpgJ0Hj91cki6y2ocajcaUeaHnP9Y56kfHSfuGkPHAF7K2qvH9PB9swy+Tru9Y7uD5+m6e22QWSBTuM1/Rgl7zAw4rJ7H9c/s5V1KBgowtirTvzRcNt8L1Uu6pYMQjFuSTNmW4tReoPjY+Dt3x612+fI8fLi+V/qjBYBelObAjNay+3Mh/Q3LB4RCqn748PPSFV9ZRBK3zYcAfHqsnDPynyOxJ5fVnU+0A== 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 AS1PR04MB9699.eurprd04.prod.outlook.com (2603:10a6:20b:482::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Wed, 2 Oct 2024 14:50:54 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8005.024; Wed, 2 Oct 2024 14:50:54 +0000 From: Frank Li Date: Wed, 02 Oct 2024 10:50:33 -0400 Subject: [PATCH v6 1/6] i3c: master: svc: use repeat start when IBI WIN happens Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-svc-i3c-hj-v6-1-7e6e1d3569ae@nxp.com> References: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> In-Reply-To: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> To: Miquel Raynal , Conor Culhane , Alexandre Belloni 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=1727880649; l=3676; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=PBBSfHDVYCdWWJVtSVLzuz59brGY1sY/p66hu57yrIo=; b=RfKmOMlSE5qLM+Nbfkb7OcOpVIojBrrVkI7oYYjq/k2xEK4mPjR4p/NDeLqFAMQk9kuxPo7hP GoZ/z9mtBUBCkLaz/ohcB8fAEyYN8nbyvSSb8TOdD4dx34U4tWnKN82 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0177.namprd13.prod.outlook.com (2603:10b6:a03:2c7::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS1PR04MB9699:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ecbda3e-4031-4a2f-ee76-08dce2f19d8e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MU9XQ2RYT2pXSVZVU2UwUm4rdUZXN0hTK3I1NjMxSnBRSnp0cjFSUU56Q3lr?= =?utf-8?B?eHRhUHVONTMyVm00elZZTzNuTU9KRTRPaWc2elZITnEzQ2lteEU5eGxmbk9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urprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aHZjZXZsRWYwdFRpNmY2ZFpFb1UzMTc4VjZVbWtiZXpKaUpuaERnMTQxeitw?= =?utf-8?B?RUhPTXlYNW9YOW5NMVAyY3lEWExSUHI1VEVKakNxL0J2bDVTNjNoOUJ5S05X?= =?utf-8?B?WnVSTFVRWk9jaUEvZVJoWjJTSHo5K1RWSWZyOThOSHJ1Qm1DaEJsdUNYQzQw?= =?utf-8?B?aU16S2lST0FadENFRkZ1T3ZpaFEzOHA1eXA4dlE2VE0xRzh2ajYxZVFhaTNI?= =?utf-8?B?bjErM3FwaVlaVnR2MGUwYWJkelpDa1Yzek5ITnNpMS9lRHptVi94QlB4Skt4?= =?utf-8?B?OWJ6ejNaenE1eUZqdk5CajllTTlOa29HU0J6Tkp3ckRqdkpYRzh5TS8wNlY3?= =?utf-8?B?TEk0Qjg5ZVlGblJsa2VDZmRSNTduOFE0RURYenRkaWFwM2oxNjRRTlhSRG1v?= =?utf-8?B?WStVRDlZMVRoZHpOSUlOV0lMSzJqMWZqZEt3bHZOelpKODUyeG1jUjhBSnky?= =?utf-8?B?OXNKeVlRbDBFaWVMZmgvb25CU25iM1dLb29OSUZUNkVTcTFZcnBpNDdxcFUv?= =?utf-8?B?OTFqT3RZa0ZkSVBuVFNRWC8yM3ZOKy82MWw2Q1dpNSsvancxMm1GS1FuRUFq?= =?utf-8?B?VlVZM0U2TFdyNm5sb2xDTlRCQ2pmY0ZaTjBQZURyZXFjOFk0YVdJL0JhQUll?= =?utf-8?B?ZDFaTnhkYzF1cVVzZ0Frd1RUdENkVEJDOXlZc3RDNWVGdDIwOUtSc2pualBE?= =?utf-8?B?R1phempjZk9EUEt2ZnFGZ05KaWRtaVVoQlVYb0pLTzM5dlpRQ2hyd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c2VpWFZwMlJWSEE2dG92?= =?utf-8?B?WTR4TmtRYm5xTDJrSUY3bUtZTlVkdHFhUDB1c2IvOUp6MTlLQWVyOWREbHdL?= =?utf-8?B?TDZkUTZzUXhDUWFaYmNxUUV3VnFYZks5MGdsdXJZbmpEeEtocHp0UUVqUlBa?= =?utf-8?B?d3Y5bFFSVXhNR0lzQzRNdlQ5MkxWbTkrYkhGMDdnbllmdEVKYm1PMEswOHd0?= =?utf-8?B?NHA5TE5TNDFPVzFWdmlyQk8xeHhlQ2Y3cjl0bzZHcE16UTdUVTE1SThTUTdI?= =?utf-8?B?N2tXZXlwbVdXOEpVazRZU3FaTmM4VmJRSHE1S2hMVkVzL0xVSUFJTGN1dFVr?= =?utf-8?B?bVFqcEpTVTNBQ1RYVVU3RFVFMFU4anZkZFB4eDJFQld2TzRQdXdQcFZGT3FK?= =?utf-8?B?ZTQyanRPQUpqbHh6by9oSkxxWnZ3WGZUK21yS0M5dXd5a2pKdEhGTER4eG1R?= =?utf-8?Q?qcJNPFm4C0WYJJvRVPZbSMA3q?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ecbda3e-4031-4a2f-ee76-08dce2f19d8e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2024 14:50:53.9236 (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: xgQn+ppliJUAE4CYVlgW0/1CVPGOCVwgSFgS+HBRvz6xygEQHObz4ABtUtjfAzMb791+5K0wZ4xhIfyMT/NoIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9699 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. Acked-by: Miquel Raynal Signed-off-by: Frank Li --- Chagne from v4 to v6 - none change from v3 to v4 - add miquel's ack tag --- 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-i= 3c-master.c index a7bfc678153e6..7cd3ce2643f1a 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1163,6 +1163,24 @@ static int svc_i3c_master_xfer(struct svc_i3c_master= *master, if (ret) goto emit_stop; =20 + /* + * 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 Interru= pt request, + * a Controller Role Request (i.e., Secondary Controller requests to bec= ome the + * Active Controller), or a Hot-Join Request has been made. + * + * If missed IBIWON check, the wrong data will be return. When IBIWON ha= ppen, 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. @@ -1196,24 +1214,6 @@ static int svc_i3c_master_xfer(struct svc_i3c_master= *master, } } =20 - /* - * According to I3C spec ver 1.1.1, 5.1.2.2.3 Consequence of Controller S= tarting a Frame - * with I3C Target Address. - * - * The I3C Controller normally should start a Frame, the Address may be a= rbitrated, and so - * the Controller shall monitor to see whether an In-Band Interrupt reque= st, 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 hap= pen, return failure - * and yield the above events handler. - */ - if (SVC_I3C_MSTATUS_IBIWON(reg)) { - ret =3D -EAGAIN; - *actual_len =3D 0; - goto emit_stop; - } - if (rnw) ret =3D svc_i3c_master_read(master, in, xfer_len); else --=20 2.34.1 From nobody Thu Nov 28 08:40:44 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2072.outbound.protection.outlook.com [40.107.22.72]) (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 905F0198822 for ; Wed, 2 Oct 2024 14:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880663; cv=fail; b=enYQhKAW4xqrS7F0iUSnkJ7NT91WSQxBeQ8sMQw+DHAjN+eJca9v2VChE1T8YUhcXrID4FRme5G1V5JSdxZcaNaCnFTPuDM7CbHOgZmIvVx5M+EqldSQnTUKZHnCwMwwzSgejVaZGroQi37vKZEZ9cYb1MMdUW/NWTd2avF8ey0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880663; c=relaxed/simple; bh=Gqd0wCYgtoBFMpBxtk0AaOasL9R8L0WjBcTL6xq2nd0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=l83ixMucfLUH12XbK41mOtbENecppW/MWF9LJBuZ88Z90dllG3/g3dDxCugxmX1/ejxIpIzna/wKWyZMLZOtDcv3R0Bp50zkdTAuaPHZnA4vvdCbGBrCZLXP4Q6Sx/ADGh1doTllmexW+WQNlEMbbPxmcLgW/N6VGyXuz3LlQSg= 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=e7iwHWOW; arc=fail smtp.client-ip=40.107.22.72 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="e7iwHWOW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KkYZ+zE2rMHlnc70VSAQ100789i18tAaO8SQTNbW4kg5CWGN+r4Cp1ETZG5/L0hjL6H698ejpvxYORdf4ouqDoAEidFXkvSEolcOoP2k1MNvNtrvsEF4eBp9qXNHDUqgc0R8GbVGeOWteNRhTfkHdqBmsXslG8CYevugKWB6Ym5ITHvL+G1ML5Js60SJHIR7X7lEl/YK46L0p2mK+DKpIpLA+fDLgD7tqhSFFXtKJf8v23MFQOBYWUV22wGN5CqnmbH2oKoTGnexE3WIMJgw0i2XpOmIq2Mh/Fq8ppYSodws+dmteD6QFp4ES93tCQW9JU8lbU+RqMpgq0GmemYm8w== 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=X3g4JdrXttj+9kVg/nPdSIQfctPvNkrRl+XAcULKDEM=; b=S9pdwUc1dRVSoCrkEhdsicNH+Hg1hivnE+JDuV8sOsXdT0uJ2hzHRSzFuR+JSUEW6z15qdYM0J5XsCaV+wQayL7WjWrtbYitcuNcqUNN2H8cps8vCOH2qONTIqW5FLu3Jkiank8iMerZPXo9rJM0lX91alPCsQxWTv1E31cyCqby3uOQM3ay/pXw7lcVnMHZdLJssmxYzqG19su0ZOKWtH4ustrYiLAk/IEwk0XRy/Af7hvaNNGxcn3201ilSFjdkyS5PZMKjxPzWyAn2ih8llcEp2PsBwRCXc7JPiOwtSLzINYfVAY5rmkDdqDjqr9N3WjHMxyluipIzlbeaXdZlg== 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=X3g4JdrXttj+9kVg/nPdSIQfctPvNkrRl+XAcULKDEM=; b=e7iwHWOW942zd9e1aU+MKBpxV6Krlc+S+tkBT0jQKHO+LM3Sz0qlQKeu+mW0XREBFhTxGvANa0xsv690yhgGb3rdDm6RQuK9fSOSFWNLcwpevJYwwEKEcJlXaE7kiK8KumBDfV/uDJEOV8ZbNtucVzyJ2xZH8XJdC29+7G4j8f3pEdMkCzQBlGKbhv7zxZ5SWh/TdC1h2yflwhscszxNxfNQ0uV/NC816BUyEwr8d76CSsJLm5qHE/KOfICS6ulIkIUpSV2C6dpCFvCJZ4fJ1gNS6qyO9qUfsTOVTe8grBBKq5jO/S25rEwyQDdQNmurwKpHBy5qGDaOa/3hbmZM+A== 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 AS1PR04MB9699.eurprd04.prod.outlook.com (2603:10a6:20b:482::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Wed, 2 Oct 2024 14:50:56 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8005.024; Wed, 2 Oct 2024 14:50:56 +0000 From: Frank Li Date: Wed, 02 Oct 2024 10:50:34 -0400 Subject: [PATCH v6 2/6] i3c: master: svc: manually emit NACK/ACK for hotjoin Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-svc-i3c-hj-v6-2-7e6e1d3569ae@nxp.com> References: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> In-Reply-To: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> To: Miquel Raynal , Conor Culhane , Alexandre Belloni 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=1727880649; l=1900; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Gqd0wCYgtoBFMpBxtk0AaOasL9R8L0WjBcTL6xq2nd0=; b=yTdOKTPn+Hk4AHdfqpLCafDEvmCl2BrJJxQOVbedY6RqaFUBlJ0BGf+gflgCusCn1PCsnkUsn f8OQ7scY4pHAVImiva3L8kVM/j/nVX33oQCoyxzyx9Gom48JoOQtYYI X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0177.namprd13.prod.outlook.com (2603:10b6:a03:2c7::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS1PR04MB9699:EE_ X-MS-Office365-Filtering-Correlation-Id: 48628745-f4cb-472f-994f-08dce2f19f01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?UkFYS203cmFydUpQbGFoaGZyYmlOR1JJb214RXhhSHBJdDBnMDRYblFWYWxM?= =?utf-8?B?Zi9ydDhqanh5cFFLeXNoRzg4d0dqZ3hGaThWaDBGVlA2Q3ZMdkFDVHo1YmNP?= =?utf-8?B?R3cvb0MwVWhxbm80T0h2U1EwZ0xsSCtUeDdWMDZyUzh6a0pleTBySG50T251?= =?utf-8?B?ZVVuMDRWYjJwNkh5Um1xK0RKblBTVEhPME1uaFpBYzhHLzg1SE5YUFNDZGwx?= =?utf-8?B?cDZSV1Z4dmpSbEdpbStqRGVBK05icWRtSEpUSTc2NVNMbHdTODJDQTFJV3p5?= =?utf-8?B?SkRibitRdzRzRVREUis3UXRRaVRnbU1ncHRoa3gvSXFiSVMzOGtabGovbjRH?= =?utf-8?B?dHQ0N2xTdm5OUHhrTHZZZFMxZGpOZWV2b1BXcVdJdVZGdzl0V0RZVjliMHJK?= =?utf-8?B?TWdva0kxTXRESXZNdHdwMnFOQnJ4WndSUzhweGdLUXVpSFlSUjVrN2RSLzhj?= =?utf-8?B?QTFRbG1JcTlLK2gyYXNQajdyRnM5aTY4c0Z5VFJWd3pjWUxIYndUYUR1bEQy?= =?utf-8?B?WTdOSmptMDRqdDk3eGh1c2ZvQVRueXlEd0VPclZmTHFiN09uNWdGODFKOWdh?= =?utf-8?B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?TVY3U0JlVWYxek1hM0dxRjFqR0NZNWVUbGpKMjRwQ2tseFBNbmM0UWRJeHJB?= =?utf-8?B?WCt5SXJzQk9qZDF4VnJVMUpTcjNiQUY0bVRiTzJZWHg1eGFSVWhXUlVSeVdH?= =?utf-8?B?QTBqRS8ySjNwb3BTaDhobm5XQnJiNlU3RGxRWEwxem1iQ0tzNVBIaENMRlZh?= =?utf-8?B?Ky9EakRuRS8rL1Z4Y2t5YkNZZnVtR3FOUnVoS0xBV1E2L24yZUdTaDJ0ZXlM?= =?utf-8?B?NFBkRHlHRDFyMHMvQUx4M0M4YjFKTUxYaXFnVmwvOUQyZS9Pc0JJKzFvQ3Ns?= =?utf-8?B?Y1FCb3FGam5ZczVlMDVnQT09?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UU9hZU0vNnFCS2hYSW1OZHlrSEJMSWdGNlFxODRTRzNWVkE3bnhlcVpTalBV?= =?utf-8?B?dGthdVV1c3NMZVhXTGVRWXlrRXdQV1dPcCs0anpLeHF0VTZsNG1YeEhXSWtK?= =?utf-8?B?VjlmbnZXM3lhWFNtdGFQOHpKMUlFQ2txYkxhS0QrYzJ6NlFHT2Q2bVVBRE44?= =?utf-8?B?ZDFMcXFweWMrVERwMEdjZ2ZtTU14bTF1MGdZcURvWGRGa2w3N2pZeWxTaEJt?= =?utf-8?B?VWsvTmlkRFNHaHYzaktWNU5HZGpVaVU2N0REZ0JGMGc5eHBvcld6dmZYeGJk?= =?utf-8?B?WVJEWjJHTklxRWFjQitJekc4T2htVmdONlFrVjVRTnozS2Z4ZlZGdHhhZ0xo?= =?utf-8?B?b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com X-MS-Exchange-CrossTenant-Network-Message-Id: 48628745-f4cb-472f-994f-08dce2f19f01 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2024 14:50:56.3360 (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: 1xd52IG72cRUZpMsDz/QlwkyrX7bmWjP/Z3fgFCd74g2Z8DugpepE4TYdLBAoSNp6M49Le+7PR5fBnqzQqx5zA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9699 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. Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Change form v4 to v6 - none change from v3 to v4 - add Miquel review tag --- 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-i= 3c-master.c index 7cd3ce2643f1a..c35a228f0c2f4 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -409,6 +409,24 @@ static void svc_i3c_master_nack_ibi(struct svc_i3c_mas= ter *master) master->regs + SVC_I3C_MCTRL); } =20 +static int svc_i3c_master_handle_ibi_won(struct svc_i3c_master *master, u3= 2 mstatus) +{ + u32 ibitype; + + ibitype =3D 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 =3D container_of(work, struct svc_i3c_maste= r, ibi_work); @@ -1177,7 +1195,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; } =20 --=20 2.34.1 From nobody Thu Nov 28 08:40:44 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2072.outbound.protection.outlook.com [40.107.22.72]) (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 D02CC1D07BA for ; Wed, 2 Oct 2024 14:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880668; cv=fail; b=DhD0L+iO3QtINhhPWl+Ge4sGsYn9n4bRStm5uk6KaUE5cTsGGe0RXyr/wVDXMsBAjWWArk9w7c49DcEM7QSrVt/o8p0MAY0VEJtuiuNOMuK8aYylOj5zT0/AEFVSc+OSfpio33BjDi6arlB1jxCtDnP4wf8KljCfRRSFRi1llB8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880668; c=relaxed/simple; bh=km8jyYKynVS8oCIdOvA4qQ3oLe8hXP9gLirgD+wv2WM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=kLVxf3i0qF6x1btMSi6h2Zn6vwxfrSOuxtPg/26N8wUCRkchPygW1ugLan6Qbag0gQl6ga3pQX3Gmc46pcCucBKU3J+efTKqP3RCAQGEfEOi72kcr6dzd13cCQWfDhvm7xAG+ZxPmdGynVsu8zN2P28PDNu9WE/3TB30uhWPHog= 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=dX2GyIFr; arc=fail smtp.client-ip=40.107.22.72 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="dX2GyIFr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nR06q5A3kMQGujjCFnBRQuNNXDVXH+ifM1ZnidTMmNMHVWOxLjPNFkUnsLrJqeDqMOZ3ewoMKjT0j3W0m5B0zHP7vCCHJz5Zb7AsAiUbVCtyXc/SHYcrouTpgWvKdxnes8g8Nr3Am4sY/53+I2JfU//R61odn6T/NPESErKQOHALScwhEYSN3VwvhFfFp39SB7x/wz2WXUKUkpc2wwRQnfWMS5YNMEeJOGpSZGiXTU6VbWHoXTHN4Vskw4HVrbd/udHiSctq05/2V/3ww+JP/gG6r/8tRV6uC1rntC0CRs0yFUG12TFKU04CC51J7nIx4jI4HQCEsUfyBxTevw1RvA== 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=tR98+9LS9quTYVdmJkr0U97KPEN31FgGaNrzukbSyTU=; b=ngAQCtXhEKIN2pKvVBPhD6z4BozYzjiKxtZsAk8tpGpBvCSSQF9dkILp1EH+mWfMWnOiEhB//ZRYCd3In7vtEF5OBFt//HbL2JuseggNWLRRg/FmEZAkT2qAPHrPb1o5Htios2ei7acaUVtr9F9r4RAPrhRdhQU7K9u2dZXjo9yylKCcwn7P7CsJRESPTIAsfF5/B1ifJPS4g5wxWscVZquWHVdi7YNuNujyeRlYTcqWOGwo9tdK5TBTqf1rhBPAQ6CF8aGFdvJASHlANxZwmSlgMaigTkde6vIA/WqAFxcVGUb3CkCATZ/zD/2rmsSQHLo8GHx+MvRBEnSw1zywQQ== 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=tR98+9LS9quTYVdmJkr0U97KPEN31FgGaNrzukbSyTU=; b=dX2GyIFrJmkKFj9e+KCMf+dDujzSDQc/g3RH8Z4qIS5FR63PiGoVODS+wMYCqcV3R6MvF6Avyxcpus9W0Gv47EDC7YaYg0qjjQRlssjvQl0BLMV5Ut/KQ6Xn/fw/2IgHgnLaL6J/rO2dIifT2odGO/ve6WJgKo0HbBdDfromPJO4ALBRhezDQ5q9iUp8mDO4pNNUk9KU/ABPFTzdvwB4MCYxmLjYGhiMfV29xez+HPP/f8D70NZBsj0fDK7RBapjiX7oEDuLcMqLnTiQy7IqcrefwRNEXMcXynKFgpJ3ewm+Z9rz5WbnftBrEJnZNdbYbKeyAp0pBt2QpJRTmfTCkA== 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 AS1PR04MB9699.eurprd04.prod.outlook.com (2603:10a6:20b:482::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Wed, 2 Oct 2024 14:50:58 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8005.024; Wed, 2 Oct 2024 14:50:58 +0000 From: Frank Li Date: Wed, 02 Oct 2024 10:50:35 -0400 Subject: [PATCH v6 3/6] i3c: master: svc: need check IBIWON for dynamic address assignment Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-svc-i3c-hj-v6-3-7e6e1d3569ae@nxp.com> References: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> In-Reply-To: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> To: Miquel Raynal , Conor Culhane , Alexandre Belloni 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=1727880649; l=1618; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=km8jyYKynVS8oCIdOvA4qQ3oLe8hXP9gLirgD+wv2WM=; b=0/6zj+o5ZrjhO8E6paIbmVG6vIWC79f/0qAGiqEpTKUA6UaeH+V+GT8AZLzdrcqDZpy6QO+jK iBpO642BkxUAHGV4zp4/aIdKEWubL/LXeKK8BdWmtfzQStd89qp0tlv X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0177.namprd13.prod.outlook.com (2603:10b6:a03:2c7::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS1PR04MB9699:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c6e1e14-3da9-4524-f278-08dce2f1a065 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?K2gzMlc0VlhaeExlOWswaFVXaEIrSDNYS2hEeDljNmM4ZlgvVi9wZDRqVStT?= =?utf-8?B?QWRaZFpDQlczYThEWWJsblJjcUJBSWM4NDZoNXdZSG9GZE1kNmRyS0x2a3pp?= =?utf-8?B?RFFhdk1PQktOU1A2NHVaMFVBLzA2TUdxYXNYVVhnQVVJOWxHSGUvdy9OZXZp?= =?utf-8?B?ZnYxdEhhaTVCdC9seEJ4RUIremxUKzFwWC9lSkZ0b2xkZjF0cXdic0VHWC80?= =?utf-8?B?Y3lDbUsxNStLN2sxc0ZEQlBRR1NzZGFKSmZqZU40YWlHblFEQkRtUDNvN2pp?= =?utf-8?B?MFVaWUM4aVZTTTMyUUxTYjdaWENndFhLZllGR2F3aDJRbWVPWmR2WWhGWXlZ?= =?utf-8?B?ay9Dd0ZWQm9wVHAzN2RYcWw1c1FFRlhhY3ZpUEFjK2J5NTNwZ1lYRU5tUzZj?= =?utf-8?B?dXNLdVdxVElQZnNENVZkU1VxYzR1RHkvL3QzekxKb090aVB5OGZacGtrUUdB?= =?utf-8?B?VFkyajcxbkduRVFqQTJzV2xvOUkvdUlLdmlyWUhoOWZDYzdYVU92bkI5UUc3?= =?utf-8?B?eXo4S29IM0dHTWluUDhNcG00UXBaVm1ieXlSNUlqTzdzT09vWi91TEtnWTZG?= =?utf-8?B?Kzk4OEJTb01Za0QyeUdiT0JFNDZ0SEVYYkg3MzFZNm5SQW1rWEUwY1pJa0Nx?= =?utf-8?B?THJ5RTJmTE9XeVJNNUlyRVJic1RyRkVIU0xjbDZ0Rkw0T1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JlSEdGcHBMTjhVNmhhNG81UGRNbzRaMzE5ZWZJYWhO?= =?utf-8?B?VkM4SDA5SzVCcnI1dndOcXFvanBlSTR4V2x5b1JnRUxDNEhYRDJuVitxSDFh?= =?utf-8?B?amxHYTQwMG91K2cwc2p3a21HblA2UEpmeGprdGl5S2FSSkY5SnFPbC9jTFZp?= =?utf-8?B?MjNlSEtiQXlTL3VFV3p2ZlczQlhTSjkyUFJPazN3Ty9jcUQ0eWkyY1J1Z0J0?= =?utf-8?B?R1k0NzlJbHZpWk80MzQzdz09?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UHRGZ2FjMHFmWkp6UFJ1K3o5cm1QRS9wUDluY3FOZWVQRFJ4UGZZWTJjd3A3?= =?utf-8?B?RHFONzZrQUFSRUE2cTRkR01NSVdYNDZvenU5dmMvRkJubXhJNG1ZWE01cm9v?= =?utf-8?B?MmUralU2UjNmSFJ3WkllOEExK0pFWFgrVllEcmFaZ09odmRZZ2podzBKdDRR?= =?utf-8?B?Z0RzdDlEc09KYlgzR3d1ZFR1di9rWlBvcm1Fa3Ntc3U4QitPSmpndUZLSytH?= =?utf-8?B?T1pwZUJuOTdqZ3Z3SmVhWGpWMlV3ZnpLc0MvTlZQNXJtZGtyT1JpOGRxcXBo?= =?utf-8?B?bzhUaGFyVFRhVi9LWHllN3B4eGpld3ptWG9iVzI0OUtCaFAyQ1YydjROWEtB?= =?utf-8?B?dUxkRTdPclh2T1kxVUwxeTdYakhJbm5kYldSVVg0ZC9aWXpYcUN1RVovREJW?= =?utf-8?B?L1JLVHRBcE04bWgySElPcXZ4TXh5SXlUVVA3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MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2024 14:50:58.6696 (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: n24dRHriu/wBjuesMWjXukQn0onb3SG7pSsQaUUeLHRT7JEcjLTA+ecB6fGhTn9p2VCqHuit22u+O5OMuXRTiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9699 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 during a REQUEST_PROC_DAA, NACK the IBI request then send a repeated start to continue current dynamic address assignment. Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Change from v5 to v6 - use 'dynamic address assignment' - add Miquel review tag change from v3 to v4 - rework commit message --- 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-i= 3c-master.c index c35a228f0c2f4..5df0ec02d73ce 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -872,6 +872,9 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_= master *master, int ret, i; =20 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 DA= A. * * ENTER DAA: @@ -923,6 +926,9 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_= master *master, ret =3D 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)) { --=20 2.34.1 From nobody Thu Nov 28 08:40:44 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2072.outbound.protection.outlook.com [40.107.22.72]) (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 DB02C1D173C for ; Wed, 2 Oct 2024 14:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880670; cv=fail; b=JZd7sTsfETLIPRAtsVil3NDGOVehqL4koSJXBkAksG/yVAtu0KC1EmIth6c1YFGY2zQfzcv/3f9S3MnqkBgyMsL+CzgtCsYdqRqzucoHSrECX50PY42PjbpmFtnvMhK9if/GG0wfqzYzJDhfvZqm+2aFwJc5VMHYpaEGTzhG76o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880670; c=relaxed/simple; bh=AHvZeWDy6/xYEqoA2DrJdTLBov3b0kSpblBok0ICshQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=qNkW2MZ8lMatX1MGk59430vrvmEuY2JNDW4V72J7pjK/CYNVEPh/Cv7L1uPPQEhlUsVRTuFDXAEA93pc1oH93Z5JhJxJreA0Pa/5jGtx5aF8SV4s2PVnQDbr9M/CZl19Tn+4yH/iY5rtKTNtZTuww23o796+1R22lxXuA0iohG0= 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=dfdl3C36; arc=fail smtp.client-ip=40.107.22.72 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="dfdl3C36" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EXCgQmjw4FqVXa+2pcHmMRHXwJlwNe/owNrJ7VKWnEIJtDc0/NnmTZUPwdIjSzL9qX+fhpmTOVUbbOJA2KGdKbT6qOQufvBovZYr6EGisFcBk6COx9VyXc3x89rC+fHGYwTN1VvsL7d0dVE8aj/dU2/Yvx/0IQimYrlk4NAOdWlBx6Hd/UNxfLXpfUxATddwIooQJ7UPuB87G5wqPoolLosV67g9/qgGLOhx0qZ8ZxxZJW7yBtesijBiRlVOwCAdhQyGqGJE1BY10xpueRbbF9wcUz/8tiJ0bfOXkVTU/TUmZECHlDva1xB1lg+xwKMWqfRFIrihjF4xsh6GITAUzg== 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=LWw8O34Z1PaA0bIpNMoMDZht14UG39YKCT4LXoVb5rY=; b=lUGvaUtRRtHlk66NlAWYcun9d9Knf7vaFByYIoh4YVOMVDXHs9LxD1+N9vozXYvJQBcx6QJeqFU0xb0q5BtxliBuR97KWbJuX2XBi5rNCetxKuRsSTS0p9FTUmS8wU5P2dLGiaXMS6E+Le/juQE+y1s38SB8voipZKUTLGGFxXubIXbErgj2R68mjGXG9YGEGm+AyMdi9t3A3AFt4TludHEUKYOCxUq7sXINuk0PhLmtBmDg5PUz2MkIhCchH5rDqv+DYyyJNZuFKEuxgjTCA954+peu+42Ijl9yHc+FcxtZ8bm7GOsJLcs1ZH5uubLhEG6ECYhO62/Ocb1qGihhKA== 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=LWw8O34Z1PaA0bIpNMoMDZht14UG39YKCT4LXoVb5rY=; b=dfdl3C36PIFZX14Mk4cVwg7Lm1AqK8VELgG+jXqq3Bg0A1eNPyt3ex03n+SKbJ1boWbKAGMu4EAYuQyOHwa2mdrkMf5uD8DcmkkuyYPS1d48Wes+6H4YbFV7hgB5DluKpQFcQEULNEFK+jSdtDnwjjfLszFhUx1Pg6jsKnUoeeQc672x8pvZjYrSt8nnU4Y7IKEB26oz+Wf6+YrjKdVp1KkRat8+w1WrjtBtcUhKbjnka0FgHYEWdL+TiHLwZGgdoXhPYUfEFyfzfrQOtkV2TKg49DLRDYg2xxAFz04D9o5H30ro2TJbG21qc9X73HEvap09nod9fmdw3pFvKzXRSw== 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 AS1PR04MB9699.eurprd04.prod.outlook.com (2603:10a6:20b:482::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Wed, 2 Oct 2024 14:51: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%4]) with mapi id 15.20.8005.024; Wed, 2 Oct 2024 14:51:01 +0000 From: Frank Li Date: Wed, 02 Oct 2024 10:50:36 -0400 Subject: [PATCH v6 4/6] i3c: master: svc: use spin_lock_irqsave at svc_i3c_master_ibi_work() Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-svc-i3c-hj-v6-4-7e6e1d3569ae@nxp.com> References: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> In-Reply-To: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> To: Miquel Raynal , Conor Culhane , Alexandre Belloni 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=1727880649; l=2752; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=AHvZeWDy6/xYEqoA2DrJdTLBov3b0kSpblBok0ICshQ=; b=E9naYrDh21bcxEeOMa+vTbTy6zWSgauI4eieu801Jp/W05Hufc/Xrb1eTHaMVezNDN0Y1sfVO 2+1cW0Ih0TRAQOvFQxNuVyKgXv+9vzFnxgm8skshKaoPQkELanThnDT X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0177.namprd13.prod.outlook.com (2603:10b6:a03:2c7::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS1PR04MB9699:EE_ X-MS-Office365-Filtering-Correlation-Id: 68d26252-9578-4d03-ed30-08dce2f1a1c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?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zl4RzRpTzBjL05NZDlqMkQy?= =?utf-8?B?cldJZzB1Tnd4dTdtamZ4QT09?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NFB4SGQxVkIyRjZTOTdmMG0yVElYQWp1NXhQTkRhSzY3MGhscGliNFV1M3Ba?= =?utf-8?B?T0lRMm1QeFEvY2pJeEtBWkJJektnL2tPdWRueGN1RDVVRmJqUVByVjl6M0p1?= =?utf-8?B?TU5HMkJkdWFRMFVFeDh0bDNmeVhpSHBIRDE0bjRxcXpoQ08yYytMeVJDVlZi?= =?utf-8?B?SVhIeEp3TkJSOWJKR3FtMGlxY1krbnRucngwY1dIQkpZLzBjMktKVGM3b01J?= =?utf-8?B?ZTBqdXVubitHR0xnamdFdmx5WThDNGtjTU9FeVRjV1Vhei9wNU9Ya3NrNmNP?= =?utf-8?B?dUNQMHVvVDRPbk0wZW5aTGtpOVZvNFpqMXVPbXF0OCs1MTJuQ1U3Znc5UHkw?= =?utf-8?B?ZDZGM25ZNE9TZndZVkFnajcwdGREekwzejFXdURsR0N4N0NGR2JReENHS3RY?= =?utf-8?B?SFBwTmhIYndtcmJQZEcyUDMzUjE2d1U4cmFpK0pLZ1lmaHNMbUYyWXB3SjBs?= =?utf-8?B?TkRYbFVaTnpleFljQ2FLUWh5SEZaL0pBVXVrMWtMUDFyQ0Y3TTBtanA3a0lR?= =?utf-8?B?NzVBM0lhdkE3STY0eUpka0I0a0ZKbmJmL3NWUDFyYitjaVhiS28rRGFmcDBF?= =?utf-8?B?d3FJZGFmM21TN0F6QnJaSlYzOHF2cVdBOE84SkpNM21XbnBjMXVDamdOUWNp?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0RlJQb1Jp?= =?utf-8?B?QXN3WnhzQjdDYjJKOWlTZ3g5TllObXk1OU1ITnd4WGhZaG9SaFFpUlk1Y25i?= =?utf-8?B?a3dnbXNZYmlNLy84NEx6Ukd3V0llMUJVeUErL0thTE5jSDhQcnZNVXRkZU85?= =?utf-8?B?V3BYSUR4bVZ3b0srU3htVnFGdUF0T1VTUFJRMTh0V3JXRzRGeWxsT1JNWjY3?= =?utf-8?B?WlhjdE9Zc3FFbG12OVVseGJGcENmNUhSd3ljQ1B2TU90aWt2M0YwQ09iN0RS?= =?utf-8?B?OEIwOTcrZjgzNjNsZzBPYk1xN3d1VFBrV1NydW9pVGlKRWNIK2xYVTZoZ0RO?= =?utf-8?B?T2hIOE1pU1BaNmxEZXVjMlM5d0pMUmI4SHdCYnFJb1dscmYzSUVwcUhZb3l3?= =?utf-8?B?V24xYXFFWjRyWTlXeERzaVhjR0Q4enhoNTA1M0tEUTZzRWVRQlZrWWpSaitM?= =?utf-8?B?dnpCR1FRL3p3UzQxam9UY3lHZW9sS1Q3bis0c1RxQjZQRFJsWjBVeWdLdXlC?= =?utf-8?B?QnRjaWJkWGRnSnBBQVpNaHZCZHFBN0V2c0NOdktZakJoQk9KMnNPcTRvYlNp?= =?utf-8?Q?cfgL0aq+TCwEvud7Pm3lDtgqA?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68d26252-9578-4d03-ed30-08dce2f1a1c4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2024 14:51:00.9681 (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: nL0mxQ1QKI3wM3AqqmtH9vozwrF+KuB6h+RSW2i3d7fg3rIHHtSNhfaeeMlanGNsedJJG7LhSBh/I4IPjKu8OA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9699 According to I3C spec ver 1.1, 09-Jun-2021, section 5.1.2.5: The I3C Controller shall hold SCL low while the Bus is in ACK/NACK Phase of I3C/I2C transfer. But maximum stall time is 100us. The IRQs have to be disabled to prevent schedule during the whole I3C transaction, otherwise, the I3C bus timeout may happen if any irq or schedule happen during transaction. Replace mutex with spin_lock_irqsave() to avoid stalling SCL more than 100us. Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Change from v5 to v6 - reduce timeout to 100us, normal get IBIWIN at 9th SCL. 100us will timeout by i3c spec. Change from v3-v4 - improve commit message - needn't mutex here, other place already use spin_lock_saveirq to protent i3c transfer. --- drivers/i3c/master/svc-i3c-master.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i= 3c-master.c index 5df0ec02d73ce..ed3f1bfbea37a 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -436,7 +436,16 @@ static void svc_i3c_master_ibi_work(struct work_struct= *work) u32 status, val; int ret; =20 - mutex_lock(&master->lock); + /* + * According to I3C spec ver 1.1, 09-Jun-2021, section 5.1.2.5: + * + * The I3C Controller shall hold SCL low while the Bus is in ACK/NACK Pha= se of I3C/I2C + * transfer. But maximum stall time is 100us. The IRQs have to be disable= d to prevent + * schedule during the whole I3C transaction, otherwise, the I3C bus time= out may happen if + * any irq or schedule happen during transaction. + */ + guard(spinlock_irqsave)(&master->xferqueue.lock); + /* * IBIWON may be set before SVC_I3C_MCTRL_REQUEST_AUTO_IBI, causing * readl_relaxed_poll_timeout() to return immediately. Consequently, @@ -456,8 +465,8 @@ static void svc_i3c_master_ibi_work(struct work_struct = *work) master->regs + SVC_I3C_MCTRL); =20 /* Wait for IBIWON, should take approximately 100us */ - ret =3D readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val, - SVC_I3C_MSTATUS_IBIWON(val), 0, 1000); + ret =3D readl_relaxed_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS,= val, + SVC_I3C_MSTATUS_IBIWON(val), 0, 100); if (ret) { dev_err(master->dev, "Timeout when polling for IBIWON\n"); svc_i3c_master_emit_stop(master); @@ -529,7 +538,6 @@ static void svc_i3c_master_ibi_work(struct work_struct = *work) =20 reenable_ibis: svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); - mutex_unlock(&master->lock); } =20 static irqreturn_t svc_i3c_master_irq_handler(int irq, void *dev_id) --=20 2.34.1 From nobody Thu Nov 28 08:40:44 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2072.outbound.protection.outlook.com [40.107.22.72]) (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 136A11D097D for ; Wed, 2 Oct 2024 14:51:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880673; cv=fail; b=rqfaZjk4rhV7dWjRYllwU2tG63y3gVOodWFJyd7Fb+lsVs5y7vsl8j7KE0ei/q3a9jQDq73t6knf2z3ADj92ASysXTBBGQfpawf20SmK9xWG1DblNTmARQPliQKnQUDByzqOhoEd7QSrib39O5VNOf0eHPPyL6oY7uywMhU1Onc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880673; c=relaxed/simple; bh=G9/ttx8HfBwzcCCJhNo04kopgONzp6KBdwhqa41YDTc=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=esocUvzZcuAB6dk1T5g+vcZchXlBar2h/Gkzsxyd8cBencc8dR1PAe10sXDKJKo4ydbxcnyw9S75363VRTHMfPCZQing6SERsp8UMmFpOIgBYasXnS830rTjno4GykAlEgJwci13hZoOZA9G83j38kPJrPIg6saZQcbe0HaVyMw= 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=PEXUPkii; arc=fail smtp.client-ip=40.107.22.72 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="PEXUPkii" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nXkh5eALk5vyRhsUdVGILm+dGYBIk5oeuRaj+gZOBUDJUkYmXgZPrg6h4dCTO8cpOBaQB8gi4L9kmWK452CWppmH3TOODVrjlb/Djq4XIEP5uOuxs2qhAIbrkbs2NgtbQJQQ8mTUCMCAcbbSMpH5bI+1tOamF9Ievxys5zCVX4LkJRLjMkzW92mcb6Byr87EuLR0WiaTVblRIqhI5JdKkrsuDzhmH335GmLUE0+LjzIAqY1d3eFxBSE3YOvSXa6H6XUXjeT6IcOqbay06XEAHcNdAEb1+QPl9/xMlp09zSQp4Fkdu8jGFxY+a+tx/Vu8u6PpQsSsBjDlj5oNuCysXA== 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=xCabqBI/J+Um2gFtk/c1eujjBGuD7tYM07r5dx9+W6Q=; b=jxdP2DcKPBe0zDSp+8mzcrWWYge39sggik/ye06ecGSDVTLcZkw+y9dmK2p2yryun+GAup7KO8i4naz9XLy+uTOwrhAmXYhSQC7mA4tpiB2Wl/GfbR6mkmGic72Nv+4zRA4nLCmj8/dvY64JEifwdYqUdhnwHdRn6jsFFthID1mQMfuRYINfaUpmGUX3kbS04KXrss5OmJmR9U3Plb4ifmzWt9dcv/Al1unOPC8o9O01XQRyA5Hu8LdQOiIhxvNOLo+qjkXByge6JIhgz7BpA3MPvV1zyAFjY/yVzZtBL7a1j6jPfHoHaIXn7h63M/7OTUIZ1ZneEiZtg7J8XQK4QA== 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=xCabqBI/J+Um2gFtk/c1eujjBGuD7tYM07r5dx9+W6Q=; b=PEXUPkiiO8XmHi0q/MkPrTL4+Bta8iS9vIrlsqMXWLLFKYb6VWEs6EQdyQS3NxFBZNAfsyxoclRM3dEzIUsNKGDGNuvBVwIeIivOs6yfW0GOpQwn6yX50zhHU4nhVxzLurGrZvZpOKMpxWSQhr1slRXju5Dw0MZEHZbns8N8Mqb1Mv49Xv1ekz1Pr3anl0GullU3nqLwZn0BJiavZj1hwKEf3st+o9fGrxxIxU1kORPSwyC7aaV/ISY/4RqL1PktUZATXeWNy8BiLsa7qjU68INIe503EZ0f6VqnpblGvMgbVvM9vcQlBTrpNnXPJvoGNJxDex8H7rzM1N0w4k/f8Q== 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 AS1PR04MB9699.eurprd04.prod.outlook.com (2603:10a6:20b:482::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Wed, 2 Oct 2024 14:51:06 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8005.024; Wed, 2 Oct 2024 14:51:03 +0000 From: Frank Li Date: Wed, 02 Oct 2024 10:50:37 -0400 Subject: [PATCH v6 5/6] i3c: master: svc: wait for Manual ACK/NACK Done before next step Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-svc-i3c-hj-v6-5-7e6e1d3569ae@nxp.com> References: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> In-Reply-To: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> To: Miquel Raynal , Conor Culhane , Alexandre Belloni 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=1727880649; l=3372; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=G9/ttx8HfBwzcCCJhNo04kopgONzp6KBdwhqa41YDTc=; b=j0Cy3zpyiNPCgiiRenemJPXQtFjOsLeN0k4YpZehwlftlCPnvrOwh84fLbeXlV3tjg/OQC8vk cLXKwyPyjfWC8euOFJY6eV/24w2f7PuVitZptCbp8suugX96dVVqxqO X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0177.namprd13.prod.outlook.com (2603:10b6:a03:2c7::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS1PR04MB9699:EE_ X-MS-Office365-Filtering-Correlation-Id: 35375ec9-9797-4301-1bff-08dce2f1a324 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?ZWZNMVNZOFFYdk84dG43Ym1HVDFtWExKNk1oeWpvRzZoM0ZnN2NRb2VXUUlL?= =?utf-8?B?VGpNdXZpcU0zV0VuQThRRmQ0TXNjZFptMmI4eGdUdzdqbDFlVjE2cjltRGhU?= =?utf-8?B?YmhMVXNJbmlaUk81MllGdUZ6eWlYTXl2c2RsNzlEZDM1dk92Q2pJVVkycTFp?= =?utf-8?B?aGJ0bldLeENSWXY4R3dvbGNmSE5weFB6TDhFTzdVYXFrdVJRRmVBOU8zVDlt?= =?utf-8?B?R0NKbmY3ZUlFMXcvQ3JjdzBjM3c1dC9XRElibS9PcGdmcGxHKzkyanJscWNQ?= =?utf-8?B?NTR5WG81c1VtQllsMHgzSVdFMmh4SVJnRHc5TWZLSmRoUldDRU1QdHFuTGFL?= =?utf-8?B?Mll5VzBPY0h3S1pUM0NoanN1OHNyQjQ2OHo2S1JFT1FsaGNGRDlUTy9saUIy?= =?utf-8?B?YXh4SXhiRkMzOFVRZWE4WDVXMEd1RWlsb2RvMWcySmFyNVRiTzVXNW52QlI2?= =?utf-8?B?a2xOMnFsRkpFSFpaeE5ZQmZiTEhEdVVIWVlYUjVIUTNIUHQza04xc3ZIN1Rw?= =?utf-8?B?TDQwdndOMjl4ejFEemV2Tk0xVzFrbzJNQ1lzVkVUdjF0cHc4UytPYXN6ZDh4?= =?utf-8?B?Mm56Q3JpWk1qTTd1emt3enRoTFVUOTBlclJNaWVhbEh1U2VyVkR3ZEM2WFZI?= =?utf-8?B?ejhvZW5SUSs4MU9ZZFltakdEQk9KV1BzZ3Z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2eFNYK0Y2end3V29HMVMvbFg3ZE1aak10MEk1Vyt0bFIv?= =?utf-8?B?UlpFMlNwNnRnd3dqNWYvbVdpVmoyalVjcWZoTzhMM0dQbGF1amNrL1QwREpI?= =?utf-8?B?YThTL1FSWmxvYm1Kem5aZHlhNUZLckhFSGJ2b2J0V3ZhMVpZUndETm1Ub2NG?= =?utf-8?B?Z1h1dlV3eXlNRnl6em5yWHp3WHQyaWVLR0YwMXZUdmJvbzlBcXNxYUZnNnNJ?= =?utf-8?B?WkhjZWJxZFFOQU9ONUY5QT09?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cUhyWkhGVm1DNHlqNE9vVXNLdy9aY005b2FJRWlxekVST0tXdnNyOFpEdFMw?= =?utf-8?B?SUJ1QnFMZ3BMb3d6TzFFaWhyd3E0SFFQQUw3L1AwdzVoWTI2U3BSclUvMXNh?= =?utf-8?B?ZlZNNnNWVCt6ZXdMcFJ0ZDZaVUNsdy85T0RrUXNBQzN1dmVTTFNpY2hiaUZG?= =?utf-8?B?OXhZQ2MyR0hLUkJPbkN0SzV6c05XYnVTenVwUGtoU1RVMmY0L2dNSmNSMHo1?= =?utf-8?B?aGUvVFk3L0padk5Hdk5hV2hXTG5nQU4vZXUwcHZ1UTVqNFF5OHFqaGFlL1p0?= =?utf-8?B?VEQ0b3A4WXl1SVNUbjdDOXdNK3dzdmRKbDF0NytzelJ2QzZTUmtUaE14WUht?= =?utf-8?B?TkJrSTR2SlVISFpuK1N3VmJqdHJzdU40bUlqdVY1dytjQzV1N3VTRFRZRElW?= =?utf-8?B?NWg2QUZuMDRKUUx1ekdtSUl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GxjTEVSK3RONVFQaWkxTjFPekd6WHJIRlIxazZ3bm9JUmg1ZXdm?= =?utf-8?B?N2dxWGZQV2RNLzZGWGVDTGVITUtEQnppbEh3V0ZLWDRINGFjWTdWQnZILzVW?= =?utf-8?B?RHhpb1FBYWUzb3BtQU41WGFueDhPOTE0ZHpSQjdoaFJRUkk1TFFIQlBrU0I5?= =?utf-8?B?T2U4L01xRnNyZzNVZmdCVGNmTWg4OEZoWU0yV3RvaEJOVVlLNVdJdFFYTUxV?= =?utf-8?B?MForSlROdHhBWjdlVENyK3UzRE1QTjNPUG5ZNmlRUEtrRGxnUDNxTE9CWDJt?= =?utf-8?B?UmU1SStQejM1ZFk2bXc2b0hHeUtzMnI4czBiR0xCZEN1VUM5M0dDWE1TekU5?= =?utf-8?B?N3ZFTE9ONlJLZWRlUXNrb00vc25MUXkxNjJnSXg3b1BKSmdwRlAwcFlNcXpB?= =?utf-8?B?aVdaeUlQRGg4a0tVZyt6WlU0NUhYNkYrRHFiSXhJRXJRNmp6OWo2clhtYnRL?= =?utf-8?B?WWNxREhXeDZtSUdFclVjU214NVIvZTQ3cHNlMkJHRHlwbFR4cVJ2am0wSXJ4?= =?utf-8?B?NkQwZkMvMk1PWWJ0ZVJRS2ErSmQrVXdVYUVqOE8zbzBOVmNhSFZKSlozSTIz?= =?utf-8?B?SCtuNW11WDdOSUpnRVJBRnZxaWw1QUgxSmVpR3FJMytYREJHMjdJQ2RDUkpL?= =?utf-8?B?L3BNMXVnQWhwZlZXS0hMNXlDcGc1S1BTSXY4NHArQTl3QmFrTVBVQ1hsbW9O?= =?utf-8?B?TGdUTWlzNmxEdWs1QllYTjJubFVpTjdWbFZiclNzdmZsL3hPVStBMGVpUXE5?= =?utf-8?Q?IbBBlCd00y17kx8YMAQezCkT0?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35375ec9-9797-4301-1bff-08dce2f1a324 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2024 14:51:03.2566 (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: Cx1JgCw6BMVgYqsPZbDQA7JO//otiwWncNvPum3BFme3Cn73gxxpXcIZZbEz08MHSWJPLzNmvUwfZSAjEpAacA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9699 Wait for the controller to complete emitting ACK/NACK, otherwise the next command may be omitted by the hardware. Add a "command done" check in svc_i3c_master_nack(ack)_ibi() and change the return type to int to flag possible timeouts. Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Change from v5 to v6 - add "add a" at commit message - Add Miquel review tag Change from v3 to v4 - rework commit message - add miquel's review tag - directly return readl(...) --- 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-i= 3c-master.c index ed3f1bfbea37a..7ef7e50b4b916 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -388,10 +388,11 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_m= aster *master, return 0; } =20 -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; + u32 reg; =20 ibi_ack_nack =3D SVC_I3C_MCTRL_REQUEST_IBI_ACKNACK; if (mandatory_byte) @@ -400,18 +401,30 @@ static void svc_i3c_master_ack_ibi(struct svc_i3c_mas= ter *master, ibi_ack_nack |=3D SVC_I3C_MCTRL_IBIRESP_ACK_WITHOUT_BYTE; =20 writel(ibi_ack_nack, master->regs + SVC_I3C_MCTRL); + + return readl_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, reg, + SVC_I3C_MSTATUS_MCTRLDONE(reg), 1, 1000); + } =20 -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 =3D readl_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, reg, + SVC_I3C_MSTATUS_MCTRLDONE(reg), 1, 1000); + return ret; } =20 static int svc_i3c_master_handle_ibi_won(struct svc_i3c_master *master, u3= 2 mstatus) { u32 ibitype; + int ret =3D 0; =20 ibitype =3D SVC_I3C_MSTATUS_IBITYPE(mstatus); =20 @@ -421,10 +434,10 @@ static int svc_i3c_master_handle_ibi_won(struct svc_i= 3c_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 =3D svc_i3c_master_nack_ibi(master); } =20 - return 0; + return ret; } =20 static void svc_i3c_master_ibi_work(struct work_struct *work) @@ -935,7 +948,9 @@ 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); + ret =3D svc_i3c_master_handle_ibi_won(master, reg); + if (ret) + break; continue; } else if (SVC_I3C_MSTATUS_MCTRLDONE(reg)) { if (SVC_I3C_MSTATUS_STATE_IDLE(reg) && @@ -1209,7 +1224,9 @@ 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); + ret =3D svc_i3c_master_handle_ibi_won(master, reg); + if (ret) + goto emit_stop; continue; } =20 --=20 2.34.1 From nobody Thu Nov 28 08:40:44 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2072.outbound.protection.outlook.com [40.107.22.72]) (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 473DF63CB for ; Wed, 2 Oct 2024 14:51:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880675; cv=fail; b=VnRFfMEvoMQ/KD9VqK74AKN+9kfDS4djlQvHD5rugnIsTiC6Uk9imxrLFx6rVjYdbfd6a1fZJ1VU37kT7inyJlolIg0PrKSWEuETINV8W1eX3YY4Gzcs1NyRqDj9Xsm8RAJyJcZKeOvLWdmF7pp3+4HB5rqGILw7eOeDKGIzrpM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727880675; c=relaxed/simple; bh=mTP2BQfrL2ajg1eLnU3vD3yNZnTqEe/2FbB25MGO4Kg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=EGfAjx7NJMoy8+0luKGJiQdXzVKpeVtSgagHgMEjY7mKHWZGMAtPzijpLKqIXUVGCIWyMpAOYcImWGeCnKd2a4d0jIC+itDgJVs7yg7W62OgXyd7re+lNfPeuKg91Gl1lxxZfgQPx1ar6ex6h69r90/lTpbAntv7JIR1CF+cECA= 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=L0G+Cpc5; arc=fail smtp.client-ip=40.107.22.72 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="L0G+Cpc5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KDpFlRKOfqscIwMUlv7EmR0JPzXfERhf5kzhGgvzgfuglacLItBOphybdR2wGm9qnLTqQBF+WaWDEN76TAUhVmpKyWj7KRRnwWGtFUZ/ZsQLaD4FF2i2/REGYQVziBEb5VSAavARVHM96xq4E7Zb6KoEPugMYQsNVMjYNiFjFUOUHeBLurd+A6Jr+LdpYYffnMaQDO33Kmnc8K8L0VSNMyE6gDvVDQTAo0iK8HAsitvwFqt4EtlkQxWX5Cm37+hJeS346FTXlbejNeSeRPs0BeJQOONJvZ8QfXIB4dBiQfzNasknDfLGGrfhhopALeKtmwAZadeNtUH/cZri1x/Evw== 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=pG/i8HsPY7XlHxdpjxt1xiQs79KpN78+7TFWBBmUyn4=; b=jxEEVW8MphB3BXTuBR8FpkTTR+mWupxlrp3fQri/sBjRbd1Ks/IWJay7FkFRKf/dN/++Rtnoxf3usMfkGKhFbhFN0GgcBtrpQAmJuJMTk4+RoH/Y+QeLNzI1A9DybRwgDbfIwV67ccA3tNbPf0OUdDhuNiWjhtTjrLygrbXcGdr9znxYlEhLlrD1T0VavfUR7b70A5c5B8V4pP9qv/je2zi4AUVOPw1mGVp3FN8528Oi/96roDzmO4TyHjhJ/1+7gjE0Tkx5UeLfGxGH9jfmb3AanHoMYYPvzc+HgiPI+hJhJYwKsKsUuHvvisqFew7v16VmMaKOgzECH7zmCUpo5Q== 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=pG/i8HsPY7XlHxdpjxt1xiQs79KpN78+7TFWBBmUyn4=; b=L0G+Cpc5QKvJ7BH2Kn8+2DTYUrWO731v3SHmSCgxqZw9gliH8iSJhwJNad0x208PGFvIOWJvH8rMLEPuwZWdm40/0aqIK6+UgAle03nAx+BTN/GM0abssWPlHvcqvEqmW6Xw8hkQeiY/T+VvLEvZ5Xu712au3YIclXRgtxEKObLUDd6OOx+60PNgjZpttXlT3C0eS8H4m+Y8+mrPB0OzL4GhSQMhVqXWhBIy76te5XmvOC/o+04Cx9h9/2FV7M6wh2nn/bA4JH5twsFAFvehVsHzItIlsj0GNIwNGEjAXpagvdXhaf1a7w22+sy6yxLyVJrcJhMtoddS6ZAuMT2jkg== 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 AS1PR04MB9699.eurprd04.prod.outlook.com (2603:10a6:20b:482::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Wed, 2 Oct 2024 14:51:06 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8005.024; Wed, 2 Oct 2024 14:51:06 +0000 From: Frank Li Date: Wed, 02 Oct 2024 10:50:38 -0400 Subject: [PATCH v6 6/6] i3c: master: svc: fix possible assignment of the same address to two devices Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-svc-i3c-hj-v6-6-7e6e1d3569ae@nxp.com> References: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> In-Reply-To: <20241002-svc-i3c-hj-v6-0-7e6e1d3569ae@nxp.com> To: Miquel Raynal , Conor Culhane , Alexandre Belloni 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=1727880649; l=3214; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=mTP2BQfrL2ajg1eLnU3vD3yNZnTqEe/2FbB25MGO4Kg=; b=/j4Z1kpOPNXOtRhpr8OSpnJ12IrkyS73HdhZikRFyEIZYibXeJA60RWSmusqukin5vvXGJLfy O4s91/3DMDaDl4843Cf4eMchhEJFNT4Zbg9ubDnITeTjYzQ9qwBkgQC X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0177.namprd13.prod.outlook.com (2603:10b6:a03:2c7::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS1PR04MB9699:EE_ X-MS-Office365-Filtering-Correlation-Id: 4417582f-8a88-49e5-3935-08dce2f1a4a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?Rmp1YkdVR2kzdUpPZXBXVDNyQzQ2UEhVbUlDSXFNU0pRNS9rYVF0SnBGUmpS?= =?utf-8?B?SjM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z09?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RVpRVTZjUDI0Q1VWVUJoZ2lkTDFQdzBhQTBqOWdDZTlFMDArZVJNMjkxZDBv?= =?utf-8?B?SFhZcG8vaDl0NmFkTVMzRFpESTQwa21sbWNScU9nWjh5TktXdlh1a1YvdkFY?= =?utf-8?B?NXBOK2lSTVNXTmZEUUNnamxzdjBZOS9aL2gwZFpPb2huSlVXNm4yT0NTdE4z?= =?utf-8?B?VmxiNWVqeHV5b2o5Z3lkK0JQSTJYN1dRR2tVQng3WnJoMFR2MFdOMFJxTEVa?= =?utf-8?B?aXZqUkd4VUkzd29teU4zNkhzUkNkcWp4OW1hbG9SaUVCVUY3TlZlM3Q1b1c1?= =?utf-8?B?bWk5cnZwWURnTm5LOEVaM1cwRUFibE9DYnZ3bkdRZ29xUmtWMWVQNzZwTFdN?= =?utf-8?B?TXNLYWFncERQYTFtZnpJZUFETHlzbitiWUszWW1EYjhvN24zWm9uZ3E1TUxl?= =?utf-8?B?ZGIwV0FQeUptRmZTa0lIaklHSGFRekJYZ3VNTWxaUm5GbDhwSmg0YWJKdVRo?= =?utf-8?B?K1ZjQ3dEUDk5YjA5N1pQSGxubGVGMmxSVFVsZ1RnRkYwRUlUczdka3IrSzVT?= =?utf-8?B?RCtuZzFjTW5NcldZbXQ2cHRVVHVDVmVSN3V1VnlObmwxQVJwdXA4Q21rK0J6?= =?utf-8?B?RzNYcW5SdnlaeVoxQ3RvU2pEL0ZBTUQwVlBDYWZsTHA5VWFkRk5mNUZZeFVL?= =?utf-8?B?RXNjb1NRck5xcnl3WEhyZUYyUEcyZ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MXNSSEFjTm44R3dXTUZRSzQ1c3lhMkhVWm03UmFaMkExcC9u?= =?utf-8?B?OGlYV0ZNME9LdmEreXJEbWhuOEcxZTIvVGF6TmVnYzhRdGNZdkl2UFViMk5I?= =?utf-8?B?T0EyODV3bTJSTWFvQ2o2VXk2MHJoTUkyelpqUDdpMG50eVRHN25SNmNkdDcw?= =?utf-8?B?YWFSMjVQbk1RcTE4dHNIKzlob1lUOVk3T1VQdklBY3ptTzdHd3p5dHhMZENN?= =?utf-8?B?dXV1d0IrS2phT1JCYmltb3pSUlM5dVJLK2d0TWxCUytsMUlqSFJvYVp2OFdl?= =?utf-8?B?RlEwS0EyR2dvOWRadEhjV204S0IzVHpKbFVSbzE3dXpMVTFmang4U2dYZWhU?= =?utf-8?B?SGRMZityRTh2b2hueE1jNm9hRGtQdy9QdEcwdlRwOUZjTFpKR25CV0oyRFkv?= =?utf-8?B?SWpmWGVsTHo4dlVMOXJOOUFtcUI5TDYvclJLbTIxQXNTV2pZVEo2amR4MHdM?= =?utf-8?B?YWdUY1dXVTVleGNXZUFOTXMyZ1RsQWJmVjNMaHJ5VWpmUDl3SlVDa1g3Z3VS?= =?utf-8?Q?5jmbObwqv9MWjy52iTudqCP9n?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4417582f-8a88-49e5-3935-08dce2f1a4a1 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2024 14:51:05.7505 (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: BUUt7pytChGHV8EOUenVS2yxr5bhQsjm5AXpNcVWdH0WiuzfH80YMGHg4NyqFa7R4lqd9wJPSD/XjOytB84qgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9699 svc_i3c_master_do_daa() { ... for (i =3D 0; i < dev_nb; i++) { ret =3D 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 entr= y") Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- change from v4 to v6 - none change from v3 to v4 - add comments about not check return value - add miquel's review tag --- drivers/i3c/master/svc-i3c-master.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i= 3c-master.c index 7ef7e50b4b916..e9c8e340d861b 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1103,12 +1103,27 @@ static int svc_i3c_master_do_daa(struct i3c_master_= controller *m) if (ret) goto rpm_out; =20 - /* Register all devices who participated to the core */ - for (i =3D 0; i < dev_nb; i++) { - ret =3D i3c_master_add_i3c_dev_locked(m, addrs[i]); - if (ret) - goto rpm_out; - } + /* + * Register all devices who participated to the core + * + * If two devices (A and B) are detected in DAA and address 0xa is assign= ed to + * device A and 0xb to device B, a failure in i3c_master_add_i3c_dev_lock= ed() + * 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 Devi= ce A, + * causing both devices A and B to use the same address 0xb, violating th= e I3C + * specification. + * + * The return value for i3c_master_add_i3c_dev_locked() should not be che= cked + * 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 de= vice + * B. i3c_master_add_i3c_dev_locked() can reset DAA if a failure occurs w= hile + * retrieving device information. + */ + for (i =3D 0; i < dev_nb; i++) + i3c_master_add_i3c_dev_locked(m, addrs[i]); =20 /* Configure IBI auto-rules */ ret =3D svc_i3c_update_ibirules(master); --=20 2.34.1