Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3452324rdh; Mon, 27 Nov 2023 15:01:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+m7AnUpTl6NobjKnNQ6pTwV6KrepKzC5phrbCFBisf6D/bs3IRKyZaAk/7vxPNpVGjpcW X-Received: by 2002:a05:6808:4489:b0:3b8:37e6:a368 with SMTP id eq9-20020a056808448900b003b837e6a368mr20291149oib.21.1701126069414; Mon, 27 Nov 2023 15:01:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701126069; cv=none; d=google.com; s=arc-20160816; b=voAhu/Q7MUUyWx9ae/PjMMh9TFGHOL1J0AssD9LeZXbUCXtsrBJlrtVE89BO/2YcWX NTMCex8vKtRroPf5SYDcXRX74bII9C7nB1nAIeT7zvBcjwU3dyvos25uCXDiCSSGC0iR KbojZVMEtB9JbiaGktPg4dybgx4HINyXduh4WOjYfvjNHlyIV14AGs2eUfta8hPwGH5T eBWMGPTpdx442WLFJWCJ6+nWRjUk9q3PLe82glk69vOPs3kYzFnq/YE/pE4aLS+G6Q6H gq7CuFVdeT9JohZIQ3P1X0ZAb1pgwt+Qsdm6PhxPcoaj39zZ3I85vdP93Z0neQhm6pn0 c79g== 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=jeaVBZ61hYUULmiG4P1ndu1Q2m319cZm4MzoynyxVlQ=; fh=ilgnB23HFm/uDJ9WG6+XnJyUig2tDVzcADilWQQGT28=; b=HNaLU6y5xFzjk7R53gbqnhZ06hzEo6IXGdN8xO9aqGbZ82f57opfQroCENVPrZNEVI CPZ7Er1CpJc9fia+3N5e1elxtzxhPWwi22pptz3YUg4DjYE2mSB/vrC59vRDSvruqYty UVhpXB05uLftQDN2YTjQq7+hRGvsixlHzCENvBexKRGS9/xXwDhcPJhzlJQAp1CvvGPc 1W0tcyIK6Glo+bH3KutPx3nzhynXXsAE64Pzzbkapyw9pkOtajL3Y49P//OWGkKckN9f 4v508bwyalHFcUCNfq7uOuPMZnrIiS+J3ssv5OwCixkzpydmH+f6HlVit20g1otAkN/G tx0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeconstruct.com.au header.s=2022a header.b=GcF5S01D; 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 a4-20020a05680802c400b003afbd8733cbsi3960906oid.293.2023.11.27.15.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 15:01:09 -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=GcF5S01D; 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 4FE76807BA3D; Mon, 27 Nov 2023 15:00:28 -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 S233637AbjK0XAK (ORCPT + 99 others); Mon, 27 Nov 2023 18:00:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231392AbjK0XAJ (ORCPT ); Mon, 27 Nov 2023 18:00:09 -0500 Received: from codeconstruct.com.au (pi.codeconstruct.com.au [203.29.241.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B47019D; Mon, 27 Nov 2023 15:00:12 -0800 (PST) Received: from [192.168.68.112] (ppp118-210-131-38.adl-adc-lon-bras33.tpg.internode.on.net [118.210.131.38]) by mail.codeconstruct.com.au (Postfix) with ESMTPSA id DC2FB200EF; Tue, 28 Nov 2023 07:00:02 +0800 (AWST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeconstruct.com.au; s=2022a; t=1701126006; bh=jeaVBZ61hYUULmiG4P1ndu1Q2m319cZm4MzoynyxVlQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=GcF5S01D0K9OrzUP0huZxWEqVkzKv+ALVQNJLjU286ml3+TWPtHI2Zc8t6o8wULQk KqmZkOUx0cGc5393b6urtjElVwWj3lGCg4obKPoov+MkKuHgNZZMKJV/ofccGs7cFX RFwEHtRS1QEG1fEyjt7aZe/h33NCJjvIcqSNRTRoHy2/N4rEquFYON9Y1iqm0rzJEv C5nfRoagxZnIgxEWBCdb1IL9THFhXkg6oGh70riVnXa5jPtyduaH/9GenlWyUlxYKi kIKcmX/4E5/YnNDHVydkF6JAVm+AICdzgHsd4IY2w2/68iom6sRDaqwziTv7BzQsrw JBe2POQtO3KnA== Message-ID: Subject: Re: [PATCH] i2c: aspeed: Acknowledge Tx ack late when in SLAVE_READ_PROCESSED From: Andrew Jeffery To: Quan Nguyen , Cosmo Chou Cc: linux-arm-kernel@lists.infradead.org, jae.hyun.yoo@linux.intel.com, andi.shyti@kernel.org, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, wsa@kernel.org, brendan.higgins@linux.dev, cosmo.chou@quantatw.com, joel@jms.id.au, linux@roeck-us.net, linux-i2c@vger.kernel.org Date: Tue, 28 Nov 2023 09:30:01 +1030 In-Reply-To: <854762fb-1767-4208-a7fc-10580730c1f3@os.amperecomputing.com> References: <20231120091746.2866232-1-chou.cosmo@gmail.com> <854762fb-1767-4208-a7fc-10580730c1f3@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]); Mon, 27 Nov 2023 15:00:28 -0800 (PST) On Mon, 2023-11-27 at 15:08 +0700, Quan Nguyen wrote: >=20 > On 27/11/2023 14:04, Cosmo Chou wrote: > > Andrew Jeffery wrote on Mon, 2023-11-27 > > at 11:23 AM: > > >=20 > > > On Mon, 2023-11-20 at 17:17 +0800, Cosmo Chou wrote: > > > > commit 2be6b47211e1 ("i2c: aspeed: Acknowledge most interrupts earl= y > > > > in interrupt handler") moved most interrupt acknowledgments to the > > > > start of the interrupt handler to avoid race conditions. However, > > > > slave Tx ack status shouldn't be cleared before SLAVE_READ_PROCESSE= D > > > > is handled. > > > >=20 > > > > Acknowledge Tx ack status after handling SLAVE_READ_PROCESSED to fi= x > > > > the problem that the next byte is not sent correctly. > > >=20 > > > What does this mean in practice? Can you provide more details? It > > > sounds like you've seen concrete problems and it would be nice to > > > capture what it was that occurred. > > >=20 > > > Andrew > >=20 > > For a normal slave transaction, a master attempts to read out N bytes > > from BMC: (BMC addr: 0x20) > > [S] [21] [A] [1st_B] [1_ack] [2nd_B] [2_ack] ... [Nth_B] [N] [P] > >=20 > > T1: when [21] [A]: Both INTR_SLAVE_MATCH and INTR_RX_DONE rise, > > INTR_RX_DONE is not cleared until BMC is ready to send the 1st_B: > > https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-as= peed.c#L294 > > That is, BMC stretches the SCL until ready to send the 1st_B. > >=20 > > T2: when [1_ack]: INTR_TX_ACK rises, but it's cleared at the start of > > the ISR, so that BMC does not stretch the SCL, the master continues > > to read 2nd_B before BMC is ready to send the 2nd_B. > >=20 > > To fix this, do not clear INTR_TX_ACK until BMC is ready to send data: > > https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-as= peed.c#L302 > >=20 >=20 > This looks like the same issue, but we chose to ack them late. Same with= =20 > INTR_RX_DONE. >=20 > https://lore.kernel.org/all/20210616031046.2317-3-quan@os.amperecomputing= .com/ From a brief inspection I prefer the descriptions in your series Quan. Looks like we dropped the ball a bit there though on the review - can you resend your series based on 6.7-rc1 or so and Cc Cosmo? Cheers, Andrew