From patchwork Mon Oct 23 16:16:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 156967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1404977vqx; Mon, 23 Oct 2023 09:17:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJ20VfWh/0D/ZeCca+u0C6dedp3IGQSlzmgoDHPVTb4LugDv49shmvVce4l4hS/KtI4cTS X-Received: by 2002:a17:902:e88e:b0:1c6:2b9d:56ce with SMTP id w14-20020a170902e88e00b001c62b9d56cemr7370455plg.21.1698077859581; Mon, 23 Oct 2023 09:17:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698077859; cv=pass; d=google.com; s=arc-20160816; b=KbxmAIvsaY9qRLf2CoRzAOFTINEmm0Dbx6FSy5qvzHZsre+avThqmLdjmvuz+jq6zr k4qSU4dgvfKc+LytKpl3d+O1medxrT6gnqEtAaqvsWz6O36nLVa+r470zVlM0oNEaM4a 343lBR++/NtmzZUf1LV853wGcWJc5Tt6S5ylIWUN/VJlIIId6VkVrFHLDn/LOqrWhAma Zm2XSPSRBSmWZMkVnaLwGCUZYozthjynFhVEoDso1bjGPjIvIvZrHakusU7Q6GXsXrsv bgMp48X1cL56cGHRkCNMHcAjxXxfmnxAAoFv61RPKWmml3KjW9wdUDL0TT5hlnp/9m8Q 0kpw== 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=D6/0l63ENa1rCG9AOCfTVMMHkxQaSAkgSO/Y9e4768s=; fh=E7JNjAJdSu5PUjZ4Tphj2KJeWxfDCW7LpfLC+N7cHJ0=; b=n1irVOGRf9d5JdQAKGeluO4BsbvsyiVb3aEa3nN1OMmcXD8RYByArJrAa6Iehwe+zz 1XKgk8PYKceL6R2S8T53vrc+Z/CO3EZaY3qBb9hH79ejBzB/rRScVm80f6VhZU9vrUTJ Sj/2U/1SLEjy6b0MNWuVZwy+XqaYD61iOM+I62et+cEqqg8LU8i4V2seFnWyV70LRSsw 8KxwIkmRw+dVBRaB/BIYGIeGNK4iCyHaD8vH6y5eKlZ2MHJLK2UzSWU1bGx59QCQYm4P adPnpbjwxzfyCi2wsJtPsK05+I+w+8KsmdSE+fUpiX1qUwwqBd+JfZ3O6m70jUnY05tY SZrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=eqkEEWN6; 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 2620:137:e000::3:3 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. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id z19-20020a1709028f9300b001ca87cf992asi3497537plo.284.2023.10.23.09.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=eqkEEWN6; 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 2620:137:e000::3:3 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 CC01E80AF3CD; Mon, 23 Oct 2023 09:17:33 -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 S233631AbjJWQRY (ORCPT + 27 others); Mon, 23 Oct 2023 12:17:24 -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 S229448AbjJWQRS (ORCPT ); Mon, 23 Oct 2023 12:17:18 -0400 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2050.outbound.protection.outlook.com [40.107.249.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35765103 for ; Mon, 23 Oct 2023 09:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VEPtuHNCJ4L+r/69sIF8dnzICbsFzEGkVE5YCcw2y8IvtbQpywxabDSWjw/pH2txUuUgdPTz8SZHT7DAp3YrELHL4BLrG4k1+UESB7jprizJ5uXEOHDG9G84JU0v0ExTR2cTTXMO8+SqWwhXAXhVdjCZD21GUeFEeQ0EutNv+ndd3a7p81fD3VzeNhjLJAiocJgk/5GPY0M8Fi+U5dPPbl8WwBe8s5U5WSQ0E+kSt3NkWRBziHUls7tKPFJ4+FOrc1DM81Y9B2+13oaSMU1sZURsmieU9a82tAH0copaMy28JfQkAzkVRbvdYGszMZEli7DZyxZT/fprf1LKJC1GWQ== 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=D6/0l63ENa1rCG9AOCfTVMMHkxQaSAkgSO/Y9e4768s=; b=mpnidE2G8Dj4rEXd63pZV1b3apmJvh9ZnNO+ZVQE98yEwP/Bu79ncIUOAyTbyy8pjLD/XhvwwC6LuoU841m/zRrarJtcRNu4BPj05akJSj4qw/fHanvxWT2TEjcmBaQc3O91ms+1htKWx2e/HGLi5o/3AH7aAjBgmoy1MWZc31SgwSaB/tos5RCoFDCcRLwoFi/mQJmliOuDRx8ZANiuFV88S5L3M7Hv/g2LhH/97S9GRwqCe3QYRw6jhv6Pv4gRbTDD4rZg+Oh5z00OUmFmYWCUsDIbh7fFGjGvUVnxgQiQdEVvRkiM9Wkz4NFItH/ACUJEN/5UHpPBf1aEXkRV9Q== 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=D6/0l63ENa1rCG9AOCfTVMMHkxQaSAkgSO/Y9e4768s=; b=eqkEEWN6Y6cZG4cfFM/fPzfThbRIIdKKPaHd3k9sGLUFNbdsEJUSKkIYKDQ26wFGNKl2aSIstmeADe5jtoNCCIa33aYqk7nvX0j4RXxtbvOTvSMob1r9HqVD7lxSuXty2LPU/1fV5Sx3guV4hzCAs5g66DL7rMqjDdsXec1hmWA= 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:14 +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:14 +0000 From: Frank Li 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 1/6] i3c: master: svc: fix race condition in ibi work thread Date: Mon, 23 Oct 2023 12:16:53 -0400 Message-Id: <20231023161658.3890811-2-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> 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: 8489aece-a84a-42fc-3c3d-08dbd3e384bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QGIVRFM0DhgJsZ7DOn0j/KOO4HpplLY5uZvEb8EXTbTOILKtN69HmexNHN+hxUygVPi42yUsGjTwiTsqw04XkW+h5lFqCDMt1wqn/dCCNAcRoeog4/MStnhUW7KAWfrMAShP+Lqb66IttY6Q9H0UH82/YZuRGOx19pItwM9NaEWBLRLeQJesL7q7LMC4pUPbDMWMZNTza1qIvEzQ/WncxZIpgWcPXqDfzThDHfY4qmufWbCyyf2E2KBbA4S334KbKjdsqOJDIdAbwPUV/yNIt1IjuDT4BLIwKBPvuQOqHey4Ihf5vcUzVu9FHsq3jB1qBkZb91inewNC2PLV+HC5rf3EzM+0h3LKczzRsxOyTtpDCaDb3vlOT78zfASGcmwslAyvG5BHHpSbsbqsInKFnKdDVLwoyLaWvVeyBNYw80qTjxbI+uKxOTrnkIX2Pl6N48782zxdLXlcctXEg6loYUmomdPV3c8EwcPGMsZYhj+yqax7Jl4y/l+By3wYeOuY1FkGfZLj9iuc/UW+5rYsDkdYiQuE8UEYQAwfA76B3B8JszBMmT8jR3T0XXh3l0/2O0pTugpDwdYMC3O9BLc3b9pmtCwt2sA9YTPs+AglFgOqsl//h1xxVJIxJ3+yyA3n 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: 9xG898d1HPqildgpO2+8kvlb7/VOhVc51pME8yo8eVViiBsYLWg2KIvpmF6uqE9xhocyi7LTVhNC7N1VTkkxpIY6qawS2iVORG4RzRpZ+amHrCbPt7/97pWqW89CefpGJs3/nv3NMim0k6er91thvKDNY2byDkUPPG/zk/oCA2dq5Aj4bP/VAjL21wvR8kkbf0cHrW9+YiEaa9Zx5fvSQpqNl7W5hNxrf6Aqi/ZHvlWm2hDQOuzUD0Af4X11PXfpmVtJ4vTW4wSZgXBA/jVLWqwTP9FaCiIZl3H7aLrpAaOeCem6cxdfw4K/OYwgTmljvZ6uRn11ipiIImp1my+XXBihiWXxDY+sQv8wxT+eYqnW65NCGLRqkLdf2C0Nx1b3rm4GDyaWkUtBaJOIfL+Vu6rzPnU/rYlOyNGCVefijjiWHbBxOAz59dTGFnzadGdcQa7Q2RmWO6C1hDridN/h3mZphZCyTeCEYlL4/FYwmS1uRiggAZbZ8GwqX6iC0Cvoi7s3mTqQEtXr+m+edRlCFmVvyZpFM6ZHVtiaMH6a2rgOlTmPplpSapUwlmK+avboal5yar86mEYWCWkICU9TlYGbuttcy2uh7z53L2UmnY3M3xBMgTGCGefENMnU9xL+oGSp16sXp5TY1hlDvLwglWwJtVTFPN8bmbt21Gjj6q5iglaupYH/qrQs7aG0cOfmQvqJ5dB5H/bUZNxsI2o96dCb//lyX+CLEGqjZiPK93khekQ/nX9GF6Jcu9Xfe/g52yEDpipu11FmBxJVbkXNGP+/W9W/LTH11TDwvO/1pEUCT4XOMlj3obfTs3+Ic6yksptqdMRDGQ2OaLMLzqU6N+vqaeM4sAblWcTtFaTKPL381viGk00JP0QB0cmLO9iGlnZTacRtQ+u37b2cTd74IhvGgtcHLDq2y1VrHwUvEkUn9oBNtlJX7p5RxqqMn+Wby4YmO71k95dBBUMogw5KbMXEt/v2JV5luiV4I1y9QPayfZWVtKZro3al8NxhGo6J4e6pdRL+w/9jCK8IjiJ74l7HQyvTHdQ9/7hyznkfsDw4nyoD34ZnUc7iD6X7ZA20beFB51UttTpmpofkafS4JbiYeaV9j1bTqEfyo1Qc8GedmEbQBrbyzSF4LVb6JJOyC6VzQpPwnkawVRGOn4dTdU1VW1wWP9I1i2oEqL8EDMyNXVPnE48oYVJ4GBkMXYNlscaUTVQRvVhzdWFTdqDLlLWabiYjvcfgOJSCT3HLurebKrtVIywCAWySv9G2X6fnitG9dyvwQDi1jS2kncOmIZzxLCD5qpXyxY/jy/F8BLkS7tkUupQ0gyyMEk7C9nZPImj4z+Xg422qY2Y0Xd+vPKcUQE6TYtTQN5AzwHGBulUTKLmsRkSzpKbkLc+CV9cD5+xyh938cHKwTzWBHqKYS30cuRUgLztJFzjFYHNvwG43CVaL7JvtvaSdsiRa9iUfNekrwMTqo6mD873ithCdrGYUoMkqtZL+6jLsznVTACeJEPcfPIpX0rIFKUKqF60L6ka9Ethh+02z0Le34WlYU9+Nekr6YC/s25Mxkh8Ce6nVKIOJJ8e5XQOmZC6t0bdZ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8489aece-a84a-42fc-3c3d-08dbd3e384bc 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:14.3524 (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: 9uflEK7zPHL/LXkr8Lfd/TBXARYo03GlXp4fmMfSYmqzDHcJqyyjNBM8uuBctIlw7bUzjNsglpJNEmZiEVuWTg== 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: 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:33 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780563689861008014 X-GMAIL-MSGID: 1780563689861008014 The ibi work thread operates asynchronously with other transfers, such as svc_i3c_master_priv_xfers(). Introduce mutex protection to ensure the completion of the entire i3c/i2c transaction. Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") Cc: stable@vger.kernel.org Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Notes: Change from v1 to v2 - update commit message - Add Reviewed-by: Miquel Raynal drivers/i3c/master/svc-i3c-master.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index d29de5fe533e6..8cd708c965085 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -174,6 +174,7 @@ struct svc_i3c_regs_save { * @ibi.slots: Available IBI slots * @ibi.tbq_slot: To be queued IBI slot * @ibi.lock: IBI lock + * @lock: Transfer lock, protect between IBI work thread and callbacks from master */ struct svc_i3c_master { struct i3c_master_controller base; @@ -202,6 +203,7 @@ struct svc_i3c_master { /* Prevent races within IBI handlers */ spinlock_t lock; } ibi; + struct mutex lock; }; /** @@ -383,6 +385,7 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) u32 status, val; int ret; + mutex_lock(&master->lock); /* Acknowledge the incoming interrupt with the AUTOIBI mechanism */ writel(SVC_I3C_MCTRL_REQUEST_AUTO_IBI | SVC_I3C_MCTRL_IBIRESP_AUTO, @@ -459,6 +462,7 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) reenable_ibis: svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); + mutex_unlock(&master->lock); } static irqreturn_t svc_i3c_master_irq_handler(int irq, void *dev_id) @@ -1203,9 +1207,11 @@ static int svc_i3c_master_send_bdcast_ccc_cmd(struct svc_i3c_master *master, cmd->read_len = 0; cmd->continued = false; + mutex_lock(&master->lock); svc_i3c_master_enqueue_xfer(master, xfer); if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000))) svc_i3c_master_dequeue_xfer(master, xfer); + mutex_unlock(&master->lock); ret = xfer->ret; kfree(buf); @@ -1249,9 +1255,11 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, cmd->read_len = read_len; cmd->continued = false; + mutex_lock(&master->lock); svc_i3c_master_enqueue_xfer(master, xfer); if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000))) svc_i3c_master_dequeue_xfer(master, xfer); + mutex_unlock(&master->lock); if (cmd->read_len != xfer_len) ccc->dests[0].payload.len = cmd->read_len; @@ -1308,9 +1316,11 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, cmd->continued = (i + 1) < nxfers; } + mutex_lock(&master->lock); svc_i3c_master_enqueue_xfer(master, xfer); if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000))) svc_i3c_master_dequeue_xfer(master, xfer); + mutex_unlock(&master->lock); ret = xfer->ret; svc_i3c_master_free_xfer(xfer); @@ -1346,9 +1356,11 @@ static int svc_i3c_master_i2c_xfers(struct i2c_dev_desc *dev, cmd->continued = (i + 1 < nxfers); } + mutex_lock(&master->lock); svc_i3c_master_enqueue_xfer(master, xfer); if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000))) svc_i3c_master_dequeue_xfer(master, xfer); + mutex_unlock(&master->lock); ret = xfer->ret; svc_i3c_master_free_xfer(xfer); @@ -1539,6 +1551,8 @@ static int svc_i3c_master_probe(struct platform_device *pdev) INIT_WORK(&master->hj_work, svc_i3c_master_hj_work); INIT_WORK(&master->ibi_work, svc_i3c_master_ibi_work); + mutex_init(&master->lock); + ret = devm_request_irq(dev, master->irq, svc_i3c_master_irq_handler, IRQF_NO_SUSPEND, "svc-i3c-irq", master); if (ret) From patchwork Mon Oct 23 16:16:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 156968 Return-Path: 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 + 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 ); 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 ; 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 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> 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+65gKkcFda02fCFDdiVEomiCwGbt/SYIRT2B0z1S5Dc2jWqXeUh/RvGFYplI?= =?utf-8?q?iCkm0jT8aaMhAtIp6ouePO+QpKtfD1WnJNOZVijU3pLYoPJWPL7x8H/wcixheYh8n?= =?utf-8?q?UYPEfRTYK2zmFXQAnXXYsOupscn9JQYxJFHStiBxDDXgxvVRmgaNhbs/LOx9g84C0?= =?utf-8?q?G/JFbP4RoBAdQPHFQEmVzU1NdotToq2Vr3ahLm8gVR1sQmI4Y73HYvu8RSwuHPEpI?= =?utf-8?q?VjnN/DpBJdzeciVFHBy/taWC/SWnZ2it2edVjajVZko5opA6sm7HZhmrAYK+TQpMM?= =?utf-8?q?JW9l83uW++6ioXn7un30vVOxwDmZDPijaXxEHifG8uHM8hjrNTxKv+gM/yQ9e16o9?= =?utf-8?q?cALXDSzr1q8BbARlJeAkdWF2ymXS4wnsvELjFQhzCqPpa8LRPiUzwrWldh9P2XxeE?= =?utf-8?q?fgdSh2ea6phXuLfSb9tIVTbdoRZdx+mRStUQ4GhwYmK72mFdcNv+EHLV3RNn3/pFO?= =?utf-8?q?AUGVfHVz1aU0QANmSCFAG4bso+nz51kHb6rCakPwSik3ioEbX4QCWUo3Ajmak5+hm?= =?utf-8?q?6Ug6KUMDCv2RaRQgcMdawagVlf/uLbLw5BQM/cRqRv64fTLP5aPNJc3iQy27XzwGK?= =?utf-8?q?m4+FT0xCWM+jSO6JGW3CjkcM+O+OhZuruvk3d5RseCcp/2PFDq9FcxWfBB2NmS+jG?= =?utf-8?q?KoUiZh8OQrCzhEz7L4hXhba7BjD7C+isGp/sW2r69/tyI4Lw9GSnzbh+fddDs6Xtg?= =?utf-8?q?A7WeAjKwP+VDGXDiLwVnq98k+Jp3vVDndDZvQ0/WozkkER+S2EPIPnLe1Eezo7IuW?= =?utf-8?q?VGJgINu/ki3VkdfjGtKaW27gbzUgGUjbAkUOfwRPFZQOC9aQLCjNvuB2W5E7IEjKC?= =?utf-8?q?HX9Qyl7hRhbM9hi+vPl8+ZH5bKmI0OSArOUlJXq7D1HJE7k/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: 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 ┌─────┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┏──┐ ┌───── 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 Signed-off-by: Frank Li --- 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 From patchwork Mon Oct 23 16:16:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 156966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1404971vqx; Mon, 23 Oct 2023 09:17:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAqqrEu7PCSvfeVJ01auvFUXL+sgiEEDUJnZS8Q7TZ+N79RyO+2K+ANRPVmeVlAzoHtIEZ X-Received: by 2002:a05:6a00:a13:b0:6b2:6835:2a82 with SMTP id p19-20020a056a000a1300b006b268352a82mr7855615pfh.13.1698077859142; Mon, 23 Oct 2023 09:17:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698077859; cv=pass; d=google.com; s=arc-20160816; b=cfekGRlcR/bpbiO/SxlUu6IlXbKgYq+eZl/StZvhuuBExPPyAh930deEQPavwtA+W/ FN9ZlWC5ppD8d88nbMNN2bfOTvXbBIF2+EXNUgiLGFv/qfn0RRWsO5GXW8ccd3uWh9dF 08Vnt5MBjQ4SBgnW6BCvokbgHz5ctlDAtnFK8WR+HPWcqn7jMrohG2A+f67SXqm7gAGj tfcoR4zMOf7Z66Js63tQHqAhoQzyczKweZ7pSgxp2dBOLwjiA+Die3uP64GQiDdVj+dm 3hGK5sl3mc5Ii4aceah0o0StGPknogKYMaRD5OoxBNbae31r0t50HgHka1eK5jO0POCu jGtg== 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=Q1Eg5x0kveUbh+2VLsIws1d1wUUv0QNkE46sI/KeRdQ=; fh=E7JNjAJdSu5PUjZ4Tphj2KJeWxfDCW7LpfLC+N7cHJ0=; b=0hxoZuxwMN1VdWyz7k7uwJQT3dteL42oKd240SequUOCJM4iqWKrBU2iZuTvLLIQCY 5jrCvzt90XIS/Jxznhtv2j9ZsUJi5SZojPiT6gp9mFxEu4QzzSD6svA8suWDHMZcP+AB sdJJbVZ+lLj5+EYLV2yfOqLapBkOA9ZmY8ZVQrrq9mvuiSDJxeSWj+FIMegWvgU/NpDA WDepVq0iOw+U+1Ph/hDM8NGiECfM6SMsrkLwxAmjCiAxEQwkI5hX/Y2tZCut7jGyCTHT AAiKrwcWSz4ENvKVZ4pP+uo74N06epYM+pXyDx6ZUQjgJ4kbGdqCQrGPBnIZK7ze45Mu ao9w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=M4IVsNvY; 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.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ka1-20020a056a00938100b00690fc88e4acsi6945418pfb.228.2023.10.23.09.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=M4IVsNvY; 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.37 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 snail.vger.email (Postfix) with ESMTP id 5008D804E70A; Mon, 23 Oct 2023 09:17:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233589AbjJWQRf (ORCPT + 27 others); Mon, 23 Oct 2023 12:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233659AbjJWQRZ (ORCPT ); Mon, 23 Oct 2023 12:17:25 -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 0FA1A10CF for ; Mon, 23 Oct 2023 09:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kEnTgr4uz2GhbpBNOlcEoKnkMloS2sDKKkKLTLltEf65KrsPVigmVbFYTlnbEMLv1c8X3QQFxzT3VNssbmNWHpaabWe1cPlLJOs5Z72nwBmDlxFHRaq4XyVFNZpyfVZuLdOhW0bXvY36bfaRqbmrWCoUtAdlVr6ZLtP9r2kCQhw5IH/YXxR0/rHCFFnydPJM0Vy06Hu6FytXa3odODox0Fm4S6qH317mqfYmDBX9iDKx9cMxRHvpF/5XDITmVYZPD1OwDT6+UNFYP+E6Gjail/tq1ht4SU2sSNpIXzU7/zUXyvReeDkgBOt4jBO+ZSfWRsO5KzvsDdN1aJ8aRfm64A== 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=Q1Eg5x0kveUbh+2VLsIws1d1wUUv0QNkE46sI/KeRdQ=; b=eRsX5YV8+u4UqoH611YbcOc6K/dLREz8097MsRG65zNVXCI63tTrU15zxsTh80UqEwwzutq+lxdiBbxxl0lwJL1pVtzI5GI262sf9ywavGD21kVXYp/hQSqL1NzsF2JeBVEA5JeFK5Tv+B5ZkQ4cJHuYFNJKBHW8XT5lfAxwwjeeadVf1Lch/Mze02e2CQEcqNmnXfo5wbhi5OIaiwbpYEOKKT4XifiO5ofm5ZpydqPsLh4/gcAjaAKXCDEcF6qaSvrI7ybt14zkciDa9SD5o8yAgDxatgoin7TSs2E/dVkJ3WYR0Ix2AR+e0l26gbbZvdeuSBKUgp1igrfKqbvFuA== 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=Q1Eg5x0kveUbh+2VLsIws1d1wUUv0QNkE46sI/KeRdQ=; b=M4IVsNvYUbSIaNCQkpM55WwkhvzRFYSjYcn7DVy+SbFHJaP6gANqENhO8mNMBxrq0KUVEEmHn9jwe5UwrI4BqZBO/CgAqHwDARvXXajaEjF8sPuWSOlk/HpkG1LuMjvWCOTIhVMfMihXlrlH4VI2B80Lkn4PiemltwtLSm+IAxw= 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:19 +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:19 +0000 From: Frank Li 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 3/6] i3c: master: svc: fix ibi may not return mandatory data byte Date: Mon, 23 Oct 2023 12:16:55 -0400 Message-Id: <20231023161658.3890811-4-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> 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: 1090b22c-74d4-4639-68b4-08dbd3e38793 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EOayPqRAm1d9ObrnFbDFrySO+h1SeZuHIyndiZlVwXqzWp6Nemzxk11touoRt4k9yUnyYdIBNiL0iA0QU4qu4wlPYM4bm6pnITBH1/yU7IVRvaXA6RgqiCv2xiBV2zsuyq0X37riL7KzCYcrsOdQN8CDUu2n8jL+3TjNypGoR2JoDjSDSbmXfG0DrmAlW62JbYb40OzyVx2GBIwkLp/PJz4Gzi7L4HsXfNBgkyfOHVGbYIPtsjbgTpImpxw10lBiZplx4/zknzbvAYcp1JgEDTtnVBx4Xl2eINk8sjRQTHLuEhaffM0Hh/R4QhZeQbuQ6atbTkQ7a2LWTdWiaO2mys18159RLHJIPf2jDrkcKPa00Otgp+8NLbeyH4L3QjuQ6sIHZ9UyRaM+wXhPd5QlC9hgfkH6xQ0B8JROlh9mI5WThsK4q0/67tMD/gsUc19VNbuHsP9IrGPCKEIdlQ/8PaadK0XBf1mXEMZJeTm8WeRikmMyhUV/r56EyoTvgiBtsYpcdUABw8lc2CK/UogKk/zbrxWM7fNHz7iyNfAuXcI6Q/v4msEuWEROdD0nxDwCBtDQSOIDDEmImYwESZ6JD+NZ7NJjjyseFPa3JJzd7jsIjD8VweiPKNeWUEY3dkCd 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: /0axMwlIomY2+G1KJdkFqix9Mo4htMPR0YywEiu0RJCLrzMF9VLRYPKZFF+bgtZRtqtKmt4q66NeaCd4/shde5MAoosJL3alQsh9PtATadobez5Vei8ACij4pjf0s8QlUs7jfw7P7Av0AUMqMEFLEPmxIzZuhrQP6tI0/gPgDdVa+rNslDSdXYn0iZoPDoOXEHioHC7DBzEH9WB30TdmHTHt6oO2zYYqqKmpJ5P3BVdNOQ4YURLwFYGtrOwNYkNZbZ2cYbms881ozHw8iFXCbbHLT8Q3ujTkxjSGxdw5zhvckttD9ul/Ag+CBzvppy7SntXX2xhVMFEtfFft7+lNfh0q1cFReggpA2z52UJwjHBVXH2f9gtGx7JfIz9UZw0YLAn49yek1Dx8YSwzHqHExLLvlADoy2dL5eWj2Q53bkldqcGchvmBkS5N6u6dz4QvQobdQaj0zKu64YZSCYIsj92CvdALuV+MpHFuHMxoAtsyUuNkWNh2GpSlT8Bb6gXHFIRm02MQBuceuQeYVTrWVwjUW9smdU+ng9qqSyIOdnJkO4KQZ/zwLoPEbNuVypi98EGSX3z+Pwp+01aka1JreUxnwX4aS369y9ixVcnpK5vTDf4BQlkIDKNelgOjkIWt0nIQtFraCxDqdORpWBIXBQP7bdIuhv5Cu8ZWUBGnVjrVwkXdxSlmPDvGIA7D5TlpwnikShA0VcSVyTZMR1/JD+q0GRsfZDUHijMy7OddhqOdWS0D/Z2ovosivGDI7PSssseSQ3rW5s5zLKVzGNRcWuJlPu5+kPPUaQrxG554+sgP9Q/3irzAp4+OIbmQz36Q4VUlFXvhX6rM1rnf8dEXduNqmExn0nzJSKSL2/TEmsOGRUvkDqh59zfvLbVVLkfqNfNC37D7QjNQKzIMPwlm1WNTBddI4FfYKstlT0ujuM5DyekhRFu8pZO8aYzRo/uRFWuuSm6SbmXWVevRo1lNwPB9TZC1xtjqRGzvwugdYLJB8qpU0fqceypW8jd11pYqTX976gyY4GaEfhXioTqbOknbyKx5CWdb/H75vp5eEzRHD/pt2pJF9s/JnuWWS05kjt9ixzeBTuDY9rH1pD4wjJymnh3RuHvcUzR39buxLW+dKi9oOagAQpKjc8JQwXww+TIe6jAQV7c4ZubXgDTcxDcqDbidSSDv9HCUb0QZPoepXqRWSIekJRMaAYY8OBInYLwuLV5azlcnMxCTgnNOvZFK90Hgvn0muWmpyXuu6DcwxZXCOItnFx0ntilVL4LY0pn1XV0/W5H4V4Yu15zB1Omhqo9H2M/LYyOgKucHcjMAAcaOEDstNhEoXxsGy8AGjSesZmjwe1PQMhkz+FAkDgAqlpCgSlUQdL7Z7bqgUviDdbadNnIJzXCnPpuWCv3OxfEqBuul6EqrAYcoFBJJF05vkqPCo8iVnKxDrbfG4Y+INNf4wFLFThmUSGMxaRR3Oir5uTlUMgWy7e81nUu4ecYBdi9NjwA4Xm7yGLByegqU7jpcafl5U8VpoqQ5Dx2KqnbK9hyH+A9ldlY9UMkH9tB3Y28UwFHmuV9nQpnmDrhSXhH3vEUh2sdU+o0qlsiR X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1090b22c-74d4-4639-68b4-08dbd3e38793 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:19.0411 (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: Z1Heo6JT1FJKSp5sPlkvWlKQNiOIn6xOHdZiLUs+DaLbYp+vVXd74xOEU1UWGCeSHiikmVH49LbfR7YkpbucgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:17:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780563689132930796 X-GMAIL-MSGID: 1780563689132930796 MSTATUS[RXPEND] is only updated after the data transfer cycle started. This creates an issue when the I3C clock is slow, and the CPU is running fast enough that MSTATUS[RXPEND] may not be updated when the code reaches checking point. As a result, mandatory data can be missed. Add a wait for MSTATUS[COMPLETE] to ensure that all mandatory data is already in FIFO. It also works without mandatory data. Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") Cc: stable@vger.kernel.org Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Notes: Change from v3 to v4 - add review tag Miquel Change from v2 to v3 - update commit message and add no mandatory data in commits message Change from v1 to v2 - update commit message it also works without mandatory bytes Change from v1 to v2 - update commit message it also works without mandatory bytes Change from v2 to v3 - update commit message and add no mandatory data in commits message Change from v1 to v2 - update commit message it also works without mandatory bytes Change from v1 to v2 - update commit message it also works without mandatory bytes 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 abebef666b2bb..dd06b7c9333f1 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -332,6 +332,7 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master, struct i3c_ibi_slot *slot; unsigned int count; u32 mdatactrl; + int ret, val; u8 *buf; slot = i3c_generic_ibi_get_free_slot(data->ibi_pool); @@ -341,6 +342,13 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master, slot->len = 0; buf = slot->data; + ret = readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val, + SVC_I3C_MSTATUS_COMPLETE(val), 0, 1000); + if (ret) { + dev_err(master->dev, "Timeout when polling for COMPLETE\n"); + return ret; + } + while (SVC_I3C_MSTATUS_RXPEND(readl(master->regs + SVC_I3C_MSTATUS)) && slot->len < SVC_I3C_FIFO_SIZE) { mdatactrl = readl(master->regs + SVC_I3C_MDATACTRL); From patchwork Mon Oct 23 16:16:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 156971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1405366vqx; Mon, 23 Oct 2023 09:18:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHrVldvXS4rYKXeCRVK+3BvP0qrYVRztWQ1E1oHA348Lj1hVj/4QBFUhVYYuRn5bVLOvpZz X-Received: by 2002:a05:6a20:8401:b0:17a:d72a:629c with SMTP id c1-20020a056a20840100b0017ad72a629cmr68978pzd.37.1698077893551; Mon, 23 Oct 2023 09:18:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698077893; cv=pass; d=google.com; s=arc-20160816; b=oSWcZtCoFIDcZtvje50YqdDktS8PI4/6MnluwXSEVa7ueVyiJNBKcD/5GMQtSgVkdx 1vl2GWlSaPag1vVsAObfh+B5t5ROAcGB/lEyNbAMLYkVUyIE2VPhHdLsuGo+JgL4Fd4x AAH+kE2FFtXq6nVYNY+ZbS3o7kY1NV/6Ov0bFV+hY92FhzCW8RybqPyXahYmiJvKN7Wl qIftdoSQt3MAFCFxl9I0ug/oQ3kRmiY74iSRLgn6g3LWh7I0SnCSXTnMXqqZarZgZlHi JRmIY6mYDJcI1RV7pMTOFfcBSySRf6xjaso7c39KxME89Yj5XtLq/KUrTRsQNk9CaaxW e4fw== 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=h4mJGV9acOW2cLGFSJ8HHBb/l6kCukylYAa2hfxh9Kk=; fh=E7JNjAJdSu5PUjZ4Tphj2KJeWxfDCW7LpfLC+N7cHJ0=; b=Pbw6jR4wirCFxdJXD+8ZsC0Wn+UJcnkUMdqC6Z1a+ywF68RxzSjkPGJ2sgWwWrEYPz CGCRmGxS2JkLmFGzOePmcrpZIP+3ROOtrs9UUQQxP9eliN3HgBxuMEzeO2LjZmC7eQ99 i+0AZZ7nA5mFezThCF8ULnBl9/yFZ1ER8aSEwMn9Em2QXgNp432vGStiERwxs6qG98mh Fq3ZEgzOfLg47sXjrDSaT9UBUOPDdv+rg4INx02NJZw2hM70cIZVTCEWZI3/4SBs+x/Q B4oC5/uBn6CroXW4mPr+ZZg5IUdvtEPOUSxAo3uIE1VAMIeyWUkjljnl612NSJGJ41t6 oC7g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=H41A+DHU; 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 2620:137:e000::3:3 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. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id a24-20020a63e418000000b005aa0e024d63si6352184pgi.791.2023.10.23.09.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:18:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=H41A+DHU; 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 2620:137:e000::3:3 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 F1B9480AF3D6; Mon, 23 Oct 2023 09:18:10 -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 S233632AbjJWQRs (ORCPT + 27 others); Mon, 23 Oct 2023 12:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233572AbjJWQR0 (ORCPT ); Mon, 23 Oct 2023 12:17:26 -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 CE25DD7E for ; Mon, 23 Oct 2023 09:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SXYzDykA5PSoEeT+D9nhOJQvrUKnf0bjtw8qG6QPff+eWNIC9iil5TJe7BSTMjD9A14U7mwJmWUNpPrQoT2QInzXhGJJ1hLKTUc1MGxfyaceWSCU0t/n0Jhb4fLrXVXU+YYGReJbbHyO/I9BoPMEaPTEXGaa/q/xoS2KlXZ6gkcyKEw1FCymyvANr617e6m4jxOZsqUcrnrSrutkCrqaFWwLquhoh8pIK34FKm7Q1NdbJ1WNJp8xp8EoPgCR52EcuSw/w9G3E1ANLuw3AQ6oXQjta9KJm5lykcYw3FeBu2RfziQTadwGlWWt3Ula3xv8E9a7iLxAOKiqR5bi1JS0lg== 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=h4mJGV9acOW2cLGFSJ8HHBb/l6kCukylYAa2hfxh9Kk=; b=H0TjZ2P9mzuAk4q5PULUniR0oTPNu9kchTy4b8YimwxjGVn1PZwNxYRErufOHR1ENG6QMR3rHMSOEvuKue+CtJeoWdHMtfBd8KF71e8oOH62V8U6/HyGMmxGBVh2Ppsy9gqyEMTIbjKIcInllw5A0j+XKEhIvfXwvZBnrSnk9nAjuPYQ+JjCin0r6O8KLC+AcAxlhNTjSaRUAOo+43yuwbd4i3T3xq+ifq2JlvCEeMegYhsdqT9hZhzpTUBysFl+4hwiGyzaCVrnaZpIO6u0lgcHAF3d3mhSTO4JKMm/qnh3KxMKdy3C5uBzHDK7NnQs9pY05VLfo3e1S74StwDyRQ== 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=h4mJGV9acOW2cLGFSJ8HHBb/l6kCukylYAa2hfxh9Kk=; b=H41A+DHUyVgZfpeNUxBLi9emY5G9wj4xSdcoeA//jxIuKIBXmpEijzxTzl+9S4DKR7ulJ/N6DfUZ5nhs4AhI6dx2D+ulC9iz5NV/yQWI4s1+gIlhEkIKlRMcmOg9KZR7rkUA/197kepu+PYYQoqAUSo4s48OlfnAcqO52VJU5+I= 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:21 +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:21 +0000 From: Frank Li 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 4/6] i3c: master: svc: fix check wrong status register in irq handler Date: Mon, 23 Oct 2023 12:16:56 -0400 Message-Id: <20231023161658.3890811-5-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> 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: 3069292a-2621-486f-446b-08dbd3e388f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lR4XnIQi1rymZuHkpoaYphbgxmNRz1SPJUV85YsB9cowoObQLDUoZ0PJiRvVNWg5ThCMsD4PJVSsy82i0RHOroO/5txBJs76e30SzdH5dUnkvwo6ZGur70jIIzRG3VXHcH6HyzwPJjmSzwWM6Z5LOS8KMF2/r1CSXa7kWbJ+IfdZhyu5kZT+lvTmyUaUbm67EEPRBJnXBZcHlBKEsQxbLID837FkGDvlD0RwyKbKnuhgFLMor3cv9ja36jtAJPUHVbsfhGSRgjxjmFWI2N8ggmJ/rZAlEI0icItbqqY7OB6nydYpZZH4Rnh2zbvWpM0sXq6O9m78Y1FrfBOJtRQygAV00RdzgSxH0036NZHvl4N5vw7cYfHrNnLXHzVlcY0CZRy4xnoci/ZaXTJzCNfa2hY77aKTTMCZZ/9D9J3SjodBhW/hdDFrF8TBUqPMV4TCNI2U/15TT0M7nCMrl13IsOWmwnhHynz1wUkNILN6abLp8ER0OBj8hgNGbB/yRIc0DWh11y30pU5MWuQwmnEWJwzTbps1HaqW+JDw8akn3KmgaosUdugD4V8K59UFrElhQxRVODlgIa/SO+axS91j06qzRtSws7LO6c9yberZSgGduHFNsRNQTktK9L5MSbKu 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: EpREH2ApipoCFTjNKq78RmnjXZbB0XRrG4CC+afhXCiIpKgh2cKFCI4Rb0bVFhFLENsAlBd9DsG3oVZbT6zWkFtv5XrcJX9ryFTG9b8bnE8Sapl+U0+PilwhGrhm99mEjnr6tD9KNAers6S0xGonuKnwhABr2GP0JXGtfFXz3mCLE+pI3+gIS+EUqBRg6/pZhwuqGvfsWQ0WFkqyqXGlOT9DTmxv/JuCtJkIvnIKS8vT6+hdoftLUWb9dw7WyjfO4xNVfeWzBMlM/p8K3a67WDlHa+s7Tyv+KepMe/J3JcO94c5VIKcLcOTkFYKSlFoB74U35yotDSWyVpU1L+9GWklXpfPWYWQccpoiDylgev2DktSPP9nx2v3ft49AmusCC5/k9u2jOnyRewm6ZrBIuJlkGJz2yq/BnMDr3Qyv6em5Fj60Uwe4Q9ZmbEDFfasfzPBCz6mqrSzeX862rgG7DyUqtSvajI9RPESdsNza1OXcvQRYnjkOGzKDX/Py8d7kAWKixc4tL9HgxL7Rpr/bXGMGrvH5CFxvkRJ5TPHQhqH9FE5ZohyqDRlMY58rzPAnNwJet2Zy0dPVSBpOukscEuBvgM43OtPTHz4G1Ms2AuR5P9MC2IdbkNPyelGZs9WuNtPtEqDigHgDkjuF/0YzIPb5Ndf3NImfkto2pKk1r7AVNE3NNKdk0Do2uDK7ovzx8AyRAqAzeJR0FOig9AXLHTRWL+prQRaFCbp5GcYp6M1yMJe+X7DjkATyUDAhq8Unk5nP/tNRtukBZlXW0q0Jr8m+OV71Wt/QoQR7NguP6GCOtOTk68zO2kMy/olRSaxso1cXAqj+juYyhFNr+nkUb8oOfb7pNuxJLFob4INP7PT7Hd7StAVrEsWUDIxl7267NYgDuJPA54Dfgc3wJHcccrPg0VoLjy9xcz/8SPlIj+8FGUVHf8eeLXXsmtVL6CZnQj+i1VPESyz1q0dnj0986ZIFO0/sw50PsCs4c9JDbFsnxZ4jXRHll5dY+YCAEsTa8/7uCMFgfT9HA3kCQZYVnJroDEB78CwTZfoGjZTmDHBOlPiXHL0yatVqMxrHi/MrNfqXWin+Ej4kWGiJ7s0aZ1hl7ir+LR+fjWSC/FHy1OV97aPH3YBwSz8eUXORz61jBVbyUPiNRW7dg+XGA/OeogvT1JCdeByLguT0+MjJvBFJFYLmvysnD4ezIdNbeAbkFd9thQOCltUmAuLCtVH4kQT/vR+2Jx5MmdNKLW4Y/7jidUxuxutHzZq8fG2X0cJtkb8mMNXpL3ZQn9H2r6RrnnN2rGjUHaWYnxC+W7NRV+uoK79GXqqoPd6G0Wmy52QvHDB/2CxR1CBJ3j8/5WCd4mWEkyTdCqutmJGgqYuTYX4F6Vavkw0BUcnBQvSZyZ643SsbPuruuMoZR1A2UTa8OeKUFlPS4zEVkfS9UaxQab7aLclN9e3l3eSAoA6ev/tAe89SaZ3XIus4c90noYldHnq+R+nrUXnM2IZ5e8VTqCkgojrEVt9XN0htcgmfaNF4eE6BLDrRILXPLBnjXqJgs7gULhbRQRr5gmMItIK9yOCyWLewUmS0c+o44CSK8vqW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3069292a-2621-486f-446b-08dbd3e388f4 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:21.4682 (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: 6waxxU/5KgXtirH/MXaK4sRjHcHfjEpQVpfP3ntSLWlh4Wc9+ib2dIK38AdsV2/1pnjnCiv7n8d7hy9bnTcMfw== 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: 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:18:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780563725251411766 X-GMAIL-MSGID: 1780563725251411766 svc_i3c_master_irq_handler() wrongly checks register SVC_I3C_MINTMASKED. It should be SVC_I3C_MSTATUS. Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") Cc: stable@vger.kernel.org Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Notes: Change from v2 to v3 - 'wrong check' -> 'wrongly checks' Change from v1 to v2 - Add Reviewed-by: Miquel Raynal Change from v1 to v2 - Add Reviewed-by: Miquel Raynal drivers/i3c/master/svc-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index dd06b7c9333f1..b113460f059c3 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -476,7 +476,7 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) static irqreturn_t svc_i3c_master_irq_handler(int irq, void *dev_id) { struct svc_i3c_master *master = (struct svc_i3c_master *)dev_id; - u32 active = readl(master->regs + SVC_I3C_MINTMASKED); + u32 active = readl(master->regs + SVC_I3C_MSTATUS); if (!SVC_I3C_MSTATUS_SLVSTART(active)) return IRQ_NONE; From patchwork Mon Oct 23 16:16:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 156970 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1405204vqx; Mon, 23 Oct 2023 09:18:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFiIs5IWbrY1wzpA1UADF2QwNmAxVAG6en5Qwx5KkQ1X+LwgtAnlAupUdMO5pMYo6kGQVs6 X-Received: by 2002:a17:902:f945:b0:1c9:d667:4e4a with SMTP id kx5-20020a170902f94500b001c9d6674e4amr7723863plb.69.1698077879863; Mon, 23 Oct 2023 09:17:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698077879; cv=pass; d=google.com; s=arc-20160816; b=IMkrWCByPJEtRrP4UtTR8otjAnpWCT2T8Vb9AEHJ3E+xv4qoxb1LWI0kFvdWjX4YT2 v/U83tka9aBtsjpEBW7MgxWHypHqKsxlE2fFm3CjqSOACBXSZRGsZcuJJtM3z+1ZMdHs vmRvULA0bQ6z5nRM/sUhsyOngpr/SA0IglA+i6BtBfUDZ42tOASAfPdBfoKv66lhK1fX 4K5+tmJ0fKzwFOw9N8vUMu3fjBorYX8Ttpnvipi8CB2tHoqjxhRCgNkc9aZCyg+ACjpF 3PM3GHIX9GYjbHky0RmiRtvZ+8GR3FF3IA3358u4YWHvIFu4UQo/UWGXnSGseCdkHNHP BqSA== 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=cU4Cbhls3SW1lImnaGTFfi2FqvW7XvhiDiskv1v3GyE=; fh=E7JNjAJdSu5PUjZ4Tphj2KJeWxfDCW7LpfLC+N7cHJ0=; b=WNlZA0Yut0OTi/PYX62HQMi0LOb3kpxD5gdou4O/q5wQBg0CiFAyl8LaKAh4hpU7oy gbPZZYlV4yrQd+F4R+EESlwLLhSeQB13ZF71eL2zNq4B5Er5H8iAPDvOvysGH6mwI/DH vGscOkYcWWaLl0kn/bJ0u2OtneE9JCDBb3ibbRK/x+qiFVoKSW6BxNA2fewc9cmEhu1U vrvNXVEMlOrVrlOCJ9XdM2UAvldCQ5rEiDQExZyJ+4/4srbB8Aw4sdPy9DZf96hTRNrN nZhla2n7rqDLmUfQT8lOarlQo884PeC7QpzVZ28Nx+LbInngJt+uXmPcGSMwCICHvLpu Iesw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=nMydSNsQ; 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 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p19-20020a170902c71300b001ca344f46e8si6338629plp.245.2023.10.23.09.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:17:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=nMydSNsQ; 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 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id DEB77804E7BA; Mon, 23 Oct 2023 09:17:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233741AbjJWQRv (ORCPT + 27 others); Mon, 23 Oct 2023 12:17:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233629AbjJWQRa (ORCPT ); Mon, 23 Oct 2023 12:17:30 -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 D4E6010DB for ; Mon, 23 Oct 2023 09:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A1kEb/HtXe8z82lgXkqqIdG8l5+6CupeCbPBbz2vifYsXd5MAQ5s2SG0w7G4j411cs8gNmvCmHn5mVN1P5zIFr66S9j1+nCwoH17CA+g+htTSRz4ECrEFYtJMWdSvOk5VvfHG44zeRZLEkaAoWYeib9WBTHVeRO0f07lkaPiD4/FEehEty7quIVxThmmHkCNE3NbTt2WpEtoQm+9oIbU1fxFdXa/xzcxyE+HVjGnoABWWUd0ptv7CPBx4uTWPyjgDgl8XJjStv9qN0+7Sy4IpBOvcUNO8c0C5+4XlwvxkZEreShxG96ViKBQkxxZ+2VbFSoZ+E8hsNG2acU4smDwVQ== 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=cU4Cbhls3SW1lImnaGTFfi2FqvW7XvhiDiskv1v3GyE=; b=Runx58+tzrbXHdf9ap+UXV6saHtPvsLXh+ROLB+nrIRuzKt5bxmTSvDP/C9YdlZRyUl9wXhg/Bhp150e57uuKWDxxfocVyJkEAiWRGTmkA4h6MhrF9T5jdeUFFoM3c3DrwhctI9Gybu1mlnkTY1g0EhgKniis8DRdWZGkDe2n+JcfJSSocSplKSK58/mlI0ZVRUZz4sUP9GqUTZ2W5NR90JpxYZ1+g0rzJrfonMjAz325DupeZB98GwxewpTi0wkc8uBF0hap59pnrD89hiZZejbwXS4pX1gxp1mZA6sNmlDXiKuV0qMhJJUlkBPqqk5nrO3VCw/C6ayR/deepq8RA== 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=cU4Cbhls3SW1lImnaGTFfi2FqvW7XvhiDiskv1v3GyE=; b=nMydSNsQkxIYKcHXm0iV4jNqxqCJG16D+H0ldoClMPcJR124kadj9snCHDMWjiUrcwx15xqDTg3nEJPJoYz/aZ2gVleOJLvAk16Z3tIlpYZIMb8nE834D9/1EJ1LUZv0pidwlzdR+hzTPqi1g6y+rjP0RLJ7ucA2At0t9g7U+Zw= 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:23 +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:23 +0000 From: Frank Li 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 5/6] i3c: master: svc: fix SDA keep low when polling IBIWON timeout happen Date: Mon, 23 Oct 2023 12:16:57 -0400 Message-Id: <20231023161658.3890811-6-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> 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: b1a567a4-ee41-4744-32c6-08dbd3e38a68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J2o60YH4aEIGMS0wnhTWPT8LWlysfWkLHbhfGfnHjDd0twDX0W8LtpdCVfGrxKezf15mXeVNaiDPl9GJcj+PTNGZp9IvMaIhP5Ah+MBsuCvmdCuJFz4lDjw9e+jRLuZo13IOwRFx0svTQEItgNxuPTByOqFGAOieqKsO1f/iFP2o188gOsPMlWngyRswrR+v5f3cgMVWfKCNJnux4UinTA4YNX7Flji0HILGWkZnq23x2jwELyJwQq656wiXDAkNZKsnpmiLNWqAUIjbFTs0OAYzFlv4J2viwbLSI7Vjbh9w3mNAIoV+KvbpjbnxUuWv8H5ugg6K25NHC5iy8CZVa0AVHk9ek6fE6FD9Ce9D3xFZB1yjyfjcIBPhQ2KCyjP1jcByS5mtiI8qzvVIH6oJntKTQlCtoGQ90JvUg/gYxnYqn3Fn/o0lcwlppKetePSabv15etZtbcQ7MoRTIYLLTI5y2Xw0/pFM6rNcrnWJnzS8e4rBSoVUO21ysTyUI0uTBlchI1KmxzbJ3QjRmVrxaJPWAtLpw2l6k1WGuFkqRpwgGq8slrz7lPFdSlqbGPqhnQFY2l6M07LbCmIrDDFixGIdsMb9IEIxitsGRFKpDpwSDKSS6z9OPdyRdnYMfS0k 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: CcmzQ/Bic81S3jCB9xE9Yhc+KTggFhQp4cN+3Er43R2qojbpCYsXLP37PcMZDufKDE7pDQJ55Je0i73cnPepL3yHg+HQfDv4Op8qkNw5amd8jFrXObN2Y79Jyjfq1pk4yi8a+VYVOCBMSSI1kqJjSvhCI7944i6C7lKugkW2M2UnfygUvwm87S5vsZIwH8TbcPn1HlBG2zmgasHr77I6L56LYl2zkR/K7W/VqAJcAhPMG2nRgVDmUBfN0UwTwtwENr6X9TNk6kGiH0S+rs6jJtNEi45BvKus1XUsjcFTknzzpjDDBv7X9Ljp9gSPXmytWEZJTLZLQqvEspdtdh4++zM0RuvlO63B6Wfm5X4xF1EXM3HUKxUzFink8XNPpsZLsbsPWyMLHU4Vwgk9dHr0L2tvsKxvVP9nNG5rHDeGL0YTOm5qwoU2610MCRvDwdty2vExuPIoxwLGc5afrdJ+jIafKTEYlAlKGB/pN4MMeXr1shcmgCeYL2tYD6ZoOrUsC8o25iwA6JnXsp4O8FM1eiStBjeNjJ5R0cDj93JUdb8Sc+m2HXwYysr8SHZH3nPiZ5a5Q+ZURdgFCSTAb96lffhqsqAghgi0DhhPchDoTbxCX6aUoU96ZUzpIvn6EZShaWnFYWpfrYF6dLuIGJxzuMLfUaNEiA+PLcXCtUpGNbvj2JeWpH3vZNGmOwKzAImOgbciG54S7AMHakOlDT6gpegKuza9Iyt0atfrNWTmPIMJNOSffDaUz/DXtxmdefdfwB/bzCfgp7hnwyo6pHx0i+uL6VflzykvMjnXCm74elcCzKbsdR9IKRHj3DI5F4xZLObd0gsZ5RhhQDKQz3Qz1lqq0z6fCv46JD3FEB52ayTtoP9Jd2gUIvLzodXI1ILv/Irml3Au2TiCRj4vCjMqjeFfOkutoovFasFi1g2I5aBzIDELfI29B/BBfZQUskYzp7pZurHItBXUEv6/c2qZC18+wvLd3VqMfcB7cK0Qi3lP/OdT4Fd9RiiK+NT/rf6XQe9T5kL36Byg6pTPyyPWOZPHzqwiwIBOTJVOpTSlgfvYfnjh9molLQU/MkNZc+rfHJVgHwAq5HPVjYx481FqNBfdJUSkTzIqSJcCBy4zVVCJmhu4XL6TkF4LzCg6gwg75wtHHvxKOGdGI/7eKAaz1biFfrckghEDYesaZf9/QTqpyrLJLEwn2hxp7Iw9OXRQfSBJFADpHOS9gnHQcjieniJ3WmmMnQZUO4hvT3pu8dHki6DlDmBnIdMRV+p7t+i8+cprzn/Irh3HoiajEkbAQLyY0smKKKk24G5fjz7MBrCjAw35kioeio6P3v3BvAoFEhcgcaq+I4kkPpoqCuZmnkmRwRTSLYMIJl3zKzz9Rk/SrUMEPg2E3NTwuKwgnqJNQwtuW9krnoNdv7OLM1u346w9dYR2dIUwPGFg202eIqe9hskiRXD0BXLI8ihqKmB2s3VOZD0doGL02JTTAtigXho4pPpJziOatDAPDMvr1O4wIcSyxfPToVCC4+8G4u2O4lENJmoWixkayKVyveODa2gwh0wzFvaoXAOtwshcwfhMStkGt5Yd4nRusT/xoohu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1a567a4-ee41-4744-32c6-08dbd3e38a68 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:23.7770 (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: giuBRlfaHk3hLM4JmCSETV7BP56CetrOvBakPF6dBSzikbmyUh5HSdPMlysFO5LVA7P7/ex/JZwooFCU96yPfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:17:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780563710917369397 X-GMAIL-MSGID: 1780563710917369397 Upon IBIWON timeout, the SDA line will always be kept low if we don't emit a stop. Calling svc_i3c_master_emit_stop() there will let the bus return to idle state. Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") Cc: stable@vger.kernel.org Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Notes: Change from v3 to v4 - remove duplidate in commit message Call svc_i3c_master_emit_stop() to let i3c bus come back to idle statue when IBIWON timeout happen. Change from v2 to v3 - Update commit message and add review tag Change from v1 to v2 - Update commite message Change from v1 to v2 - Update commite message Change from v2 to v3 - Update commit message and add review tag Change from v1 to v2 - Update commite message Change from v1 to v2 - Update commite message drivers/i3c/master/svc-i3c-master.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index b113460f059c3..1a57fdebaa26d 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -404,6 +404,7 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) SVC_I3C_MSTATUS_IBIWON(val), 0, 1000); if (ret) { dev_err(master->dev, "Timeout when polling for IBIWON\n"); + svc_i3c_master_emit_stop(master); goto reenable_ibis; } From patchwork Mon Oct 23 16:16:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 156972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1405428vqx; Mon, 23 Oct 2023 09:18:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBSgtK2gpPBfxT6bnr22bTcTUZMg0BgECBTQnguWoNOcFh5dx81zTJwc+N3efceRk+7xfd X-Received: by 2002:a17:903:22c5:b0:1ca:8541:e1e7 with SMTP id y5-20020a17090322c500b001ca8541e1e7mr11908940plg.22.1698077898861; Mon, 23 Oct 2023 09:18:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698077898; cv=pass; d=google.com; s=arc-20160816; b=J+zxsmU2G653FsE/27WTrPjsKMrJJbykjAfxLk5k9g62V0Mx7gOTpfIG6dsifnq7xR SOrBQ9OdGVWipvd2KTeqFvtqjVy08ajoIU+6sato3HMHH2M4Mj8CTLcVlgtCiGHhVJE7 yuSndmTWy8nRfnDw6yXCs4rdQxDvdpxcj1FUwpFKK7Oz0Riw/H8RjLHgi5O/MPql1o6i To0tyTtnEhqv36ox3n6ElOCS9Z+NpxuporRNR1S+9MrpuQS5Tyf3YL9+UiTGN1Nqforf dMZDiFBXx7WMUEs+q+gNdhd3/dQiV8Y/t8ibAZx02SJWDl/bVYiKesunroKfXdI9RVf+ y9cA== 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=nxBwTfviefvCF4FZJghiatpkh63SM3ZApfysbHSxGKY=; fh=E7JNjAJdSu5PUjZ4Tphj2KJeWxfDCW7LpfLC+N7cHJ0=; b=mILkagB+rmzSB46PRo5V7i+SPUbxclU2i87+JpcsQcEsOXjDSXSqlwH6Q3gSUYpgsi CcK9+ik3na9ery2I75TCUgk9fplExqgn2u6u5PibIB++nUEahyfgh/xQb+M9jOgWKreC 7iDNDXiaK5CDrtPcK7BdX8T+ycugilj2ayB3WJh1PuQA6YdOIljXs3XadUBpW2rqPZhA URQYFHwBidon5vh9geHaSfMjnQHgOr+UrbYJt7Da3zGh9icLQAYcYJLkBeXyQ+POTqAF /oACDskku6oZBcs/2DpzPT1pLbPrz/ND5EawPASFNnXNyPW3kxulps1Lkxys1HdO3oVj AFQQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pbOcV8Av; 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 2620:137:e000::3:3 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. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id j13-20020a170903024d00b001c9ad75c067si6983196plh.149.2023.10.23.09.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:18:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pbOcV8Av; 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 2620:137:e000::3:3 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 B132880AF3EB; Mon, 23 Oct 2023 09:18:16 -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 S233692AbjJWQRy (ORCPT + 27 others); Mon, 23 Oct 2023 12:17:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233641AbjJWQRb (ORCPT ); Mon, 23 Oct 2023 12:17:31 -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 2B77610EA for ; Mon, 23 Oct 2023 09:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BRLI6FkfM/TdaI18u///YcnF0M0g1tIz0GvzM0xejITvTwaYIhkh/+mwTEOBeU0gvTiWJQSTt0jnelZEaLCcaZ9Q2VPV4oGKoyhvE4KqVyuh498Jl19lut+7cQyRawOyUR8Wx9Iu+DT50gXy2eIPKOM9kZQfAKWVH0JgrS1hwkBIzNAxQGDY37y/Omc7DnqDf46DyUgEpWXJTKC5dEmjduMBvtc4LaUTk4ILjtJfSge7u/bmUwYN10pb/9dK5/f+mGs/xap3KyIbwitgojhygMpVG+NOOBf+uJZfuAm5E9B5WMKA+aJdchc9L5IHzCC7TaChicD0G2twYbOVEVo3ow== 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=nxBwTfviefvCF4FZJghiatpkh63SM3ZApfysbHSxGKY=; b=SNnX29DqPMWWJ9x1Ds5XY/6Y5ps95vOjaahe6vSPe0wGM7Zlmbcql3s5IW8TEgkXJu42Ry+7iAl2uZtUbuVbxF6RAuuYVmmHr6AHZsDEwrPgKsAxQ4rBff0z6i59qZQf0TfhlE8t53ua+RiWURRKEPNY259vuGItGsJrW4/SwfYNX8CwbI3F33hkZfkyXbDTG9IRG5aCXGFK3FY6saxSCkeIecVyrFZHSSk/0JqP2a2meOrANJ2z4anAe2h3Xsnc7OdiEPhLv4B642QxppnLnjT4xOYjbo3v+2XUZ5yjyQojNA6DcyDyJbS2JWmzAGYcc9zhvENs7omtW5s5ZfV7oQ== 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=nxBwTfviefvCF4FZJghiatpkh63SM3ZApfysbHSxGKY=; b=pbOcV8Av0KqKjZ5l+K+zgQjOsDMsYc4Vq1aB2o3MjVX2avT3yaZCu/SBJiXZIGGWNl/zF8JDHQFr8wHpctq69Yaz7vPQ5ww9INCPjHnMMv/spEugLKLdDpcOLw32T2Rw5VfnFTVCE1ogd2buW5liSZTdMYJ1GucalyYlSvl0w4s= 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:26 +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:26 +0000 From: Frank Li 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 6/6] i3c: master: svc: fix random hot join failure since timeout error Date: Mon, 23 Oct 2023 12:16:58 -0400 Message-Id: <20231023161658.3890811-7-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> 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: b6aa3968-6fb1-4441-0e8e-08dbd3e38bc9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8zCVGeih/1XImRLE1hl3BcOTxLhQr7KRepfcuRX6ha/BJfmXPe6bw94yaVdNh/u58eVxmV4gO2G7rKDVqAMvxFpUKBj3eSgcoLeiEfUb9PHpDPX/IRpktinvigrtFPYRTtV2pNLnJ4DpIJm8jT/75kSVYyNg+G0uBU8SDYSx9pjaufZB3NDDimrQl0UE4sz5bahXtmzhUssUsK2KUuNqV+lgP4qb4EQJikJYuOqWf09CMo4tyEv9/eEZXX9KAlGi9faKO6je22yyUbMUCfQF9huuuliR/C+bvuUqc1xTgJa6t5nr1pGEyn0Qh1/uuNHFl5TnaXVjM5OGgadqH46Z5pxDHB6py35jhv+4QfTiowwJOGp9NCNhZXHWOKlnJO6Vsoyc0mXOH31DtIZeTH+IigJB0UlYdirJuPu+wXcMP6axN5DzHA8CvWfOfqo2X1cCGhCro5XfuQbbckm61zZf/WecHG8cGPPyZAP4CGhnxTOBZYQ5Yhh8xPCGKd7AWBg0ohTxfYUCOS7rD54Rm5yyAwOcxJMu0v0JRjWX5mDNBdRPVj56v1zy2dQWHQFJ6C68dRHx5jQ9tnDAy84qlCJgseWS1pP3jm6bz9/+16q6BoED0Y2vxAD3uBd6YyyuEMJW 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?PT1brGKV4OG8gqr6IIyZmMI+uNPU?= =?utf-8?q?VHvhy0J0lN1toYdiQCbNblKFGHrFAl/HZRLC5UiqZqGlJ54u6shusthfNVhDVzFI0?= =?utf-8?q?9/tcMLEY9f4GPrrULr2u0hBt5xHEIkQCfGR0B0Iv6Fx/u3lGwbMOm7x+CRQGA82PA?= =?utf-8?q?K3p+rxXwBFZV5ZM7cyifuAkemZNLuY2mPljBr7A6bH5snSY1YyL1EBFkfNI2YPLsX?= =?utf-8?q?l5Q0uKiFVHFGFc56iGG+xJWLaWm8nmeYfdGofxXYWcthmHXlEJWOiIzqmcWAuBY+e?= =?utf-8?q?vaOfeXICNB4VcaxMqQ73/H5ClGHYeSdd3sub3Hbh4BWnQkndIqJsHgtaSPq+G/wdc?= =?utf-8?q?qkfXcz3Vc6d5l1bBSEK8ALMhgzHzPEeO0PUYv1NG7/qXuVbLhwsCtJoAXfI8lwCzO?= =?utf-8?q?KOmsVDhT+medEc9IDAA+svkyNYYMRfYWI5xIx40bbLO+oMPbc8CW5i3L2SYw0QlZ8?= =?utf-8?q?t1GYER07ZoVBnDYae12I+n9FIpL7iS16Yw67u2PO9Ga94yd7oFbU5MwhZGKuoU0Lz?= =?utf-8?q?/ZUgJ9LAWUVbs8yZTIr0sKXJ3C9jHwlDBg8krNbBBCJDh/q0dMRvHo9/t9ltdiQvz?= =?utf-8?q?fo2jKB6UByqvyfTSMAfugNSe5fpq6wqoz23HzACEJn4NOMk6kRo3NI+uvjC1FWJFL?= =?utf-8?q?RwZZK+NqUlU/R0ABJozwTWdqm4U0eo6UfAkNkq6OYw06qfw0Ay7tsl8RBS0ZoVfDo?= =?utf-8?q?Nws567DT+YBRA89alcEhwFd/ZubveqJb8BeiyNQbP/kARFBrd3ksgPp9wavinPL/L?= =?utf-8?q?6pqhiojNqCpdgFZJNTC0nbb2bSRaERYNCBfI7Jxdf0v9Ho70/8y8KHDAxM78c79Gx?= =?utf-8?q?WZ/G2T02/19ZtLlVmPNDOeO3ckZ/Xire1kstm0JSYCN9oTNJ7I1XBAV5e9oIDpZtc?= =?utf-8?q?ACcQ/Xd0CZO96Xpsju5UAPBVXxtfS1jW233wyMzNchBfUnFO8mgiUlLEyBeY4bXgg?= =?utf-8?q?QUn4as3fdZb43s1aSGT+sW7Oim3BegBC0T8hDwaPTfQEz9ZdWk99Rha9ps9I8t+cg?= =?utf-8?q?DkqGs23ABdiuUIJmxQs1sNu4+Mf93a7m9BtRWEaf17YVMSkEIOzMhx4jfzQF9iEEB?= =?utf-8?q?Bh6vF98qiJSV9YAEwqbD+ihAtBVrnox94shgMGrXNJ+DLQZxfMAlzsJNpW+lmV4px?= =?utf-8?q?8Oxer4h/iyRKPW7Qh43tVGHlnLNVP+FG8HdZuP/iuwx+iMCGv4vZp091pwhmSQM+7?= =?utf-8?q?yqdgsX7FwhnB7o50MFZ0IUuqjtQE68zVpSz6tx01pUBqyXMGSrH6HpQqlsprOfKCu?= =?utf-8?q?aWKy2riyVHBeLm3Hk62Ym6DSk91JXM25UVrhKfzzumGZYEiVGLe7IL26wgZpbazDF?= =?utf-8?q?5m+E30ukTeulWkNuSz4pUtx13N8pvbqGV708nrcD+gCRWoN3X7yklRBra9tlVI13m?= =?utf-8?q?pxC6flc/FQL5gunO0H/ZLKhr7/KgqxYUZUW9YK559b+Ou40MdmERwN2Yblieqmd8F?= =?utf-8?q?4tyGm6GxxNlkoWh+imqplF3Pj18x7VQf+bRCr2ac500w2njWaLLaq5F6x5hc2oylm?= =?utf-8?q?xOXC/lq8NzQ7?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6aa3968-6fb1-4441-0e8e-08dbd3e38bc9 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:26.0587 (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: Fv2aAifx1F2hnB4a9mY7Ky225TgNnfdoQNvWE8DzyfWWSXdNQy2obMMT08ujlHnYmFcBAsyMQlKzPObKwtOM2A== 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: 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:18:16 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780563730979103967 X-GMAIL-MSGID: 1780563730979103967 master side report: silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 BIT 20: TIMEOUT error The module has stalled too long in a frame. This happens when: - The TX FIFO or RX FIFO is not handled and the bus is stuck in the middle of a message, - No STOP was issued and between messages, - IBI manual is used and no decision was made. The maximum stall period is 100 μs. This can be considered as being just a warning as the system IRQ latency can easily be greater than 100us. Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") Cc: stable@vger.kernel.org Signed-off-by: Frank Li Reviewed-by: Miquel Raynal --- Notes: Change from v3 to v4 - fixed missed update commit message Add dev_dbg for TIMEOUT case This can be considered as being just a warning as the system IRQ latency can easily be greater than 100us. Change from v2 to v3 - remove 10k at commit message Change from v1 to v2 -none Change from v1 to v2 -none Change from v2 to v3 - remove 10k at commit message Change from v1 to v2 -none Change from v1 to v2 -none drivers/i3c/master/svc-i3c-master.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 1a57fdebaa26d..6b6bdd163af4f 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -93,6 +93,7 @@ #define SVC_I3C_MINTMASKED 0x098 #define SVC_I3C_MERRWARN 0x09C #define SVC_I3C_MERRWARN_NACK BIT(2) +#define SVC_I3C_MERRWARN_TIMEOUT BIT(20) #define SVC_I3C_MDMACTRL 0x0A0 #define SVC_I3C_MDATACTRL 0x0AC #define SVC_I3C_MDATACTRL_FLUSHTB BIT(0) @@ -226,6 +227,14 @@ static bool svc_i3c_master_error(struct svc_i3c_master *master) if (SVC_I3C_MSTATUS_ERRWARN(mstatus)) { merrwarn = readl(master->regs + SVC_I3C_MERRWARN); writel(merrwarn, master->regs + SVC_I3C_MERRWARN); + + /* Ignore timeout error */ + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) { + dev_dbg(master->dev, "Warning condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", + mstatus, merrwarn); + return false; + } + dev_err(master->dev, "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", mstatus, merrwarn);