[v4,2/6] i3c: master: svc: fix wrong data return when IBI happen during start frame
Message ID | 20231023161658.3890811-3-Frank.Li@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1405088vqx; Mon, 23 Oct 2023 09:17:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOeF58p37PP3fWCPpdzYgHf28DB7qV2gntYZWU9CSf3vDthpplDHamsAoaCkdYNTo1PHpR X-Received: by 2002:a05:6a00:1acd:b0:6be:43d5:6505 with SMTP id f13-20020a056a001acd00b006be43d56505mr7841983pfv.6.1698077868645; Mon, 23 Oct 2023 09:17:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698077868; cv=pass; d=google.com; s=arc-20160816; b=I5RIXCe6odvI7YMTkVvvtw49m8L0AELaPWESl0Yfw9c4kg42hYxVagFtIzfvO7c1vA X5QvdBuDWcgeFUM9eaj7gNGi+ZjeZtorwfq7/do/rqtARbK+esAD7Mj44f3I5kO2+TNn KWIGXWlkalq/Cz4So1oAbgM3z6Z4vcpB5rSaOt481tiWl1ir9iuqkF2t3V0wqfNhZe1+ BANjW/bIwydPIsE4Hw5mDbwS9E4LxCFDRgU/7vKSqhgu+7lRVtdO/PfiZ5HfcSiOmXCb pxPuFGb4yc4K7R6FOUpaLwVGENEVHwr3ZAZczsdDjwYn5ArdgrlE45OjvGaY2laOYNc/ JcNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uJcAQxBYawmHt4F5h8Rz2JZ46sg6P7hOUVI6G6WO4qs=; fh=E7JNjAJdSu5PUjZ4Tphj2KJeWxfDCW7LpfLC+N7cHJ0=; b=PqJSGoNOTWJiD7C0KC6BypA48N2mvZvsr20R/4eEw/T44Yth+VuVlWAbireKaoWACY XYxB2DtfRqLeYW4Y1pMbMl/cC9g034nPjYM1c3zaEsDZxwRcKOlfDfSTK/KPdntZG+xA 6djhNf6NxNVcMcgpn8t9VZYANuUnJ5pbBL/f3FcpeCIN3JLw5n6pTmYm4MR3uNL6eHUG mKiZYHq+MSEm6YxffcFSMsJ4TnQhLjYdTWcCKou0l7cSf8+VMMUjyPSL50CCNNGEuT1w CweumaAlXBZK6bOeB+J/rNnf5mGpARpxtkzRBS1UmniI/c3RP9z0jsrZBwaYuueaCXr9 hqCg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=YfrBIctZ; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id az1-20020a056a02004100b005704979833csi6784303pgb.855.2023.10.23.09.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:17:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=YfrBIctZ; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2DEF180AF3EB; Mon, 23 Oct 2023 09:17:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233658AbjJWQRb (ORCPT <rfc822;aposhian.dev@gmail.com> + 27 others); Mon, 23 Oct 2023 12:17:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232058AbjJWQRW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Oct 2023 12:17:22 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2056.outbound.protection.outlook.com [40.107.6.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F28110C1 for <linux-kernel@vger.kernel.org>; Mon, 23 Oct 2023 09:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y3t/wGFSe5J7o3cvXafWvvWkh7d6iBVwWFgggd8nFWq1PPU6ixv7hNV/AQXLDncgjGWy/usd33LUd6xtyBW3bzkgL9vmPkdCNj6+bBGBFI8hmp8XTYXDIZDeH1BVPUenCFozKzrAd7RSkj+fHTvdZmpFNDpDDXvYLJqqjpiNKs+AozzIc0vXORSvl4j2Ka4L2J7gN4m1b7wQ1gdUwDEskU0NVEneeTfQ16ydgajBccB5hbEjbuHfQr8JmcoWJ0bCTplUpEpaLra1e3yZA7oJVivoVhJUrAV024zLcL+dpq9M0jr14dHK8kXLZpb8MlJrkUoBFxOGJYla/X7HDJuYpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=uJcAQxBYawmHt4F5h8Rz2JZ46sg6P7hOUVI6G6WO4qs=; b=CMHkEw+IiBtGz2jc3iBm2G6/UmHF/0YSoY6KizC6+1iZLG9LgT7ga/cBYqPiGl8QB+h/Ak62h/E2HiyIv2AicM2xcwOscNXzxVtcAuWhF/Co4zWoK2ovn8UZo+VCyGGbQwfwEsm6BwZ9iMF485Ot+jKO45roGZOvlo23oOBgSvKwxAOgBpyEdNnPJgEjcg/DW6XYXGcAvRFV/XQq/feCQ6hE3Rxjv6c2TYSzyg4csE18RdnnkoJ+CdMXNL4sbonumAkQoSvI/ZuhKVSE/SpXKIpkyvuPGW82hn/IqpU1dUZYdm5p25cvfP5HNfPtye6fqFJwx4zGjUFRLDSVHVBcKA== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uJcAQxBYawmHt4F5h8Rz2JZ46sg6P7hOUVI6G6WO4qs=; b=YfrBIctZZvCqD5SStvTd/2NQf7LjhG9osMMGjVSGMEGVVlr23Acc93JDvsl4IByr33q9hwBP+OjUsGY+rm5NfWpwaPkCuGMWqH1FJ2n+oQ9AstciU74gkND43AqSFyiAXQyR+yCfUNozw2lxCjs9NpuBATta2m61pXo9TL3r+CE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.16; Mon, 23 Oct 2023 16:17:16 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::97ca:a905:8e64:c098]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::97ca:a905:8e64:c098%6]) with mapi id 15.20.6933.011; Mon, 23 Oct 2023 16:17:16 +0000 From: Frank Li <Frank.Li@nxp.com> To: miquel.raynal@bootlin.com Cc: Frank.li@nxp.com, alexandre.belloni@bootlin.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/6] i3c: master: svc: fix wrong data return when IBI happen during start frame Date: Mon, 23 Oct 2023 12:16:54 -0400 Message-Id: <20231023161658.3890811-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023161658.3890811-1-Frank.Li@nxp.com> References: <20231023161658.3890811-1-Frank.Li@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BY5PR20CA0002.namprd20.prod.outlook.com (2603:10b6:a03:1f4::15) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: d48a6b18-aad1-4ba2-8d2c-08dbd3e38632 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DGJt/1i3AbMH/FS7ITSmYt0LuXfN1kl5jLs0pyRLtgbm4I9f3KHNfBEjCmN1amFEVdMQ8NM06UH/ZNflZ/8FW8K/ClowR64lYlfo7TzCVt5c7Cz6WJ5Zr+FopNkV27S1YiXjaWTME0RnhkZTbqT9jr1SHrSLAww5kNE0wY9YJsFZSu5ZIW9PfhpYL+OiPzCidxWH/VXI57fGAqwtAx5oL0yMsj+qlbzCld8mTmsowUK4ywtlMG14iZZhefG90BJIchEWzYPQKttkirDmviKW+WGr6dTs/q1uG1eTMPAF3wKA+OhlKzHq0A+44RLfzQWFy9jMEVl6KftVD6WLsu+BNs6rNAoBWXMw9VRreaml2i38BWITJE5c7LnKaRH4frHVahXbDa/L64MtLUbhTzrimutLggPDYYP/zXqDEltQuzvXotHluTmPzvAMC3j3WfwYhbDG506dWYYrSra4fbkqlyQp88IdG2ESMf4QEjWNr8PDlKvf2JLwcEZFusIZ8BSSFYU2PdjCRmJ+qF8n0U6BKPX/5vZm7IwB7/wIjSDzhpWvIDQXyblIY+AH/Vm6NtegahEkEdu0a7WuhM0AvKRhFsRgVecR8OqwtD/gwiqfwopTvAHL1Iod0KBb52AmUlio X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(136003)(39860400002)(366004)(396003)(376002)(230922051799003)(1800799009)(64100799003)(451199024)(186009)(478600001)(6506007)(6512007)(6666004)(86362001)(316002)(41300700001)(6916009)(2906002)(6486002)(5660300002)(52116002)(36756003)(8676002)(2616005)(1076003)(26005)(38100700002)(8936002)(4326008)(66946007)(38350700005)(83380400001)(66476007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?XbIHfcAEKPgKXyaqOYjJxMtaJSem?= =?utf-8?q?976TF6Mc5tRV3xV8cx8/Kok6dsQv2kOQjNxetNxlqojk0LKmCG0ArVrWXTnpWdFKi?= =?utf-8?q?eKZCGIbqNOP1uIV4eOMHuRXTdi7iWwZ6gZGzgrWh0WJUCAVOGyKMJaYJ0uV8mtdeu?= =?utf-8?q?dNCbtEX9yBs7VFLrqCPUOtllDtwclVXxpGbkwXD+YrZxMAFdN1a5n6sFAtFBUQzVQ?= =?utf-8?q?VCWbD+65gKkcFda02fCFDdiVE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I0OSArOUlJXq7D1HJE7k/J16gauGbX9Nk8SgUe?= =?utf-8?q?zKa7fhJi7kMKfN80+zNEkpfQ2GQyJGNu2WbFjFw/PB7m5QNeXqKtSetJ/KAD4RX89?= =?utf-8?q?+mBoxRn6ZrBXrwLcJjeBpQ+SyekaBu8lsBdfvf5lHRDZ3dcBrMP0YvINYxUZILeh/?= =?utf-8?q?LH/4ymezwDrrhgc4IzL0qQc1/r9zTvSONM7xOJdw4GK8MtUUiZJ8QldyZkDPIadQH?= =?utf-8?q?/7OFUNWapDxE2Uq2kPuyN8YeGgKtm29gqynbKcjQHtBvkcVodU+ZYKIeCTMwu1fvP?= =?utf-8?q?y5oQYmWQOf/79gsqA7ia/dIm8+rDVVaFo0UAKlIWBG+j/Hsn4UKw4NIqrrPe6RsAz?= =?utf-8?q?0hKoDPnDoRiOIoMTVeGJmuhrEuaVcaoZf+RDBMBk+MLsUiazd8v++YCdSaeRYv7SL?= =?utf-8?q?HB7psO9R7Z5P?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d48a6b18-aad1-4ba2-8d2c-08dbd3e38632 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2023 16:17:16.7065 (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: uM+OSme/CEM72+aqI7lUpTxo+9mEMSHpDKBsP/oAyHAuVF41ruJPbMCMYdWcQHyW2wgs/tLljFntP38UvOHlaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:17:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780563699239574824 X-GMAIL-MSGID: 1780563699239574824 |
Series |
i3c: master: svc: collection of bugs fixes
|
|
Commit Message
Frank Li
Oct. 23, 2023, 4:16 p.m. UTC
┌─────┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┌───── SCL: ┘ └─────┛ └──┛ └──┛ └──┛ └──┛ └──┛ └──┛ └──┛ └──┘ ───┐ ┌─────┐ ┌─────┐ ┌───────────┐ SDA: └───────────────────────┘ └─────┘ └─────┘ └───── xxx╱ ╲╱ ╲╱ ╲╱ ╲╱ ╲ : xxx╲IBI ╱╲ Addr(0x0a) ╱╲ RW ╱╲NACK╱╲ S ╱ If an In-Band Interrupt (IBI) occurs and IBI work thread is not immediately scheduled, when svc_i3c_master_priv_xfers() initiates the I3C transfer and attempts to send address 0x7e, the target interprets it as an IBI handler and returns the target address 0x0a. However, svc_i3c_master_priv_xfers() does not handle this case and proceeds with other transfers, resulting in incorrect data being returned. Add IBIWON check in svc_i3c_master_xfer(). In case this situation occurs, return a failure to the driver. Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") Cc: stable@vger.kernel.org Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> --- Notes: Change from v3 to v4 - When -> when Change from v1 to v2 - update commit message - fix typo yeild and falure Change from v1 to v2 - update commit message - fix typo yeild and falure drivers/i3c/master/svc-i3c-master.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 8cd708c965085..abebef666b2bb 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1010,6 +1010,9 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, u32 reg; int ret; + /* clean SVC_I3C_MINT_IBIWON w1c bits */ + writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + writel(SVC_I3C_MCTRL_REQUEST_START_ADDR | xfer_type | SVC_I3C_MCTRL_IBIRESP_NACK | @@ -1028,6 +1031,23 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, 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, return failure + * and yield the above events handler. + */ + if (SVC_I3C_MSTATUS_IBIWON(reg)) { + ret = -ENXIO; + goto emit_stop; + } + if (rnw) ret = svc_i3c_master_read(master, in, xfer_len); else