From patchwork Wed Jul 24 15:45:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13741123 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 93BF7C3DA63 for ; Wed, 24 Jul 2024 15:46:17 +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:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3RN4WrYZZ/5gnhfzgisHCv9OXUxSXCz6XRA09a3moec=; b=JArHG7B2NzJGGHS7saqoc6w/nw xAKNQ02vMYS5I96KdOBQPt4raeX409mEzxYQXNOe9Up7lUgbEv7B604z4GDIsjYDwd4UH1AkvQbwn kdkIrW4qC2mrY1Yq1ljc62xMC6lfP3/oxNKY5c+1U+tScFQe8xolMviS9ax0Qml4uAUTVj5a0M6Kk q92KcfN3+fljGYuegptBe9q0g5MW+djiy7NthCZooDPp5RVuGVfhS+GwYgPnsbvD6vHcUmpzFFFjM TWk0/Tk76Zhgg8JJ/wuvO80ghp97oD/2/hp26m8qbZa6pmfQXWIC+4hxu/1/9I02Y3c0S57TwVU+M F02ib4cw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeC1-0000000Fou4-1IVX; Wed, 24 Jul 2024 15:46:17 +0000 Received: from mail-db8eur05on20601.outbound.protection.outlook.com ([2a01:111:f400:7e1a::601] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeBx-0000000FosN-1tIU for linux-i3c@lists.infradead.org; Wed, 24 Jul 2024 15:46:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UL/Q7HnL5kAoc3JStDozAoCPI170iu81xwYIytYfspGKQpcFzdCZ3nx/51c6k5cn2wg80oR36UZasNVOv4jHaAoyKRXUpIaDnk3mL6ZV9G8OcvkggCbmdtoP0CxGbS7XerPiAsDtObEEcwcOb974f9+VExL312XGv2UOuDVmsOr8AgiK8OvuDl7nLzxDVCiXUnDrLHl3wK7Zwh4LsCaolZo4Xkba6IyWjQ28tIRgxd9rNDzGXf0ti97wjSbbRaGonod4fJkE8eCVuvjXbcvffqTkYji+LLmMF+paes/pYc+xuORx75jGPv+N47VqZChgdOhozAvaDrTdplk/ZiCXlQ== 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=msO/EdVkx2mV9sT0i1lpSL3vgzOXI3/slTEqwN0P8jFNSGsZW2aJDS9Zk/hoe3IVQtIukF3HqtB9kPRg3OKtguZEP6Qi9AEUdJvUbuM0pFRygUl0aBZPifBRhn9JT+uDGNu+ogwrxaFQWEYWOJaAFaKf6FSbnbn4SwPoMyeIf6eK6PpMKAAYLJsdYxOkhM/Z1podt3nmDFJOArRpUwdleVKWY9Nt5AV0Gewxaf6sOr4nYIGuwJWzp0dGzeDmRQ9Lig7WyTB5s0oEyveJw6XmjGoJNgrT4Ls2B9G6zNulGyw1CrilRMr4n/aOoXmYNEQifDKl9vhmrYMyuttHXkaM1g== 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=a4QDHlwocieW2UypgvFfBg0npeEBrCOCLsMZcVjMN7MMiVDNX4LogWPJdInIuWkw3OFLUYPtEa351AYAf6Bm15dR0G4yYpTwVqhe1A4dZwERb7WGH+AwcZ7LSXg8Y5eV1wWjnDpGJE8J8slVJt0uP89u45xzhmSh9G3/+fxkotTbsc94IxKCqwero4Oibfrp3bIsMzojfUasvAcBuj826Eudwu7Kh7O4YhgpCUUCepMdE7TDyvq5N/BshEu5jzxfPLwvE3Hp/ZaBSdEztIfoQDkd9buyhsxGPEsW5oxazosjXzy877p09ySGaU2gRs8hAMovTh8hY1QgJ/9e55d04w== 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 DU2PR04MB8599.eurprd04.prod.outlook.com (2603:10a6:10:2da::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Wed, 24 Jul 2024 15:46:08 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.7784.017; Wed, 24 Jul 2024 15:46:08 +0000 From: Frank Li Date: Wed, 24 Jul 2024 11:45:46 -0400 Subject: [PATCH 1/7] i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin Message-Id: <20240724-i3c_fix-v1-1-bfa500b023d6@nxp.com> References: <20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com> In-Reply-To: <20240724-i3c_fix-v1-0-bfa500b023d6@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, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1721835962; l=1374; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=/JI8s94ok2z+hT6L0BfTNT5ICOc99IOP4jbZmyhmqiE=; b=vyxohMNLsA1z6uxTUSTcPrthrJborPex1MOrjSPVRNKz/05KfcjgbQG571ILWthcw3HcfFCHg jrp+UIZPzKTDZNIjlTe3JN0zpCKFlavy19fbLG+9BOEF7RteESp2hXZ X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0008.namprd17.prod.outlook.com (2603:10b6:a03:1b8::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU2PR04MB8599:EE_ X-MS-Office365-Filtering-Correlation-Id: fea120cf-7f9f-48f7-9e90-08dcabf7bc59 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|7416014|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+3y4iKO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+uqEsKm3j4hKcfRJAv+?= =?utf-8?q?HpUjCgd8iqqasD5HBeayum28Pem/c0PSblaULFt96miWn9/RQbfiRBJaBxLxr4UHd?= =?utf-8?q?C3aRWw0UkKFM+OjMKXnkqmlPEmnzSfFXXapdIGqsxbenKtslm++g/UtpYH7Ynpm9Y?= =?utf-8?q?FyzyTee4H2LGhsxDRVe52sUrLxiXruMO67j06XrO6D2SkK2PVKgi6I1ocHWy6vTnc?= =?utf-8?q?B9oUTGXcyH+llTbCXBNLHemdi/pXxn6yNonqVu9Q66X8h2uZP5dmbExPmqukqTTcj?= =?utf-8?q?AbTHibrBKGvebWgx4bSOkHAAgtdfYzEx1RtCe0KA62qcK/P73h/46yReAlPYunqep?= =?utf-8?q?bmsBoF1GnTEgXuFhRd/vq436qXoxM/rhUmAbKwbkuvms5QWATtFKXZqwAhzSnPLmJ?= =?utf-8?q?ZK0sH05JGvu0NmVOIp2jKbiq/WVkTSkXlKHHSigVI8IhkIWQ+r10JYZzpmPeNf1Ls?= =?utf-8?q?KKamL3mU0oMw2qeg9NIXmbJaeZs4CCcOzA=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)(7416014)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YgyCzh0iOvRdnWavHQ0JVsBaaMsV?= =?utf-8?q?BCX7lwpWj6vd+YyRnP9YE7XrZIu1Y+/2Klb6h9H51SL2hssXpTuQO+svWE3vDHz3L?= =?utf-8?q?0+RfxFrBY8PejlzndXORAvxq0fcJyrTq7iHGUc8BJtHQEwvXNwqWmkFBUYYUM/EMM?= =?utf-8?q?5GB+Vn/2xB/YZBJqGJihR0HfmvhK9rupW6vO9OvZ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doDIOZ/rZnKN2tWK3Y4FhJZQbTeI0NilzKQWAtW?= =?utf-8?q?pFThMAAWZ0KYkDTO7Oc+ccQCvK4rNE9u8UeNbysFDyNuiNoeyBRLhgXlD2QqjDVZn?= =?utf-8?q?6zlGbLf67HNrRhpnwLWcGwRbv6/BC/RzBPlVhIFUFdVRmsqcDMrfIYnDFBHmKKgH/?= =?utf-8?q?1UiZymeELaCfb5TK557njgGMOz4oyrdoU/2agkmcceZBIZskpYibuQcCX6Ds+vTKR?= =?utf-8?q?L15+scVBUKq+zxwOQr9itcx2PaJ+i39w44M9LVJ3vFaCNIrCUVHSP80rsyaPwd5Rd?= =?utf-8?q?DtTWIUrsY4c76q8UvJH0XWX2Hiu1ZytGTu/+hlsdx4RviPu0OowHklcWWPr/ZOzoz?= =?utf-8?q?5gr5fPn+lk7RQ0vu0SuRndZlFq9v7WpoPDyK99z4/BSSIMTuXmocgMizHOkTkO1Ni?= =?utf-8?q?xh47702Ysq+y1LgNIpSZDfdjPZewX/6M/1MNEfMLVIkJ3wRl4pzVXf3mCt5PBsq7H?= =?utf-8?q?yWExX0CNvgWf?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fea120cf-7f9f-48f7-9e90-08dcabf7bc59 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 15:46:08.5959 (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: cMwWSxVc2t1XzCseARubJn3D5Kezsb6Im7O6B/4HdMS3HfsjcI0FE+IyM17MRACICJL+GR+8MBvijj9+POBOfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8599 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_084613_529855_263413C0 X-CRM114-Status: GOOD ( 11.85 ) 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 When a new device hotjoins, a new dynamic address is assigned. i3c_master_add_i3c_dev_locked() identifies that the device was previously attached to the bus and locates the olddev. i3c_master_add_i3c_dev_locked() { ... olddev = i3c_master_search_i3c_dev_duplicate(newdev); ... if (olddev) { ... i3c_dev_disable_ibi_locked(olddev); ^^^^^^ The olddev should not receive any commands on the i3c bus as it does not exist and has been assigned a new address. This will result in NACK or timeout. So remove it. } } Fixes: 317bacf960a4 ("i3c: master: add enable(disable) hot join in sys entry") Signed-off-by: Frank Li --- drivers/i3c/master.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 7028f03c2c42e..852b32178b722 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2039,10 +2039,8 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, ibireq.max_payload_len = olddev->ibi->max_payload_len; ibireq.num_slots = olddev->ibi->num_slots; - if (olddev->ibi->enabled) { + if (olddev->ibi->enabled) enable_ibi = true; - i3c_dev_disable_ibi_locked(olddev); - } i3c_dev_free_ibi_locked(olddev); } From patchwork Wed Jul 24 15:45:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13741124 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 202ADC3DA61 for ; Wed, 24 Jul 2024 15:46:20 +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:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=NwHj60ALX45bPWmNU8oS4bDmMVteWjZQD32eVuJ5iPw=; b=DaxkWqm3RWqzPOUgDX1rvQm2At okxXnhYbS2LXar5WWiECgffpTgookV18rWTLbHvNLl4QcJsi+lmnhJbmXXHnOgz9PLD00d43VclrC GXMqu83ecUFJybOjnS/JmFOkf9fIMurPvte0A+1YYVFW2bBX1lviWSaRSqdPXcFVPh57qrPSAJptu lCFVmr/Ij988Hl0kqWPrQHdgNuUYnw2nwaCdJyW2I44TMLzPSMx7WIldgoDw8e+CD7WIS9DRRVhFB TX5uvNWTQnPf7zUkdx5Zstu+gMYHTCU2U7VxWaiudmoapFHFB1QUk/W1EgfZE/xj4NuUaGKjVfGC4 Hn7Lr+Yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeC3-0000000Fouj-2pZl; Wed, 24 Jul 2024 15:46:19 +0000 Received: from mail-db8eur05on20601.outbound.protection.outlook.com ([2a01:111:f400:7e1a::601] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeBz-0000000FosN-0RAK for linux-i3c@lists.infradead.org; Wed, 24 Jul 2024 15:46:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A0hKXhIP09WxodGn6dj/F/2R7F/tPyOq+aFChGYKTdnmgQAD/z9+K/bt7W7fliVSEBekpKnsLX8dlSfet/MGHj5CGGvbuvx7R1Rc8zS1cEcHtmCGPGba2+LmmMX8qu5YqMiUuzI5mQ7PdQCi3qwCYoQxj57nNZKyYfjdMDqbCpaZiENY872WayDD2vTUsDPduLQdtNNBKPvauEqK9ME0TzMLNToOtoMjo1+Hve2N924cUPNgL068ZWu+ZIOMFh9gg+PXuqHStsFGCAzCVZ8SsHLfJBA8yALxUMihVonKI5OReEMlhj2dpJ5nHRjwyBVVrObQTvnYDN7hlkMgu0EI4A== 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=qewuBOKZP4RwYXwcnEPATi8Fd20Hl0DoONQDXPQwHSJAQv2FOpBiIvL5H64RKRX7Dm+3yeRiPynKcaGS4OZj2i0GETyspxkNURVnU3ZfsErHQYOXVTTmzVOvv/i8AlD3m+Kw+5WW30XZPGOKbuUh3opcZdO6UCdT8L6wmxC6qKGnTFGGPjnHDBv5AWC4DB8+iehXbLzvJgMaXiA7DpxWhTcMmNeMXuf/LxrbPBwrW6OikhhVVq7Vs1yFlhHtR1O7ljd4ZDtR8ee6qxLQ9E4dAONslMmB/Jugbv0RDDnBEDuVZBo2xWe0R1SUbEPyrg8gAIc5Hq/PJj4l/sNhra02XA== 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=WXS+PVjcKeqRF4jjgO7iLt8go+BMayzwf66w2IzcZOH/ExyldavC95D+dYBbybfiNtEBFDDIXOowTLOF4lv/awJtouyi/+5CjLzvLQkXgypCk3j35jyA4x0tLlat7nZ1ajz70gHu3zcAQ64iudMH4JJThDzm785h7z8Lcd+N93JCgexehoqDziPn9Es5wwpnBoKt/ug+klbb2F4zl7RdKP+POdset6eF2OaTh2oh0Yybugkq4QhPqZUQId53pAAgsL9X4/zL1GMFf1BBMWZ8PBHn43osGn0YcCSC3KNaHrcqxLdUkZvTQrE/THkTgqxXIgwYvZ3TshzBACEUi9tYLA== 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 DU2PR04MB8599.eurprd04.prod.outlook.com (2603:10a6:10:2da::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Wed, 24 Jul 2024 15:46:11 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.7784.017; Wed, 24 Jul 2024 15:46:11 +0000 From: Frank Li Date: Wed, 24 Jul 2024 11:45:47 -0400 Subject: [PATCH 2/7] i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_BITS Message-Id: <20240724-i3c_fix-v1-2-bfa500b023d6@nxp.com> References: <20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com> In-Reply-To: <20240724-i3c_fix-v1-0-bfa500b023d6@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, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1721835962; l=1901; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=/8gjfrLEbeqdvh2UWIsUOXSQLlEPInExNiw2wP5o2A0=; b=o3K+zGhp85Eo5QVg5L9biEGZcoVSDJXgyOoSG1pJZaeva+eIH2wEx1039sM8ZAULgIcYz9q/n zWlMN0WXdfhBxRe9XBnrX4yMFMzy578s75fzlZ2Vo22QPmPZngeO1Qn X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0008.namprd17.prod.outlook.com (2603:10b6:a03:1b8::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU2PR04MB8599:EE_ X-MS-Office365-Filtering-Correlation-Id: 5af0900b-d7da-4119-c89e-08dcabf7be49 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|7416014|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?bOdEOMc1r/4UwpVfrqvsdFtTA/JTDHk?= =?utf-8?q?I65SkSK/wAb1k9Gm4z+nDrwbn32GJ/Fz9w0WHygWMkOSaI+pz5xN5nf9MnOhGhF2w?= =?utf-8?q?mcE+IWbEUVr+7U4MNGFA0gUKhEFYxJBZWRM33gAZEJrlo6/OWYmigzWjlmeVxMN+g?= =?utf-8?q?1Y/DttKFFSVUk/0Wb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jHEHBBvLrxhdbvz/U/WErDxZIt/L3dlC6ejQfTykxzJCnwJqCmlV7ksSBVHg?= =?utf-8?q?EFbmlNpbfQgSjxiLa7D8csB6VxlwT4WWOpguhG0V2umj84ApoltB6MnDmqlpPsVOT?= =?utf-8?q?TcgBUkYJVJ+UNhgHmCNvmsu5qtEWk2MYAqZmlvHcJhAYLFeg4g0N1pvbt7JniJcJJ?= =?utf-8?q?7PIN2InVXe9+W8Z2HyK2jiMPVf2JnS7aw7jI04b3pdDzTkaHSY1FQStmGH01Ge66P?= =?utf-8?q?1Tnonea5bfzqNOR0T00CxOI9TZfs65w8jLLSP99ML4XnsImLCvmQkZ1HZiiPPtqSa?= =?utf-8?q?6W2CHZhY4A7mCOwAfi/aBd6iobpBREpMYg=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)(7416014)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8zx/mhREo7a23aNTwCBCKI373ymd?= =?utf-8?q?SvFehLMhlvD0tO6Tecm3fnK6M0rM4kfABJieYkDsGHliL5bzB/F2NKcHqOjXf8MnM?= =?utf-8?q?0pdaVlojH1AAINM2FUvzlBIi4c1x2s21pDthoHk/Kf0u9ppJNKdulSMwci5QCmsSk?= =?utf-8?q?MSaTnYS9dSFbVFL9yBoU1ZCLe9tNwvB1t04UdFpIvvDjpULUN9XPNnYfKaPVWF5yI?= =?utf-8?q?DJlN+pj7nC4bHDu3o5b7VYx9TJxq0VoUmdfLnwb2YAPU5tL4W2mebV7SRHPcD5oYI?= =?utf-8?q?cHCRSONfOJOf6TdGXPbHPRdfB/vvFeNZCVzNOnNpe59xiBO3f5GW4uJaTZ71FSu4N?= =?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lrwdPJ56lyRyHHCaNuIJjLVJCNZsVh5pebXL0ggaQ7KLf2CwsjWu0yIE3?= =?utf-8?q?M7eWYyseEtktUAFEVGikCI2UUKIyl0pnSXKaImWJjrnqvGLBymtWh+S5bWl1alzll?= =?utf-8?q?6A97ZIusQAHSc++qNYdK3cI7ee1iWlMSSipw3w+KKP3PVc7SFz2QIwbUqNkgqOrG1?= =?utf-8?q?1+OihqzLdrkZOehAO8uJEKLnyTZ03fYTyHLY98+K3ygpUGK5cnpLHhFo4e3gfgQ+W?= =?utf-8?q?8goC/E0DVVeN9Av6542Vy3Db+0RZqo/GOOKVxbsyd4UVN5yl9gF/xIHRAVgs7h03E?= =?utf-8?q?zxXHG4ean3/L?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5af0900b-d7da-4119-c89e-08dcabf7be49 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 15:46:11.8621 (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: Qt1hYMUyq/SuY+qoVFOVUPtmeSrXen+RLaOTzmEoXxLE0T6ONukBxNMLMb0/jWcB4DggwNwUPjr5pnikcaTZEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8599 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_084615_198262_BF035B41 X-CRM114-Status: GOOD ( 12.72 ) 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 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 Wed Jul 24 15:45:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13741125 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 77EDAC3DA7E for ; Wed, 24 Jul 2024 15:46:20 +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:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=z08FI5HDToHA4OxwWb+9hhI9RCo7sPpBQknSLKQid9I=; b=XPTP5fv09X8AqbCaWA+Ke6rdzK 922gHlTN5pOBWRbVdGCyvddlNVOlVUSxRhmA5iTTD9Ra/x/M3pzNogWxSEsvmkb095LSazConlj+7 mJmDmf4B9Smwi4HgeOdFUVM4h/Qk/z3E5puCmDf0RK17VX/qX310GYtiPtp01fntU6j/bk8c9w00K k9RbAj//vub5w84eqFBWe6MKBKb7zJm60NdgkdrZrWqDcfaU83JoVfRbwtSrO2t/fwaOYYCLeaD9k SjMcA4Jzx31n5DjGvkvJURuwZCnQ7rVpLavGBu+FrIv/HdO3B3qMfvtoWQJSHAzgZSL0CRNfsJY8T ImJAJbaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeC4-0000000Fov0-0bTL; Wed, 24 Jul 2024 15:46:20 +0000 Received: from mail-db8eur05on20601.outbound.protection.outlook.com ([2a01:111:f400:7e1a::601] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeC0-0000000FosN-3DUJ for linux-i3c@lists.infradead.org; Wed, 24 Jul 2024 15:46:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n8FVY26yIGeFF2nyBwg7kQTqWqUXzmWy9s+68F/SxFvHaD/z9kxKGPiuwS7tLPJadTy0+Hq5rQ+bJl75bFGxvT/SjSBccYkwll+krvhyy0NVDDuTL44kHaDNfvURgsOjTlcwdTyh6j1SJr5QscLqPPoMBkjIPf1CwXWBcCCLwo2OeWbCGdCkV/mHxCwu8pqmOfpyKbCwffMPGma6jK/zOLR69ilN4jNisGq7BuhjHbthYwZS0ZWEM5X8YmIC3IR/6nt1r+4F6zM5hcltTmn6HgAWVtDoWoGz3lJl6bqFED5ovpG1ItRuAJF17KYWnU8FVtEyojQOkTFGSzII5rxWFg== 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=PWB7KsGIPUzmMPdiTS31D0C9IvGSjU59b650GBEYYzS88CG3vyGUgcokL3yCQJRUFYAmz3gMhkeZHxu8YSXFJTf1dkCuN4+llqt2ushIi7ywAoZuk+y9h2B8fsizazF3cenDOn++p1Ed+M8K7TZS9XfA0l8oMo4FzNKLc0YBa4j7w8uTmqwUWsBwfo1XJDG1IyZfkDnUH//5J1j5sIiulc31IZWZwkmmQK/yBVSc4d7e5i++QyKKiTqnwZUjNtoLJQBtJA5afEH10iIXh+0CEepioXghd6TS+P6xu6gX7rnjdf6AN/GAbI8zG5v87vVQ9zjrJfKnOYLI08cdP2WvrA== 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=c3O3efiloGTsEHe02FROPDYyjYgp0L+gn2NjzjPnYNNnVKw6C0wRtsqx7coSmIYQL2Jj7Fkq3Efriq/4jVFR7vTFMZ2hXSe5ylLQu4Q22XuweQWEgOH9acyXehmuC8asxhRIIsRG9r49zGt0RMz9xRA5jHeIU76tb9K9ULAkzr64/+7IIEuxFwcyv9FOoS4SBQQpxzDuhZwmVfBSMiLK9TSM19hRvU3I5k7yCqfcHCmoYHSNEk9rG0Y15UYkOmMJ2RJFv7zP8vLeycmdwvPJa4dxmL/SVfQU2AjkZVQfYHPrsk+WucBHMYDgrWjmfnx8b4WZBGZZ4yBMd1AdPaIhig== 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 DU2PR04MB8599.eurprd04.prod.outlook.com (2603:10a6:10:2da::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Wed, 24 Jul 2024 15:46:14 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.7784.017; Wed, 24 Jul 2024 15:46:14 +0000 From: Frank Li Date: Wed, 24 Jul 2024 11:45:48 -0400 Subject: [PATCH 3/7] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT Message-Id: <20240724-i3c_fix-v1-3-bfa500b023d6@nxp.com> References: <20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com> In-Reply-To: <20240724-i3c_fix-v1-0-bfa500b023d6@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, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1721835962; l=5289; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=nvcmTWDJj+SrtpBzaB8l8keUZ2F8Z2oCpFCzJlzH9us=; b=sjKVN7n3qDvzp/ZKjRO7ubR1ZFpEBwXfqUL6koCoxCnfbSExSMcJzGPnIGBceG5/8TQp8kc0y kNJs07FZpdGCA/k+oQpurU9BSuemRwfNxhtrqKD3F92NDBA1KHkN5m2 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0008.namprd17.prod.outlook.com (2603:10b6:a03:1b8::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU2PR04MB8599:EE_ X-MS-Office365-Filtering-Correlation-Id: 51b3c391-a828-4821-5ee0-08dcabf7c013 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|7416014|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WbOk0oY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frzRH5A1sX5sb6?= =?utf-8?q?XBDvUkgCMSkDf7A9IEEuuGCWfYyS7kzhcQflC+qjkMmaYi5nwxlnxePrOpeTVWPQ1?= =?utf-8?q?RjpY+pITt8D6Mvy3hbOeYLS7znukR+yniVWwEJ0nNIwLKutBc1Upsue7qq9ggEpAj?= =?utf-8?q?rJrcIj2yqglPsURlitfwebD4HY9dB4nLszg6WBRj6+YnI2rVYivAQ+azyGpCsrTJw?= =?utf-8?q?kFh8Iyo80ixG4QcEOM5wpJLZNLViuDHJUM0G8w+bocwl+shK81A5y5PWbtx5BQjfQ?= =?utf-8?q?q+iGLzyeAbTRx/9CQ2GFo7iq5FyFtME+rljyVe0RqdnaDEgSWVE90GtoZNRiGhHOs?= =?utf-8?q?rVSRoUE2PGn4fqsbU2QJiNfFx5e5FMqrEVx0j2XG/07GOkk5JvxHKJ1gCxJNrgWX/?= =?utf-8?q?41+wC7tVAMowq02l4Z1Z717ZTq45T6ffBcRf6aHk/t8J7haQ8LWFdeHGFyW5hK0t5?= =?utf-8?q?T8ywGOrwJg04tOTnInFv9PKoIVNMJITZXA=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)(7416014)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?OgJsYNvqKLMjQLsA8hVEffkmOagu?= =?utf-8?q?k/Vdbc0y7NHmNAbLBOW6t7WIjQCBfKEwyqDilVuhtWvzFiDjZX7HhJvKHU0rK/3nu?= =?utf-8?q?WB6CaJV8lzk0zlVEbSIx4dvfNdiutsjsCYgyfsyFO8tuf3vx9KODV5NKDTuCcPeNE?= =?utf-8?q?DndDfnZ9VFYO7ifQazalb22qkX2/m77ThGiJq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nBgdcDWeAY+BizA?= =?utf-8?q?8G+dV5z4j7MdIl0RlPKNKiL9lm8Y4+uEHTntkWlGF6LJePVrHqU3ZSC44YecUmMkB?= =?utf-8?q?p9Zz4pzaArg0VVf2znK7aGptmAPhNUMskEhlqYh3KH7EJoXU2gv3BIv8T/oI50AEG?= =?utf-8?q?SVCGXqEoVyqsba2mSqH7GDEB7UW84Vp0zXIOUQsjIhJ8fK01GTMd+DE9GrIbdQWZs?= =?utf-8?q?hUihuJHJKXIqW0LhjrWF+KdtPSKN0o7Srq83gj2sv2tMm5hl22X94dipy4FmpRg9B?= =?utf-8?q?r+aChz/gdawu7zbF8Bzf6y4QowbfxHgKQXw8W0CNCwh5I4KRxQiC+z1D3/QWcbH9h?= =?utf-8?q?OPBOXkerHpET0rk+7keZu9mHxqyaZt1+qrQn7VUkY47iM3kb+vBOYZMdIIKjv4BBu?= =?utf-8?q?qJ50bB03UIDBVH/8HRnxbd6cQbNCpIwv7ecpI14VmoNKlp8T5fM9Fi6QP/GvLtgPS?= =?utf-8?q?l/un6YlD8c4p?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51b3c391-a828-4821-5ee0-08dcabf7c013 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 15:46:14.8636 (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: Bnee3CB35MGR7ulv/boQFU2Fg8GQeJjN5uD6XW0O/Udi43VoQ1aE3/FdVYWY7qx7WizSEHXgoKvExDre1Ls/qA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8599 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_084616_849566_56D92126 X-CRM114-Status: GOOD ( 19.89 ) 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 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 Wed Jul 24 15:45:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13741126 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 59EBFC3DA61 for ; Wed, 24 Jul 2024 15:46:26 +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:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7AI6/H7SBpYEXJZDstCYiDrkAz7aOHj8mZS6LynlF9g=; b=GGtyj00G9zGT8i826al8/0QWR2 2FCDx9D+b1MLxMGDqTnGGAdbcfieyYGSi2Ybn3q7/VA56j+Wjh0D3a0tuzf1+HQTXOL4x937X4QRn GNgJ0T6Jfj7xn23Z7el4h5VnDKxP5vaHR2aJDpvyIJJvCM9CLg39rjtheer+tlwJwdpfcXJN1rLHt 2I496/NZK3BAupUucY+VH0Ou2jnLLh4O+ECJ11FMNB5dLa4AURB8BAAnKQRzZ/cRsSdy98PK3Jqt5 CBUsgsYIrCQGXWUJsheG6tVNFGdijLyka0D1jaD8hnSHGbYjunJJhFhKT7Rko9rCOje+aH0bxK6lR 3rf02ToA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeC9-0000000FoxX-3jNx; Wed, 24 Jul 2024 15:46:25 +0000 Received: from mail-am6eur05on20627.outbound.protection.outlook.com ([2a01:111:f403:2612::627] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeC7-0000000Fouy-27xG for linux-i3c@lists.infradead.org; Wed, 24 Jul 2024 15:46:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QuS6vfRobAMe7ErioX4SAqCZG4KGuoRDl4R1hj5/BjaO6qCBXDhFRgJSqH6xLuY7m2mfX280EqHDhB9Vx8Yp6blxevTypxPD+ETrzuxdV5jdl7UB3+Ttu5reKOJbbrd671jF7C0gPoT0K7naZThJ2Uu+5oMgawg2nKMLHCtQGYvrdLgcAaeF6ysUyjn2jEYRstmtJvKSXhYE6ORNtoAAgf3ENzeSe7Fj4vTyM8F2eXT9y35WpskVRVlO6ldDJgGGTf+NbJKaBEmg17AA44xsRTvAbVoLDLQ/OF9PdqryGhREjPhpj3JE55Y82X2zDkedxyHkGsFK2RIJvSkyli4L5Q== 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=GguIrD33wfZVOlWx0Wf6FlX4el4py3JlynM2di3srKwKfhhGRd81u5DG3/DdmWvPe6lWU9kgpd0dnKnNHX9CCAuh/AymJE5JBgef/bDtKVZebTRHM5C6rzSYR+vnH/n4mnCOdpK/ZdgubulUSF5XQ9yVVGyh8DdJiK1PVkLoJosgf4iUITOT26iHVwtoaRxKrUPOucRE0CzdKQIeZ5VSM43zsZYiuWFfq7WWOjM0sBQ/OHOMyQFEJSLpR3dHYL5eA7coxSvaHymkKXnfHQCh7+YvuoKr/+n83Va/2fhGGNWhm4LmZaUqZmOmVjvhRrlzrSUqduxP3uXOKS+hA/AO8A== 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=CxXCMnv03TqgWktSBg1A+7x3Wf8DNLctSeAjyfiLm3O1R2YBwysXjXw9Jyf3D3CY5Mci6AigIqvvg8qQonyfM9P8FkRN9hIrLD09a3wvtXiHu31NjBNY56kKIf4IAPgtmIG1GCEaje93rAfTaSUPO8q4/isxGca55ndfTQforAunaY0yDgZg48R2xEiqgaH1wP0iSG5HTA1e8hb3a7fXdSRNq5o+k/5wACrTjF45qxKd5jQa6jyI/4AdS6xQ/V8rjcbWFatX94OqK45Qa5p/+Oq52RbqDVXg3CPvAu06+8NRLSvNj0FawlqQ4JoRWk8SBw/5QTsXN+4z3ZPR7QqSMw== 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 DU2PR04MB8599.eurprd04.prod.outlook.com (2603:10a6:10:2da::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Wed, 24 Jul 2024 15:46: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%5]) with mapi id 15.20.7784.017; Wed, 24 Jul 2024 15:46:18 +0000 From: Frank Li Date: Wed, 24 Jul 2024 11:45:49 -0400 Subject: [PATCH 4/7] i3c: master: Fix dynamic address leak when 'assigned-address' is present Message-Id: <20240724-i3c_fix-v1-4-bfa500b023d6@nxp.com> References: <20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com> In-Reply-To: <20240724-i3c_fix-v1-0-bfa500b023d6@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, Frank Li , stable@kernel.org X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1721835962; l=3637; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=phlwJ/9jw9NpeTB7NJPyHYpdTuYWHApnsz953oBcxmA=; b=bFam1yY7BeGLoVc3lylUfnBvI0dojbpBk9GROZZaVWtnPAY0urR9VS5sJ0CzXLcUYp/FN6Z6r AqzW7pFiOXCApRF9lwBMPP7wBPBbgsfPv6QoV3bH0gT1OdPR21aEPW5 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0008.namprd17.prod.outlook.com (2603:10b6:a03:1b8::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU2PR04MB8599:EE_ X-MS-Office365-Filtering-Correlation-Id: 245238aa-7814-4c7f-1404-08dcabf7c1fe 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|7416014|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?wAnVH34NeRSl8lMDPV1Nl2neCWkkdk3?= =?utf-8?q?WwvyTVLS3eAEP2Rs2/GZlyoLxOjBUUVApn2kSCwebI1dxISOTxP6pPOMzPoH6RUea?= =?utf-8?q?SWurl0/SwwLI1XXXINULJyYGpGr6sUHBlVjlUe6OEFsMltrFMYAgeogfkQ6+5ofoW?= =?utf-8?q?HgPVY+ueMiy2R+0d9RmVjH2qrd8RVap73XL/BCTuxGz6e6gaZYCRRJ94GImNaUYUg?= =?utf-8?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fdP7356V28bO+VUCaMfmnYwFnTStRU41+bnwQ5QWYgqJIFqa4WnSCwhDxC?= =?utf-8?q?fXpBDYxCwCoMtlhAtm38lts2eR6qa1GzKTAFY3GSgF/bdtJZzIkxC6BNr0Nz4W1wi?= =?utf-8?q?Q5mPAveTQW6ogZUXLgJ07jcBOqCVUXK8OqNLiXDfd0SOB3eoYJWufhVDy2vhC/UZw?= =?utf-8?q?yV4p0vK7kWnLNtKGlV+hWLk94m3NxvUg+Ig87IBYnpJUp9kiSlG3aUXYDm3TXbVLg?= =?utf-8?q?172uvD/6Pwlu1kUyDmMCJstmzubB6bUDMw=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)(7416014)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?qiPsUc+WKTMDgv+XRRQHvakT3XYN?= =?utf-8?q?5RbMFuR6m+nZ4AfnD4A25yOD0y1BvtYB55n1rAGS+Sj9cA/KMKrIT4r1r9opjA5lT?= =?utf-8?q?vF2YSqcT0Nbq13jLEaAB4lj4AmxViXQU/01xpdk+oH0/3IyQ/BKJ0jNuQ7GzV6f8i?= =?utf-8?q?kHP7Hqypy2n2XGHlqHkdlt4K8kZuEP1zCmzUK9rOhe5D17Dxej+xFp8O8jZcmwSlU?= =?utf-8?q?vAShVNPVooL097Jl9bS4d27Bwgp5wHlCEsNvNKkbDBtug6GTCmf/W7d5XtnwBCKBT?= =?utf-8?q?rDBfYGIIjSLG7oQ9AttN48ctBRWso4nxdEV8DSQFywSvCnlzZn3gKTweWHTyYa0wR?= =?utf-8?q?sWG44oiftKZ091X+8uyYWpzFUpMhDAKaQkeqq/U3e8fTMkEAS/evg2ZpEaLZItV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KrmOt6f4CiiN45qzK8Bqmu0XJ+b1WWd9GWLSR3gPLgfEkwjOg6IK+BEJW3FpUr?= =?utf-8?q?pVuAqk25Iz1EjGqGhh5/vCYR4LIDyFnVAehx3E5MmZX16xpnqphAF5Rfz2sIkIs1M?= =?utf-8?q?vozqFQWujjeZl84BNZlLyX0+gyNjSiwsRS39lmiiChTcocz/L8rl71wfy8Fh5Yool?= =?utf-8?q?q9gwcr1lb8UndUM8LckTXLjRMVR0gQ+tLPWNZfBz5nW/U5EZb+jDn3eHau2X76pdm?= =?utf-8?q?y6KG1SvaGj0O?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 245238aa-7814-4c7f-1404-08dcabf7c1fe X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 15:46:18.0751 (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: dZ8Dms9LO55cyO0YVZc/zaLhzO8f71rYPTmRbm2bnPIRWOjEFB03YV/gPYqjyWkz7McShbdfTM4x/Fy5VLk7WA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8599 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_084623_588903_6FE786CD X-CRM114-Status: GOOD ( 13.11 ) 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 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 Wed Jul 24 15:45:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13741127 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 282CBC3DA63 for ; Wed, 24 Jul 2024 15:46:33 +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:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6bp/tQqlBOp7EXkQkdMksXeso+Qnl4xw3VX1tOEdRxU=; b=TnwvyIxxpI2rlY/+FeJpLzPOgT kHMjDAHmRLWZ96UI2p+RVqDptAMX7SJHwtmbHnBvUGpeFjSGO5H6oeHPF2n2T2GdlLT0bAq7LCOge uRvng3MnSGHSHGUzm0abq52KSFtiaOhyi+gL4mnRl8DyjPXAIIzDbEh69dAYJDyndh/02W8mA3wBd oewoYl4KjBsI+g06zdc7ORz+RNGQMKRyu0exb7vSrhziJK4nEL/eGLmccBvXMdN8rFu6NUYD7cDLv dBRGP4XY8mrfR0UQSPmeGPZ6jUZyklvxDHmZpPumnaOpsHfIa0Fk6ud8eUgViggOJE0DbUefU5ByM rSxG0jow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeCG-0000000Fp0n-3bYp; Wed, 24 Jul 2024 15:46:32 +0000 Received: from mail-am7eur03on20601.outbound.protection.outlook.com ([2a01:111:f403:260e::601] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeCD-0000000Foyc-3uaO for linux-i3c@lists.infradead.org; Wed, 24 Jul 2024 15:46:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BE3/41bCQMojSs2o5XfAeVyC3ky0SQbfnvgkVSsZWfFhHJmj9qZLb55Sv3STgHHKERVLafAzhmt82q6AIW8euhFGRokN45VQR7KqE0zxdlXwU2WLbOMV5yxigzkQnUtfVwwLu1W0vPPiL/gu9wO9nK+aXACwV+3Y6PtZqU5kD2GHYmKASps/mb18NsK327YTVsIMJpxu5YUEQWc9ucq0LJCu1yXS0KJknGpz3xwGVtNuw/G2ipBEN2jD06newICeqMNf7vYtdaqByNbdTkQDJAudhyY0xkLPk8H4e87lpwxaCIj5BjIekb08WZMgTER2xX8GM7W+8Hqf4jZRc5cftg== 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=OlyQ/+7T93lo0ecrPGaYKB/IdR5kO7VG1S30vy8g9mOjjX24jZAP5N1/3nJTRi400xWJRGu+XlyXQ0QDtkqiob52z4Rj4kvwyRYM9Jt2j9sUCDu4AWSKm8Ftv0vxG0vkQOEsqFUD2eKP24iAC2hlUaXh2DWHWuUiG2LqCLKak3oVQaODvMZdZGkujrNW9mtEksCzmmRlA59YgS6wb/lup/2yiijE2f6eo9zlZmNnj1fgpf5Hor7FgM65AnUL95mfGkVVsdsxUCjuRSMekXaDHhYUc7THglAtuFZpLzWwk19FQSal+qkeCcglp9mOhD3esKEHc3DwuoNxOdsue8jgcg== 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=nP0cI2DglCsZMvDyldJ+TfBzlVyfz2Y+XpiORwfQrzy7pPgeBXDKhFJ7GR5t+0LMe1dHASWEjyrxcpuBtw655OlR9Oz514WGj7hTmTYiy8Yab49WKQVS/kRRlqggOZ4Oz0LkQDbd/+4mWesfnOra1hFuKc65hoV/kNwen18T+aaGEzal2q2F9VrDZy0XkXYeiGnJN2F9AFdB+Tr6U2asurwAPOA+hvvKoiqUqCnhopzWlYS6NZbDcayq5NbSSP3N0vvSO8A7EmHD77PBOZKVi0V6fqsoTAPKD1Jy7DH3m4W+xqHfKqkD/oFFvSS+vut6/6yDCzcusobtAWqobSPqJg== 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 AS8PR04MB8963.eurprd04.prod.outlook.com (2603:10a6:20b:42e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Wed, 24 Jul 2024 15:46:21 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.7784.017; Wed, 24 Jul 2024 15:46:21 +0000 From: Frank Li Date: Wed, 24 Jul 2024 11:45:50 -0400 Subject: [PATCH 5/7] i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs() Message-Id: <20240724-i3c_fix-v1-5-bfa500b023d6@nxp.com> References: <20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com> In-Reply-To: <20240724-i3c_fix-v1-0-bfa500b023d6@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, Frank Li , stable@kernel.org X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1721835962; l=1049; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=EgTA/bzPVGwsyEemXX3hWkQUEBTDZOU6gFrO4erNl9A=; b=0UuauI2+/BTetwObzpVZ+YmX7TCq/xYlCGHfHnPIu8OVeBh3FhdtPHT242b84hOpHYMFpmh+i vLeIEA3LZIlB+2HaUC9OWqBX7RUYV7fAywjzPdEUccBjPD9eqJIG6oW X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0008.namprd17.prod.outlook.com (2603:10b6:a03:1b8::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8963:EE_ X-MS-Office365-Filtering-Correlation-Id: cb70048c-8e9e-49ec-dd28-08dcabf7c3e7 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|376014|7416014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?JURVWhRUZqwSkLGHH5hSSqDZrJ0Jqgo?= =?utf-8?q?qHR+qTn8xC+5hU+M0xD8uspMA489tTXJEahZ5/mTnzkS2A+wW48aGK48F89PoN0do?= =?utf-8?q?9Vmych8BwCbggfFzquK23hHyE8+6954k7ECzRKqRL7DQ+lYMyv/GA97aTTwShodOf?= =?utf-8?q?H6FxLf11Z0HagsFXDe6Rk0pke/3YsgvzJCFoLtaUR+uvxJh3B2WOsjP2AIeqXuE9S?= =?utf-8?q?lALZn0QTBab2tybLWywUy3MQjnI8mwO2DfQnK+YpYmzS+NwXD/APoibBBbU7LRy44?= =?utf-8?q?Izlo+wohNSj7qnipxj6eARY+7qTsHxDHeYAsEpA8QtvJEPhZ0DH0OstW0vJf/Wt2S?= =?utf-8?q?v+MUPwQhxnfNlnthrP6hne9hRp/qCDjLtZC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ta00RgcW0ty0AxSSt0gH7R6/1I8?= =?utf-8?q?GTrF9IV0D9WZJ8AijlZux6I21s/fKM01rqC6/UxqNCiP7Pk4fttB6WEUQDwpTwM9X?= =?utf-8?q?++FlQjkyiYB59qAwuVlAOWVKhTE5ObpvYw=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)(376014)(7416014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?NWcmQCot/BP4NZzLygHvgOoKR6+u?= =?utf-8?q?+IexaP//VnBr/zco1HFDg15rowsy82MS3Q6AtGIu8uAxLpabI5v4bGDWdfYDhRuSC?= =?utf-8?q?oPXxWbfq/SyBhMM7u7QJFjaM7awoJ2aoU0DAoLPtkZ0pCf2kP42bwm8Mnes23BA1A?= =?utf-8?q?Yrg3emIlE9c0hK6DKNzZyWUfKVmMQikV4skhrs53ZsTekJSXc864oFr/6r4LrkAnE?= =?utf-8?q?GXiRUtcn+MzZc8S2XAWX3p3Z6hs20RSgO3Tubx0Bef6JwHJsPazsDHmX4BeqLg7vF?= =?utf-8?q?68rplHU5x1d3zZdphkwI9nsDkPm1KcZFu1zJvQVaHDfrDMRiFzixCc88CuDlp2Dw5?= =?utf-8?q?K0GJZ5UhJ0P6uYuEVYsDGrcBFYeSQ0ZcL6ANp25+6sueGQ/J7A+0oamt2dX/5u2+E?= =?utf-8?q?Py8LYoGb7BlyR9Uo0xudAhoNake/ddtnCQZMbZ8S+7XbL8PV4Rpa06Rwk+1Wg/xEi?= =?utf-8?q?DBA1cVP+8v9Dg+qR27Rya54VOSuVFgdrK/nKHsEiRE8fUCPG8Z/BKy4U5YaKI60ZE?= =?utf-8?q?uaxKk10+KG2yAxv2v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q?Cfgm3riSZP1VijPqeHecJu5dbiD5P14mBLQ+e+fgQ23C3omsiYzCXFumafgQBc6oF?= =?utf-8?q?eYHAVBiF0tWctS8l5Et2IskH8opBtGxRYrDnWCPRqtjau/9znsWSq+OU5c6R56hho?= =?utf-8?q?0JdNRnAqa7Yl?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb70048c-8e9e-49ec-dd28-08dcabf7c3e7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 15:46:21.2572 (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: ufVv8VsajwIux79ul1PIpFHgNT70+KtFipUDY5L7KXp09hR4etcxqFI+OMBVGBu65+8ghUA1KDfhqTmOIDaCZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8963 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_084630_007377_FDB832EA X-CRM114-Status: GOOD ( 10.79 ) 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 if (dev->boardinfo && dev->boardinfo->init_dyn_addr) ^^^ here check "init_dyn_addr" i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, ...) ^^^^ free "dyn_addr" Fix typo "dyn_addr" by replacing it with "init_dyn_addr". Cc: stable@kernel.org Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure") Signed-off-by: Frank Li --- drivers/i3c/master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index c8eaeada54781..65642e5afdcfb 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1442,7 +1442,7 @@ static void i3c_master_put_i3c_addrs(struct i3c_dev_desc *dev) I3C_ADDR_SLOT_FREE); if (dev->boardinfo && dev->boardinfo->init_dyn_addr) - i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, + i3c_bus_set_addr_slot_status(&master->bus, dev->boardinfo->init_dyn_addr, I3C_ADDR_SLOT_FREE); } From patchwork Wed Jul 24 15:45:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13741128 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 AD392C3DA61 for ; Wed, 24 Jul 2024 15:46:34 +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:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PLT1wrK/ofsaDMhIuqCnpOzGQ/QxHeXKPDe8awHPxAY=; b=dyJ2wVxmStYqcGpT8kTTOdM5X7 s3tu/YHrJisVsFi98NYp9Zrx0Lh0Ab21qMtdBDrB1Ag7JTtde4FFo0WkZxFra4oWF+xKZn/asbcOY tznkGShaimT6mPII5msMCxo06jGG9dfPo+nXGAL+tkmY9js/aFpajghho7noo4TwypAEm9i6XtuUH 3oGLkFVZC8JuT24x88EtK6ZrTk6otbxcWDQoovCSD5YTxSgctyBd+n7YZw5clZhbezZ6dVie8PIE2 Sekx6vFMscGTaAisSo5X8tN8boX30iQzoBA3u5kjgGThTcLCCcuHMyTHTvoZikgG9ve2Gor3/fYhZ cn1IATBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeCI-0000000Fp1V-1m7Z; Wed, 24 Jul 2024 15:46:34 +0000 Received: from mail-am7eur03on20601.outbound.protection.outlook.com ([2a01:111:f403:260e::601] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeCF-0000000Foyc-2FFS for linux-i3c@lists.infradead.org; Wed, 24 Jul 2024 15:46:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aQm7r6eKPIpox7k2nk9B2vXKDz7HSXNGHcvBFZ32VNXgzZeD+lylIFqDwthvdG5uQAql65GRbHWQ/HYQt1HEWDXLMjgBRlZJCPxKoRYGVovJqEKB4eki4Ub5sjK+gDAcjhh6uHi44bnnEqNBKfa6OsT56HsDInJWEtLBPsx3B5tuvVjWgqUPE+FcfGXgXmldZ+uifafqBoxSuIeNWEPjEBEJjxgBjainBAdmD9gJox9r6gPpbleq1SkpogBNNEflg/dzO/eaIT5HR3nfgwyWtp4e4BWkK/xswFrlYXmFBLxcAbaafA63U/f8mvQk+Iow1kXQRaGoIY4jUXuk6hSKmQ== 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=CaPmVxcuYXaI0yv1EFbWMD2BvkLx075DQxb5diQ/AopRhexHWbTTs0lgPG/kThiDefCjtUXm6Oz7oJJHkk6TjDFuH4wUYgkbxB+EmaWub4QHoKMiC3RUOsrSKhx4xQAZnab3bmnTZ4qMOrww48YN86fefwMCAU3W1Sh5+4bxI9Ibt8vpC+aGWYf5lAt+7zs9Vt0WRVTSwa0y/P0Zs5WSW2pdJoE1LIhA1ABmiWvbjvYS7O0cTPO2OrgdCd95XcII1Ucj69gVvg7dyHUvkUmfZlF4Njc9IpApR/KZ7WSmV3QCWmk0oNpdO0gP5LhS1a5fzI/ZMhkS5VXEWN6gLHyEpw== 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=BLTB+QqFIHV0LUuhH6wpcv7WXYqjiAohNhfnUBJO+ZKBTMmA/04/S2TMfR6gkYvg0tPWh+qN4stOcmHUYq1lSRUZqzbkiUrk9fTIIM3cdETwc1eKXb3jOcpc4JGx0eQG7xufI/Edq9KMG7q4k1R8Lbf/bhq7RjcRpiq2pwwXXT8IW72u6bDfYbtkjudymdxS+QWMajHCEOTEAFG7GYX8UgD46fxousDpWj+cZvG5ez/l0SLvCOz4wpA9l2cr7OJ5N8+RhWejKSteQepowrA59zZRjhlrf5ZyE/q84UYgY/XVidQuKAEoX85c3BMbqr8HqPOHPl/7qLvTpRGMPMB1fg== 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 AS8PR04MB8963.eurprd04.prod.outlook.com (2603:10a6:20b:42e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Wed, 24 Jul 2024 15:46: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%5]) with mapi id 15.20.7784.017; Wed, 24 Jul 2024 15:46:24 +0000 From: Frank Li Date: Wed, 24 Jul 2024 11:45:51 -0400 Subject: [PATCH 6/7] i3c: master: svc: use repeat start when IBI WIN happens Message-Id: <20240724-i3c_fix-v1-6-bfa500b023d6@nxp.com> References: <20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com> In-Reply-To: <20240724-i3c_fix-v1-0-bfa500b023d6@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, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1721835962; l=3542; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=An63rdNKf8siEFmhpUTOtrd2drbSwaCzp/D7qZONW80=; b=2Ij2pePKr9oQIJVOK5bWSO3K/6+4NSzl+qUlw/3b+/5QPy6mx2HNAT9qefo7Huai9Z6dpS96z yXLEdc5qfmjAD9ku9AtHVx79TYOWb7bV+FPm6JHnWihNV4y/447WGzP X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0008.namprd17.prod.outlook.com (2603:10b6:a03:1b8::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8963:EE_ X-MS-Office365-Filtering-Correlation-Id: 37e7f5f4-906c-4875-9be9-08dcabf7c5af 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|376014|7416014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?nzwMl1/BdnrV0IXejwVJV++QxH3IZvj?= =?utf-8?q?jFVS7ADL3YBZcBZfgAOPek5vcdH0vT6OFmhdD/nYoY6WHbZilMQIuz73k9vQwN/8V?= =?utf-8?q?gafeZmP+eyzh28CWnFYtn8qI6P1ERIk8Vprsjby/CovTRnZz8CE3gLfUf+WLjI5hD?= =?utf-8?q?8K8oIy2gUUQb6/PwO2COHzew5yxEbwn5OdfWSXHKLQEEaCJir6IhbRXIMo3T4FjZn?= =?utf-8?q?ZpblncJC+KKTNDnbL3YRoZUm8ncwDcmn5/w5nfus5Fh3j3k4EEbtA4vIlqxBSJTDm?= =?utf-8?q?4qjgFNkiCiQfxZsqOX8wKh3doAGeOIDKys32qqoKFIeWSUPxWzJ/NbYdgr2iYbUBQ?= =?utf-8?q?GpoV4YCKuFZZqnlyjxD/i8Y1AlpLpEb4ArA5lzcrZR3yWEC3sIIzMORE2JOWSQ5S2?= =?utf-8?q?095/E08hrteABau+4OOGvVjrmz0ctLEudMHkQjLJOhwla9rLpTR88ev+MRDSoAhim?= =?utf-8?q?kawudlkqKG5ClC4iY0BrZIGVqDiPJI4tVahbPANuzMv0KwXtBXEpVaV9GAhaR4NfT?= =?utf-8?q?ysFWUvilF18Ky72M8HM15q8NExe/Nr2eF+QPbAcILRZEBllD8Ymg9svmfvhSFNYqB?= =?ut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CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?AtplxBY9ud35x7EbIMlcmuWG+IPC?= =?utf-8?q?9VcMi5EY8KVyzBrV+fXcNLXcdl3+jfGhQXXWeUneb9rpUknWB4rm5ej3EYqE42odX?= =?utf-8?q?MDRWXbaFOvHdx0kecR4hRNcE3DT6o1hS25WcpWLtHqaReHNvKcHPFKWJZvdCGFSyI?= =?utf-8?q?RJdw3cqf5CjiUBwWwpW2/Sz0PDr0aMmixsqQJNUTDRRUr0pw+7/TzjcKGCHhMrpPn?= =?utf-8?q?Ax65IbKcllwAtzwkRuw3bqesH5U6jTDYGHI9dKtrh5s/JUb09SSYXfYxzksJ6hHQl?= =?utf-8?q?Qf1VSrkaRD35sf/DAE0QkYwpzseIRYw7n2HWR/Pwz8CX867gNoIz8hf7MiJvGOpyk?= =?utf-8?q?jzqUSt1LUN1N0B1BPXqFAlwqxeiY8QLXYR6STJ3GiWZJcaCtWTXZUXBLlSJV5dCJI?= =?utf-8?q?9+J90bQsWT7wEwPJ80ukxZe/Nn7TwnbwnG0wnOs4SAOzIlQG28IiVIpoAyT4HQzOt?= =?utf-8?q?nYKMrnP0y7HZKeq3mWR2nif0LjyTEJduDPyquUZotQpIMetAWZDI+6WNLhu+xOeS/?= =?utf-8?q?A6qsFyZh3R4u/mZQLRTfI1Xv0lTrDZHiJQqKy/+PNaXdqzMFkxus3DsbtbCS4/QM/?= =?utf-8?q?C6ODQr38Tx2dwERFB6EH1EjdRXK0GqKDl0Ukc6I66b6nxODrG62eGL55anyddTX9/?= =?utf-8?q?CxlPW0Lfu0Webg4Uds6l4fZRCW1KsFbrfafDXz4Y+tJ4FXVfhKIc04Aq65UP4YWWa?= =?utf-8?q?mj2quMT10t+rnIGyCEkMabI8LyrZikQsCaCNNo+f0FsHnho/wP1Z1LpQF7a6bLwat?= =?utf-8?q?sLOqA7QdgEXc5aklbj2w4pzpIbnXEOrr63FfoU4OTzJxAgSFzTTqmSywxxnGZz2vy?= =?utf-8?q?MehmAGqfQOAv30Jh7aGrQ0ZRBmZ1Bt5b7VC5KSDbhDLaR5FknnK4eV5Ji8/MRW2lZ?= =?utf-8?q?fDsMR7lA2xDnlc2A0FwRlYa9dBHVC7meRhDS0JTrutAZejS/9O8W2c4uP+l9942s0?= =?utf-8?q?AMTcEF3T9SHUvKKQjr9zWYKrafYeOiOVsXbaJD8WJNom/OtxcszAytDzpik+GsOte?= =?utf-8?q?OXP9jhjN2yFjfCSrKkb3C+CSfjZV9kkALZ360DL8WbfJ+V85bCbj8hKBoRIzLsLhA?= =?utf-8?q?yREjhbQmjiKmDMmBOfGT8SzSZmfG8jGSyAE/l7UoV4XD3KATdOrxz1shLtGbtyUJC?= =?utf-8?q?+CkId3cocWOTFtNoYGPTY9tdyXNwxHjcc+5wgwdwnImwjAv5uJnocGcM8iTD+ausO?= =?utf-8?q?jBeYiusyUy4Zd6aVNdoBKoLqrYAKx+MQffnXhbc2hhLt07ytBfNAgfaHm5Jnlx0Su?= =?utf-8?q?LdT/DX+OQmWRc/AOFvHG1UOzG3B6C3iXJEyZdiuKy9llTXE+NQ8/w461lj599RNh7?= =?utf-8?q?v6+cHj7H3fCTIWPNLMvSSAvtpty3byFSpVNcEgMdqcdJSwhzV4inkhTR5w//ry3au?= =?utf-8?q?LKr9HQunklkSk18FZ3tidK1dcY0if2pAIdL7fnRu9hLa4Ie8/jAansVJ1HDpWPKQG?= =?utf-8?q?RrSfSBeklDLJ+7t+39y9+xzM32Wv/DZBbHj+sHIzfYqwLcrncUHpV9HrB6ZaZ7kjh?= =?utf-8?q?WjgzuSCBO8Z8?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37e7f5f4-906c-4875-9be9-08dcabf7c5af X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 15:46:24.2434 (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: lY0tAXpsv75WymS0eLrDwuv4sUQHtTHvTGtmzO5idElAlJeh2Htli3fM+jSsMS4/ZDITZyqG9TP21kw7XAJpkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8963 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_084631_634883_98E0B95B X-CRM114-Status: GOOD ( 17.86 ) 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 There is a possibility of an IBI WIN occurring when addressing issues, even when sending CCC commands. Most of the time, returning -EAGAIN is acceptable, but the case below becomes highly complex. When a Hotjoin event occurs: - i3c_master_do_daa() - i3c_master_add_i3c_dev_locked() - A dynamic address (e.g., 0x9) is already set during DAA. - i3c_master_getpid_locked() - Another device issues HJ or IBI here. Returning -EAGAIN causes failure in adding the new device. However, the dynamic address(0x9) has already been assigned to this device. If another device issues HJ, it will get this address 0x9 again, causing two devices on the bus to use the same dynamic address 0x9. - Attempting to send RSTDAA when the first device fails at i3c_master_getpid_locked() could also fail when sending RSTDAA for the same reason. According to the I3C spec, address arbitration only happens at START, never at REPEAT start. Using repeat start when an IBI WIN occurs simplifies this case, as i3c_master_getpid_locked() will not return an error when another device tries to send HJ or IBI. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index e80c002991f75..5d19251238ff8 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1099,6 +1099,24 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, if (ret) goto emit_stop; + /* + * According to I3C spec ver 1.1.1, 5.1.2.2.3 Consequence of Controller Starting a + * Frame with I3C Target Address. + * + * The I3C Controller normally should start a Frame, the Address may be arbitrated, + * and so the Controller shall monitor to see whether an In-Band Interrupt request, + * a Controller Role Request (i.e., Secondary Controller requests to become the + * Active Controller), or a Hot-Join Request has been made. + * + * If missed IBIWON check, the wrong data will be return. When IBIWON happen, issue + * repeat start. Address arbitrate only happen at START, never happen at REPEAT + * start. + */ + if (SVC_I3C_MSTATUS_IBIWON(reg)) { + writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + continue; + } + if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) { /* * According to I3C Spec 1.1.1, 11-Jun-2021, section: 5.1.2.2.3. @@ -1132,24 +1150,6 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, } } - /* - * According to I3C spec ver 1.1.1, 5.1.2.2.3 Consequence of Controller Starting a Frame - * with I3C Target Address. - * - * The I3C Controller normally should start a Frame, the Address may be arbitrated, and so - * the Controller shall monitor to see whether an In-Band Interrupt request, a Controller - * Role Request (i.e., Secondary Controller requests to become the Active Controller), or - * a Hot-Join Request has been made. - * - * If missed IBIWON check, the wrong data will be return. When IBIWON happen, return failure - * and yield the above events handler. - */ - if (SVC_I3C_MSTATUS_IBIWON(reg)) { - ret = -EAGAIN; - *actual_len = 0; - goto emit_stop; - } - if (rnw) ret = svc_i3c_master_read(master, in, xfer_len); else From patchwork Wed Jul 24 15:45:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13741129 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 4A2F5C3DA63 for ; Wed, 24 Jul 2024 15:46:36 +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:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ZztEYNS9U6GEs1Nf7be9Hazl0JzcwfPBXX3dRIfYkHU=; b=Jf77Eo72OXfrj5VL/cnlmY/laj cGnEF1vHHNBXdkMSOvyO6po47d4kid861ttBW8cDvca0SDwMpb/WH8o+0OKVvj5O6p2Cr7u8FcHEB hvGjPQRG9NI/L2dlpO/5j8Nv3Uk+43GAlHCPdO0ApU7EhgJkWoa3Ki86DZ3uPnHGADKCtVWFaoMZR 1HOxL/uzs0lF2DTC97cGhsnqIa5Y323ScuhZvJbOo2505mjLOSsgpXUKTWHcVyLIfbx+y1GRDRwXR Ow4nke2qPn0q5N24GhTLf5UbQSk8gTKJLfXu48iQiag6HOMwS8f1zXzXejuq/9Ye9QJPh2kBC50Ec nt5Mnpcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeCK-0000000Fp2A-05fs; Wed, 24 Jul 2024 15:46:36 +0000 Received: from mail-am7eur03on20601.outbound.protection.outlook.com ([2a01:111:f403:260e::601] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWeCH-0000000Foyc-1pm1 for linux-i3c@lists.infradead.org; Wed, 24 Jul 2024 15:46:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A5eKVmHUDVhl9/BUz0qqvhhXz6099jSlA00Y+qW/KrCfnA8GbdHKe8lRPkz4CVmSDbwC4I2exWKsmqoYhZ2IznHkJUcsD1wj9n+SFKPmc1eEExU60w0UToX1UYmaDufu5A8kqPaLQoFujsodcNIBY1YQ/3LH1XaQN9LombJQ4/ZMBfEJ5OoNkP9jJn8CCTCvB1i9hRJGoK254uCIr7zVCBh+81FVMDCS/IVBEbjTNgzTUJuA5Ek3PxO6+9AUXqVMH/aJZEybSrchT5hyybMsNxRRhaYzrChpfhUi4guM7dJcJibrj6DSIB2D/mHsGWLZERiTzkoQeRFWlaNAAXJukg== 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=v4JXtZRVQMARG9qMgKwkntLShr3lq15YWhLhU+kDbuA=; b=q3fvJMfno1+ven8LgqtwIzTua7vjX1+93EjwHocXR4Mu8RsEwaXFjxUSlRwZ+cr+wFdI2MQHRMYYf1S1mm8iupFtLnwKV0FZ7rp7VdUupKwU0cUI+2ORM/QB8gMu9dR1TpASNlY1S2HlQOr6oTH/jTl3lY7EM1KGoFQUBvUgAGbIAErlg9yQVUp6tkQiNI+D+pZZKAJYHOOtPZBHLKcL+ZDeUMEavrqVxzOzCI/eo/aBhxa8fzuR67GLyf10flynBAQOXQemfTlNkXUT/mlY2rL3EB4mBPMOMpV8sV7xjUxMsJHaT6Hx5rpdp1KZhZ45X4mHLh6z1AA7BWIt0VDJ6w== 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=v4JXtZRVQMARG9qMgKwkntLShr3lq15YWhLhU+kDbuA=; b=kAxJ7STBo6rnxGtDfqQThzNbEBHICtfj7kNiq8N7mWaaDOL4ipEhajZrcfUYwNZu12WSrTELCytJdkSs2CG53ATWZLPFm7cF1r5f4hed+iOiroakSevWagcuQ2TpfwQLkewKvt25ApG2VWqZI+bGvGJOKZNzISuGEx3XNmRUUiTjwnlfYSetKcvVEa7efCp8N7li3T1eQbUR7pY1rdhJAK4LHN62OXNZ9dTfGu6FxX+f22dBzhdIfhs0L3fDyriM+X/OgvqXHsAnwkHaMbYlBLEkujXFOqwZVezxjATZUXvAHAn5/SJEG8E7e348YNx3oNb32g13ocb9AJ3rrquICw== 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 AS8PR04MB8963.eurprd04.prod.outlook.com (2603:10a6:20b:42e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Wed, 24 Jul 2024 15:46:27 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.7784.017; Wed, 24 Jul 2024 15:46:27 +0000 From: Frank Li Date: Wed, 24 Jul 2024 11:45:52 -0400 Subject: [PATCH 7/7] i3c: master: svc: manually emit NACK/ACK for hotjoin Message-Id: <20240724-i3c_fix-v1-7-bfa500b023d6@nxp.com> References: <20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com> In-Reply-To: <20240724-i3c_fix-v1-0-bfa500b023d6@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, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1721835962; l=1155; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=8AD6/oyw5maO8G3UDbDr2ZOWPiM7trJt/A903JRssEo=; b=NVQR/STY999tK82BWZmJWzz48Ldla2y+1bpy7jeCH5M3rNEXgYj2Hd3ufwIsSx2iMb2vJ3Eoo oEcZmcGFtm5CQfNO/tnsG6nnlQLD+owSo3uRPyE0hHniUOyiHRovvLi X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0008.namprd17.prod.outlook.com (2603:10b6:a03:1b8::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8963:EE_ X-MS-Office365-Filtering-Correlation-Id: d4e6e549-5d11-4031-ffa9-08dcabf7c77c 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|376014|7416014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?W/Q0BNTRkm2JclEAPBy86ZCTpXzJKf5?= =?utf-8?q?Memh9zOtQ26YU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QPCErJTFsoU6MybTMEWksq1ZNhyUFi?= =?utf-8?q?7cSTeay3ydnqqB5lLMAgv/7z0nGK4hGcyVXZMQtq+sQD3vwhPOjSI6s2Ja44hQ+0c?= =?utf-8?q?M1gigyRVp6of191IJRlTJ4FnYY8yY7cvHOGxWEgrKTBJLGOI7ERcdSreU4RCJ/V4B?= =?utf-8?q?J5KNuoGeaCCTWw7YzpLY/9iF8s6WU8th1H4gnbz87XvJ1L6mWNX65PQvdxnlXOxu+?= =?utf-8?q?ewAZhRLERrjNnZFNp/O+cRPa7eQplED4iTzqYYzIcCxKmKBpZQck0DZ+DEFNvM5y5?= =?utf-8?q?RbXC+V4bnn4EnyAhgUMI3m2RcAk9Jg2Xgv4zjkLwqT74WkRRjg5IGAHq9a7FuqHqO?= =?utf-8?q?MRVN2Q8IAUec2jhP1lL+yAx4dNsfo4lkLzviw5JhvqRhJ6U9pnDqJvuLGrcgDaeW+?= =?utf-8?q?U0AzSfJnmk148EKzG4cT5r75yMcHWUYrSw=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)(376014)(7416014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?c21YE322mVyXm7JmmBn/E9cu8Wlx?= =?utf-8?q?rlfuC3gFq55ARDAu3jL+WV1GqzwUZx+UPe5v4sbjWT7zZLjUMbSMOGMDYJrJShSQb?= =?utf-8?q?l/JFeKBoCr5hbyEt5QRYQqgVA3oHXUItfRh31iL+tuVFoRJ6slfawTlYsJrIkILZD?= =?utf-8?q?3B3MBRaOT+Cxu9XCzaaXsCPmSZHAn4BDFcS2pdER3lLJZ4/8MOu1/DYWB7t9NtmvJ?= =?utf-8?q?wuIcpibvi+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VmpfWIRepAnz4B9bmQQ6WSwa7BMcQjw6roFEH4rxZqWTf?= =?utf-8?q?iNJXBmnkVeohDWVg2EVB3Ncr9LLLuGmy5NFCMMTio/c56YcNdvI+SyEBUUA2pZM+D?= =?utf-8?q?hvyVlODZU+sFLv0MIzZxIVq0sCjyu2YSEShwV9j1cs+spqpZwQxR+L9TOfJSrcY82?= =?utf-8?q?nO2SoPlDTa9AdDQOlwTU005t1fEI3FmyY1l0NEOijO4QoFUnl7/SU0J36nw+46JBT?= =?utf-8?q?FIDkAJAQRY6LB9GBgj0RpUhVXb6fbVbQ88tQB8oCXjN0wHmu0bbjB2d96Ch18+RsA?= =?utf-8?q?HDjNFuAxqvfRPHUQkhRqfntqUqmSnOGAxLuUXWzmN1slkZtTpFKcEdgU8IJzBCfer?= =?utf-8?q?cBb1NLCMTmvUx01XIYUaR3y5cHDr3DEdsH/04eKRlOshMb6dz9QGlUPJ3ONH5Ac/7?= =?utf-8?q?VarRx+Q5od5X?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4e6e549-5d11-4031-ffa9-08dcabf7c77c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 15:46:27.2991 (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: 4PlNxrwA3uqt9pkxnGLUkZQp7NmCZMLJIPQkV8RG3k+N+Be3hipRJOGuHnUhn65xzp0KGLEnSdWysdyiPHYIRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8963 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_084633_550528_9C79C3DE X-CRM114-Status: GOOD ( 11.40 ) 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 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 an event type check to send out NACK if the event is not an IBI. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 5d19251238ff8..36e01d0430747 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1113,7 +1113,15 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, * start. */ if (SVC_I3C_MSTATUS_IBIWON(reg)) { + int ibitype = SVC_I3C_MSTATUS_IBITYPE(reg); + writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + + /* Hardware can't auto emit NACK for hot join and master request */ + if (ibitype == SVC_I3C_MSTATUS_IBITYPE_HOT_JOIN || + ibitype == SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST) + svc_i3c_master_nack_ibi(master); + continue; }