From patchwork Thu Oct 3 20:14:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13821539 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 6AB17CF34C1 for ; Thu, 3 Oct 2024 20:14: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=Ad6ReAPGl1uyept4W7Kj/W60Q9lJ978ocxOxrxJiP3o=; b=F891g0rtBEK5wE xGVBuZRlRzrosMiE/n6DlXTWD8NNJbPwfK9rjRqT2UUo6ePWjuMotatQ8xY5udfv0y381sjs+Mbz9 mVG1fa3GGlyrfyicSAft9E5ruI6H2KRqsKIO6+aepSNiEF6etj9i4FbH8y8OCoE/x0svVgnur6Oq4 luRoqY2J/muSPNQ7A6lR1wIhzQCzKSnrMxXUuFh0ofoUlu6yZsxgtVEVAE+KgdaZB/+C1r2n0WBFI TunZvHJAiQF0t6fkCay6ieXwZHkv6bOqFCAudC7NlMmh8PwqnAOOycm/DguoFjwA8VOiZwIXELkws 5JKsor136OLotPp/d4OQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swSDp-0000000AHML-33Nx; Thu, 03 Oct 2024 20:14:49 +0000 Received: from mail-northeuropeazlp170120003.outbound.protection.outlook.com ([2a01:111:f403:c200::3] helo=DU2PR03CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swSDn-0000000AHLf-0yOs for linux-i3c@lists.infradead.org; Thu, 03 Oct 2024 20:14:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Tx6sKZsuzH1n9JyRAx1sBXE8mw8c7TA8ah3pxb/N/1WIBdmj5s6ecPzOJ8urzEK08pRCygYuN6YoG6JuGLb/G02LR2yX+iQASdhfBpnvZWGuvUnX2XRa9yHgE4Da6b5TOFaFWrqsCJ0W3U6knyAwmep4OZC2MDUJwKo6h4YCJm0aoO/Kl4cXbtpgfMJyAFBk5LOQZ93Vz3RdlfP3+v7FX1/5gvOniV3yxHLw6pGIbb7EKk9eCT/QHEdkxAZIrwpByhtkz5UHBUGgjbNpyoaunW6lJCHqctiIRDGTg4Jway4IrozXutc+PzNIn7/uQPL8HdFWtzJKW/VD+Fwy+pKUyA== 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=v3e7x9cLibEAaJLBsUqwYYYpuTR8RvsoOm9bWgcixXg=; b=bpt0BIpso6JdN5QiJnW8U2KzeH7jdqXd+wkLVqUxjHAlIFa5nS40X4yCj/7X5G+xmSL06aPZ9qmrz/X1d8jpTGDh501dsm4+J7odX5bNs3A/okMscLKir+1GsMy+Mh7WHhsX0IF+UkvZhkLu1KupkrB6HWwqiMc1B+0qX5jSYLrJUA+ZLaR53oxg8+9FWIjgt0WNieqcoZqkUmv1m5yBcsG/EoyADlgU+Rs+n68kaCXjxkGQ5Vxvj4QSMaNS7nesuf4nqRHor13rrFHFTGS6aWNhE/cVIts0kX9Gtt7e9yb2T7J47gs97J6cLbPIDbJdUJL+hfKqXlFW3t/2MM7hqw== 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=v3e7x9cLibEAaJLBsUqwYYYpuTR8RvsoOm9bWgcixXg=; b=oWFPEF83eXeP8VDgeVVecmQSRrIm3uQIKUwtWgI5a4vyPPMbtqgwVfXKm9IFUL/DjOZR9gKuWCG+yXenhGkfz5bbQ49SfZnQCNyx1PtmTUdNmKwABOaXAiRE6O4vES4RPTGLCrVr7Cy0yGqvD0NocjyT9cWPHfklrhw0SjWd7A/f6HPTed9ZoDV6KY7KXQQz94WPTUApR9f0p0bkjzzbERSRS8LmPIBVCduI8APQCpxCUOjrqcUaK1WPy7YZeKxeLP18wAfv4bbCdvbp9fPL/RSPGfvAdhqhO4NZzJSp27DlFmlLhhKJDL0QfbponmzibDGrvXyI86+c7++FkkLjeA== 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 AS4PR04MB9291.eurprd04.prod.outlook.com (2603:10a6:20b:4e6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Thu, 3 Oct 2024 20:14:42 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8026.016; Thu, 3 Oct 2024 20:14:42 +0000 From: Frank Li Subject: [PATCH v6 0/3] I3C: master: fix the address assign issue if assign-address is exist in dts Date: Thu, 03 Oct 2024 16:14:18 -0400 Message-Id: <20241003-i3c_dts_assign-v6-0-eae2569c92ca@nxp.com> X-B4-Tracking: v=1; b=H4sIABr7/mYC/3XMQQqDMBCF4avIrJuSMTVIV72HiMRJ1Fk0SkbEI t69qfsu/wfvO0BC4iDwLA5IYWPhOeawtwJocnEMin1uKHX5QK1RsaHOr9I5ER6j8hargYwhQg/ 5tKQw8H6BTZt7Ylnn9Ln8DX/rX2pDpZXtXW08YRX6+hX35U7zG9rzPL9Q7CAvqgAAAA== 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=1727986479; l=2848; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Fn+xUFtUNC4/pC9Kg7zC3XBaOt3wtdtlXo5itdLWzaw=; b=AZD6hOV+dyTjy+/An8j0rt0krZIDclUj9O8ZiXBaziPx2dTLqKwirt4JeySq+9QfRW6Cc/j53 L40c5ZqjGplDZb51ib5yUBmMm6eu0LNzDlcMNxjZPaoDJZRo5k3yF9P X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY1P220CA0008.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:59d::16) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS4PR04MB9291:EE_ X-MS-Office365-Filtering-Correlation-Id: 42202554-aec3-48d4-522e-08dce3e8044d 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|376014|52116014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?TIFMo0KD0vsnSM0PJwrWCfvfURWIxY/?= =?utf-8?q?5rDrKmZ5XLeO/QwhIY6IV0GJ4SAQ91MzDJiuxC8DEFEpZmJsueqZsa9XqlHCA02s8?= =?utf-8?q?8vRuxWEFYxTB4er5fX0fj/M/DR0qyf9hH6iHezH9Lp35t/GerC0sPSSbOd0FVpAXZ?= =?utf-8?q?etX0RU/sCLLrZ8S1rBeSCL3a7VyffUruR2YzJkBUckNkcrOyIEsXOoNKnkTfhjTaI?= =?utf-8?q?vHGQcy6lfQMmOCUDhNnL0Uc718kvb2oKGbCwn2tuAuL4pFM67heEph6GyuJctSVci?= =?utf-8?q?yHEX/ZCKjNCOHFd1uE8tu1yS+Qko4tVPNGrKQ420mZ0c1JGFlKcRl6MAaiRdmm2IO?= =?utf-8?q?5N7tStSiBFU65fQLF78ek62jpNVqQrnr/66tpOwWMdXcFeO6i2jGnB9K6zNXvmYyp?= =?utf-8?q?xrWdnsz4kC56OnbhfPu1F9ZufPvzLrtC46Bhr4CQZ9IomfYq7cLkz+SDGIl/crnxd?= =?utf-8?q?FarWmDUeI+YmutftIULGBI3s8cnyuBuSSZLbTa2XqjPhCPp+B0/NUKPLf8LLo6yCl?= =?utf-8?q?spyOH2b3HRp+72yptMALCM8WQy6391nPdLrHIPkUlwk390e9GkgDxpk2SH/rqZaMg?= =?utf-8?q?u6NLOtZws9s6EHhXQ5hTWLHozp+5TqoNiC9vWvNeOTZcOE1oPnZT51N6ibr1U9gAQ?= =?utf-8?q?ITb4cWO7cVkTtUs3XXy/Ccs/RyY3pJDkdpFyY/uL6X7Kc2tZNnOC35ajb8YuAEF7D?= =?utf-8?q?udjsDHa22UekWsv9im2JUO11Xadmr4Dwetz5EIPWXLyNDpWF0iDFzPf6ZPM30P3Bs?= =?utf-8?q?vVIzK3h5sT7xQMWwaF+5tXPDZEuE9xzsJlSNnfIZL+/xZR2pFdt/vQ0nIqXPsKJCz?= =?utf-8?q?dyj4kTArU589m52YAlX3s5tyXjMydSQB4JBfEQbvIOEk7fiSXKizjZsBChRmiamCf?= =?utf-8?q?DsPRXyKCRk8QI+V1oPg4OtjOPjk3TZUlF8p9HHEcfg4c8SybzkfhkvyyoJ8aRDFxm?= =?utf-8?q?KxwNWR7q758HnRbzfrSSG5yuPsnbM6nSu9Ph0UfUD+54Cx6s+T2m1idD9jgypRFTL?= =?utf-8?q?LnZsnOpaUZpnQJ52/mLGLqFNSUQM2lzHSpN+mo/e6FKGkMPXbS/B352+yTOkdsrnV?= =?utf-8?q?HNu+lXUbKXjFMOJlWEdvJUrmcL+BJEYhLyBdc7YOLw62AeTjACYNSU1cCSQOCzyur?= =?utf-8?q?x8cH5WVxOLRR1IJnKlT9l15mosOdfTecaEECqoBIUr8hYGXfNqaelP5XZcf6xlnAo?= =?utf-8?q?qKSmKzSMoQVra9GTb1NJ6K7zw6F30IuJzA2bYCIrNsCfaY9JblP1p/4DBliXh8zHT?= =?utf-8?q?APm1mpQYJQz1VAWO4vG8zgBql9tYctlF2iQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?5wKHmAcMbT3Zl+Cp+L+jEdBgH4Nr?= =?utf-8?q?isFcUd1i9/gsh1FN24QKPP3Fj/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EkEFghIFTCufMN74/9+F6vtSH4IGUgjpHnijmUWSHZpjpE?= =?utf-8?q?H2m0sPXXM2OX5N4sc0yKxj5cmi9qb1LMh5Vl+c64N6oyJXAW6sRHzrlImxKbA8B+K?= =?utf-8?q?aq3YTtUvFnwA3Da0uw8T/mskKCuTcG+PMJ5Vk2h4Bz+IFPrwJ/nazdw9FY/e18XFz?= =?utf-8?q?jFJtKebjaGDaKjeCYDmvVX5LZWXeYhOTgEeELRpD9ZXxicTtBz86K+IyVlM2TS2Y9?= =?utf-8?q?8osEEqmHNjGBTnfDgmx0gdlXn7Yi3/vHPJqNvk1w8x8tlQQJNDnBssjnxWy+4L2XE?= =?utf-8?q?ckEh/fKbJaSkunf5CzFvdtGLK303N0bR5ZhgVSH9FMhtywJvC3CCKnx5TBuQUgPUy?= =?utf-8?q?/W+W0vwJxuLrR2yYfdk5zoBcso8/IFbjZmJdutTFI9N9oXEYEHF3Nsq4ORhguK6Au?= =?utf-8?q?l4hKOUkXJNVNL40at+gOY34FKQ8n1uVog9IuOR31F7gd++Kt3XTel0/P/k6S/uDnA?= =?utf-8?q?p3i7qN/otPeaqt9HeMOYrYNf1db7Nzr3/qA6YwBqdZhySwNhTN4Sj98himjYeelt/?= =?utf-8?q?7e5V2MQegOzd9XpzqHPvfFTLLUoLlgAdnRzWtQXlfcuzO/tOfqSMn6Rc=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42202554-aec3-48d4-522e-08dce3e8044d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2024 20:14:42.4838 (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: I+lwjshSKvDCDgriOVaB087AHmRLSJiYyKQAPxchw+H3z+unslOkQiWHMkZ3ivR3SmyEEzcDiYkspvgIfIymTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9291 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241003_131447_312454_55D5E16A X-CRM114-Status: GOOD ( 11.44 ) 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 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 | 77 ++++++++++++++++++++++++++++++++++------------ include/linux/i3c/master.h | 9 ++++-- 2 files changed, 64 insertions(+), 22 deletions(-) --- base-commit: 77df9e4bb2224d8ffbddec04c333a9d7965dad6c change-id: 20241001-i3c_dts_assign-d615fc33cc1d Best regards, --- Frank Li