Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2104494rdb; Thu, 7 Dec 2023 20:00:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzYQBpWjW1a3y4NdHJhVjbz9NDylwPOYsUBYbicguEBMkGtTGfw5xP3BafytG3s3cWGqdd X-Received: by 2002:a05:6a20:734c:b0:187:1015:bf9c with SMTP id v12-20020a056a20734c00b001871015bf9cmr3592368pzc.10.1702008048022; Thu, 07 Dec 2023 20:00:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702008048; cv=none; d=google.com; s=arc-20160816; b=QcNfNvoikfh0TNpscTGQ6fHwlrfpTRLI17yXE2729Ldv1SYrGNzxM5Sr3F9CQzHA0l bzVnAghUEFpCezrYfu/5eTLQe2TKtNX0evGtXeZlgBVpbcSJT9TeyqIquBGPsY1PL77s qVDKDueFL9OkQbojJdL5JI1u6uqlVcCFIFaaaNyKYoQ5rCjNPXR9ZidPp3TmlTSoT3eY 89Xy6EChsw5IBvN2WY1RYZ6srKmsUAFQb7qP7okthqspiiF3u1dJMCtR4T/C6ArcWQ2A B/C12GS/y2dvsN/LANHG6UMBES9B+uekOb7ciQjYKpDS1oJKtOBxOIlOKeEOAhccFQf4 gEEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=6g1gg4ODYQHLBaloxEIVH+B88/pEH5RLfLJX0MQ0iPk=; fh=yDkQzEl6IxZLQSJVtYl4ZVgHjrQZ2Js7dKd11NaUo5c=; b=lwKYB1gYOltwWfBIvIq7kciPkXXJggZKR6UyXe+6T3gUx/UvbLwFdGVS7lT+gj0Yi8 IjBdWwn/dgCT2WzWjsm3VpakEIVk1yN7C4ULMftN8/K08IAJkIF3fH0ewoqCRikRN0m5 RIaE4b8JoKS/tVZmK1CJpxIzgxuDI3kr2sBi13Lr8HI3puJ6Qji3jUj/MWuhaHGVMvCZ qMRcy9icS7dn/p8BOZgeaWFJi+ryp9XmJW6p7tjd7RNYPhoVIYinu+K99y17XTkyLHW6 SHNMqt0T8shj7EsdeNstANVrrFoc1KW/8LqMCKZeZvFBxiUDNcVVk2HrLyhGoTo2bJaf 8flA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeconstruct.com.au header.s=2022a header.b=kuPvuuYQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeconstruct.com.au Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id a6-20020a1709027d8600b001d08c079196si850850plm.36.2023.12.07.20.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 20:00:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@codeconstruct.com.au header.s=2022a header.b=kuPvuuYQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeconstruct.com.au Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 27F95808ABB0; Thu, 7 Dec 2023 20:00:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231410AbjLHEAQ (ORCPT + 99 others); Thu, 7 Dec 2023 23:00:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjLHEAP (ORCPT ); Thu, 7 Dec 2023 23:00:15 -0500 Received: from codeconstruct.com.au (pi.codeconstruct.com.au [203.29.241.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 682AE170F; Thu, 7 Dec 2023 20:00:21 -0800 (PST) Received: from [192.168.68.112] (ppp118-210-181-59.adl-adc-lon-bras34.tpg.internode.on.net [118.210.181.59]) by mail.codeconstruct.com.au (Postfix) with ESMTPSA id A9E6D20016; Fri, 8 Dec 2023 12:00:18 +0800 (AWST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeconstruct.com.au; s=2022a; t=1702008019; bh=6g1gg4ODYQHLBaloxEIVH+B88/pEH5RLfLJX0MQ0iPk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=kuPvuuYQxgat5rpGJsEfXAPhzGJuzhJ2gy1NNdBDywTsALSlK+y5+LJJrfM67Cf/N pWYRPPWFtmBhxmcueYYwlJgeflZkijiXUyk57+6+ccSB9MpLhmEUFob3tvyTWOp2qY cfe1lzES+DvX3b8f3u0kq84I/X4t6z/R4g+IFy0GJoBGzEbe5ogR/jAVyzbz42UPsc XMdVxIGceJzbhow79nOdKbD1F87BbNHz+VSuPg/Ox/zfaSp9UgWK/cpYUj19stXq8Y sh5ezvwsWrbuJg8B9kHzOIiHqTwRMbqKMbx2WF3RZVNsDcjS3FAB6ZCIPMyvqARxGh HgJy677d6fiYA== Message-ID: Subject: Re: [PATCH v3 2/2] i2c: aspeed: Acknowledge Tx done with and without ACK irq late From: Andrew Jeffery To: Quan Nguyen , Brendan Higgins , Benjamin Herrenschmidt , Joel Stanley , Andi Shyti , Wolfram Sang , Jae Hyun Yoo , Guenter Roeck , linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Cosmo Chou , Open Source Submission , Phong Vo , "Thang Q . Nguyen" Date: Fri, 08 Dec 2023 14:30:18 +1030 In-Reply-To: <20231208033142.1673232-3-quan@os.amperecomputing.com> References: <20231208033142.1673232-1-quan@os.amperecomputing.com> <20231208033142.1673232-3-quan@os.amperecomputing.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Thu, 07 Dec 2023 20:00:35 -0800 (PST) On Fri, 2023-12-08 at 10:31 +0700, Quan Nguyen wrote: > Commit 2be6b47211e1 ("i2c: aspeed: Acknowledge most interrupts early in > interrupt handler") acknowledges most interrupts early before the slave > irq handler is executed, except for the "Receive Done Interrupt status" > which is acknowledged late in the interrupt. > However, it has been observed that the early acknowledgment of "Transmit > Done Interrupt Status" (with ACK or NACK) often causes the interrupt to > be raised in READ REQUEST state, that shows the > "Unexpected ACK on read request." complaint messages. >=20 > Assuming that the "Transmit Done" interrupt should only be acknowledged > once it is truly processed, this commit fixes that issue by acknowledging > interrupts for both ACK and NACK cases late in the interrupt handler. >=20 > Fixes: 2be6b47211e1 ("i2c: aspeed: Acknowledge most interrupts early in i= nterrupt handler") > Signed-off-by: Quan Nguyen > --- > v3: > + Fix the unconditinal write when ack the irqs [Andrew] > + Refactor the code to enhance code readability [Quan] > + Fix grammar in commit message [Quan] >=20 > v2: > + Split to separate series [Joel] > + Added the Fixes line [Joel] > + Fixed multiline comment [Joel] > + Refactor irq clearing code [Joel, Guenter] > + Revised commit message [Joel] > + Revised commit message [Quan] > + About a note to remind why the readl() should immediately follow the > writel() to fix the race condition when clearing irq status from commit > c926c87b8e36 ("i2c: aspeed: Avoid i2c interrupt status clear race > condition"), I think it looks straight forward in this patch and decided > not to add that note. [Joel] >=20 > v1: > + First introduced in > https://lore.kernel.org/all/20210519074934.20712-1-quan@os.amperecomputin= g.com/ > --- > drivers/i2c/busses/i2c-aspeed.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-asp= eed.c > index 1c2a4f4c4e1b..967a26dd4ffa 100644 > --- a/drivers/i2c/busses/i2c-aspeed.c > +++ b/drivers/i2c/busses/i2c-aspeed.c > @@ -617,13 +617,19 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_= bus *bus, u32 irq_status) > static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) > { > struct aspeed_i2c_bus *bus =3D dev_id; > - u32 irq_received, irq_remaining, irq_handled; > + u32 irq_received, irq_remaining, irq_handled, irq_ack_last; `irq_ack_last` might be better as a macro, but you're probably saved by the optimiser anyway. If there's another reason to do a v4 or others are unhappy with it then consider fixing it, otherwise: Reviewed-by: Andrew Jeffery Thanks.