Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4434594rdh; Wed, 29 Nov 2023 01:06:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJBNTSxlFuA9JvKQ3URfzRS0dOsI8qSvtPkG6g0arerS5ktk3DMz5lH8DHT/TABvIkjfxs X-Received: by 2002:a17:902:db02:b0:1cf:ca67:4336 with SMTP id m2-20020a170902db0200b001cfca674336mr11404056plx.11.1701248769158; Wed, 29 Nov 2023 01:06:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701248769; cv=pass; d=google.com; s=arc-20160816; b=C0S4rZJe3I9QghotEdQGY1IOCPERqKNKT9OVfqlKp1dynCWQ75Z1/TC1m6OrB1PT4S LIl42rSefsNWGzcywbUNTVVZSRapXROK8vw4GFM1s2VfCP2rXfrTQhbAg3+MUdhIpjRT UCjmuekwSmYMrjjNNaKHg4cbeKWiHtC2SZTjwyfQTLPAgNQ7Tm0LAXDZoi+zhoBm/Qen 0ek2vAK0LRJeyCNdxy7vZx7UUe1jhQCRrDm6nEVuIbOriXziOboKOkgb1xCjanxkLKS+ ySjf72DZPelKmWwGx1Y8g5kHrnsruvmgj880ivrb6b76D/FGVGEgeysGFQsf3bMdNDB8 /n6w== 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 :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=uxawtfnyo1jYfd6dS9GclOJQx6eOHfAdR8BF/OAgKas=; fh=fDV2kHKRZyQJzGaB8rKZy+G5r76YYDkRhDRoC4GaaQI=; b=ycqdk+Z8Y2a8artaZ4BrReogZN7ovvlCyMc7Mw8w0dxFxa1E3FELWjw2WV/LsIoZnd SQYYnfIZqK9/yFAgVn8jxZ9/n6iV6B6JciYeTpJsPCm7U2Lw1yr/FpUiN7L83W+huPvJ MjXe0f2VmKmtC09bkbK4RCqMXaLBE/SWE4YWcUExCtC2e5tK4wmoVKsDHL2FZmy8+EA4 iPbSppFZvXcSjJ2QIZFSYDsiBfQl/k1n9zJIu6E2iEYXk3oGn0xE8G7E8Vg/XaOwk1Qq 2VuhjpVxhRWV8aSCrlpe3ppEe7DNxIXG3RZBstZl3Iaa4TU6lvNqf3bLwkDRhOfb6df1 41gw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=sf6x0msg; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id c8-20020a170902d48800b001cfc3563badsi8014187plg.629.2023.11.29.01.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 01:06:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=sf6x0msg; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2341780964DF; Wed, 29 Nov 2023 01:05:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232614AbjK2JFa (ORCPT + 99 others); Wed, 29 Nov 2023 04:05:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232608AbjK2JF0 (ORCPT ); Wed, 29 Nov 2023 04:05:26 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2115.outbound.protection.outlook.com [40.107.243.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA85C10DF; Wed, 29 Nov 2023 01:05:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gwQzyMLd2t9v7m6BP6acDKUPZGb4ZwWN3iw3/Gb0okSdYwmpPl7i4WloZNMGy7tP8h8tbVEqanTATneJqBIUFM8e7j9rCRqVF9s5eg4ZRoNoAOnsZK+2SJxhxrPcoVLUGnKy8zhZ+J7z3KWhE6yzQ+RPJL0MOoMZl8SncWSEpp+2fjzF7l1GiyWkDDqzt+zuC9eL3B0EoUG7o7YQoTsU83QeEFdhaevrQtNEE4JY/SMyXYxAEibdmxmomEQJ/9sq+OyUWaCOSmib0ypEO0ESEiRSWblwxCtAF7wxvZjlfETmu5qNoePFd/rQMHtmTyKZ7OA5ck0yXeiOnCDEd6wmDA== 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=uxawtfnyo1jYfd6dS9GclOJQx6eOHfAdR8BF/OAgKas=; b=UVHgTQomOEDeBmi5U2UJfAQAoVERQel6dO+YVtj4zwcB4Z7Nn35Hf8qqJ2DidW9aaIQXTpz9I3VrJJwmA+P1cPYFJzle7gtHIjPjDOqXGNosnUAAZ0LgUBJdbu/AOuulR+oQf8ka4HVKQDKG/zmEQ4aFxZdOmLlCteejS214VYN4qrT4miU5CotUS10/vRdDwsSVlqBAjvKV5JzXOHEk1/GW0t6bOdQuJVY90hDOua1mC6FXRAXQox2rjgV1Xnp32Ap86IR5Au0Y39iYhEmEgOaQkRVCUjEUbJp096DwRLJEtVtgtj9NjnpelTQqu0HYUC0Hgn6f8ElNjxxGH1yODg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uxawtfnyo1jYfd6dS9GclOJQx6eOHfAdR8BF/OAgKas=; b=sf6x0msgr9lCcB9gpru7aFyS1gIi1xTG7ORYNiikWnxO0Zm6uaSg30FxKB+wFQ3PgD9CyqJJnl1DKW202yBTfHttxJkpjyPLeLxqs4FdV/AX3RYoUncmewGMkFSZFDLcBwY1aZtkWQLCFmLod9gCg0NqHLMwaDyOzwSbC7k9UCU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SN4PR01MB7455.prod.exchangelabs.com (2603:10b6:806:202::11) by SJ0PR01MB6302.prod.exchangelabs.com (2603:10b6:a03:299::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29; Wed, 29 Nov 2023 09:05:29 +0000 Received: from SN4PR01MB7455.prod.exchangelabs.com ([fe80::5682:1d84:171a:1d68]) by SN4PR01MB7455.prod.exchangelabs.com ([fe80::5682:1d84:171a:1d68%3]) with mapi id 15.20.7025.022; Wed, 29 Nov 2023 09:05:29 +0000 Message-ID: Date: Wed, 29 Nov 2023 16:05:23 +0700 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 RESEND 2/2] i2c: aspeed: Acknowledge Tx done with and without ACK irq late Content-Language: en-CA To: Andi Shyti Cc: Brendan Higgins , Benjamin Herrenschmidt , Joel Stanley , Andrew Jeffery , 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, Cosmo Chou , Open Source Submission , Phong Vo , "Thang Q . Nguyen" References: <20231128075236.2724038-1-quan@os.amperecomputing.com> <20231128075236.2724038-3-quan@os.amperecomputing.com> <20231129004509.ilriuwm3hulvy67l@zenone.zhora.eu> From: Quan Nguyen In-Reply-To: <20231129004509.ilriuwm3hulvy67l@zenone.zhora.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI1PR02CA0017.apcprd02.prod.outlook.com (2603:1096:4:1f4::10) To SN4PR01MB7455.prod.exchangelabs.com (2603:10b6:806:202::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN4PR01MB7455:EE_|SJ0PR01MB6302:EE_ X-MS-Office365-Filtering-Correlation-Id: e3d4e511-96c3-448d-1ce7-08dbf0ba559f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gKYtvprj7jYHUawwgFYUmyI12ylZLlPJCFjaXv80vAy2fv36+cKRBfLKJbIc51lsVisWBDfDr86ndpPNTvY4NP4fIlv/OdURhMwJLKKBFY8LOXOcZW0Sp0ec1PKXoJpjXW3exmCZ3XQtIVQMuylzFLA0AJZt0KS+/YIiLoEjHl0dkIJdZrfF0/Mubm1EbCqdpVo1gBZnEJfriRcmljvWB9mHuXKl3X6IDbIc0UiW0nzKd8x5pVCJ6kUUnXWZ6ZsBgb+3BtmuR2rOEV63nVKF/EL76lD4dnU7SzTuQtJcv9q4d1A/yHsv682QsYVqBzvW/olMjjR/wAe+QY9NujUkHWdYkr4OtY+o1aaV+14OR5oUzBqAHFzEcZxSvup2YZYa1lKgi3Q+bQ9/mIb12ZKlL5rXneFRkXLlnOCyJD5VHvE3Rrqm1q8TH5I7PnyqUQ4ZPSyLdp4CJjjne5rREVR34s5SAT5r4tHQ6ij+7j18OnxYgd1ea43D8EgXQZtDEOigQOGT6o6cBJdypy0upYnR6vxH96dpnaW8YWONDL/CJ4YLJsp7FCg1nfbAhOOiUkbLdE+Fvy7n0LNyGH5y0+7SfrbGrJalO/JRPbfyNOL/PtM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN4PR01MB7455.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(39850400004)(396003)(346002)(136003)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(41300700001)(83380400001)(316002)(6512007)(6916009)(66556008)(66946007)(54906003)(478600001)(66476007)(6506007)(6666004)(31696002)(107886003)(53546011)(5660300002)(6486002)(7416002)(966005)(2906002)(86362001)(26005)(8936002)(8676002)(4326008)(2616005)(31686004)(38100700002)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Nk5SeFV0ZUI4WFZCVC9DTlIxOUUyOVk1ZGorS1lmOGtlZVF6dzl5Mit4Q1JI?= =?utf-8?B?bjNUNmZPVENyNEhQcis4QU0xU25OdSs5UC85RVpNOExQaUJTRW4ySC9ia29R?= =?utf-8?B?bCtad0FUMEdRL1JTS3R0TjlBMlg1c1ljbVpSTFBLc0Nua3NmNUZoUUVZRXdw?= =?utf-8?B?Wm45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L0YxSS8za1l1L3I1ZElFVmNC?= =?utf-8?B?U2VOUndvUTB2VElFNFNJK1RnczhIVFAwTmY4TS8yRVhnMVcwOENoODY3cFFJ?= =?utf-8?B?UHRIVHVGTk9zN2htbkJhbXc3YkNtdWpqV21ZMXFqTWxKblQvSkNnbE83VkRs?= =?utf-8?B?M2dlZjd1dUh3bHpVaXRoOWU2NjdJQk1MZysyWWZwbk1ZZGpZeHFnRHd1TzY5?= =?utf-8?Q?K/XgXRV9iahbLiHFuulVmnE=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3d4e511-96c3-448d-1ce7-08dbf0ba559f X-MS-Exchange-CrossTenant-AuthSource: SN4PR01MB7455.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 09:05:29.5219 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8uyMd9ayObHqfmTRBxKo6DC2agsHOaQjEfjlYljSkOrRDiEO4fpN4PNpCudDxlZqnOCS6by4JeUBNKNOuF0UMQCxBfo0oEVbH6qO5u3/nn8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR01MB6302 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 agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 29 Nov 2023 01:05:52 -0800 (PST) On 29/11/2023 07:45, Andi Shyti wrote: > Hi Quan, > > On Tue, Nov 28, 2023 at 02:52:36PM +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 is 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, resulting in "Unexpected ACK on read >> request." complaint messages. >> >> Assuming that the "Transmit Done" interrupt should only be acknowledged >> once it is truly processed, this commit fixes this issue by acknowledging >> this interrupt for both ACK and NACK cases late in the interrupt handler >> also. >> >> Fixes: 2be6b47211e1 ("i2c: aspeed: Acknowledge most interrupts early in interrupt handler") >> Signed-off-by: Quan Nguyen >> --- >> 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] >> >> v1: >> + First introduced in >> https://lore.kernel.org/all/20210519074934.20712-1-quan@os.amperecomputing.com/ >> --- >> drivers/i2c/busses/i2c-aspeed.c | 17 +++++++++-------- >> 1 file changed, 9 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c >> index 79476b46285b..3231f430e335 100644 >> --- a/drivers/i2c/busses/i2c-aspeed.c >> +++ b/drivers/i2c/busses/i2c-aspeed.c >> @@ -611,8 +611,9 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) >> >> spin_lock(&bus->lock); >> irq_received = readl(bus->base + ASPEED_I2C_INTR_STS_REG); >> - /* Ack all interrupts except for Rx done */ >> - writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE, >> + /* Ack all interrupts except for Rx done and Tx done with/without ACK */ >> + writel(irq_received & >> + ~(ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_TX_ACK | ASPEED_I2CD_INTR_TX_NAK), >> bus->base + ASPEED_I2C_INTR_STS_REG); >> readl(bus->base + ASPEED_I2C_INTR_STS_REG); >> irq_received &= ASPEED_I2CD_INTR_RECV_MASK; >> @@ -657,12 +658,12 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) >> "irq handled != irq. expected 0x%08x, but was 0x%08x\n", >> irq_received, irq_handled); >> >> - /* Ack Rx done */ >> - if (irq_received & ASPEED_I2CD_INTR_RX_DONE) { >> - writel(ASPEED_I2CD_INTR_RX_DONE, >> - bus->base + ASPEED_I2C_INTR_STS_REG); >> - readl(bus->base + ASPEED_I2C_INTR_STS_REG); >> - } >> + /* Ack Rx done and Tx done with/without ACK */ >> + writel(irq_received & >> + (ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_TX_ACK | ASPEED_I2CD_INTR_TX_NAK), >> + bus->base + ASPEED_I2C_INTR_STS_REG); >> + readl(bus->base + ASPEED_I2C_INTR_STS_REG); > > So, you are acknowledging everything here. Why wasn’t it done > this way in the first place? > > I would appreciate a comment here from Guenter, whose commit you > are fixing. > Thanks Andi for the comment. This base on my observation that HW may proceed to start transmit/receive new date as soon as those irqs are early ack. This may cause a race condition because SW was not actually process that irq yet. I've also put some explanation in my reply to Andrew in the other mail for this part as well. And of course, I definitively love to hear from Guenter as well as these code is just based on my observation through debug only. Thanks a lot for the comment. - Quan