From patchwork Tue Jun 6 18:25:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 13269547 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A794FC77B73 for ; Tue, 6 Jun 2023 18:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=GPutfiN+AGxsCQKI1NY9Z8Km+MN5PaAbEg51C4mse3c=; b=vc1k0ceZthZWQ+ tK0vISegcM9Jo6PBBO4tzCtKkqw04DZF0+nUwfamA6+oiqH3MrtjG7u2grFT81bfOmAg+XZ80dgo8 BOOBgh/pLeOHIqrtb7hlrQVjV+Q4iHQpSWoj6wXUAwAPNp34r6pvmVSgjFTlcsYZzfUEOnk+HgoBy mduH1ukhaJdiJRZnJYjgLwWG3BR8FutpesGsFjqxSy+IhmOAJCHf85QH2AjM9tNaYqkh6MGyC73NA G7njdz46RVejKAtl0wvoDDYDFB6HyRl5fSxWFLL7BtZeMD271oPN1RIQJgccVyqQXzcMYpg5lLqQ2 6p9X+EA6rfUiXxwDVTSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6bOT-002lcA-1i; Tue, 06 Jun 2023 18:26:57 +0000 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6bOO-002laK-0x for linux-arm-kernel@lists.infradead.org; Tue, 06 Jun 2023 18:26:56 +0000 Received: from pps.filterd (m0208999.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 356HWEq0015275; Tue, 6 Jun 2023 14:26:35 -0400 Received: from can01-yqb-obe.outbound.protection.outlook.com (mail-yqbcan01lp2237.outbound.protection.outlook.com [104.47.75.237]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3r00mvjcku-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jun 2023 14:26:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e0Z+NhB5zdKTZIcHZG/ZHTq251R8Xxjl6Cn4MPo04ijYx/pB1PUmYkLp5BMPYaRPBpJdV5WPxFaVK/2QHwrvmxalBERk0BDxHRXw7qlbJY1NvPqQlrBgy0ELMtQEEhkGyPuj1hay/JOulLvHVg2+QePEBEivzhDlk6sY4edE22/ujp4SVOA1SZcXfO9eCLIA2XnVovRKp8yJ0dPwhSHjz4Skf+uJmM8DJbqquzuQauwJZnqnkcONopmX0pVtb5wh1z76PNgeOlpeJr+/nvszabhxLB1ELZ9qatqNdTRONa72x1l3bMauBbMdf74CBQirtSc8TlihTvlH9lc1KlvIqg== 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=vy1i7aSpdwV49pNkWKpyrlDslQjRzhqGkYGLQuD91bg=; b=CqHyytnZ7FNhmvwx8GHTkHXWHfSuIUy6okogFJXE7ebkzQM/q6ydKEO+2L+nlt/MC9aX1yQjroAY2A+1h1gN0z4tvLTrLflCZSBtz4/u6/od6GxDIZ98gmJNVmFFGLAkjq2Kxwh9KNY3iON9mj19HXfBvbP/b8LhOiEZmfN1w2rdVLDtApe+nDxr+ypioewM65VrGtr50F9sHLwQB3pMzl5/MecwhEiWAAZy70ylYdwoQTGRsWY0998wruDeUj9M1CfW3VqPoK1Ah5rx6zIfvODQGw7Pf+DEom2kntNYAt30OaymijQ9p0QCeBQG2QX/nMRTECWpxX8WGcr0YQchKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vy1i7aSpdwV49pNkWKpyrlDslQjRzhqGkYGLQuD91bg=; b=gas0RMJsmdvFJbK7Dhm1EhDBdmr23U8UfhOESBr4KEBaaoV9oYfpUJv+YKgCsPhz4Lapv6bckZaPBhAQLN/sYGwl2L6VQjNj0W4TmuNOe2kwlLh3dqxyEFSJ3Nylk+ZnDPuvVOcmj5XkoE+Ts62LdoUJPaSrFXpgJHF6h5v4gtU= Received: from YT2PR01MB8838.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:b9::6) by YT3PR01MB6677.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:74::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 18:26:33 +0000 Received: from YT2PR01MB8838.CANPRD01.PROD.OUTLOOK.COM ([fe80::c059:dcd5:ca20:4a0]) by YT2PR01MB8838.CANPRD01.PROD.OUTLOOK.COM ([fe80::c059:dcd5:ca20:4a0%6]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 18:26:33 +0000 From: Robert Hancock To: Michal Simek , Andi Shyti , Shubhrajyoti Datta , Wolfram Sang , Marek Vasut Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Hancock Subject: [PATCH] i2c: xiic: Don't try to handle more interrupt events after error Date: Tue, 6 Jun 2023 12:25:58 -0600 Message-Id: <20230606182558.1301413-1-robert.hancock@calian.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: MW4PR04CA0307.namprd04.prod.outlook.com (2603:10b6:303:82::12) To YT2PR01MB8838.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:b9::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: YT2PR01MB8838:EE_|YT3PR01MB6677:EE_ X-MS-Office365-Filtering-Correlation-Id: 06065b16-21fe-4408-f248-08db66bb8de1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vpfZZX+lHYsV7tAD6wWIoft9zJzDkUx4FrTkX6hdXvlWR18xWIiiXcq2Hk6b0ugR8auZZvp2y/q+RQRcfAzbNtpSuJJ8zWIjmEDrR7YO95xoIGWoo2wSEquwe6piyhwDvr8kiI/FWTcTZwiZBY8s3Vah/TSb5FnNdpe92pu24q1jebHydZk8j7ko74xYZRV6iLD/I041mZl3qbbeOyLPQYp4cLuPk+fFMyfT6NJTMGfiM/rt7jM3vuOT+uTysu/YmJ/lxmhy/zxbfU0VniOs7AwvuxqEQ0cb5h+Af7RllZ+DVaT3r02daCFG6v+5ZW7SHS8z2jOXD5UMUpo59hGMEt0C3NHmRzOkTOp/0ItmVjAKCuZdIEqUw7VNyIUkZUUYEZkMTUmBgkxWBef6hAvHlzY/QGGBb/GVpL7xd8uI++B6faTx09h0xgDWSws26aAqq0ivYffuItUiJAWvWOCSVKX2oHyGFdaHtlbcD+8RfdPk2x15tP9uLTz23t/XYGi04Zpf0T0M+2D9JnZHjqu6M0y+t1jYxd4/40k0q7iwEmizgyEatGPzAbDebwJdZBB+/fdcfopqLFiAC79wSksKYrJZvjGF1zaIREKtsF1H6QE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT2PR01MB8838.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(39860400002)(366004)(376002)(396003)(451199021)(110136005)(478600001)(66556008)(44832011)(8936002)(8676002)(2906002)(36756003)(5660300002)(86362001)(4326008)(66476007)(66946007)(316002)(38100700002)(6506007)(2616005)(1076003)(41300700001)(38350700002)(6512007)(107886003)(26005)(83380400001)(186003)(52116002)(6486002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7hZaYGs/Z9TXQr/GpXaRBGu5ryfdnWuEJMpl/tcmTcT3ZHlZ9LRx+JIeagOI90BCfDAYq0x/QzsVZtrF0DGGkRci2cEkvjIL21XnGxkl6SDePnAIaa4I02dg70BqgY9d8G+/CoORuAXi/1Z3DJZpzDKDjclqeHuu5zWcLzGbHvkq9cTjbqt9jgixdzlhGCJ6cO6V8MkUp5ZS+N0r/Y1LcaYDhD+HAmBQlaktb6vSyvCRhqwhJi07oCA83X9e67nVFjxB0R+Aw4oQ1k7NgYqoPmXc7ScVPDLM4BEpZ2ir2J9AwXMizS0zyVkn6xOi1mYJavdsrsjJ97Za+v05PJ175+Gpr+dtu5BoT8uMLAlooBLmikI3FQ0U8kmv4dk25teX0S9x63Nb3eCwAQv1UWPdpSwxfq2sAkw9G1rlIizrLwnLYR8m+6ErOqJR9IbxBjuHJFhJsIigofvzmU8UZDx9mepkg1qjtPzXwn+oY/wddyDcrDrH6MiiyEQMDggTWm+7RTU8o30Z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d1LjHZ1rwls1ZbgQA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VMmoPS7DDm+fIDJ2aCl80kWyBwhz5qSBx9gkvK8hKzKHNbDPlrCB8nCxEamwLdGrEYoRteweNT7zJm0VBhuLPGj11Qvh/Q35AQKqltCVeuoBh+TWT+pmDucVhTRLidRIIri2Yl0y4JT97eAo9FcpgbZTZHl5X3PYWJMkUfwu5kx8nGuYfPfnC3y6RiqMFkS95vui8VNogOTqf/yB95XxfjWVfSUzzWkReIpK6/8sw2F3bC9PpK1pFNuLlUyQCFkdkS9SOBxOpJ5EeE/+QgXvEliSgtc+feswTt4znzQYwrRGgEnvooAlfpe5vrnc8e1ltAjLmZR9KinblpV+Oy4hfIee1ItnPuVwVuqtMrcZqt/UJ/dA1a/7CjYxn9l726uLXf4q41aAIWTX+w061HiNTQ6QPZDiuAE625uc+XhC4EkSpzkgv73nkjsOq3v2RuakgDlJ4RpE9SDvxk4zoUzNbM6g4LrdoHQeQnH+b7MeCoTD59CO92KeQAP5H0+q03DRkhf9jjOFlHGTWCPlrd4bQcNxO4YGe0pDHlgeL3NnkT0HMruhKypUfUwjLED0WoN65RfMZCk3KReplOub+FACOgvXoUvLuxJm6YbYVVJNLS0AI671o015ZMkT1FC8C+LHQOdTnF9WPvDymajq5YEeUVZDVDlO8syHUkIkFOBfOtKzMy+6NFLYj8kurcd6cuNHTxEocbk0Bi8X5cBZrL8ntU+3iUaEZz4zNoW5PGg2PoE67vYS1krLWIxe6b3Xq4DyXfVNNfNwRSDcE0h6x9Fv+JLpYREf6kXWRaySMCHmiO22lDjUWG9XJZM1K7r4fAPTy7bX0pA1V4WFv/tH2H5q3MWClp5xL2encz9/jvK4c/aRPHbnW5TklcH+YJ4SgqZQeJ6kvz02lMOzpDfnjQt+qToZ86KpYFlJ8DkiEUSqVfsCDFH7eoNtivSl8pu6sWW0 X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06065b16-21fe-4408-f248-08db66bb8de1 X-MS-Exchange-CrossTenant-AuthSource: YT2PR01MB8838.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 18:26:33.0277 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iLyshUSazuod2vu3/c0rEB3pMwSU1J+ejcvKyfUMbbGq4lRYduGwal8Wnmco2VXpky0Een9sQHUO9lrzQSqRKe+YGxoL7aaeQlc4X0ow15Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6677 X-Proofpoint-GUID: EFjiZk9tNSMH3fj7TDcFsFWZ5EQqLBak X-Proofpoint-ORIG-GUID: EFjiZk9tNSMH3fj7TDcFsFWZ5EQqLBak X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-06_13,2023-06-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 suspectscore=0 phishscore=0 clxscore=1011 mlxlogscore=522 mlxscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306060157 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230606_112652_526804_DA3218B3 X-CRM114-Status: GOOD ( 18.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In xiic_process, it is possible that error events such as arbitration lost or TX error can be raised in conjunction with other interrupt flags such as TX FIFO empty or bus not busy. Error events result in the controller being reset and the error returned to the calling request, but the function could potentially try to keep handling the other events, such as by writing more messages into the TX FIFO. Since the transaction has already failed, this is not helpful and will just cause issues. This problem has been present ever since: commit 7f9906bd7f72 ("i2c: xiic: Service all interrupts in isr") which allowed non-error events to be handled after errors, but became more obvious after: commit 743e227a8959 ("i2c: xiic: Defer xiic_wakeup() and __xiic_start_xfer() in xiic_process()") which reworked the code to add a WARN_ON which triggers if both the xfer_more and wakeup_req flags were set, since this combination is not supposed to happen, but was occurring in this scenario. Skip further interrupt handling after error flags are detected to avoid this problem. Fixes: 7f9906bd7f72 ("i2c: xiic: Service all interrupts in isr") Signed-off-by: Robert Hancock Acked-by: Andi Shyti --- drivers/i2c/busses/i2c-xiic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 8a3d9817cb41..ee6edc963dea 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -721,6 +721,8 @@ static irqreturn_t xiic_process(int irq, void *dev_id) wakeup_req = 1; wakeup_code = STATE_ERROR; } + /* don't try to handle other events */ + goto out; } if (pend & XIIC_INTR_RX_FULL_MASK) { /* Receive register/FIFO is full */