From patchwork Mon Aug 19 16:01:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13768540 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 C7922166F2A for ; Mon, 19 Aug 2024 16:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083337; cv=fail; b=SQaVzriUX1ljtV8N9t542aBkGgZy+8wJblaQIN+g7fWItK1poLlHkFh+5zHb7RSO58oJVgunvfdAxosQfcSy6eSR8RuN+pnLjVOON1yuH7NUJOXTtwmsaZnqatw0C/jWMTk2ROxAdUIyZpj/TH8v/wDyBmpufpxLmnuf9VPtrFo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083337; c=relaxed/simple; bh=/JI8s94ok2z+hT6L0BfTNT5ICOc99IOP4jbZmyhmqiE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=knhSn4pWPJbNQKP2Awf5rczaWQyPbWxGRYPRRweGGPkAbS7ghp2Ym3F3fRkFRfu717m+Cn1zJcTVlmVrB30icd4J6QlTlnlXunlSFAaSHi3QSiO1mUgX6sAC9X8XSR712VVxcZcBMewjiFo5JlsTUA8kdFM6lwTf48WqhQqG9go= 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=OIKaA0YL; arc=fail smtp.client-ip=52.101.66.37 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="OIKaA0YL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t1ecW37Gb3zLMvvEW1YQfRJ9VEOaKwpnQS0NKrvOBHCerOII16NaKMYsaymDDP6xaZgfJgiuuLpzGnGeaLjt1j0beDqckVrYmVtCByO4TlfrUEKPjK+Hm15KeqmenFfee2g7lgRN2xiH4LeNPt8KVReU+7k/mAcy4yxe4WP2+fMSLuMnCwCIcnlucdqR8lD/gNj6dG/LXnrG3/xiKQ59LsNTi4Wr2JNTEPTn8rcR1p6LylK5dxaYeU6EgLuTMSk3otj8epdEGVTHgdPgXtk9u0dku+eAtHYk4yFkHI6TMoOfJ+Z+ctVPDCzgbxkcp7P2x46aXHLHRKIBAMxMu1BkKQ== 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=yrlT80qdOWzL50NlKeWPjZC+U49vraok5/5hjrkzdkw5qIWHOV1ddWYTGPV3UDkSTX9d8osey5VwdzDPKJXJRQV57yyhnSljp5w3bH+tNwGoAFcum2leBojdizH3D76GFMhbZDMODrdhokytcZMayiJNsFImiQCBea1smfpIdsYZYqWaaqoFjixcfJdvRD9njYGqEUrkTG4qmsjzJ5VFf151ejv4b7Ed3CFCG8BU7AWBWYgeU5VSmcaGPdQUpImxGEEIA7q3d+uHJt/aCmqSsPHgCVbrnBLZUe/88AHmzdL2zFbosOBMOVEZtB9vQpWhyYooLe25juKGDpks3unlzg== 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=OIKaA0YLZ3HpleVMFLgmvKJuzsvMEgHyubtKSSl6Kpm22127WlO2xx+O6z341s+orU0kpSnUEIHsjbAZEMTWhKYactUK2yX4hV3hdXpJnZbd5C+nT5kwEpCqnQgup5PR4LMSNzK334uNCZTbZ/zzPqwV74jF3PnqNJ79XleMFOXhlsMfa+MLXfQ+GrkmBu1YhmsRzcmH0IcTyMHIEe64rKa+ZbMidIIpAVBdp/m8bgyCZEbtUWPLKDjEcje3Bn/RbIM3cG0p5zKvtLH4DOz5a9gj5wMkXDauZ/L/JKEjfcxjfpjMEQSIorxzax+D5/hRzX78ywijtrl6WxOEVmynsw== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02:10 +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.7875.019; Mon, 19 Aug 2024 16:02:10 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:01:55 -0400 Subject: [PATCH v3 01/11] i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin Message-Id: <20240819-i3c_fix-v3-1-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=1374; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=/JI8s94ok2z+hT6L0BfTNT5ICOc99IOP4jbZmyhmqiE=; b=U8JWV56QJWMg7tHj0mH5hBVpJ2WB54ZuW2LJPI+LWtGmYzVgSThVRW0Ibp8hZnHCAQ6mK1Xu2 41vCFO3ye3PDMzTam1jgN1r0x5OOy6pKWMrOhZRXtoUyeEm4aPZLUNJ X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: db33ad1e-d352-4141-acfa-08dcc0684885 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|7416014|52116014|38350700014; X-Microsoft-Antispam-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shWs4b5BfErDNAWbznEvRzSUpfIJ771hXztY2ZEoVli?= =?utf-8?q?K4kU+boTcChJLF/Scc974VB50fkoDAgrKF0OwvO+VFAC927xNjf5cFKkeR9ybjeJv?= =?utf-8?q?oxNrzeGPvB3OA6O5LTBIrWuYZqSy/Nleio9QAitN/Ia+nK+1RwsTW76Lp0yJZkV9H?= =?utf-8?q?GElrDgk0dg38FAFHBwNKgvsZ8aqTSDfLzjo1i5ZLV3DnejaBAosBOS4I8uIm11r70?= =?utf-8?q?eK4mmnEhOoN/jnvekvhjTe0ycBORZ4ohFSpdTrd0XQUn0PYWjZyZ4wSBmaM8VHsoP?= =?utf-8?q?y/j/8Mbmz1Igi7ggnDWMlouEfIPyWQ1FmZhg4pD7YCgb4mDnHK3Bo3XyER18Z1mRx?= =?utf-8?q?gXVVcX7/XJQGH3S1QdrMZJeCNt6VlHvthQWiz9/1hwo8pX7peHHXU+tZR3dJWRRPP?= =?utf-8?q?xziT36osIIHP0Y0mGSTaX2KsGP9SAaWAyjhzYUM6SMGBMW1IgKuvN8sj4VF4XSJj6?= =?utf-8?q?6ErAEVR5cWZbX5V+INMTk7ntHT+tbPtdCg=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Ysu+u4xapKD0xdfSVtaSDoaD8sao?= =?utf-8?q?9r7ZYKC5e7B2k1RTj7CMoDrVOm4C1ekv2mrZEFfkoSPyl6J4O0stkYXk+u8APDXfk?= =?utf-8?q?GVOfXvyDQs8VTUNdyN7GnlE6JiGJkH2kZiPjT/Mlcp6zQ7HCZGVDfz5PFF/MB+U1h?= =?utf-8?q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AwybjgxW4PL4m1ldh+BszneAVPg6gSUpvzGNmDsWHBojDMIYeYZ8uaJ52cWgVZPK?= =?utf-8?q?Rs4ickOckNj2n3KZvlcczZpK/tiaPURc1582GgrrCiPLAox8LGyMX4jPBkMIALAic?= =?utf-8?q?bK74CJKu/8jsjNPF+I9TOlEZT42RIQ+QCGarisqVk+yGwyBC8ccJdr84kZtQ7bZ2O?= =?utf-8?q?0Vz4+L2fYPYGXP7FbrM4B9x38ei1BV9fFQsv4lShQw7h7H0wX16F4l83G1Sha/n81?= =?utf-8?q?+mdGeLSDkTm3SRDLv51I9tc/GDlwnMiX7asyg4gLwi2mzPWWJ54+rm4f4QaDvrQe5?= =?utf-8?q?mDH3gliV5n38RB+q9J4Ft4Hpx/Cm2AVAudTKbSeUipyfyC5VhTK4TQqmrVCDJBtm1?= =?utf-8?q?1z7LdwYe8k1Yri9djktTfNizgi3TlhVKv1YhCJik8k+/HigC+z3dJjn9fTneTcx+Q?= =?utf-8?q?wC600acuwV+2SDJsJBg6tq3e+7J6I4MOdKQOWZcyTQL7tofUHDq1Hia0QxbPhWV58?= =?utf-8?q?sRF6k5k2Eggj?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: db33ad1e-d352-4141-acfa-08dcc0684885 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:10.6829 (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: GSsGBVJ1w5UfjCUM7gC2LzZGAmn9k8dSZca0T1HiSHLN9ypXhk5O8eVfP0jSPJumy/iDAH0z9udelZnL3lpP6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Reviewed-by: Miquel Raynal --- 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 Mon Aug 19 16:01:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13768541 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 E3E1A166F2A for ; Mon, 19 Aug 2024 16:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083339; cv=fail; b=BdOr1fqo7csl7Wi5eDPCKbQ13dHjRI1riXYm0LRcmt3ynfQgCY94K6AlWobzPTfskPaF5r1gokNH1birKTQLx9GEKHaIUAZr6+brnVQxAZORrAu0Ei9pqYGjLtdWs6UjuQl8jlCcXb9MnzjGV+Yfck2HzPu9m/+jWbVYaAFhaKU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083339; c=relaxed/simple; bh=/8gjfrLEbeqdvh2UWIsUOXSQLlEPInExNiw2wP5o2A0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=FhuVuuEuG56iwTnRHYO7b8oEQiiOdl4B3iPzLxaYkYqIo2QnBWgsLIWXGZ8VI37Wc3Z3zlXhMhY5z6PVjj0MqbZKsXan8LzP7y5FS6bRrIn4paUNFpJx93v3QU6AsTes2rnEjikuoLDjPWJY/CB3DPiaa5730nRP2XkcfmgwjoY= 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=Xsb5brOP; arc=fail smtp.client-ip=52.101.66.37 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="Xsb5brOP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NFoZl59sUWP2TZ6Jw+NZ80oZgghDvfFYcoqZ8CzNOJATzHXxroWyCuZP3YrnidnBUfTuZ5SIx4lkd/XfQMmpnjCw2d2KBRLJ9cVI9zWK9WqIYhhNHSIg7uV3um7H9VMX+0EdfZjad0sBZek4SfvLVrQ799lx5scomay7doK1cII9UohgMHiLtddzXPYMLPkNrdlNJQ+RJZa9mzLRrk71VkEiDvHwJdvxwz3UwAA/O2WlJ8MImmHB9C/YEZluH16QxlI8PzJTufWLB1jVJRaZJKTRPeKcb8D4cnlwEezz3weKAE/HslMaW56t2Mq4OgbM3kcPlUTez65ETDUS17tXeQ== 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=NOMi56D9MWEoNAJGfQ0tO/l5ejQS+oxQK9wCFOsXRofSYf0geWuVTP55FbMGn/Hat0HSZzy/n6aBC77LcJs8TynquairyRCagGSlTrZfh9jjbrPyO+dIKcuMcxS4Jr5H4KIP5NHrk0Z4qdKdXui7tCl3QVWMJ8+Gru1Fx2RHwkkzGb1hffEYLrUQyXH9r5/4RYw0umJPbt5MzvYnqrQVsBRHqwm6U6JMWTO7XPOqQa93ICmMEAdTpdRLcEyLpIa7QM67fl7ozth+xOH6F6rfRD1j2/o5alutvgvJeMFCuV76iJr9BEGddSS4MQR1YcWNl7iR46j2o1jDXFdD4IPy8A== 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=Xsb5brOPh9GDcXNYBNuEltP1zxFSbDuZQdL8+iooSJZlQYKAycvLRYmI9PXLhisBXFbybABG8IZBnPtCMg1KbCeU09FjAZQf38R0Cqa3NL3N4W521BqlvjWi8TecFMM2uu/PA/g5ehlXV/hobiNus4SoKj6IqoD1bv80xa3EeqpoN7Z6q71E+WZzOQD3eaTQwmUKGUki58XQ2tmEVFtxKNFCZMtT8mq7anC4e0QXXqxC7CiMs5R0JyCMHFSP3h/++z7bg6gby14L9O7JohmXV8SdTF97AisXGAGPg79TQi7nG/F/Z3RpZNp5QNF9kqYs/ry0TeKq6tl/SM2XtwzqdA== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02:13 +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.7875.019; Mon, 19 Aug 2024 16:02:13 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:01:56 -0400 Subject: [PATCH v3 02/11] i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_BITS Message-Id: <20240819-i3c_fix-v3-2-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=1901; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=/8gjfrLEbeqdvh2UWIsUOXSQLlEPInExNiw2wP5o2A0=; b=rR5dTmllJap2jATJpl9j2kxuFRoEdc/puEV6YC1vOtpHfaNtxtlfP2Yk+Lwbr/BrUE7GgD/ZH 1+Cq972U160DozBKnW5azrxjvHHUFAyAHKxTWTOmlQP4SUHdb9d9TRN X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: b679f02f-9201-4ba2-c229-08dcc0684a0a 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?KOFCnU+HL84BQVBdMlDIoS7uv4cIOED?= =?utf-8?q?nkOztEPMMftxk8uzV29qY85f+A/bbnQXwAuOCCh1hCO+YsS7u3O+p4Ogfeh+VFfMI?= =?utf-8?q?wd/Lqih5a55H4Fqa93985CDWd6tuPEkKQ9MnmtKG8CcXazSplsWEsknGVT3yGsAZm?= =?utf-8?q?6/itehN6cGy4CKJmGtLF62fEJGK+RKT0rsIpuQXYQGxg8S8cLXr1eO9NorEk7TeDa?= =?utf-8?q?hYI7dgtyuonov9KORjvKi28Yfv/FMrkiKnnMJwtUTfAnjOuQKW/V+cq1ZP6lB9SY5?= =?utf-8?q?1J12xWr1qmYFHopwJvyTnT0J3CRQ/UGOKJwGkz7T+hjn4vGmOA/qUBLTiHtHce9Fs?= =?utf-8?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q?ZFzVdcAHnZwKo/r+Jx/CRFzKJM8/a91Jan1LFZ9M/CCoDovKVz3cKPOUjpM2I/6ty?= =?utf-8?q?/ZdZtScXz106KFMQcEajEfwH1/OCeaaqc37P8DIuLQTegZVBq+gTpmSGpng9ef3g1?= =?utf-8?q?1RKNsc6ErhLM4FkRYK8H+yJBpC2wfDPf+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)(1800799024)(376014)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7GjGhFoSviPl2UHE15PDFVcDb7+f?= =?utf-8?q?MtT3vJfPI0rC/YeXgn2ZbANQMHbnS998BT0FKB6FPUTyJ4heUHnHBqmI5/7tEqBG5?= =?utf-8?q?/4ZIVoObbxjRGhoQ+zHDRKpLKFa1ENLsW8qkQUpChelszu8JeoH+fnu7QQWtBaJH0?= =?utf-8?q?QMuUYe6AEgYH4bL9p+mEODY8pUlw3U+7HrO9ed9INGYlHurFacMOs2aJcz2CuFs12?= =?utf-8?q?LrJlVnj+j3VuV6IMyRTVh2QghxbesqZ6P7htSTcud/zQ9SjOpH7jiQPF1wnAhRykA?= =?utf-8?q?JdYyS5qyZfVdF/2dq13TbfSEYc06Nwmh3lkk+3gm4lvgUfAPt9cYIwPthV1WffQTr?= =?utf-8?q?fiOI3sM9vULl6/9DddIpc9XSzIEuImj9I/ydEbcnG/6ZVA2G6x+Xjm1o/NHZ23pEu?= =?utf-8?q?QpP9hA+CGoLEsORC7O+KlCx3fFuyVTBZ6fV/IreVxcgHk31GgZPQvKKH2uK3bNJP8?= =?utf-8?q?Sq+9i9XLmOBuZPCDdofoMEtiAK5h6k2cEPs8EDMLE2GFOnlNbeorEP0Y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rmZZT+9jh2kvdXtO3eEk?= =?utf-8?q?ET7jftKdZdJrRP9G9v3fyCbP8AM8HAG1lJlznsayJvwkKG3zIdEEXtawvPevBl23E?= =?utf-8?q?L1uAgTGQ88fuViV1zbLagFmDlbEm0n9cOJXNzxnkZQXGDiKx+cq6ubDPHri0Cjaiz?= =?utf-8?q?/5JBb5bQp42D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b679f02f-9201-4ba2-c229-08dcc0684a0a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:13.2004 (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: n/lD746UogE0sqVNQRhizFANGDLYPwdtd+9UmXUeG3hcN6Hd0BTM02MTiFCth7hwgf6o/6UwIZd0vEGfybSDkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Mon Aug 19 16:01:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13768542 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 1EC6F1741D1 for ; Mon, 19 Aug 2024 16:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083342; cv=fail; b=IJO54rlmEDw8ITrxP1sS+kojRtisc157aqRgzcOSJmCfhsRGs+zRvEteaNSMuduEFl62rq6ltcjXb7xB3LwbIHmtWsIYuUlFj4fRi12Ute7IAxOvk5Zi1YJi7Rz1rbchioEmt0nTCmwFUXMM2E8KyWW8HDd5M51rlR8iU3bW8uI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083342; c=relaxed/simple; bh=nvcmTWDJj+SrtpBzaB8l8keUZ2F8Z2oCpFCzJlzH9us=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=bvII+E7ISLR20fylwheEAdxY8WrWtHk85GkwqfKzG8e+7j1exOayZNKes+OXIX/u+WuVFG1AbvmrQoFbksltWDFgLBaz2Ir8z4lk4YccI6z5kdaoEgUt3bsFvHSiYBV0+KxXMn2X7RVxuX9yffF11F5vedBffs9Rn0aaGKzWmtc= 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=Y61hzPCY; arc=fail smtp.client-ip=52.101.66.37 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="Y61hzPCY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VRZUsi/UiARK420EBNqbB4SsChBMTNREhJZZDxv9c9zhcY7cfoPAb0XN0G9eKLkvuEqo48pN/8KkLdut6kY+QVzpc4gluABVIJ3U8rhVSS6GPqC9HIqPJ5MokR4SUi5a1wkrnKDM46ralLwx2e/10EuZ+ydS9ipZEFMrh8ZChAHlX76J6u5sFS/W/qIvQRwcEucCoNiS7bvgyFsQvM9949/yUKltGWuw5mW7/OEd3gq9HeAfgoABwcvC4qgmjawvPmYyF2iMVANgQA8OQ+vBeIGHCMmDfMSU/iIiUQgYz7cV8dx2w5cad5QIg/sk3/AE368dn7MmyhWKUsMBXsPqsw== 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=F8Hg7R2iEOlWCQrQ4xKQ+NSKUaYZ5ItyIQol0SvJbxzdHUqOXK0mwxOBovpUyvpkpE48o+ha5LCOTKQFJOD13Kpf2559SDl0kdPBx7NtqhkkthLBoY7GUkz/cR02pFpiw0IUZl07GLN7y8X4QaGmifBJiuq9DXQulUMBnqHQmWQjk1I3qtXdP9hzuaQ8GMlwv96de5tPs5pS2+ca4exEEXaNBUgH32O5/EZrKZ6ZJocwLCHXowuITW5MMxqXremq79B0UoYyZr8ItKLhMCWIyDjd/QhCRTs0hPTaZYagg1Ny8mThxMvsMO/v0QqBb9qeHHw3LOyngyYWDFAwWVi/pQ== 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=Y61hzPCY7DdZu6dPh7EkNDtJ3EGGeS00CmUKTEaIVi2+PDMq4d0Dqg/zFUAJg+CH3n2MlyvGdM/Rw17ZyLPNAUOidUB8iXirDhQqZFB859K/R6n27DWlDRepev/Iyefh0I4ajyf8DWQHllhEV7P8XrjYabYi3Mk8Fs2QWBjVrcZ90hHy7cf7TWYZzNr7U4sziEdtCspvyJqS06O51j5vjuHDy06SWJsorITsTUTuCPgrwXtk2aYs25TND8TWddhldS4lVnJ+aTloGlclCbyRVuz/kbJKGq0zL6OJpajNk3rD7sJPd6lhIB7LO0nHnQ08sZA4dT21Fvfh5Q4STzl7Lg== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02:15 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7875.019; Mon, 19 Aug 2024 16:02:15 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:01:57 -0400 Subject: [PATCH v3 03/11] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT Message-Id: <20240819-i3c_fix-v3-3-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=5289; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=nvcmTWDJj+SrtpBzaB8l8keUZ2F8Z2oCpFCzJlzH9us=; b=ELiX+puj5c7a1rmOAJG04z8hB45bXBVpVH3C6CTavRWD83sSUWHazijgZ05nyDFUViSEmq9f+ 4I87vY0LIYzAFhDQXMdxftWqnxU5faZO88M7QSzBctSk/b+26OHqtdy X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: f9a7c7fb-bd21-4b49-02c8-08dcc0684b7c 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GjMSTMq3uVTgehev0Yw8BkyvttPXZGw?= =?utf-8?q?qYK5Zmfbu4UUfwx7OovfJYgOdbkyNiqsYxcS2uCdPjnSLDmkODQs6WAp4Rv1HrHf/?= =?utf-8?q?/h+B+ncvXYI/lOiQ+kOKL/FjoIXfIcjesEMm+f+qmrz6f1IUT3VG5Bd0fN90svvY2?= =?utf-8?q?25IiMiQPaF1wKSNBIIph9VFNgeOOFXgSWY/dTWuRH2DruDLs9i+rjBfmjuXnFo5eJ?= =?utf-8?q?Fya9l+RYFYQWLK+Vd87w8GixXOWxIPbgNqc3f4ylMqGk9tJGxEc/1EaH6yh8mq9nt?= =?utf-8?q?oeut+fn/tteJEHZnnoSqwKPaqsqCWvNzoxAhk75OTsYixnZ/vhBrnbpeWsy+bK9JT?= =?utf-8?q?Fm1B8++4d5CUwMI/7chaB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6tu1xwUs5KQSJINtRtdvCzoyuwSjF8fQ6CLyFEGVd6LW1y?= =?utf-8?q?q6BFsUaIdtLUqDpao0jJhGGnuKGHx6jOW0adUAtA73EksXcQi/hIXhZ3KNlcvhemB?= =?utf-8?q?CoOXgB4mqDswRoI6f8ioLBAcw/EDHVQu6Q=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gd3YHqeZRi1bKRtCBFoUgfElX4y1?= =?utf-8?q?gKvbGsBguzRFRVOQLcvryRbhJMcc3IAzsm6Y8MJGwH12n2HS8y7MScqlI1BvMay7x?= =?utf-8?q?0c8L7ebQoQygS1P+C5N002ULeVF4p0F58TbRvxw+eL9RJHkjAks1r8uSjPZKTJwB/?= =?utf-8?q?9TjmkD1JxObtIoU+ppJ0CM3sMc0nWxrcB3MHVFhSxA6r6jraAGSfGrdiK4cx/917J?= =?utf-8?q?57kWRJwaoDKBNI8LICZmrHjjCzsAkYAWBJDMbRUPxsCH3FExMCqnBAI4YAp61/ac7?= =?utf-8?q?BXkzNgW84OU1bhWufSOANKHCEcqJTP4umX3So7npGDinARihJStq1k/dbjGPh+8Lj?= =?utf-8?q?v8pqCCNF1zO2y+wk7wAKqWCIpAqQdQZ4iiGNPbYHP9DJm5W0mzwJiqLLPeqJ5okmN?= =?utf-8?q?MbhoKduQNUEdhhK+dky0C+gKD0HjkOd/+xLzVjBT7VFN60+l0gK7x9AngP9bBVVI9?= =?utf-8?q?wCkN35biadyvu37nZzN2TdAmT5UJ+19gWIPE/CKKHedX3OORg+YTXiM+mHa2A19SE?= =?utf-8?q?EhRyNJFq4yKFEoD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vyUaHE2EXP+BZ2rOqG+2byBMxpzl+i9g?= =?utf-8?q?splNZh1LKBH0jKgjU1as7FtIFEJfrGeatzZbCSFr2Uuo3dDMOwcz5TNd4kAgXoWen?= =?utf-8?q?oZO5eOdAmqPp?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9a7c7fb-bd21-4b49-02c8-08dcc0684b7c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:15.6910 (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: e6NTMQJNAn+skfnkAXOPDD+Vz9cbW6H076g4axp7SSxnJaugQqEAveTpBvYDpQBn121YlIwZi0BWDAodMdK0PQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Mon Aug 19 16:01:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13768543 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 433D01779AE for ; Mon, 19 Aug 2024 16:02:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083344; cv=fail; b=lkfxpEOdCrEdO0qG9BFd6yufiy6xmbD6kaRcDZcHsSx35yYKLq7SsevbHhVvy0h4vQFC+KtyJBXmRlOvJc7im+VNxacezfpNM2F0bWYaShR6uGz15n9fXEhw5mU638FL98w80NLrB8LjUR8RvaelEpp/ADgaibI6XQBtLrLEQt0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083344; c=relaxed/simple; bh=phlwJ/9jw9NpeTB7NJPyHYpdTuYWHApnsz953oBcxmA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=URKIODDYuDrTJeLDermwceGuo9yubgyhm33uPY+i5gXdiu9HLsns5ujvGFPxqvJYe82ClDfyjzseGrjWqWR9quom2Zjvx4ejwWydgEuWKV093si6SoOFOYKLtEVuixePwrR+NA7z5qMUm063cRS2A7RYiZYcW0SezIIGPR6jtn4= 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=VT9wjUSV; arc=fail smtp.client-ip=52.101.66.37 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="VT9wjUSV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jSMUQs/raDWipPcsG5zENM1+XzHEOPakEVYgvVkjWb8g5OWUMfPZFUxodW2aBecBYYqZ+OiPJJl2WS5BGRGnosdyAmwAM+oSBAPOTxpM3sURDGEgUAnivGQCGW6/x1EBqkWOH9PIXoL4ggUEepNKCOB4Bk/4I+xsmrsl8woo/5+VEBFSfSfpCSKdNaefQgMzIA1W/JAoyVjjapj5P1gdkMjTXMJoPQed4NNDPYQvDXqhSWDBI5wdJWdUovLNn2itQHEOkYTEPxB5Em9qmup8BydV0+yhhs+l7mNtz71MlLbayy2JehxQ+ZY47WwGV/bsF43NJB//tTIiQ6rKzuXANg== 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=YXcsPCgaDbznlWHD/b642IHS0YFq4IgGhYPg/l/3k6Fpo7++sST45juLRFfpSSh9IaGPWIS58SM4zBHq9IdSSB9QXXZEH/WrD+W4NKWf4T3jka5x7zgF3rpSS6K9QUOlIVuzREVQml6YTHE7LpcM22FKseRrXniHYwU9yuhCQz+oDOrBg4C8VzKU7uLuy6fpyeRgbEtHOTapBujRDAE60EN5tIObTu0BN80kLKb+vb6IQS8jOlwxIIT2QE5IUncjruWE5kIqTGGYj2Bh2fj3cjAB2SgcnBpZgj3UNmrvisuFznGGg1129BWdYx9vZWg62fP5vod5rJRXJ/sCJbyxKw== 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=VT9wjUSVSwuWc92TMteATOOB4zdN/JK0idyf70hN4GoAdV/wKdVUMiagZnmKhNB10NHM5v8O5PvWfIOYmQgf3JsoKaBlWafL2EMZ+FM3AbFYqI1mG0+/ckCl+geiyGyuh2qqMEt/0pd95P+gqZ+6N/nvLyLR7PpR+D5P0XxbBJf6qIADmj0m/VvniutllUlCjfStAeQSuxmKq8pWmj6ZxDGCSNMxxBbz8/idCDG1mQ1Dz9Q+hIao/hOT4RQFrzajRkFx2ZWmncI8l8R/tdN8ikxRKuf/lIxhrgYQH7DJ+Lgv4X0iBW3olUcsYmdVGf9YSoFC8hDrpXjnBfqYdjtCpw== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02:18 +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.7875.019; Mon, 19 Aug 2024 16:02:18 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:01:58 -0400 Subject: [PATCH v3 04/11] i3c: master: Fix dynamic address leak when 'assigned-address' is present Message-Id: <20240819-i3c_fix-v3-4-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=3637; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=phlwJ/9jw9NpeTB7NJPyHYpdTuYWHApnsz953oBcxmA=; b=T8jmLDD61caEY6FKsJk9EB1yCOsJ6DQjBeSuejdIN9NGKNUu4DuLwCya/eUH2pM8Fz4PvP1+b 9TelFo7AohdCHMr3Q+/jHeOrNCacVcwb71VLPm6CtHpsZobZIT8kRX2 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: 01371e4f-ba54-4565-f2c1-08dcc0684ce0 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?g4E68uKNBnm7DwMoMPtbi9dADNPXQiV?= =?utf-8?q?WeahxJPxiSmFd6w9IZHlDTFEfnbv3oBoO+1jtH3e+X9VR+P8jQkGuzmtFIWbcL4Ry?= =?utf-8?q?jYQF4oxIecOWquQy+lraj4Gct4xPhJ4hrahb9jzeo/ihFD3SjaUpqUUkfCS3x9unv?= =?utf-8?q?K8EJCTz0TYA7Bjpt7XK91R4Gtzo9pyGHkLHakWPg9BQsJuI07fUGMnJFM+z7T1dtT?= =?utf-8?q?HHlTIe2f0WMPI5/+h46qlCi5VZCS9XFmbrMXkRdxYCnQBRhrGPFT40gRSGlMLDLwM?= =?utf-8?q?nwxM6KzeAqH5QCoPvGcIYmCBy+K8t73DoOoTh0UpO6n3UUJLXd+hl8AWMP8tEmvIa?= =?utf-8?q?3pJr9cdz8jFp9uLJ3iipwS8memFTIadzufBH/OJQD1B9+sViXplKUnclo0flYyaxJ?= =?utf-8?q?FuOZhdLZSsAI9Kyga6ONsPXnJ0Wp8OdMHvv5GJ6raEgRCD0vqTbQrkNyDu3/5m2xx?= =?utf-8?q?kFjJcrJD2pL6foeF+no6fAkz/DKbII8KEGFtlxU0fH+GrGc3uytOBaX7n8/YEKi23?= =?utf-8?q?aw1IAnPK85tsMTh1fRBdqcRFR1eb2vZHtLLh1bzPcWMo/PP8TcPTLYT/yXbBXgefO?= =?utf-8?q?26NWZM9gjDFiVvH0SN5f8ZOnN3VSFxSkwehNn3nhqNXoDmItaeX5jRlOulYT59Avw?= =?utf-8?q?wQtQHv2bd10TzZVRrO1hztVWlLJf+/xRfklCQtUU/JwWgi773v5DuAx8iQzBmmOj/?= =?utf-8?q?JktXNADUvtrkYmEE/N6vNPJtm+OZb11o3pYWLSrMqGXZ0NCq/T4y34916/JoDyyPT?= =?utf-8?q?6196jIpzHlCC/hQ+c3Q7LqM136ldMsRP2uGqiIhfLI1lCiyzSURAYcxHjMNT4jrXk?= =?utf-8?q?p2L4WbeVeDG0nN3TpB1AANTPJOUfsorBrOEcBuhow35czkB0UPBys4e4uZXBY2Eoq?= =?utf-8?q?SkJwpWgIBJgePV6Xwy0gxV9BT/Asl4y8HF8y5Sk//b8oZU02jTzk/QAEzxXvH3TZO?= =?utf-8?q?ZIRsk8PJQeQ3vDHkuJn984I18teSR/Ae9pYkax0ij5dZLa3H1uHLGP8yWx7FS6LGa?= =?utf-8?q?I75IcPIY8ObZ5O/7QWtfsLxJyEOb2BZQSpkI6nZ6BuxRIyuMAqWtTm+OcQ/5zaOSe?= =?utf-8?q?NtKYbPxHz87+Nx2N3kDKDrisy/3U+OLGN/mRU2hoflKN7n9TOdOb0gHkRBib/sNpd?= =?utf-8?q?hvX9v0x3VL7jc7vPwPdrEsAPy+clPQHV4S+8L8vvGw5KkLHR1wiXe+fcDxfwnfOCV?= =?utf-8?q?wbHn1aQfdTYhsZzXfwsbuBlCQrs0B0lkr8447HDaynArP/MznObBhtcWGqgC+l5T9?= =?utf-8?q?vI0INTQS4+pX9Go2LUReshZBt/NHefyx3STZ+VzPGBViCDyAZSmyZD/ZpAUa/2UIS?= =?utf-8?q?2k3e2z2fjA+WuAxi7gmX0tg08PAeqrSOiw=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?009Q05ja+0YMvuHImAYggrqUglvi?= =?utf-8?q?x+LQhCNYT+GvtWV81WnLTk7yRrD7a+dbx4tA86xNKuVPt5QmpRu9eW0Jqe60gWiYq?= =?utf-8?q?cxGas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460Q8RD3wQulOTJ9AauhwN8KEsINqxEg+H8baOgI9hrTFBif?= =?utf-8?q?QYG2nIlr+BSjaUeyG3ByWNESvTmlek33r77+KF+W/vkzDhH/0CtmPB6r0Nzg71lkh?= =?utf-8?q?eovYoWuQKneJW+fVXgcFWF9hdvD5+Qy1hSw7KoOZvO/Kje1/UONB/2vySurBPMpka?= =?utf-8?q?9OuYjRxfEO1hU+3ZCYhoONQql2ho685b+IU75PJ9hUrD6Prboywzwn8qxKQ97WbS1?= =?utf-8?q?wht+IOsbJTYWjKnmzND1pdAVqFAt2+ZwTimJLRw+xGxWzMngQj5q61a7V29ko8NoF?= =?utf-8?q?X2DyQbCE39rduwUzIav+H/d+BUJuZIz9E/ZSc0UK8eQWzUkQoyiwfhVXy4Xtau+p/?= =?utf-8?q?lIodEdz5bIYRIVBEe16XtDMaTJuZKM0H7+PsqLbIv5Wt8Tyb9Md5LqfHtBExcTne+?= =?utf-8?q?WFy2wDmxrKlkav3666R/POVgqFtwc2bi/scEtKbSQgdqrmYFk+lrAe3gj9LUsEkBd?= =?utf-8?q?6+03g+lTTXQK9dWdWZnzk0Mf4LDGxS0bFTuml6Ec4t2KqHFSUdIPhuu7jf+p8tbMz?= =?utf-8?q?TGxr+qya5DGB?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01371e4f-ba54-4565-f2c1-08dcc0684ce0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:17.9822 (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: Yr/4+yAui4egw8RTGa3zsIEFZoc5FVL0Uda6w1/x6LgXxcwCGD9JWVDi6uW7hdWyt1N8O/3FR2T8BS05jCSmjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Mon Aug 19 16:01: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: 13768544 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 6BC0917ADF9 for ; Mon, 19 Aug 2024 16:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083346; cv=fail; b=cGSM78c1nbpI6FrpBWoodRPbnLde00OFOOCgphU1JFjSoGUnBnk2LL3L9XoRxrSwUNdsgvw5hisIaZCuQahbVa25wV1wjaeaV0wl1ek/01TLvBJxY/NUdwsd7si6ClGr4rPUkToFcYC5vIgReCef+bUz7EvyrKv+o/idAiABoXk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083346; c=relaxed/simple; bh=EgTA/bzPVGwsyEemXX3hWkQUEBTDZOU6gFrO4erNl9A=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=VIbq2F99/XAmtuL9CI/9auNaayIG14VDWyovBZmB+7KgkrzH7VrtpevRMBWuP0j7OLORNMyoRyfz853Fq1TZoULmOnVSocmoQA/Km3+p2F125l2dex57D2xOPz51qjlXYbLrx/zRgulz9XFhT8Dbix0mxEemUTEWXbgQU9thJwU= 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=mXhZYmXb; arc=fail smtp.client-ip=52.101.66.37 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="mXhZYmXb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ctQ0csCh7jlZ2GGofr0z7q/TZdv3lqqyVJ47ZjZlWtpVR9jQlPMX34FK7v/wJTNobp4u9OGeLIg9JCcAx44jCUckIXGVySIfm+OY8iiJ9NsSUhuLmFAJQBDjeKPnD1qTMThrCH/SKmKAp79a2dpFFVfR25rkrgeEoJA1LH/2Y3rIvXpgbT4iOKoDYEjNZcDQmTFGbneqIjsBh1OGFClXuuwJdsmQgpM4O9ciRNb9gWHcAwhcd69iqvkVzImCEcbgZ0uulXtA6IZXiqQM5KDawsnC610d3v5FWvDaLohTjJueML/eExc6i6RJLhbGMvT6wU7v58BhtDKeVVvssm96pA== 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=tcxdAw4f4CUFIq9bFaa+Z0p0lIPUddq86drQQaYv/eYm4VQtAhw68hBJ8txmd1ex/fEd1SESzzXrg6+ImN3/apmDWX24INnOhPW+V6f+Q9EiERb+ydZjQ2nB+oh+m4UXHDMpdrCSB+XJZLxGzVxBDLbVES9Zfhy4NoQ3OnXvEKT/hCByqJBcqfyXsa436Kb9s+78EIHfkj3GUR6+0BVX6bQIDy/AAyBFuLffhtTLO6CzPmrlRbNrVzhVTrMN9cr8QVM9JrxSt4YSGDpNkaaDi//FDX1HKDobC+a6W/3h2qimlmicu2jH/n8v4CXl7C3xyDoES2Aocsn2E6CCDGnyXw== 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=mXhZYmXbRp7usO6DxBGlPS/aYf3dpuVRLjOaErNv8dMV0ePfdcpMD6DpXP6XY1ElHcrbjYs3OU/nBjSTHJuF1QtKDTU4VlDPMp01DC4P2HOsD16Z2CZpYmAApqDhFvWrC+5nqjeXEJuf4/8VH6y7AlzGkfgP9dV8LFq4GxOG7HJtfnHtPDuQt/6ix01JjlLQEScyopqQnft8OXSxxM+PyXVnQweTYhjj3e7xgx1qwIdVI0E7B7shlEjGqQoRuJbKedWEyjcdiN7jyFbZcMvzsTNA/6WgYGKmpo7LE66ezYF+LF7k8tjMOhAMtGZkyHtGY/1ITvdJ5JRMKkwbGw9CHA== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02:20 +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.7875.019; Mon, 19 Aug 2024 16:02:20 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:01:59 -0400 Subject: [PATCH v3 05/11] i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs() Message-Id: <20240819-i3c_fix-v3-5-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=1049; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=EgTA/bzPVGwsyEemXX3hWkQUEBTDZOU6gFrO4erNl9A=; b=245C5SaZoRsMaZrnL72wzR8YXU0UPxmAMih2qbDLqUW+N8dWcW9+yw4j7b/PpjNRkf+9/C9P7 9ZCCLqKjzLCCoe2iFOoW7pZlxW17gi4tieq2tX04cV4u+/H1LWhMPSr X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: eb21c79a-4dc2-4c8b-0317-08dcc0684e39 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?JzEgF5NfDIRrGFp2+zV85UiC3m418a2?= =?utf-8?q?3fHeEP5RqlYhhidg31J8ijv/PXUD/fw2qLCswiUnbigv1vEK9GMXTXlrVf33USGAF?= =?utf-8?q?erxpzAnM5JnTyB9joJZqKBJ4HnnLoqMFz+2Grv3NTAHpe61Y7qd7DBSa7KOCV6hWQ?= =?utf-8?q?ut0Ic7OS/XYOVp0qCYv/YM+s1Tk3ZGcnfGsjmX4a2y1LGvrtYLqox12JoUZUFhrp0?= =?utf-8?q?Xuh7dgvlIb/bM0reGT0F1m3CqCzUFCMGsp+CsEF95mAmUumZbbkk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Z9I3bCq3OvhSrzUIKpCCtP/OfIU?= =?utf-8?q?aqEANMfZtclmlKYsCoeOHbG93oasTgj89eKyvOHaM8AwMb2vpDh0ZIP+0xSP/b40n?= =?utf-8?q?SLEA+33Naueoz33eik2PL6Hj+z3MNaapWKq7MsfJQ4asS3zcILjaTBiutVq3rTdgL?= =?utf-8?q?O02d6wtHWK7W0C5xx2mao/whTg9nD061GrgFHKRHt18Q0z9qhw6AZY8maQNlj08X7?= =?utf-8?q?cNFEyt9YFQZLvRBHgQCyEt6jCzceb3xwlw=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?doYmLCrJOuOV2s8CP3GkdpyR2q/a?= =?utf-8?q?5wu0qYcToQBgD8LVKVNA/whPsQZV31BykTIJ2yYkLOGa7E0SZNjgErWN7oI4Gh+bD?= =?utf-8?q?WtmyLebqFXEuGrRC/sHMoo7vfxnlH84myYZBSt79XYinzqu+hJjQGtZjQ2wYwo13D?= =?utf-8?q?L3F1f+NA3iiaIw75XO8t8MyEeiHOJQKou4e5n488oz+e/AZXNkcBIqVZg5TtAypXb?= =?utf-8?q?4pA5Xg3GWgm5/e6zWVveAuDuESZOt8k8StHLZlyFLzNLoKEaXKyiD9Vj00JNZjdGc?= =?utf-8?q?pvcJqKz9V2+VWNFlywzrD9eMF3Kx/TqUTQ6e2fv1j/YGQtf6r3r3eH3Ubbp0ypuVY?= =?utf-8?q?ZsNC60s5VdJaIfubDPdCgkwvrl6GOjcfY1CcrfXq9oyZmJSWXGePzuZi60CdLj2J3?= =?utf-8?q?oZ20SAAdObv/VjMYCfuoWsN+oxlpEg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NVn8LkhHcMBS53ltFEwNJdqIsshZ8TUcOwGajx8Oa?= =?utf-8?q?gVMqpQPe//ocuFhyzKwFIC9itBOQtmEgHpM7vtX73+4xGraVf095GDovQrwuN1nX6?= =?utf-8?q?Jg3SvCmy3yc3BWagmV/rUIPbEJ5kbr3hfTFEh1NydI0RxgXAIEdlHqPdCuM3NGF0n?= =?utf-8?q?tDSEw2CCX0MkquIq6xTbr+mNcrH5zv6zu7uJdKEhBqIhl6Z1euGZcwWgjQX23M7pU?= =?utf-8?q?ZsAcij/8QtsE?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb21c79a-4dc2-4c8b-0317-08dcc0684e39 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:20.2541 (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: e1n3lxORKPN+KR31KAHetuU4WfJ1/wSDzQZ0LtuKmiTJEdIV1AwzxIGbZ0PdBMS+UaDaQb3wjpfQ4fFhd24wVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Reviewed-by: Miquel Raynal --- 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 Mon Aug 19 16:02: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: 13768545 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 60BE117C233 for ; Mon, 19 Aug 2024 16:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083348; cv=fail; b=enF59Kcj7ouhWNunepg4s1PT3w1Km/q+fONlaKC3hJhjFgtn2hdQNf43hxhHH5uJPGp1WXd6PMlea3EH5XiZqWhynp4VKmhDBB+FxdX0re8ZxmduL0OX5fWnDCc5cEMZsoAxKHnuckzPNDFULdo3cO/X0hItzLU02R3YKpF0u0k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083348; c=relaxed/simple; bh=An63rdNKf8siEFmhpUTOtrd2drbSwaCzp/D7qZONW80=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=h0iUyXG4t/Yttb09z+KTIPJxFF6JEp+ecRtlfuh9U4/CRucmoF/EWGm4vbx6KKPmq2mkePa2yskUaodGwN7pncNPZNt/vKCV2f4dilrzacGahgmStSAOBGBzt8Z0bXy3Db5zcea5pPrR+5L8FrW+pzhVrGWKjcmz119exISZhF4= 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=fZJg5PRY; arc=fail smtp.client-ip=52.101.66.37 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="fZJg5PRY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NsReliGiUowy30l+4RgCrLFb99vT0cnfktYBq9iJF7hLoj28msq0gA3nUXXfos3JzyOX/s8rrWRd8ZAuLRx6y8sRcd3i6cVbHrOB9uhqcLsHpFUU7aj56BGjMoAOMsyuyPW38OKyI8YvWF3gu2hHnoTvrTwALP2ddpFpv+EmlsVHYGbX0ddtUuZ+RY1sWFVh+S4Bj41td+QVnJd+C12i144oPdeNf9jTP9nHIxRc+6oNTl4nJaTdetDmVnDnH4t4iLpM2F4ERimCEHl0iOiVHwdbE9YKxuIhTMvXSqXFkmL0V+FiDhtx3HKfDywXuacXrwL33SNy7ft2Vn11nuZbBg== 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=psJ88Gb4FD4lUAbUg/9rOviAsw1/2Fd63jvBW3I/fwpQZhXcInQV/VLiBHZkQgpokk3ZjcocedZtxntSIBE5BlgSlAUMs4fc/Ci6oPnoSf8HjJVGeqqXfFh9CfHJRqUdfr6lZJY5NVKLoA8Fy/pujOpQC0aTObE1cMOYrGpeKAThT0RI5PP656WwRy9aaK08RD8mgKumRFzqufRscw8zLmgvv4xVlPhTdiW+nJIvDVKpMwxZEnrGNBYsWEFVD7nyqyUxoCtr4Ee2lPh614A19Ousk8SKRaze0tsa8MImui1xNj2zFnIluHyel11XbFj2LjH7JARbXRcaZVmbHlHDHA== 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=fZJg5PRYWkOiN2bC8h3UYozQjeW2SY57hVHkcsaoCOOBSr2tuTLjBQmZO2hLoUqrst33OBZ/DCsIN86hqbAaxMqm4HGP9Oibq1rtLUIWbVyXTizYVRlNouD/Z1+U901fvH90C5P8xFvUQyodR2Q4377GmI2PP9Yav3FWXwP2qNJewjFinRk77II35eiTIZ8j2iv9/fDE/xuXd7fqM2//tqCbT8LngC/i/YyzipPdS2PfBzIxYM6Q36LUEhU+POXcTxdjQQRw1yv/gZrxIA3UJUy2H8w/Tj9tQneTSI4ze5jqiNWSJLfAxuIp1gCLNj4lI1tYXW3p6/rs6/6tFw5llg== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02: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.7875.019; Mon, 19 Aug 2024 16:02:22 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:02:00 -0400 Subject: [PATCH v3 06/11] i3c: master: svc: use repeat start when IBI WIN happens Message-Id: <20240819-i3c_fix-v3-6-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=3542; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=An63rdNKf8siEFmhpUTOtrd2drbSwaCzp/D7qZONW80=; b=U2Nu86+MwI/9suQLnHtXPMrp2ou+GnLcJelxmoeibsrAu75XESa3qrNRY2K5Aj4Bq3gim7jEy FWMd0ltnxafDYH4Q4K6WvxdtSjen2bIeELbiCZsIz1O6heU1WUCmFhR X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d1fa9b3-01fc-4168-9ba5-08dcc0684f7c 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?1O/Jder1rVO3CtDkqACZnoPGAk6k35b?= =?utf-8?q?3dwrA4LwNvEz0dCweP/a0fxVGqrVrwM95CyyNz0Z2uQwC/go3hGjE+uPvm0xKFsH8?= =?utf-8?q?x+kBaQWycFJ7PaAY3oIOjY1eAvrK8n8KfpsIeXjnEKd+uKwdfKc+k0T9YtE5FYMfo?= =?utf-8?q?PNu3p5aXrp6yTDOog9TIO2Ixp3z72iFpqbdodt+90sbW3nuzOW5AlmCCDt+YaczSJ?= =?utf-8?q?STpHBrLERErOAXcFGmNy4rQOOE42JAwyFGWz+dStAp+jvBwdTgHoGVa4a+IMqAZzq?= =?utf-8?q?pdvHC4iEhzMnLgKDOMgHC0udwGU5uqYSNLfb5Gqd4upMFMWszjlK+vPF2zfICxHld?= =?utf-8?q?3JebNvk4h/JHNe+pAp+owhAqx3FpAoa8s6QKd+As37aaZ8beE6w4RByYWjQDdv+o0?= =?utf-8?q?W9HHDx6BI+Fr7/aSGjYoPQzUCRsrzNSmR1loWg1c81prLHO646Raw3qNjLfKU03dC?= =?utf-8?q?erk9KuBebaI9Y6EtXvXJsvp05CtmHdCVlsXa1u2OmA7Mp5VndmxANbgNgQqoQcaNd?= =?utf-8?q?X9Lvy2AMl0pQvcp198rr2LPIdJDohYJs3r9SMDBuQb6ebWh7MEg7wm9mOyXQdQcWY?= =?utf-8?q?hrxQQH7feltVziKMKXiB12CuwBXSOsJs/8Y+NcJMWoDNfWMO7sWJDQ6OlyD0RdcAE?= =?utf-8?q?i2gYUKuiKUD6LRt4dJ+MZtK0MA2EMGCF9bIMZzAnofZYt3haL5IYG1PA7nanEgRPI?= =?utf-8?q?7k1Xu+JbwhF43gXY4slUd9xtq12AELJCGeu5q2ZUUCndsrVHNi+OzPcPbPqw6mN72?= =?utf-8?q?BttqelaqQIGAw7XWVBYTzyDbiEU6H7K5/qGN3oPCdU4z057gkrAMPN78AqvYCXd7t?= =?utf-8?q?E5lovc7aShJt1/ykuV4walwN8V41qtahbVqx2rc2op5WvvO0yKXKITKCk7IOHq39g?= =?utf-8?q?qD18Pg1Vj9x+s2/2AuecUKGMcliOnfT6Hxf0RSiBowQLNcwElKHZzg1pMKyuwQYS8?= =?utf-8?q?MNryLvH5MhkWEpt7LcsBn487cjZ9wjn4J1N4EryQ+4wnZfe7iXhoGWOOWRBUeywnh?= =?utf-8?q?1jvGuryRVep+G9cXG5LZ/rUh3peyTgd8wOdAxOn1PUNjpU3oAG7OVN1EKisYqQ5eG?= =?utf-8?q?r4DPzZe1vwOUhooGnGx6EQdiNY+LSMvDY5b93ukKDFM9CPGV5K9veTdx5tyuZBDNK?= =?utf-8?q?OzjyQtF4ShaiGMGhEP8bYTwzIRaozvX4AOuDELkKQxYqSEwUw0jlOlP1pHXKMkg+k?= =?utf-8?q?PIyuAAIt9Fax5ZulsWJiYg2CsfcpDB7zbNMr4q6oQD3qiDJF7mUKwM38wZxBIdxtR?= =?utf-8?q?G9onr1gMYKkxpSeW5dtL88S6KUjuKi7mamzesYfPD6M2UsS7REFD64+IbZul0Oq87?= =?utf-8?q?1X+BMiA5QWhpNlqr6/SJqPDZaf+mub4rmQ=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Mess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tTt7pH0GzVwT784JaMwJ2dYVdOIZppd3SG4Y?= =?utf-8?q?IIRFaJppU+rKbRlDPA8DdOQSacTa88gK/byPXQHQZHDcfAndJR/kUaT3hyTJz+7Fn?= =?utf-8?q?J3Q2rnRC/88TQh3/yPLxjD84xhNHD5MagYiXIvrdjZmrMmGpnctJyGbAsT1eM7+Ii?= =?utf-8?q?oDD6qb5oThIp9yEEfaLScxzIlXpXZVzQjYvdV9xVkwVysiJlQeqZyh/NmyjlBSwGV?= =?utf-8?q?PiWiq3h6NMkXPCuMjV7EnN/ZOdsq1/2qYdWOUBFqU/rSQzMIcFRvQVPmdm9+v+jgk?= =?utf-8?q?aT/c1D0NYD5bxhexLe6Bg9jmg+IKyErsQdsKTgsugjevrbK7nhjqlaRYOZwfvVDZn?= =?utf-8?q?kaPnj7aEsgAHgQAtS66bZhbnRZELVRtqHxovEQ0Ckkg/lvwSrHckaq1FdcWKyNv9P?= =?utf-8?q?gZnVdfVGXq57rUVQIaxFg7sRUF3HJMosnxHp4yB8NpA4JmuWN5sFpUut1NCUgZGiG?= =?utf-8?q?aEi3X9ESJMhBzJ95+1BsaZHS9ax+u0kIwV3h6kvU1hJklmj/7S1yEd/PtyUUwd1st?= =?utf-8?q?QYuwoJZ9vzsml4jU/rU2EfqhCcZqs+bQEmphR3vycCyn81Neo5ge3cPYIJW2dvrz7?= =?utf-8?q?7CBMcpEtCh6VYjbA90apyZ9VS44+PEZNL9MTv8+gs+1aQ3JuVeTzadQDgbApGeC3Q?= =?utf-8?q?3BTLXJbyBOna?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d1fa9b3-01fc-4168-9ba5-08dcc0684f7c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:22.3259 (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: 1/+C04wQwhAf+mLzruQKVhqnAFKq5HFl5CGvkKy1EhBhauxBwLMY07EHPzsKZIdqrj1QE9COpHQRAnVckUWd2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Acked-by: Miquel Raynal --- 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 Mon Aug 19 16:02: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: 13768546 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 6F3CB18784A for ; Mon, 19 Aug 2024 16:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083350; cv=fail; b=flUE0byv9HIkog1Q3xaB0qVVG0yXeUQBfaAnDgqJM5aZ8T3SK/sbbW+VNMN+PRvX9ln1SVcrro9/dVzO0wWhUSaLsz6DzirSb8RcOBR7RJrUnWvVQ+5n0VtCP2Vb1wm7LFGUsFAgiViQBPjr6yLKWAjBsqnkYbm2rENQ+vaW+P8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083350; c=relaxed/simple; bh=wdMOaxvdED4nYxZmlnJu7BdBDpzKEEzpzk8ZMhb0ahU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=dbOXNQFayz39poTb/UjSlh4G/XZv2t+kMf0QD7wfNTE3s9V3TNFQjfctBNWCOLxi4cyfjst4OJ9mHi1meHgkA9RDpD8C6WrKMSp7rIXmgizWKQh5ggkH4R1kai+416JrWyM4frqgFI3bHRrD24TnnYUfY1sxlyqweLUHuM+6WjY= 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=XPhj33h7; arc=fail smtp.client-ip=52.101.66.37 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="XPhj33h7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PoCDReAd2Uy3ICMrqJbZIgBqA3aDaSqjypTGXqZakchjHnu7XE7HUsQ1Prf9SyrFYnrJ9W1XCGVODaSOTjZeKpVE0qC+oYIoF7+muuNwXknmH7tYZth2n3JGPowuooA4cR5/SeZJiFYtjVe19BjCBwOMNN6gbpw3ltDeMeyeUgKgq/D6+3sB4dQNg9aap95UMjchpnXsow68UlB1EnjSBgaewGqotZjNFAWEiJbAV2M1MNq7lz7MVWAE6Fde+Ddde6dwG9m+2VgusGH+DIn7Rq17p4q5KjC5Dl2qtNpNqQIqcbm7suJIr4WzLJohVLlWfkI504ads97B1ZloUXkwUg== 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=Yqmy4WDgDHLRSKYGFneRE9dgO8lc9ERl/ymSafzYvv4UbNs47BUqJvRvEyYiFCUu9cJumqnP15p4jThtvRrViLZE+pCMmzhGbEEwFzJLLfjhMH+RbltPKTJGCJYI3xfdrls3g8MAX5HMEcYzxrGaLOW2HPi0n6CfSx2BXVt2ckb9TonvqDXMg1rm47dAARbYMXs1ohvPKwxGbnpcmg/bsVsdBrmG1XQlev5NIXB8ruYe90oqRCUlPRE8OyjqBSRdAmoXSyb3tkDoBb6bprOqOr7YL850Pi4ZHqX7/1tPTiLooeIcbGjXnCYqjbl2/z5ttLCxXr2tWyyFe+oFUmadMw== 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=XPhj33h7SXSOZ1aJTfq7O7nDlUaqVDfPcOP5sgySnTZbsNBMuGMVde4KoAWXucN/hrimW7RECAqDuQKkvV+wjP2ue3tfTGKqiTgT/2IZjI8bMlbBJo0ZCgfh+0FR6kcOzTeuiVdxx0qMdr42GEshml7RmjCIMZCitnsQjTairJyhadYg34AsRB3LYSv5ZcjIjvOAtnqKBM2GRML2bE1B8kMpn7q4ma2ozVZoE64WBHdQpFWplqrxB7HwryyzU7l9EYqH9sFzN4XZ4wjCan15diqqdzpr5q8yXEzfLc+xcqUSWaKE4Nxf4oBG8mMVNvpURlGbpfVnlcHNBefKgU29Wg== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02:24 +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.7875.019; Mon, 19 Aug 2024 16:02:24 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:02:01 -0400 Subject: [PATCH v3 07/11] i3c: master: svc: manually emit NACK/ACK for hotjoin Message-Id: <20240819-i3c_fix-v3-7-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=1762; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=wdMOaxvdED4nYxZmlnJu7BdBDpzKEEzpzk8ZMhb0ahU=; b=A56sFgcvX9sbc0McVV+FF39qyIvzaJ3q29C7EXlzuFph00h+KCPaKoJcZwn6zRH+9VG0+5nr5 RzmTz/NrbVcBljgxIY2ch94IWForttrCfjQq4dh+QrJZ28MBSHMtFWJ X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: b14d999a-0810-4ff4-5b24-08dcc06850bb 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?a6lMDl9maGy1NCtV2iC2rtwA/ttdtTd?= =?utf-8?q?vSMjBo5o+orqTeKsVucJt5T3cwFbccNxuiOzxtHC8cxkXsqn7LtpIQZiAmyrQhkh+?= =?utf-8?q?jCSPDBRmXHPlcHU20uZyq7P7xvxh2D4/g+Zm//Imx2PuV5q89+gJzV1WbQW2oxfye?= =?utf-8?q?7jiLWPYZWZwkzVBU63tbUfOyAkrmu39aHRS5NSrv+lykWFlZkGd0vaVnA9NS7kLww?= =?utf-8?q?NMJCVzKO+DrbRxoCHZ19o/jzZChbg0Up41kStiBGBnf7tRAN3FNobiYsz+tQ2L6Yq?= =?utf-8?q?0zXZiJN1X0lIF+PwpMhD2vpgT1PM0QKk1UpaQ5nwkVYbQ8aDOD69O2hLI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Qi3GNj?= =?utf-8?q?1tDBP/0tBFk/arz2DRtKmlwfQ6H6wKZ4wgcq6EdTlspglWLpEYZqrWeTxBAk2YL/s?= =?utf-8?q?wQXVLi+wk5RakhY89CRwyADkDa1ZYyo7WQpzoy1qtsL+3JoBwjsWqAXkPsioU/Z7a?= =?utf-8?q?+1J9Sck0zVjykb44ZjECWgfFO2c8xwj+yw=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?zStpXw4wmZL5TjbpwY+65RJBolSI?= =?utf-8?q?7/WqXkryx2kMKpV2GzkhsozjYyUOd0rf26ZCgayR3kG6tGS56kKJ1MOfM/V6KbKAn?= =?utf-8?q?dcPVIjSKalZ+IFzmEPWgqLfVY/SEcERY0RIWrQdL9nZvy515+tNe23rJSUTQ5nHmM?= =?utf-8?q?GtShv3D6zt2DBcSftzuOAeJbfvsBkCxSQOr8kbcxZJfuI226g/ZXi/US4bL841YF0?= =?utf-8?q?Oxs192pPBZI+HtNY4l/SdrEUarGweaTlb8P5tZ1gj2IM6/44KKz8S+S1H8MXIqa8d?= =?utf-8?q?8Ay+xRfbhTjgO95jr4ZpMZBIaJ6bd+kmpINEtNEQb9t8LdWKDtp7sNYgYB1e5nl9V?= =?utf-8?q?7yiXTTejp1WCx6LQY8IRK4zJZ6PDakoScIGppj7nzaSMqUtlthoLHJlQD/3r4bPAj?= =?utf-8?q?cmuy46XNVBG0tNtJeZva/l6h47LTxE4RFGHVjEJTaA70XH/CWLZNBVFZQXHmVGJOb?= =?utf-8?q?3qiqdvnniWtcX5rdzgwGQeEeRhNDUTXrAyd3IkOY6w9TZp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uev8/OXeVrWMHM?= =?utf-8?q?9BNT5czheG/mfzbISUXxvkzsU+8Cc+T8JR/so/Vn+Y7MyMagmJr7ujry+egKyLhC7?= =?utf-8?q?JmqET+tUJLvAXQv8eYC7rsAZ4njZuCu3aaQ2KNuyh7xqaEv6pCePTK7FX0qrrzqPo?= =?utf-8?q?5DNGmz7lv8ir?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b14d999a-0810-4ff4-5b24-08dcc06850bb X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:24.4231 (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: xYU9coy+HAgHcXCC+F4uEFkCtNxVidEk6kKlvkuQYtNtGg+iS2ACdMGCg1GC46hlTXvk3YtdxnQ8Dk2nc8pmvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Reviewed-by: Miquel Raynal --- 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 Mon Aug 19 16:02: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: 13768547 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 9699A18784A for ; Mon, 19 Aug 2024 16:02:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083352; cv=fail; b=LNEl8Sav6DAcyHq+5tbi2RemplIRZQmFzXNSpuzQm89pK5K/bVG7e0HqObZKAU3LeLd5/PFDPE1LbbBT7niUbEmRG+UjwRAqGYv7xBTTywg1kEpJOqJDhPXj2xjS5ih+f3PV0F/GFy9lFiUN31XaO7YfTuOVMcWFK2tNw2ZPl+Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083352; c=relaxed/simple; bh=L9feF7xb9MUyRMKZRWW6AUoqHkDTiS9UlH84igh2U64=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=AFJfi+AGHtyhyYH6dtuidBwH4lXRrqtI4FK1MpWBnBAvFK3uITjKW1+EWNi5xpg+lhnmHgxyC8kXS7iVGs9xiEAkxgukD5tN4+tAiB3Zv+psinNq/IXkfgFZfmGXI84Z2tVkzlIDEGOrbE9AMk1qOBuy8ApaA9HlKumGmDfl5EY= 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=UiwMAunf; arc=fail smtp.client-ip=52.101.66.37 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="UiwMAunf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UVrr6rVXnlBgso55g6ojoEBnbe+eEY7UlJjllAS8bJjkrii9AruCMp6ourRjXxo7ccFNu+/CScJ9CBqdbXXRswoYCxeEBYf1zPXsTQa2vI7SWFFDGjmUN6ywZXgcBYOLV699FfyWoVXfnpy3tZehkF78dTgPbFlq0YHWdJto3LaNp9q7Gr2IC9sL04Gxiq/Q7ILTOcNnXJ5wQTkIjEgY/c/UnNPrusedlVI/VdXXKG5+YyRfSmWhKU92T6u5fzFAG6fDEfUBwadOE0nah5Y0uwWkEzc21mQl8Pgi+J17gqd0MtvICSXH83KpikBYnBc+WPra+nKcChuUfeXDiAziZQ== 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=yDy/dUv9FyJj+6p85G0SsYlFT5cn2B/mFqgAldrwPDxv+KN0KwqFhd+8si3p01hEGzFut8RmLdZvlM3ZvQl5rD9weMA03/1k7JzIOS5cBAUjybw5c37b5OQ9V7sBIlHK8qXnvJt/vhw/qX7qGBRLdyvMfKRzmlFqh6fr0kEVe6Q4KrXK3RaSrrM5NnN4Wedr2fUHvxx9opviNn76TRlfOgzP2UDyH5/KTvJSszOzP6AUoKtEYOJXEtOy6/aphF/20WpZADUf3TdGZdGhdxiJjLB/v7ST+nHZv/AQPDKuEzrIIEKkohXhjSOUcFesjMG7FMaFWUQLU/9WB2qIpJb6Gw== 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=UiwMAunflKxAOMckuQqfk8BlFUvg9QF9GLDtSOMAuyK4Ld9MIS7vGyglaS3wDBWWtJg2nBVcPLAc8CPxmjr1GVX99/hICxTHl4l/MSPezeKalwalVDDhuSQDJQAwBr27BzcCnIsqBl++mLXeVZmOxUnAKO/BOk2q1uDklMPnSmWF9VLEWefacHOvc6Ex3ieX5xYZKwCjNp8fwhtBvL1xf2Klv3Ptn6tLKRXholWI4t7WdfKxBTa5JpTYV2sDwJUFN+jwnRPX6Xz5ag1HeAUqaO2RUwZGoi5W33Hhjh+74XBHdYIqFnJZDOY/rjYLmgtGbXC3BGdiw7laSppFsBhYAQ== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02: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.7875.019; Mon, 19 Aug 2024 16:02:26 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:02:02 -0400 Subject: [PATCH v3 08/11] i3c: master: svc: need check IBIWON for dynamtica address assign Message-Id: <20240819-i3c_fix-v3-8-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=1408; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=L9feF7xb9MUyRMKZRWW6AUoqHkDTiS9UlH84igh2U64=; b=V5wVjA9A5Pw5QgHVhN87C1yDWHaMPIw8UeE69020BkTxQkBUnqy34E22gr8GofUX03Nde90gc DetFztsgca3Cwx5KvSaq7jncg6T3DOSP6TvXhNYJL3twPEcgkwl+WVO X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ca094b9-bff0-42c9-4ff2-08dcc068521b 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?lTT02jOENexGuMr+U/FnWBU29iYLNzW?= =?utf-8?q?snuJl66irBFXXBuVnHQfwYU/uyabzbUF5r1am+ktNIU7BTU+hjuTSbiS5tGJwLQZj?= =?utf-8?q?1Ma2OYDOpcI4/Nv7LdrGi77JGsqasHrcyxM4bYU9GOZWUZsv6lQ6aGgnOk2ywjS0D?= =?utf-8?q?dMFLvEBNrSjH9ZNxfxfOGQLrvYage0u8KiOCePjXEcE8B+LFAlQB0a3jl4gJC1Bki?= =?utf-8?q?MK3xU4VA9+LwVLtKkoDAjE9JZKaN4leYpXwpu0mVnBBoqdEGVovMH6Qqz8bLtHeBN?= =?utf-8?q?BW08PNkXJA91qJZOQxFXdsg4g3XmrguGq6g95yw34k9wVvIYrYr09zCc5xJB/uGy7?= =?utf-8?q?/XH735ZMvMGJ8kEWKOCz6QVv5rRXYbNoJa4dsT5zYIX57NZSUd2R09dU8O0Kb18ie?= =?utf-8?q?7H4mTpqnAkFoDxXox9wawQYP5Ogkc2pES1Gic7sN7InRESeM0jNKdTkWoH/uvdqi2?= =?utf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vllMZ1U59fO+w58yGJuu5Q=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?vBrE/zJJgzQ63UQopy4m/3hhldlI?= =?utf-8?q?SYFlpMmese4FyZs+zncGJrYnMNiM9ROflD+Vtay/2WUXJjCycAcTafTadGTEhlCxj?= =?utf-8?q?mN+nqxmTOokRWFnCmO7VxdNIxI6gb9oQchnvPHy2oL8SM34gU/Dz71Ccrcg/0XxW3?= =?utf-8?q?VDJwJg+iSWSTOrVQFmTiYlJU4WL/+AAJHAFd7fLAXJPOBoASkspHlrqCF/rlRsKDj?= =?utf-8?q?dP44VNeu9PiJFCqEesbj/KuJ1OiZ3E73P8+0u4AOoK778yhtVO5Fy+vPgkbelNCGE?= =?utf-8?q?UYjVMZyF60WzUDaNlg5ZEGgX3Qd58+c4cNpDaHsofpQDZkcifIvhMI/5PZV9J5quO?= =?utf-8?q?xmikcMwQUiblscQdPnd9ZE5SMcgBV8vzBO7pz6nUN49JUKTT/uQUxWXUDG08qiAWc?= =?utf-8?q?JjJZ7WtE+aLJ2WbKtrD6XY3F5asN6yDOvSrow6AIe96UsZ15pOrYWV4yIiuCiwaP7?= =?utf-8?q?qXAZ1qCd8JDLx4wM5MO1WRe550CQ5bUJdhAwMOR4a8KAux3z3L91tcijism6oz291?= =?utf-8?q?5r8dteJ3p2pjKFdfH9ZoDUqXosCFZFWI60y3CQRHVTROlqUiVXCzwmbJdZHAFLJFH?= =?utf-8?q?FKuEy48WPcdSVD46q6j0udXvLTg6BhvVYWm4o2WiMizLaJtqAF1A9iFjBUEEuPH4u?= =?utf-8?q?Y8lhh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g: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ca094b9-bff0-42c9-4ff2-08dcc068521b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:26.7344 (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: aRs9wuOD4rpvSLYQS3ylIXALAfddWAQE+oFAwjhOW/hzKlRAyneCiG3/JLlLimvgQuf4w+WrBHBbDjXackMRsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Mon Aug 19 16:02: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: 13768548 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 9187518784A for ; Mon, 19 Aug 2024 16:02:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083354; cv=fail; b=ixw6fjFuttYHFubuIyeKljOzuUWs6ylUrwmT/7c3lR8KnqKgXAgJrD+gRcoesTDtUslxoFGGkleBMbIDSzEtT7uDAQMK4pitHlq5QyHQ5rImZnrn7fZMG/RK/y/61QWB2CWO1fjUatLHGHMHtKIbfGyJoR0D8XAZALo7F8VJVz8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083354; c=relaxed/simple; bh=eh2E0Be8sY7V85u59um2EkSafUz25sxM0/X2fX2jZpI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=KidFlc9HPHNK9KGQJKvbFhno09yK8WKtwfVwf7mjx2TY68vVDLFBKLcRS+niqwgVdvnFsxM007Gbni0mFxThYiXFz12mjjkR1/VXxTw/e6VUKyMb15UilUiXvRkdd1Cs52zFX4/7cYl4nTEPcgjzNbeEKdjypLa7We1kG7kFpVI= 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=Y1cXQShr; arc=fail smtp.client-ip=52.101.66.37 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="Y1cXQShr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AetfqVbMgicTBd+zAttqDtWxKoA5uq41q+yEu+d6BAYRHdDPnmFpNINI6C2R+dldvuZ4LJI3RVijd3kZIwtCwrlmsmpeX9l3M+ZeR4SlfVVFfFYqiIq9yZeGeKgV8FlOCwmUt+uG0qAOCdsmYwkXbi5yYopQt+TDKuOgtv/WXsc2jWp8fyapU5fcS+3OH5Dsjkgg7Qm/h8zoUqgKeuAXCruSh3rOCD1vCIYs/xG8QmPmvFEYmMM4a7qcaLHoFVe+lvhtHhMLnmW7UC/ZflfbYbykWZ2F+f2vW/hc7N94a7tKTEh1WdQJd9qTrJ7Uthw/kOHUnvOL1fMYR1Z0oMq9XA== 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=bkqLH9t1HwvkoAApj73Is23J2GP5cc7E3vUJc/jeSqLRCfBBZ5qGc9D3daM+sgO44Kf+FFitiLiYateVgaHx6fVtlqUrMZPPCYqKKcKEtyONxvXet2shIUQCCtrIBP1v54jcz37U+jLybIJrJQMiYquHlr+5dm4syiM7C7DqAhMWQqoivdSU2ANZ8HUxqAunVYUJHl7r+Qyg+7va19JEoPPztV3ppmkGlP8lXVsh+R3qEQi3cfXGzpsLNFSe/cL0DU5QOIm4BDnvjnSA/NTvbIdGCm8GPePwzWCj2zt6CRdiZMc5lRvm8jGIUNiqVSwuwwBdQtncTYRu5ujDg7yQNQ== 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=Y1cXQShrkEO9BVVRzW3Sx/Pr1NuChx+TbdqgDg/jeB3uaJakdHcucCwvOz4sOhotBM/fWGW09xbaEgvkU9P68gBEvgXKqk59tUAAFFpdRiQnxCbBzAtQFTkBdnKlmWrnR0e/C+TYgnFv+SXZcVX9SlhcGosV72MHrWMbzi0XLwZ7FD61C8G7IpDeyBbeCt4oJK514PZ9Kq8z+YsUzribslXQAgmEGLXSN72EBVR3TTcW95fvaTV5TyV7Br3PE41iJ4p/hmydDEJICWAzvqaJAcYNbB52GXuzUecOBnz6IPa9UcM1XFcbD+qqrj0cO3kQSnISs6UoQKs2XrjcZEdyZw== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02:28 +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.7875.019; Mon, 19 Aug 2024 16:02:28 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:02:03 -0400 Subject: [PATCH v3 09/11] i3c: master: svc: use spinlock_saveirq at svc_i3c_master_ibi_work() Message-Id: <20240819-i3c_fix-v3-9-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=2350; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=eh2E0Be8sY7V85u59um2EkSafUz25sxM0/X2fX2jZpI=; b=a7JLHlKiUwfjI8lZ3CTMofCK5gTYMUzJACfZhPpJPZX2VCIhxGci6PHq/KKFxNyO2fjG/JaoH aWNeJ5iCtScBZtKp6F5z0spHp0c1otbnLV6tes6GJhGRUFsTYV/lh/H X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e891062-ce08-4c36-c333-08dcc0685358 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?3zQroetfibJi1+d7UHQyu1pITZIEqxs?= =?utf-8?q?vybG0KBov1Ox/k11oVqTIJEOTyzlF1B1Vc1q+Or9Q1mEW8iz465Jv1ISQbbfRIcCh?= =?utf-8?q?iHnzPCpyLo6ihB5wkiOTdMj1Z3AkvzNbo2tEAmryrXB7nqaVsK5gnU+K6Fez4b/fJ?= =?utf-8?q?I9xXY38bJ4Ph6jHX9dGi9OpbT8nRpWm2+l5+nH3rtVxmqZfDg/RGexeSg7ZWItgq6?= =?utf-8?q?eEY61mshhhJ8vrlMtIgbenITIZLj6MVsIK5n7S3qzzzMqxk58nBSqfVV+lupFbxgM?= =?utf-8?q?aLSI1P5RJ8f8CcW7N7Py8HKlERjlo5U/dBhrILGDEqv3y+vAZd2OUyfNb7MO3wZIl?= =?utf-8?q?giDqZrXJ8qPwn/FUs1JKzfuGhQ4xiYbRPNPbCjvPaVSGV9ivrwzJZVelET3qKMGHF?= =?utf-8?q?5ZtR2y0AbGNeYqnPV91a+fX/3rRS0sN+55F0tsiGAzXlsCtAe7ux8FktUyZE3TWUn?= =?utf-8?q?9dAxEpPiraugihmNn7GuiDx+j6wZtUvVSjQoEj3pgpYcdYwKMZQyc/A71GxIHV4/n?= =?utf-8?q?v+9As3IiczVwLfpTlFJEVW6FDmeS5LJMeBQH5gta0ZXZf2W5BLdbpjwykPdvh1rZL?= =?utf-8?q?BXI6/wouFopoMnZADDulE/FUdNA7uUl437eW3FECr0EiUl49HCFtYTF2X2DvIJYld?= =?utf-8?q?YF1OsdIPr6+OSg5rFLDQSpYLyolidVdvgcxHpjHz6VE2qoCTJ59OrW+kEBZm00kxO?= =?utf-8?q?IExLPByw9oSENV3dFHEXEV1cyeZ3HnE1Z/cGmWiT68GGkztGMzNOgvZ2NKV16iwr0?= =?utf-8?q?jB9G4N6bv3jr5eiROcSEkevB2TzNe0+Jlr8dGfUzCj3qhikh1MKLa0VS8T8KOsemA?= =?utf-8?q?xAopPDzvkOr15BZwA7APL+aYDBAkJ8J+0l8i8d//sAQ0NFQH2sl6B07hQEy68sskG?= =?utf-8?q?OmbQXYYHM2Xn9OMi8ujt1Ainvw9kh+vCm5JGRiFcQogr5iOdGo1xJ5lEiul3wDTkb?= =?utf-8?q?irxpPt1dHLLMqiDT7UN8lvGktSRPZc2b2SmMKXoZRJWHuBquU+YYt8MaOdzmEKBVY?= =?utf-8?q?o1e4W4kGYGxgZWDTmQiguMhmRB89+xhawAiSlrwDAShHTYWgIl5BruHZWVYlRIoWn?= =?utf-8?q?kmF8BT8G342zfszB4E6ianKmIEyZ9Xn0TraoBgnZ4Mkg7DD7zgkPQ7Se2vyGUS7dt?= =?utf-8?q?8MZ+97RFkvT1HWcRrsWzPRUMWGOaecbKLL0Oxj433DneFTd7TENFizKCpHAS45zcI?= =?utf-8?q?T8s46SovVwyiIEXdv5apAKzZfmBcepqSOeAc8YrF2NDply1CcX83gcywWUBekDnZW?= =?utf-8?q?0DBi2spBae+6IewaM77CQno3jQD59SKs7i1kEFFLuFqWOZlQap2NZSYHA3S4TiyqG?= =?utf-8?q?CV5JoZher/uNo0FqmRU773CgwuuMjBVpyw=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pZz/Xo9Ly+0J9+AvhEi2CdAdEojN?= =?utf-8?q?0NXLQ0xbIKSzotc8RqMGug4Oe8cMY9HOPaF12qYX7FDYARO4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EXXuLPfx1ZFzNRg6J4SVhWLv?= =?utf-8?q?yTlanap+CEOk9SQUcwDjBPTgeRJ1jXFEUIZKWg29NZ6ZDEH7c36neYCTiluLHbntJ?= =?utf-8?q?/E1hbbdOSzKc7pBdAdNTbwmjek+FU6cKk39YT4985n+AC4ZsHaI00r0E+tmlAa++4?= =?utf-8?q?vJTQdRHO1E0RBRzUzbniXi7suefPToSdCq2loj7FYXVzGLZmfuCSn7P9oOrN/0Dfd?= =?utf-8?q?CdhB/k1idHTQYjCXKesglR5eOjPAm27+uFzU4UsMSmJvC7Kcs1JR/+AhXmvPXi4Qh?= =?utf-8?q?hx/igDPWAazWoLRtaNymZjpUmVQMlRN/8afL1BjglgQvBD7n4k8IFIg+3aernxUG/?= =?utf-8?q?0S0d5Re+Who8vcL1qOXweS6C/oQNnF5xH0/yk3P5dW8efNgzhTPq57IRY+LgCOE2p?= =?utf-8?q?u4S/qYe58feBNSQ50XGfgWzUcyXztGoAnOW/otL1y//H0rw6RLUo6zlS+vcpPgKrN?= =?utf-8?q?YV4JONFJhrbQn57/4FexzqTxLLq2WZoQWCYJNXryYSipwLYlyWZd53BKCw6kg6T7x?= =?utf-8?q?SpJxNhVSJqhyhR9mFgPWxMEhd0UFIkiGS9sbzntVe95Jyr01yGjO6L9HzjjVelwts?= =?utf-8?q?fo/tZIhWWtjV?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e891062-ce08-4c36-c333-08dcc0685358 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:28.8208 (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: r4qgaa0BI4NL3Zh+cvbHeUaxQnsoYqo/4n+lRZ54a5bcTc1QNul1qBaQg0M5LxqbCyq+MKYefG/Gn1D++OfL9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Mon Aug 19 16:02: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: 13768549 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 B6FDB18784A for ; Mon, 19 Aug 2024 16:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083356; cv=fail; b=FewAUoUYExgDX+w7H+Vd0mj0prTT0oYbi924aCmgAJ67eAkLQKXbqe/HZcG4ftRFXW3iyEmNuR5fE/d+zt8oQ5xf7JeQZOYbr0uW+uSKK15eklMhf1+5bCqyD81jdaGGOQp4CuD3OwvQbTHsHGtwMYhK9JqPjYhhXibejvs0V0Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083356; c=relaxed/simple; bh=Hh0q3o0ccZLTR2dgGNnC93iysep2t/1zblPjKc+L/EE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=c62t5v4bb7Y2ftKyS3Kfdd+iH3G36SHTfcmZZiS87ediIXFwqATYKpytaChVLVjHjxd3swOr8rkxCJwZYpGoR1TAGYd/R7AxGvb2Z3VITZo1uJJEaktKmvPAuQWrojDxSykkaDVCkyakVfAbLiGOc5bPP4QjtqmWr4/o5aaqO2c= 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=eYKAB4pj; arc=fail smtp.client-ip=52.101.66.37 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="eYKAB4pj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wO8Ml8bpm8pCOMfrFfmKQfvrmmlH7wG2mbUJBWJdZ/waYY/00M/VvbhfEV0Rmp4QsYhpNtcAQUlkUxbRPr4p35tg1/Eym2CTXPIcJNOCuUE9PyH4dp4NEHo0TcpQDf9LeJZZrPTSxC76ijM8jW8zGVpKtp7vXmglASFYGNHfMT+fqTCl0hrGHEMxanwsdlwIDMYqLKrI7aXS8Lunb+Xhw9IjROM2671Nrt09efiblTZHG4pUKEUC1brBO/AdElKMJhiIpO9fjCboIO5RNw926JOrupJMiOjtUH2Q5TmQTclxhyqSihv4fnQfUkokxdEjEdrgN1Ng4DVfu7jp6vGgjw== 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=MEdVL+pyB93zAIEI3T1O9Db0QOqRxjZN/Oi8sHzMIOo=; b=UHxvUSRQOVwVzuPUvg6QdSV3Dg/94AVd/IXLDCpYPU4dhZ4b9aH1D74VLMvCN0woV7Kf6d/rQ0NzpIy8h6TdllfMUSxRBNF47+7umvht8eFQlJIYbLo1C7kCLVPhKXEVhQGPXYraiXyOdKzrGRVNlds3v8E4bViQmOSW40YRDkcEQBg6lyu4O4fTThX1c15YFZm/UgFEBoJGA+VCTabXc+44LcVsxq0Y3Am94LRClIHq7c8r8lW/VDHOPvlVEqWDov6aMExsPtTV0LCHGhYQmrokSvMhzrUetgHXxLfjog/r/GLIrpk/FnX9GH3Fnv1BmedmtF5YOs07zgcEBLqigg== 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=MEdVL+pyB93zAIEI3T1O9Db0QOqRxjZN/Oi8sHzMIOo=; b=eYKAB4pjFgSf3QTFZ0YWxv9roZu0FfoPGqcZfZ+yMRhLeSt919KpVTvR0+JgIP7yyjLx38sRTRxLsMzZ75WssE06IH3K9OxX+XNhiMvmE6pcmiJQ0GhXNVjz6CpsRAupwH71m7/AQJsgEYg+zBgHrquVI5qAPxPKrWvLQQ1kaInvcRZXC3e5YcQUO+UdS2WhJZd0NdVxLnQCBLHoMWD8jDwPYOw6sRsKeGRLQRW6du3U9uWISXEORaA/Nx9gQGhcswayd0/VlNWpi5whSMuiYdzxPxzhJ+ey4WA6nNZPFhyLZGakZzEBq+YCIQy0cH+9EbutyovEJMJzSKTSAHN4gQ== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02:30 +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.7875.019; Mon, 19 Aug 2024 16:02:30 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:02:04 -0400 Subject: [PATCH v3 10/11] i3c: master: svc: wait for Manual ACK/NACK Done before next step Message-Id: <20240819-i3c_fix-v3-10-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=3150; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Hh0q3o0ccZLTR2dgGNnC93iysep2t/1zblPjKc+L/EE=; b=7BuLoeBKoGN+8U+MgzzIxW/CbXsgpGth92q7FZLdgrl75sujgcY3Vn770RRHmPkABe5ZpElHX ZKTjPmremckD55edf0juU7bOPzxS60Bd+TmfOVafXzq/946HBi2H9zF X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: 36f76cd1-dbde-48c2-03b6-08dcc068549c 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?HbJSoGhv92u8ApXYAjVdm9mWWN6JLD9?= =?utf-8?q?cQGfJqqfPrHREGpIYWgjuCDG0ZE/5DmG7xXCbgBnm+GBUrvPC33xu+H24R0BBTxsz?= =?utf-8?q?JPUmbTEYVQlczTs/sKanPMXNdoKDpFl65xVrI5KfV1HqQTCCgmoiuMPzjpB14Kacn?= =?utf-8?q?W2KoIeq0Mc+tyS1+Ajev1vJK/fy++k94nYj8P/U0oFhVPndJUW8nvIOdIqYLsAdBO?= =?utf-8?q?batfC/PjOREUfDsHG1kzzNXLFYy0ENG0twNdVsyx+39B0Op85gbtSzCCrLjc9VLXM?= =?utf-8?q?5wsduhzk1528F1Anwmi6ZtQnwdHl4TL4YorPvOTkLKekae/bKL6oTWavyxWXGXzB5?= =?utf-8?q?KpKe7t3b8gbgaTCq3+N/McA77qY6JoLpCWsnuBsNDnDixSmFo8suxh5W0XJW5zugw?= =?utf-8?q?6q5dGV2SOvbEBOX9792nA/mA8gUMH3D2fO5KCQwL2EdAVl/3lTn6S7CapKT9SQNFF?= =?utf-8?q?LRXO+luav2Z7EpPVNX6h4wdSAhGHEw+HRmRORQPCZHk6836H+8k0ITZgB63hO49K/?= =?utf-8?q?9GxS3OoOSTwlJ35DjU1qlMPCRNcU2EUpTC3K+AVKaNlXXM74HEk0z4EAihZ6oozRx?= =?utf-8?q?S3ocJLAGN8VvcinrfM+ND3ZRZW4HsJOioh/4aCls6c7859tMuA7u72fE/sL1g01gn?= =?utf-8?q?zvMtfwgqoasUWErWsSabZjhSMHKjxsVazzdj06COnGXobVWMiolfsLmCKB7FFbZim?= =?utf-8?q?e7e++VjBttt1wdu6WTSWMVPHMma4tXa2SpucTRyr1kbbpQkVhR4ZY/U9SdMmGF2eW?= =?utf-8?q?SCpqR27dPSAlGglZS+aeROLW72tjILn4YEsxx9RIqxOI5mWj4viC4mQ3b2kmxWcAg?= =?utf-8?q?KKBP9HBVODVH3B/5j9Z6fe8piu8NIakqHsPV0vCXHkBuCSS5ZCnweltePuQlSmAXt?= =?utf-8?q?JxMUmdhtzMFQ2Xh7kokG/UAlM8R5frjMlwkqdiJ/f4TpAk95GLAe5TY1ZxDL5+H5u?= =?utf-8?q?f5bA5GYuyrzvzQwe66LIw3o3ntOlVNuLfmRIfeFLQpBtc6QoHmaSQuu0gsmDd9pMC?= =?utf-8?q?3M+5Zv8ks/k2Yumbg2EZnuu31t8WKwqWS2d7RqYB9e0NNtt+aBRhncX5t5ZHWtP8A?= =?utf-8?q?EcXUS7FHtzAEOquEwkC+rLzr1zZyYyTxFMvGmPEuij4dRa1W6zeP3d/V0pXmjYEmt?= =?utf-8?q?Dklk0iOS2d2LxPG2w/Oh3qUrgilBtcXXBHBrC5UcpQlt2zXdG6roZV1LwLfcBy3TO?= =?utf-8?q?/PxSsFJE0T0MokXbNQq3zrztANoL9kzRVmfXudoHFh3G0PSOCgQVNOU9GRArjfMVg?= =?utf-8?q?ZAeRCKkQokE1iz6CgwyAoejVQ5KZ09pdgNlua2aG/eS8m+6Fgwg6mwXYVh0lCYhvB?= =?utf-8?q?HykNu0DBUoPz+wCAzv476SpV3uUUeQw7ow=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?v+YT0f9mdRerNAV/AUX2R0qpIQMS?= =?utf-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sbtQkcJOC7Ac6vXE/g9tfqIEipu4xpFi2vu4pQhkdfFS79nWvb?= =?utf-8?q?lzejTufrgzJOoo+alZhidcL4zEklkBO3lkoP9yJDJQBYiHk42eckegT+E32Us0ShT?= =?utf-8?q?rOTCnaWlZgkgcDJGgTJ3g/l6w2BV9JZZ4a2kDD7qcbCKhHOSkRkxoNlQAwELezevY?= =?utf-8?q?dDM12blYPBEoF1QOr6x+POrlHIp9aH16Z+/Jou4U+xeobrGSQxCfAlHiQc7YhWG4V?= =?utf-8?q?AWNdiDb5pft9ytdTZ2vYvV4nQZeXcuXYmCgaAIH8qohJsCA4wGhCWa9YORU//XZiE?= =?utf-8?q?IhA7YV3wJ9W17g/Aut1YAP95Qou+2cho1gSqBT8bWdO7rVBNwgcgxH/6xrQSLXTob?= =?utf-8?q?SKAOTesRi04W7Mq1sYQDCaO1RZWinqJsPUnJK/98hw92TQ34/PzTqyt7BQzJurnnk?= =?utf-8?q?jmXts94axm67wGO2s5kvPa6I+jw/Oiao09dOabOXroliI15R+ibJEAiXwvP8qT1MW?= =?utf-8?q?tXCc3RUkPvZ5scTglEBVaNNlVVzKckw90R1vaAy9aN81G/yBFuvq88lOm2aK5i00y?= =?utf-8?q?N9gbV3mbZZU125EPniX3yPPhNiAuVbDmUkKiT8BFOIkbZLgjJH5Pl0GfKFMc4n/x5?= =?utf-8?q?JX5H/ptcx8Ce?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36f76cd1-dbde-48c2-03b6-08dcc068549c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:30.9044 (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: 7STn8EcBqX61Fw6yVPmEaWm82TI9VvttR976QGZjKtAzbxUvYXlpbCbDGgCypTUREKon4Z1pQCFpWX5dqN365g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Reviewed-by: Miquel Raynal --- drivers/i3c/master/svc-i3c-master.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index fbb6cef405577..2010495906eb3 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,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 = 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) && @@ -1145,7 +1162,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 = svc_i3c_master_handle_ibi_won(master, reg); + if (ret) + goto emit_stop; continue; } From patchwork Mon Aug 19 16:02: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: 13768550 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012037.outbound.protection.outlook.com [52.101.66.37]) (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 B77AD188CDE for ; Mon, 19 Aug 2024 16:02:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083358; cv=fail; b=to7F2CsrTUgqIZVRzRKLW4AA9AbfWd3AkcSfZTA+5jU7kIsE/CklUlD541DkRbTA/sH9EsnIuDdiRXv8fCVbF8jcsWrRAVEFLc2GJ7wj32yemNLGh6+zfNqEYBCIeZA2IXjG1rsf12mztKcFpRIcuhld2drA50L4iUvOcCyH7yM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083358; c=relaxed/simple; bh=/kxhYgzUferEekPx9wl+SzvtPGPz+R1s1O4alcaJOX4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=WiQGkkiMnnsMXT4TWFnG84okkDcpNHL4yTvclq4cnhPX9IxT2wsHAPKP0V3mtLLTGVm8fiyElzghMv5WfQY1Pty/Xe2NA8vhusKVuSNdUNOGW9ODlI8wMKAYArbWFhZmjxn6oC+OLlVC7WQtn3fPQzAqmKCgEiDdaMs2SudIJJk= 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=iEldBPfo; arc=fail smtp.client-ip=52.101.66.37 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="iEldBPfo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vKLc4nTtfI/DbNMDwnuLohrU5pmnwU7GQMjeS2pljVD81NyAC3B3S1OmB8tIgbr+eSw2aFYbOBbpBF5/ZzA/pYtTCRIvZqQj2/NQrgSjpVsvCqflUkQyPwDioZVaU7N7SglFiKYnBL0Fym+UBFrf01+nJ9fY5MWQA7/kfwsaoiN3tWtcgLDIRenvLs726Mrsm3dLtThAIWhPTyBKMBxSt004JDcgn7QYOgvKpj3RNpFHgrfUGfBcKj1Zh9rS2xZsmj4fqnOwnn+VT4EplpdyHq4Ju6l8a3Odo+BCsT1a0MFrmDYSu3dnMnFJHq/+U7veXu9GoPpDF7hyulvnM/Bddg== 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=05ymFfDlx3mt6M2jYBSt9COY2d4c3YvJgPLK5JzhTZM=; b=c8ggPmEKgEy1wv5qW5BfHrwXZAw57z0W9+rNLUaDiw8AohfqLEdgLEVZhmFIiFk+wuBxhegpo508L5Gr6p/eTSdjpmFalruT8ZL8/oPa17zEgTnAc5UYJVASbydYlbQOeyfZhm7r5ul2iMx9kS36hyljYKRm8I5mPeS0m1g7RvUPw38HJ7O9OMiZWBt4WyajrY46lfhrsjRRT2qHIgRMO3BYjXODHlJzxJxPb0w8vjrEKdd1t2q/tPW8lWUWia84zmbzMme73y6m7r2/WbcCT3Mh3edjxOD68nc/1kgsJk3uC1H8uTe2rf3Tc5OTRtRmjpqVUcjvGVnPgT2oNSXU/g== 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=05ymFfDlx3mt6M2jYBSt9COY2d4c3YvJgPLK5JzhTZM=; b=iEldBPfoPa4CHZSdvVGSJC8AvryvilnMErkGraQB0Gpp9R72NoxzQZmREsSzn/tyKD/tLAsed5Mxw7hGRplQ93rx+Gt569Mad2lu8HE/+mKJqqFOWngh4RGNvvVYHsqYO1YCGQbtWlnEM0gbtciQCbxJKFCVFBBYWp8Zk+WSoPAWUH1ZREeo7SVsa94T6EXl6alJHQ0YOdzVQCGIqpdB6E/v6xaMudH4MI9splMuV7ennHjKCj1zx9mWodLpY5T5lzPS7+KBjvH1dQ/kfdv8YvPWW7SfZ3ULgFl9uw6jcMGZsthWUXh6428aXT+aOCh1zkAhm5HPFoP8S358U3CZkg== 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 DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02: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.7875.019; Mon, 19 Aug 2024 16:02:33 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:02:05 -0400 Subject: [PATCH v3 11/11] i3c: master: svc: fix possible assignment of the same address to two devices Message-Id: <20240819-i3c_fix-v3-11-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@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=1724083326; l=1988; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=/kxhYgzUferEekPx9wl+SzvtPGPz+R1s1O4alcaJOX4=; b=MoBziw2awxiRpomGR6mnOWKnvE75LqKwPWuK71bCcQ8Hc23Zqeh2jl5t4nWYM9vQmcK/l3aic coB0VToW6zZCXZoILMjBR1lJt3UwfIyva6aBZpW0DrZQn3rvfZPEUFX X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::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_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: aebc813c-6100-4561-9897-08dcc06855ea 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|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?346W5EYBo6xrcog9RJazPWkJHNsejAM?= =?utf-8?q?Vf11Rr3IHrnVjdLZ+LK83j6XkRyhQnK4LYXNhVLpLAqp2754pib0bgmmFvEWw7WXv?= =?utf-8?q?BIKOo2bhXN1BVMip+L8g2UsWWbdpN02TyrVlQxUBwckLG2/DSeUU4oJBxPo25e4dp?= =?utf-8?q?G9BRvaJt47Y2gVvQv+zBTE5iBGNFk0LczzAst7FvKqV7I9fYeS/EDrHgPboW/puO5?= =?utf-8?q?C5ktynqRpUJt7QfQP8xYP1u0gv0qmypjPALLcyK2t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upgvTUfOuL4V4urPhs?= =?utf-8?q?/l0o5GWFnLP8l3uYySgNSm5OrF7JTGFkz9Wmx/z+ExxK0swC+v9IZ35wqNHqvAOEq?= =?utf-8?q?3wXYao4/K0GMpEhUJceKmVM8G0xISoDKlI7UWQiMptyXM/pOggANIhV+H3ke6PUKw?= =?utf-8?q?/6ct3L4zrYWRFDeJDQMm82tWGCsbpgVzHbzgS+JZOAspwBGu2H9OUTM6ekCpXuf09?= =?utf-8?q?MwoXY/Ce5dbPaF1SoBLujaTgY+cMAK70uQ=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)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wMifWAGcKZe83zShB4sBoCZrXyuh?= =?utf-8?q?gX9gZ9D74+EmBdLejH1mc97oWgVRvfxYChsEpAbWiOkoQtsZ1Hd/T5n/+0zqnk1Z6?= =?utf-8?q?f+rVDJYJkIdm7VQsgIkvrv4B1tFJMQwfR7b5vI8kaC8ywbOFJOBgmLv/6R8ZZ1k/7?= =?utf-8?q?ydm9VZQ8Re6zEXebf46jxuPkDk93CLa3Oh57wf1pDdAPvwYD9NWUXlu5LBdWdwEnA?= =?utf-8?q?R0WF2juXJoCViv1nKn0yZbGi7qo3ET6BErBn6rzKEj6Lc65lZe/sXMER2NxrjpEYZ?= =?utf-8?q?Dz9YFh4elJd12cdZNyQz4r04Lae7RIx0SvObgPrykANx9Gf5PVvBhKgcTt85z8fL1?= =?utf-8?q?BC9pn8pf/hfeiG2Rg+g+YJEXZqOOkZ88AVwltWGlIDkerplZE9isvSji5caPLrR9+?= =?utf-8?q?rIf7Tlkwronx2HLf2r73J06SYg4UUb8sElL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wUcUpjUreeoe6vaDFyvKIHtrVKx?= =?utf-8?q?e1mcQUyR4rb9TnctkNIC9fU7uWWAQO1AcPC+kOIM8QYpHaPINrpkGnZBtZVbTAGM2?= =?utf-8?q?ZLyvpphwtS1xuajjp484BrqkxVvuCA5bwBNpHs84TdKyvVB/mkU0YOOpFvmpODetm?= =?utf-8?q?JBR94bIX+FqpR6sQIgSMsp9aVC4X9xnrXjbMjuR0U31neBrSfLY6w8Uou4SSYmH6p?= =?utf-8?q?0XDTCqrK0xX+?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aebc813c-6100-4561-9897-08dcc06855ea X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:33.1025 (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: nZ9A1VMGplZ+/0P8woW+FYV1GXQcZYtTrYYf69CDjnYrEQaxyUWJqVSP2Bzzz8S1PzK3Wm5dZaq9OPFQHaqvaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 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 Reviewed-by: Miquel Raynal --- 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 2010495906eb3..003565fddc261 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1042,11 +1042,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);