From patchwork Tue Oct 8 15:18:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13826627 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51CCFCEFC21 for ; Tue, 8 Oct 2024 15:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=bGGhEpcza0w19VTYBtyvbaTPYyciWDlozUN2wVqo4x0=; b=2Mp/SC/F1dVL8M 0gQYBb4zMbk/P3MPm9ZQjVzdgpcozlpnhy3PQbNGfQyftFX4y3XFfHgk8RiecAB0oD9bGYZ1lEXVB sJ5BbusOQwrOy8puLAIMWdEZ1vHS74rb7A9NqwurXhfqU317SjvKrgsDpiu3KqCDOWnxXnuc9yCcv q3CfUGumIRt7MRMe2U6m3W0RIJOnLxZQ6u4pXkfinhOdADSK9JlxNvoqHCx4u6y4Ps9D/4OVwqojh YvXi0BjgNMl6QAbXcz95E9n4jkQBPJDPHp9sGNO8EPNVd36fHYa0PhYOF1wmIisYcrPfl/5btDEZK /vbwweN4Q0CBWTkdsdKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syC05-00000006LRj-1gSA; Tue, 08 Oct 2024 15:19:49 +0000 Received: from mail-northeuropeazlp170130004.outbound.protection.outlook.com ([2a01:111:f403:c200::4] helo=DUZPR83CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syBzA-00000006LAZ-24qh for linux-i3c@lists.infradead.org; Tue, 08 Oct 2024 15:18:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l59dPJYO4wcJ/RehDy/7mGd+9FhyXAkZjpzagxtxgtGL2Fc/h4eW/ACwuktz6SDwEMfpCrNPaS6Yeh2i2n4fJwlwqLWakTaqSPcXwyHzTK+APQMIluC+SncSAZE+lgdtkjGlm1mDOwRYdYdM0k+zHiUw9olebvQ5iaJUB8JtnjJzhDN83pUn0y48pjXM/Sh0wDCf4dA+Y8uQ5NpihDTpmIIQTeYmiliTqFAOyptY4V7DcQuwYb4xzcOUIDrb9BSRIkk/dGs0E2rKhITHayKuuacSWgHwPkVSRUqtlMeUt81qaPWhr+kOpjrsNecTrKYdjt8XCNHis4luHL84Mzxo1Q== 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=7fAfl3zyO+Nj+cRlreqeSBYK06jwDw1fGqD5/PIkPSE=; b=wsLy41OJx14hzMU4zyuqWZ9wsrBAoxuPdvBSKiCI57z/6yo/cq46ji8Kaw1LYfA5SNxVpdFTc0JsjJQhWIHqJRil1T44WA2qcgppVwl0WgF5Sxc0rSKXIDvo2II1MBzwfEXAn+oNsCo3uDPJg3LwZMVcm6xg++FGi8SKNmZmYHL7fwEkhc18SDL7gb1aNMM/BoWgbJh9w8Ziutu3oCCmNmWGrXSreECzy9oHTwtSdEYJ6ryKnRLFBt9YQ97Mv3CT9GX43+XRhJVF0KD35GWl4nrXgIMiL/Rd3nkl8CNZNsAoY55ekD82va+M9twG8fBxVNoJSsWC1q31c84cGA7S9g== 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=7fAfl3zyO+Nj+cRlreqeSBYK06jwDw1fGqD5/PIkPSE=; b=OxIr73tJikAyD9i944SZhHCF9mlRLpaXGZsdvRF5ttGckeevfWxGRFkarKXxJ8MrjWCDtxw5n7CTLwcmQ8qhxyAYK7w9m4XUzQSs+a5sGF1nVQMCLW3Q86ya1hmQSwX89pjrHFzr6w/p4YcXNx/Nz136yF5I472MmsJytbUDbER2Q9AhWFxFDp5v7F1xqioF8wFekbu4MtrtY9p3dhUHNWvWXi8xHszyhUe4WHv1f2Oij+rRwA22GU01nGga2tn8Mc0tOEDuux6uaxswyQZ8vg1J7CNy83piZQIkbFJNqPyx1Ub1ICEYaIG/Nq0CNrD5/ZgINEO+ohRbgKfZGvJchg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) by DB8PR04MB7194.eurprd04.prod.outlook.com (2603:10a6:10:127::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 15:18:44 +0000 Received: from DB9PR04MB9626.eurprd04.prod.outlook.com ([fe80::e81:b393:ebc5:bc3d]) by DB9PR04MB9626.eurprd04.prod.outlook.com ([fe80::e81:b393:ebc5:bc3d%3]) with mapi id 15.20.8026.019; Tue, 8 Oct 2024 15:18:43 +0000 From: Frank Li Subject: [PATCH v7 0/3] I3C: master: fix the address assign issue if assign-address is exist in dts Date: Tue, 08 Oct 2024 11:18:23 -0400 Message-Id: <20241008-i3c_dts_assign-v7-0-96ec93d1f34c@nxp.com> X-B4-Tracking: v=1; b=H4sIAD9NBWcC/3XMSw6CMBSF4a2Yjq3pQyo4ch/GkHJ7gTuwkJY0G MLeLUw0MQ7PSb5/YREDYWTXw8ICJoo0+DwuxwOD3voOObm8mRLqLIWQnDTUboq1jZE6z52RRQt aA0jHMhoDtjTvwfsj757iNITX3k9ye/+mkuSCm8aW2oEssClvfh5PMDzZFkrmG+sfbDJGi6owF VQK7Aev6/oGpO4kKucAAAA= To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, arnd@arndb.de, bbrezillon@kernel.org, boris.brezillon@collabora.com, conor.culhane@silvaco.com, gregkh@linuxfoundation.org, imx@lists.linux.dev, miquel.raynal@bootlin.com, pthombar@cadence.com, ravindra.yashvant.shinde@nxp.com, Frank Li , stable@kernel.org X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1728400720; l=2974; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=+7QPBxnwt2V1GG1U4yxNLheJGHw+eSP4zpbWKxI6V/s=; b=eoYRNB1Esyjox7DTHyU0EI632GB0WoN/RnXDofnGr9T5O3q6X8ew1NdpHwoOfiqpoSco48xlC ZkhCi4i1rYdBLC5NkCUYO3Dc+NpF3mqIBvCbtQmQ4XSfn3TJjfRg0Bj X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR11CA0101.namprd11.prod.outlook.com (2603:10b6:a03:f4::42) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB9626:EE_|DB8PR04MB7194:EE_ X-MS-Office365-Filtering-Correlation-Id: 59aa9827-6555-4764-273f-08dce7ac7f64 X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GOdU4fbr3AkZ14HS56Tyuk/zSZA4CIm?= =?utf-8?q?PzHKAxrkPwqJcf7ZXP4/m8eHFFSdWw/MHYYEeqfe1tAk/YeJcMie4JLE+A4C6jkhp?= =?utf-8?q?l8d7aHhgvFkpb9oy/qtLJyNc/8SstTzg/dBFULSddPRRiH1weUXu8bVXLOJ1hR247?= =?utf-8?q?Hw9JwYme0u39Gy/YrPuOhagOcc3W27XHg1uCw9K0lytXqDvMZLVJEujY3Pf21F2qL?= =?utf-8?q?lzSSazY+qUqEk123sAnLi8r046ZyLS3Kb3R5C6ouOlUwtG02Dc6nqllpORDBHBNpc?= =?utf-8?q?qcA6/MDTLF7Rnn7s0btNAQV+cpZmDHavvgvjPQRdFZji8TkaT4IReFrWbrvWP01Ge?= =?utf-8?q?pYW1pX+wDqy+LexZPCEX2bBY7nkTwfuStqZeFmcrVLp9OCrgy6wR1g0YT9/de2GjM?= =?utf-8?q?ObFdaAFYzDeCQuWlt9cDvcDsjATGneU+PWRRhnyNEQXJ5frHUiBV/AkBB0GP1Do14?= =?utf-8?q?llA10bMX3ALCQ7YfWSOv1q035KrT0CoRuPfl7SPiZdHGyzaT8c7ujmkWH/w8jZA6n?= =?utf-8?q?pYoJxYBV4NyVdGb9cErfHBL+YZzEoHlNDrHluNuBzJjke3+IU/nI2raUXzwlyiZTw?= =?utf-8?q?vg9GxTKbNViyuf/EZ3RrWlJ0v8rXXuy/Sbkxd+6L1mw9GsXwbf0gENaFrOr535Qm9?= =?utf-8?q?JLg3qLM/oP9WYlvp1ShyJ2LzIIVWVr0n2b/rtjsV7oozMsekLCPRdQrPqnPk0B2nY?= =?utf-8?q?W9aNiOlebv3eSCpNWxvSUQde93UfxhwxAO1NIwdfiBzV14KqsEVmKHDsC0kf6vty7?= =?utf-8?q?5uGiSDfAfpfrtdmTnNK6OCCIEWB0nD49+746+9CBQab7PIqE/hV4JmTyzktPlvPG3?= =?utf-8?q?Ni+747Z76D1r3cryzABn2PlC7TdO9K6VLZuf3kdfb1uxjVUvkSa2EXSwTB4DRYWZu?= =?utf-8?q?iSusSl6hzRBO7NpKudBLn9U9XvYj5YugaujdJi4xj4g/G4gHSMwuwjgNTrx3/1jjs?= =?utf-8?q?BejQGZjYVBLj+FNW10prkPc9BnITYOg9dzn1/klpBg6QDe+9erLx5hWRVF7UL9xGc?= =?utf-8?q?pTyBqtoBBa1+7V78JeWhnYinpnnlBfY4p938unyCirZv6IAYvrzhxoFO6Ns2j/3ID?= =?utf-8?q?oDdo7Z46Uj75lV7twzKXsxvB5DLkLbcNU1sqVZyNrT2o3QwynpMHxnGunHwWfgzvi?= =?utf-8?q?c9cCI/xqF+X3SpnAXq4Rs6YZapAqG6XBG0Jwe/GRRt2TZd4nZraQ3FZARlWEAO2fg?= =?utf-8?q?MyHxF82wzYAqBqSfV0tKl8mKXQNGJv+6kQ3wL2LFRaZrEAPhUlL/Yqit4dyJEZlQl?= =?utf-8?q?vZz5FhpQxdnnmCF9SrPbfabs4U2ilTV47MQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB9626.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(376014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?a+tzS+38chRHjCra+0B/kOpxPJyc?= =?utf-8?q?x+UOLce2dgm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3KBbsHjYMbCarXvTKQBWn0kj7baiV13wmnMTG0OgMgTfXp3Q+IrjKY6DXO?= =?utf-8?q?krwtM9M/kTWOB3/V0ZTpxcRjADYio5b7gVGHvBQvw/AvTaDylmL7BHUJGZ3/sw38k?= =?utf-8?q?JKCPUuvZK6bsps4FfJ9DL0um/lR0JINWV/uuezIt9BAMtmg0S4Ye0EpQ5Tkjqjism?= =?utf-8?q?fJ4kMTTG+nWBdj2xbZnGw8gXwMdJmaTKr35dPArMZ4GgJFTDnEfzZVcDtnFuDGsk8?= =?utf-8?q?P7ahwdxYg9LtUmmHgC9Dj4isZ4magmC/XtcuaGsa0HcBmxLjW5IQ83OZ7P2onxDrx?= =?utf-8?q?gLobCRIdtfdYKxfZbCP3n1SOJ7mPpuMnbDquC6MB3gkwS+PohRGbjIzPqYq+8n/Gj?= =?utf-8?q?T4I0Ql2xMvGR9aNzUndhwiMue3ALhpbp/QCEe8400cqjdUzWreld4B7WDQewlswdY?= =?utf-8?q?gZ6PZXsRLBTdlTJ3dHWEVtccL3y0csi63T/6+ug7cNZuZZR1SI/g9Wij7Lxq+C3cv?= =?utf-8?q?55ipnE4tAD2aHHxQtTfihMpWmoZHxbanReqHxhpfimqqkhtU29RyAPH53VZYkzd+m?= =?utf-8?q?X//mBrI8uTG9KrpwPjIMBNCs38vj/ukCOO9mIx11f4JgETXaVbGUVZ3g=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59aa9827-6555-4764-273f-08dce7ac7f64 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 15:18:43.8663 (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: //83gv1Nn3sNC2jbEIw6SOWxFfTOc/G71adzeDPXeqC2QuGHnfOmEePKi1GPOimaaQcsiXCsvlSizlbcccX+dQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7194 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_081852_683630_B538DE2D X-CRM114-Status: GOOD ( 10.98 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org These patches are split from https://lore.kernel.org/linux-i3c/ZvrAuOBLgi+HtrPD@lizhi-Precision-Tower-5810/#R There are discussion on https://lore.kernel.org/linux-i3c/20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com/T/#m16fa9bb875b0ae9d37c5f6e91f90e375551c6366 Basic back ground is The current framework is 1. get free i3c dynamic address 2. if found dt have assign-address for such device (identify by PID), change to such address. There are problem in current implement. If device A have assign-address 0xa, device B have assign-address 0xB, which described at dts file. If device A is not ready during i3c probe, and device B hotjoin happen, 0xA will assign to device B, so if device A hotjoin later, address 0xA Can't assign to A because B already use it. Mirquel's opinion is return address B when B hotjoin by scan dts by PID. The issue is the controller HCI (i3C standard), I3C HCI Spec 1.2, sec 6.4.1, when do DAA, "DAA CMD and dynmatic address" queue to cmd together. We don't know PID before DAA CMD. So dynamic address can NOT get based on PID. When do DAA in HCI, it needs a dynamtic address firstly before get PID information. Consider this need more time to discuss, so split from previous big serial to avoid prevent other fix patches can't be merged into i3c tree. This patches's overall design: 1. keep current frame's work flow 2. reserver all address, which assigned in dts. 3. the device with assigned address have high priorioty to get such address. 4. if all address without assigned by dt are used, use offline devices's assigned address. To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: arnd@arndb.de Cc: bbrezillon@kernel.org Cc: boris.brezillon@collabora.com Cc: conor.culhane@silvaco.com Cc: gregkh@linuxfoundation.org Cc: imx@lists.linux.dev Cc: linux-i3c@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: miquel.raynal@bootlin.com Cc: pthombar@cadence.com Cc: ravindra.yashvant.shinde@nxp.com Signed-off-by: Frank Li --- Changes in v7: - see each patch - Link to v6: https://lore.kernel.org/r/20241003-i3c_dts_assign-v6-0-eae2569c92ca@nxp.com Changes in v2: - see each patch - Link to v1: https://lore.kernel.org/r/20241001-i3c_dts_assign-v1-0-6ba83dc15eb8@nxp.com --- Frank Li (3): i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_DESIRED i3c: master: Fix dynamic address leak when 'assigned-address' is present drivers/i3c/master.c | 82 +++++++++++++++++++++++++++++++++------------- include/linux/i3c/master.h | 9 +++-- 2 files changed, 67 insertions(+), 24 deletions(-) --- base-commit: 77df9e4bb2224d8ffbddec04c333a9d7965dad6c change-id: 20241001-i3c_dts_assign-d615fc33cc1d Best regards, --- Frank Li