Message ID | 20231016153232.2851095-2-Frank.Li@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3543767vqb; Mon, 16 Oct 2023 08:33:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2NmnpINXk9ePhWLN6zidffelQQZYyAQ0m8zpI1XeEXNZoCdO81iJSH/tDh6lhLzY+A8cF X-Received: by 2002:a05:6a21:a587:b0:163:c167:964a with SMTP id gd7-20020a056a21a58700b00163c167964amr42630122pzc.1.1697470401792; Mon, 16 Oct 2023 08:33:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697470401; cv=pass; d=google.com; s=arc-20160816; b=HVet67J95/JhuEBjc2Vxrbk8DabOEvquj3rKSzGl1THQDCBpzU7cL0mN6nrKS6kSx0 clLcq9omw+wHjQZyX0QRTxihlOMJBnC83HDqQr6u7TeoBh7wxBsHy+TyY7gPTdMP/L23 qJ5vgP0f/1v1+OxpvKqJJiLeFJv45nDUZo+dAQSWobcBpbiRpS11r637na/rZYIIAHeA IDmyZombBHpeOTnQCuXC7ArhH19PAP9BvxfuS0cB0v31KL4rBTbJrigxhybv3ggcH2dp HlEJCcEsRc7D/m50his9sXx4Cg4TOIVRQdyVf35xs33Cz/cJe4zyOKKbulOP5DsCqsFX 8Akg== 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:to:from :dkim-signature; bh=Xn4mPAvhPGdHiiCr3YwVziVD/SfIEV3x+7h8xcqcUzA=; fh=bn4KwJ7hiZC6iHD6ocv1YpB9R5Bd8J/ZarfJ7QImr28=; b=0+LJuXaBpJgyYKEyw9JH0cAWbGMRN+oO8o3eSjtsWW/3B/DJ0m/rl3tao5RBnDvVGJ qjf4kmsoJeVinUc3sqDoRXDD64QPVkIo2EhB4CHIJXTLgvAb+4/pW8bZpdAtnL9kI++x p4dLmsa2TlHZEpJbZxTXnuiE8kZowilsDx6iYWIsLY1YNpBqFmyf61fybr1V/3I8VQ2Z e+7op0GBraAJtFNtv2Kn6K5cHK9rTLh7T64DjROIxuj6k0TwqvFS/SBRXRHFrZVQcVHX yaY1kzxoNsXZxqG2JRKEH4F5k0Ef6H+fqyWuiC22n6RqRyBLxHDZ/q+ZDDrd3MHaHr5C uofw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=p1NSuLfZ; 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id be3-20020a656e43000000b0057c7341d568si10845205pgb.645.2023.10.16.08.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 08:33:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=p1NSuLfZ; 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:1 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 morse.vger.email (Postfix) with ESMTP id 36C478021B30; Mon, 16 Oct 2023 08:33:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233592AbjJPPcy (ORCPT <rfc822;hjfbswb@gmail.com> + 18 others); Mon, 16 Oct 2023 11:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233425AbjJPPcv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Oct 2023 11:32:51 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2073.outbound.protection.outlook.com [40.107.104.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4941ED9 for <linux-kernel@vger.kernel.org>; Mon, 16 Oct 2023 08:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mN4dSZsYVnxL3yEn+1Kji+In1KAgNTJsvRx+MMC5xBxx+wn4esucUjpSmlRqd72uDWtf2JsuWZESxFVYqnbdifKjIL0Ov77sM7zC1SqeruP/814FbwE+x3t2YhEfccTy1u99gJZJqjXwt3R3lWMR2ArJVWjWlWM2R3pmWn799B/F5xxDSZlAmrmsuG2KHcXa2iUSBlXqq3xdPgnZ/Ag9eY5EvGsAEQepYrWFGsl1NX/wYSSNewpDfZPvk6Y+49aBGpWHgm9CZCleFTJeIwY7bLHBlTGezDVXXsFYac4ydV1/xCriFSqUpsjMUewhlYTX8moONXST5sXNRFrdA5BZ6g== 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=Xn4mPAvhPGdHiiCr3YwVziVD/SfIEV3x+7h8xcqcUzA=; b=QOyDe1gCVqTaCwcsFgHJNVKH1/gNWX3SdhWoOzzJg24DodPKd1EcPSKn1eXqw1TqkZAa/D1oChXav7RyXSu0Cq0P28KkkRDoOmGiAWa4oFBjPjf3neEEiVeHsdEmw2JIR3voBNZCdAk3tBxEboDcUclxiJEF7MLpfeNuV4LP03rQwM/UPsYR/EVhhe83UE5L5pzbFQ0GmicwcHMJBGrxgYZDY75PCPO9IvTF7cV/9Frjlay6RHE1W31Vjho8VlLZfJS3GjuT/x9RYj0ntdI0THBaneC11n5nUVWxDfJB/n3gPbFZd4Tvo0GC2ormHANTK13h2e3GUaBQT5B67H+/cQ== 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=Xn4mPAvhPGdHiiCr3YwVziVD/SfIEV3x+7h8xcqcUzA=; b=p1NSuLfZ6oQTyKP3Z5Fm/Hv+mRMq1tb4vLUeksDExBeNen66yxM/v7Qx+dz7YiBMUb93WeNiVGuk+ZABBpe8Yw/LCF0DDzkOPVqE0m5kBomFdePjIvMEM3bStJcs9pcxJ/EpIi/ozRQptEGT/nwx+/hWy+QpF5bJ0ubQ4ZuWiyo= 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 AS8PR04MB7592.eurprd04.prod.outlook.com (2603:10a6:20b:23f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Mon, 16 Oct 2023 15:32:48 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2%4]) with mapi id 15.20.6886.034; Mon, 16 Oct 2023 15:32:48 +0000 From: Frank Li <Frank.Li@nxp.com> To: miquel.raynal@bootlin.com, conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH 1/6] i3c: master: svc: fix race condition in ibi work thread Date: Mon, 16 Oct 2023 11:32:27 -0400 Message-Id: <20231016153232.2851095-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016153232.2851095-1-Frank.Li@nxp.com> References: <20231016153232.2851095-1-Frank.Li@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0P220CA0029.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:41b::13) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS8PR04MB7592:EE_ X-MS-Office365-Filtering-Correlation-Id: 26d73f0e-e4e4-4fa2-cd0e-08dbce5d26b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AABSY/doIXSuIx+laH/eQ1V61vf/gnpQIoxEa/IbMyvRDq+iu/X9s+BwH1Un+PGxXii0CYzdZRSAq62jIjfWGvSbupgD1gx+SKmeC4tZTWaGS/wkSZlcR/Rcpqpl9Kd+25J+Vq48dnupXMV4UB1PqjBzoI7nb8tbbSPK7wRCIW2GVvW9imBGMgt6dBwTEQGZ6ZMVcADTqSz2bBPBbZpD38tsF4X2HBTrT5T1RMbrTFX6MBWxXNlwgnKKYhWHiCCIqgHvPcxHhTYBSWEac4aMipcVwavtYQ4pT1B5CqN4oZwSYVQvABKpz33cRXGRA3vvpgqPsOsRc4DMtT79td0t5l5UExLhC4tkFOeRCvgP4Rkc12Kjq6Io5U0ZwH4bs9hUhwq3bUwFOxsc94tWPiM/GxFNxMU2b6zvEwLE+jiW5xf3SSn6Y1ssgoH7TnVsbUyCtlxDBsaYC/+1rjmUP52qJqKWJxgKoCQHjdFkOODmPqBb5ObDVdsimjbGRiYRkpfQEWWN59vY6vWVhFUtWDs4Sfl5acmb0CrLjFZ7QzY6n/rvuYvp9rAcb0MLZxmRZJ155qu0QY3hrbnGszfQnLoWQjQoUpRVsvcpQq8MM45ULb8tZIhw+GNqNDakLOjz4jQd 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)(376002)(366004)(39860400002)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(6486002)(38350700005)(36756003)(38100700002)(83380400001)(6666004)(6512007)(26005)(6506007)(316002)(66946007)(66556008)(66476007)(478600001)(1076003)(2616005)(52116002)(2906002)(41300700001)(86362001)(5660300002)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6Hb7fQ/bCrQpNyRFy3eS7Ipvehe6iM90xZtvB2BiY6/nnLDfLd4E245GcMLA0qxmkuPZHSQ66klwvF6IWLUOfvpzLz1wXLD6zla5mrK+kCpYi1VglYK7ZHbRN8i1kCVS+mxk/dOdKb3Su1sKr9EZWzkEYaDl4SlyBIKjn86fYj7kjMzJvxdvhzc0xHqrB1+8jhFl3s47ObAGHvu5gscfiisTmzNix6q96OmfvmvPlCGKMWK8Xa1J9qqTU3nPrvw4vkvV2LfZKY6px14U6LI7Zf+M/u9vlhp+0RaRFn9P2KIo+BrnBKVdkSObqLkqIQaa5miJLLTkuJdDHTvzngdwnePlS789AM776lYRR5r9/zZ3RwUtiwJlHyA0QicHKj2H0891uM96lC6IFT3lUy4rafCJ4+a0MR+qSF8OIiNcgEnIwNysdRjYXs7Z9+jbpc4RABo2AqJSmpD/Qa+9mJZ143nijTkKugIj2QidszjHeAhmgJn3OkAyyKFxHhFxN30N/nhA7eC/YCXRXOuy9cc1HzcmD8dzPcjAHRDuCIxmvJV+qjAgP9WLDxu8yIrTdv807Au49xYMPd24HJWwnd9PbUHMJUYmZxV1nbDaxPVy1gKwLBmTCDwCuYmpH5aosIC2lQtg4uwLwggTYR134cIZuvTiS0xWT0yfC7H97fd3h5xFIZzUn08VHhBlPXYvudIHmlWae4ffZGWRFfInUHSjDy6Hmjgc1FvI14x+jEwGjtyx6rv79X21u3BK7mS66BgD1hzvdKwf5dN73txuJtaLjyjtyQazWGgZ+XDyUsHzJ0b3B5EvvF66YqRdAh+5dQ35iDrk/Ozzd8rPUxhy6U8ghHFO94atS5EPIbZ8KKqZOaUMAngBObrpZFrlPhLsxOap9qqTKdyc52o+vbE+LEBNdqsR7xs3+YHEbxji0WIMUjF4MOe2tknZ3DXzW77G7g9NoIF1EMQrOj6Wp89OUCDgiWPN0aiPa1hxcPi1JG1RiYi0jNWYFs8byfsWhhS45O6UH4D0ICyhuCDBPwwMgqqP3O0o3l76oZUkv7U3m4boJnPb2Jka6n+PMKcLW+8H9mPFkLGbr54NTvASElJb4aSCaguKbJZNmcBuLVPZuDj2Xy9+niXGHNRCHB90Wj3TzlLjhNF6RVeU/q9sM4Q5jdd3CpRfOhbwL5mBxEBOi3I5xmx8H9eNS/uAMLlxYNDxqAxYtko668ET2KzOUwgJdFotByGmzEK8PErABN3K5vyOhoQhYbPMhTd63wSesnW7SVvg+onGzAdhQRnbJUbhPFoNiLWWuOWMaK4e1491HQHDVc90JskRm3iKLNpTBnIjAUSUaFyuUqgpEK5LBCKIzuCrxieHLqxmzUNWix6uBW/cspn+C0sh0NEljmh5UOcm7afY/hwv05NJmYbg2TeSOVb6rLkKYOZYYnWNQYXPy0OVXqpmhJuwJ0SMqMCisWfXhCwYBbXPlEAWZRDe/t/8ElftDQoeKrW2tjf/TPMCeqqIfQifbRPCL7FHYe1rKSpaE9vIFfB0wBUoTdARF1SeMK9B1rAP90h2EY+uHb3g18IQ9BI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26d73f0e-e4e4-4fa2-cd0e-08dbce5d26b8 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 15:32:48.1604 (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: q3XSOQmhczwsxHwqXMiJuWtIEs8HCTFdcCACjloCZHpkxHGjXMzkX/x9Ltzt2bUySyIzJPRJe/hun17mjCEgEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7592 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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 08:33:15 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779926723820234751 X-GMAIL-MSGID: 1779926723820234751 |
Series |
i3c: master: svc: collection of bugs fixes
|
|
Commit Message
Frank Li
Oct. 16, 2023, 3:32 p.m. UTC
The ibi work thread operates asynchronously with other transfers, such as
svc_i3c_master_priv_xfers(). Introduces 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
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/i3c/master/svc-i3c-master.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
Comments
Hi Frank,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.6-rc6 next-20231017]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Frank-Li/i3c-master-svc-fix-race-condition-in-ibi-work-thread/20231017-151123
base: linus/master
patch link: https://lore.kernel.org/r/20231016153232.2851095-2-Frank.Li%40nxp.com
patch subject: [PATCH 1/6] i3c: master: svc: fix race condition in ibi work thread
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231017/202310172150.4GVdV44X-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231017/202310172150.4GVdV44X-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310172150.4GVdV44X-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/i3c/master/svc-i3c-master.c:207: warning: Function parameter or member 'lock' not described in 'svc_i3c_master'
vim +207 drivers/i3c/master/svc-i3c-master.c
1c5ee2a77b1bacd Clark Wang 2023-05-17 153
dd3c52846d5954a Miquel Raynal 2021-01-21 154 /**
dd3c52846d5954a Miquel Raynal 2021-01-21 155 * struct svc_i3c_master - Silvaco I3C Master structure
dd3c52846d5954a Miquel Raynal 2021-01-21 156 * @base: I3C master controller
dd3c52846d5954a Miquel Raynal 2021-01-21 157 * @dev: Corresponding device
dd3c52846d5954a Miquel Raynal 2021-01-21 158 * @regs: Memory mapping
5496eac6ad7428f Miquel Raynal 2023-08-17 159 * @saved_regs: Volatile values for PM operations
dd3c52846d5954a Miquel Raynal 2021-01-21 160 * @free_slots: Bit array of available slots
dd3c52846d5954a Miquel Raynal 2021-01-21 161 * @addrs: Array containing the dynamic addresses of each attached device
dd3c52846d5954a Miquel Raynal 2021-01-21 162 * @descs: Array of descriptors, one per attached device
dd3c52846d5954a Miquel Raynal 2021-01-21 163 * @hj_work: Hot-join work
dd3c52846d5954a Miquel Raynal 2021-01-21 164 * @ibi_work: IBI work
dd3c52846d5954a Miquel Raynal 2021-01-21 165 * @irq: Main interrupt
dd3c52846d5954a Miquel Raynal 2021-01-21 166 * @pclk: System clock
dd3c52846d5954a Miquel Raynal 2021-01-21 167 * @fclk: Fast clock (bus)
dd3c52846d5954a Miquel Raynal 2021-01-21 168 * @sclk: Slow clock (other events)
dd3c52846d5954a Miquel Raynal 2021-01-21 169 * @xferqueue: Transfer queue structure
dd3c52846d5954a Miquel Raynal 2021-01-21 170 * @xferqueue.list: List member
dd3c52846d5954a Miquel Raynal 2021-01-21 171 * @xferqueue.cur: Current ongoing transfer
dd3c52846d5954a Miquel Raynal 2021-01-21 172 * @xferqueue.lock: Queue lock
dd3c52846d5954a Miquel Raynal 2021-01-21 173 * @ibi: IBI structure
dd3c52846d5954a Miquel Raynal 2021-01-21 174 * @ibi.num_slots: Number of slots available in @ibi.slots
dd3c52846d5954a Miquel Raynal 2021-01-21 175 * @ibi.slots: Available IBI slots
dd3c52846d5954a Miquel Raynal 2021-01-21 176 * @ibi.tbq_slot: To be queued IBI slot
dd3c52846d5954a Miquel Raynal 2021-01-21 177 * @ibi.lock: IBI lock
dd3c52846d5954a Miquel Raynal 2021-01-21 178 */
dd3c52846d5954a Miquel Raynal 2021-01-21 179 struct svc_i3c_master {
dd3c52846d5954a Miquel Raynal 2021-01-21 180 struct i3c_master_controller base;
dd3c52846d5954a Miquel Raynal 2021-01-21 181 struct device *dev;
dd3c52846d5954a Miquel Raynal 2021-01-21 182 void __iomem *regs;
1c5ee2a77b1bacd Clark Wang 2023-05-17 183 struct svc_i3c_regs_save saved_regs;
dd3c52846d5954a Miquel Raynal 2021-01-21 184 u32 free_slots;
dd3c52846d5954a Miquel Raynal 2021-01-21 185 u8 addrs[SVC_I3C_MAX_DEVS];
dd3c52846d5954a Miquel Raynal 2021-01-21 186 struct i3c_dev_desc *descs[SVC_I3C_MAX_DEVS];
dd3c52846d5954a Miquel Raynal 2021-01-21 187 struct work_struct hj_work;
dd3c52846d5954a Miquel Raynal 2021-01-21 188 struct work_struct ibi_work;
dd3c52846d5954a Miquel Raynal 2021-01-21 189 int irq;
dd3c52846d5954a Miquel Raynal 2021-01-21 190 struct clk *pclk;
dd3c52846d5954a Miquel Raynal 2021-01-21 191 struct clk *fclk;
dd3c52846d5954a Miquel Raynal 2021-01-21 192 struct clk *sclk;
dd3c52846d5954a Miquel Raynal 2021-01-21 193 struct {
dd3c52846d5954a Miquel Raynal 2021-01-21 194 struct list_head list;
dd3c52846d5954a Miquel Raynal 2021-01-21 195 struct svc_i3c_xfer *cur;
dd3c52846d5954a Miquel Raynal 2021-01-21 196 /* Prevent races between transfers */
dd3c52846d5954a Miquel Raynal 2021-01-21 197 spinlock_t lock;
dd3c52846d5954a Miquel Raynal 2021-01-21 198 } xferqueue;
dd3c52846d5954a Miquel Raynal 2021-01-21 199 struct {
dd3c52846d5954a Miquel Raynal 2021-01-21 200 unsigned int num_slots;
dd3c52846d5954a Miquel Raynal 2021-01-21 201 struct i3c_dev_desc **slots;
dd3c52846d5954a Miquel Raynal 2021-01-21 202 struct i3c_ibi_slot *tbq_slot;
dd3c52846d5954a Miquel Raynal 2021-01-21 203 /* Prevent races within IBI handlers */
dd3c52846d5954a Miquel Raynal 2021-01-21 204 spinlock_t lock;
dd3c52846d5954a Miquel Raynal 2021-01-21 205 } ibi;
f32ae0219a47f74 Frank Li 2023-10-16 206 struct mutex lock;
dd3c52846d5954a Miquel Raynal 2021-01-21 @207 };
dd3c52846d5954a Miquel Raynal 2021-01-21 208
Hi Frank, Frank.Li@nxp.com wrote on Mon, 16 Oct 2023 11:32:27 -0400: > The ibi work thread operates asynchronously with other transfers, such as > svc_i3c_master_priv_xfers(). Introduces mutex protection to ensure the Introduce > completion of the entire i3c/i2c transaction. Did you experience faulty conditions or was it reported thanks to static analysis? Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> > > Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") > Cc: stable@vger.kernel.org > Signed-off-by: Frank Li <Frank.Li@nxp.com> > --- Thanks, Miquèl
On Tue, Oct 17, 2023 at 04:16:58PM +0200, Miquel Raynal wrote: > Hi Frank, > > Frank.Li@nxp.com wrote on Mon, 16 Oct 2023 11:32:27 -0400: > > > The ibi work thread operates asynchronously with other transfers, such as > > svc_i3c_master_priv_xfers(). Introduces mutex protection to ensure the > > Introduce > > > completion of the entire i3c/i2c transaction. > > Did you experience faulty conditions or was it reported thanks to > static analysis? Yes, I met. But it needs my slave part patches, which will be ready sent out review soon. Frank > > Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> > > > > > Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") > > Cc: stable@vger.kernel.org > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > > --- > > Thanks, > Miquèl
Hi Frank, Frank.li@nxp.com wrote on Tue, 17 Oct 2023 10:37:57 -0400: > On Tue, Oct 17, 2023 at 04:16:58PM +0200, Miquel Raynal wrote: > > Hi Frank, > > > > Frank.Li@nxp.com wrote on Mon, 16 Oct 2023 11:32:27 -0400: > > > > > The ibi work thread operates asynchronously with other transfers, such as > > > svc_i3c_master_priv_xfers(). Introduces mutex protection to ensure the > > > > Introduce > > > > > completion of the entire i3c/i2c transaction. > > > > Did you experience faulty conditions or was it reported thanks to > > static analysis? > > Yes, I met. But it needs my slave part patches, which will be ready sent > out review soon. I believe several of the "fixes" in this series are related to newer uses (typically your i3c slave support) which were not in the scope of the original submission. As these new features are not supposed to be backported in stable kernels and because these are new corner cases,you may drop the CC:/Fixes tags to avoid useless backports. Some of them however are real fixes for situations we may happen with the current level of support, please keep the tags in these, and move them all to the beginning of your series. Thanks, Miquèl
On Tue, Oct 17, 2023 at 04:49:46PM +0200, Miquel Raynal wrote: > Hi Frank, > > Frank.li@nxp.com wrote on Tue, 17 Oct 2023 10:37:57 -0400: > > > On Tue, Oct 17, 2023 at 04:16:58PM +0200, Miquel Raynal wrote: > > > Hi Frank, > > > > > > Frank.Li@nxp.com wrote on Mon, 16 Oct 2023 11:32:27 -0400: > > > > > > > The ibi work thread operates asynchronously with other transfers, such as > > > > svc_i3c_master_priv_xfers(). Introduces mutex protection to ensure the > > > > > > Introduce > > > > > > > completion of the entire i3c/i2c transaction. > > > > > > Did you experience faulty conditions or was it reported thanks to > > > static analysis? > > > > Yes, I met. But it needs my slave part patches, which will be ready sent > > out review soon. > > I believe several of the "fixes" in this series are related to newer > uses (typically your i3c slave support) which were not in the scope of > the original submission. As these new features are not supposed to be > backported in stable kernels and because these are new corner cases,you > may drop the CC:/Fixes tags to avoid useless backports. I don't think so. The issue exists. Just difficult to find it. If there are i3c device that use IBI frequently. The problem should be trigger. My case just make it easy to trigger the problem. In previous existed code, IBI is supported. I think it is typical case, which need CC/Fixes. Frank > > Some of them however are real fixes for situations we may happen with > the current level of support, please keep the tags in these, and move > them all to the beginning of your series. > > Thanks, > Miquèl
Hi Frank, Frank.li@nxp.com wrote on Tue, 17 Oct 2023 11:10:54 -0400: > On Tue, Oct 17, 2023 at 04:49:46PM +0200, Miquel Raynal wrote: > > Hi Frank, > > > > Frank.li@nxp.com wrote on Tue, 17 Oct 2023 10:37:57 -0400: > > > > > On Tue, Oct 17, 2023 at 04:16:58PM +0200, Miquel Raynal wrote: > > > > Hi Frank, > > > > > > > > Frank.Li@nxp.com wrote on Mon, 16 Oct 2023 11:32:27 -0400: > > > > > > > > > The ibi work thread operates asynchronously with other transfers, such as > > > > > svc_i3c_master_priv_xfers(). Introduces mutex protection to ensure the > > > > > > > > Introduce > > > > > > > > > completion of the entire i3c/i2c transaction. > > > > > > > > Did you experience faulty conditions or was it reported thanks to > > > > static analysis? > > > > > > Yes, I met. But it needs my slave part patches, which will be ready sent > > > out review soon. > > > > I believe several of the "fixes" in this series are related to newer > > uses (typically your i3c slave support) which were not in the scope of > > the original submission. As these new features are not supposed to be > > backported in stable kernels and because these are new corner cases,you > > may drop the CC:/Fixes tags to avoid useless backports. > > I don't think so. The issue exists. Just difficult to find it. If there are > i3c device that use IBI frequently. The problem should be trigger. My case > just make it easy to trigger the problem. > > In previous existed code, IBI is supported. > > I think it is typical case, which need CC/Fixes. I am not talking about this patch in particular. > > Frank > > > > > Some of them however are real fixes for situations we may happen with > > the current level of support, please keep the tags in these, and move > > them all to the beginning of your series. > > > > Thanks, > > Miquèl Thanks, Miquèl
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index c308e22f0ac5..ebdb3ea1af9d 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -202,6 +202,7 @@ struct svc_i3c_master { /* Prevent races within IBI handlers */ spinlock_t lock; } ibi; + struct mutex lock; }; /** @@ -383,6 +384,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 +461,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 +1206,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 +1254,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 +1315,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 +1355,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 +1550,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)