Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2862601rdh; Mon, 27 Nov 2023 00:08:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUYYf3ubDcfa5ZLn8v3OaWoYq+BuYzFkjGfOefWyPLbFcBXNpNP7YsqfpR6gvjfhHKoGKa X-Received: by 2002:a05:6a20:7d96:b0:18b:d207:d857 with SMTP id v22-20020a056a207d9600b0018bd207d857mr15491289pzj.11.1701072520383; Mon, 27 Nov 2023 00:08:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701072520; cv=pass; d=google.com; s=arc-20160816; b=mFmMt7JWJVRodvVhpAq6ACdqdAuraW22zm3AHPLtt+DxrVHN83PGRQTJZKInyxcC32 /+BGV7z1bEONuOscz1ELGG4/M7tfW91hWKTeMaJK+7lp0eT2rJp3cyyw7/dOeL55VxVy oV9zFiGyp3MxB77mE5SSK7PLSFfCdyAt5JfkycQCYVSgkNbS5G43LODgqTHYTqhkoqir eu4G5qzDEgMc3rEXhOKzZwb3G27gNZeupohuuCCI4k1569anWNjScxiOvD73QX1pyjPR /I4cUZaVfdmzZ/tb6JAWRl1nQbkvQDlICqhyE0YaPQ0oir78rwG4OsNkmiI9iW5YJ3iI bZBQ== 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=zuDCknC0k5CJjp+ssj8BbXc0Z+kcu1L6HYB4R5mlmxc=; fh=QVOJhww1mSMPJB1rfTJ/JFM3uWUmZ+QolN4VwmyB7Sc=; b=023WjL+YQSpnAtScjqWTSw/UMArFOm2Yeg8jvE9lvkIg0tFOEbGxUzhu+R+NM98c6V aPuJ3i8Zgxch+0C3xkFhWb+bsh4OJOgb4XfoCTJ7lVJeDZwh9SRWHRI6ET7nF4SPaRX6 TJkyxMweTqWSbkUfZeGTdIXvZrfvn4Mho17R8CxYyOdTe/QrSwP37WjBS1m+ZyVZL8KM /280DPes5Ig7DBZK8twnpEgH5/wpPSN3UjQGXgDrBHhDFWfGNbatQvBf55BtEfs1OErV izg3voBnEH/l/zXDQ+lhHro9ArgF6sYI6K/fmK0pC+g+gqFN4n26s1PEzTGYpH9zHZKK J1YQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=TPIysxwV; 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:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 143-20020a630195000000b005c2017e77c0si8986406pgb.475.2023.11.27.00.08.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 00:08:40 -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=@os.amperecomputing.com header.s=selector2 header.b=TPIysxwV; 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:5 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 groat.vger.email (Postfix) with ESMTP id A6675808E8E2; Mon, 27 Nov 2023 00:08:37 -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 S232369AbjK0IIS (ORCPT + 99 others); Mon, 27 Nov 2023 03:08:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232287AbjK0IIQ (ORCPT ); Mon, 27 Nov 2023 03:08:16 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8550BB5; Mon, 27 Nov 2023 00:08:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BTgW/YDOmJT+eHiuI2Akv5d0ErTjsBP1ZNnhSrvB5fVLnPFWrTVJbjvKlHxw11j15tPBdUHis7kUDr0D7fW14diZRGHjMEgth0WLERxZxT+3TFA6j3HO6i5SKYeIMs8NfAtne7i0H78jbFjXz85cqIOQTVMfZGtG2E8VY48IoNMFzIZ5DsOjeSnn/hxM8NLPMaC6xEgWoyroP7TQPHUZcGaVSZYz3+bicXyyFAd+ueuDNwCn4AL+66GIVxI89m7meyLq6j2CliLxiRgGL3LD1fw+Fdvknl3L+OyqYP4tEOQuJJ3VD9SlIQabwj8GaJc5GxioKBAM85dLccrIh0gjrA== 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=zuDCknC0k5CJjp+ssj8BbXc0Z+kcu1L6HYB4R5mlmxc=; b=S/mLxaI74x/X0roEUDzG4l0XFKF/1xk+HaFNLo4iJeqdpF/i7a/z7VikKiiriImnM6EL0mXKDuiB3hQ9BM8N/3MK/P6JzosyzJOb/uF1+Tzt0s6IPens/5oSbf1/UD5uq4PQFFYDwZxl2vpwpHiDeSdhWEnkfCNqAYFVSD1XbpsQn3I2IVNhW0qXhp4x9IFQx0dzBI/QZZR6ad7f46FNagV2ANvfoNey3xr1uzSPX9I3oWQ+TZQeJ1eM/+uhjhJKdzKUbKYixGvxnsHgi+4UzDhG3DorwR8FnnnUVPAefN2Wh0IdDE4HM6yCXZs8pPhCSnGfipJMmhCV8wNFaNI7nQ== 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=zuDCknC0k5CJjp+ssj8BbXc0Z+kcu1L6HYB4R5mlmxc=; b=TPIysxwVsNowTrRwjg+gf1NbQenyg3Zs91OIT64QWr9HvBsS/YEmzGdSxws7mQCbavPlfm6KcgEYVJa//M5m5j7YxMXQwt8dMIJBVoNyiyRQEa2DfvSn0P/cT6/lu+V85yXqzquZu/3yjwXtT91cVmtSg99zdGT49RrM5JW4Z5Y= 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 SJ2PR01MB8077.prod.exchangelabs.com (2603:10b6:a03:4f3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.25; Mon, 27 Nov 2023 08:08:16 +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; Mon, 27 Nov 2023 08:08:15 +0000 Message-ID: <854762fb-1767-4208-a7fc-10580730c1f3@os.amperecomputing.com> Date: Mon, 27 Nov 2023 15:08:02 +0700 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] i2c: aspeed: Acknowledge Tx ack late when in SLAVE_READ_PROCESSED Content-Language: en-CA To: Cosmo Chou , Andrew Jeffery 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 References: <20231120091746.2866232-1-chou.cosmo@gmail.com> From: Quan Nguyen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SI2P153CA0003.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::20) To SN4PR01MB7455.prod.exchangelabs.com (2603:10b6:806:202::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN4PR01MB7455:EE_|SJ2PR01MB8077:EE_ X-MS-Office365-Filtering-Correlation-Id: 720d0133-50cc-4631-47ed-08dbef2001bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5TLUwdoKyUVDQ/qPQK9Z3UYt611GdsvbP803J9eP/D5GXPzhkzZZVQdcc41iYxDXz1d6YXsnnhHMcIA16Gh2n5fsYzhWvuHvN1t4U1oOtY2Dh6aewLhvyJ45yGlDE2XU0u0rEviil9fYEQRiuVqdeLFndrRvlPZ4R8EF9IqDNNzlCiYAcc1ojr4/WP79bM/7TUthaw8j/dMVqhYOcMhkXxrX/ZtgkMShCND2oTSUANRflh0FG/W8xt+bgY0idy/ffB/tbEzSGggpAIZYgvUxhzORaOuTF3iSyDv0EHokW87DURIId71Dk8e3WUZ40WH9odeAHVU3eIgGtVqLsThLpNWW3d4MqhpZSSkOs+pYGSZetBKz/Jn/8CIxGojqNIQDItkKH6HFs+ZG6h4J5jgl2chkvBUtZCr8XdHEETGFP5PQA52id3sISg3TFx2DKiLoUYXCKFduvmhHRsxxnKiLgtsYUWi3x3kupTtjatyLeadaIjtwvbW/SCuRrwEnzrfF/if76X/EwNey7ZU8jnBvNHDsfKqqjkuVmP8kSUhPQkZqUludZfy4pY+X1nUys7HcJHOcGoGKMYR0qZlph4xDg7Np5EkYgnvv3XqVmfk7NJCwSJWhQEaIz3R2LbShAJC9mb+eIMN6ulCzuiWpvt1kDg== 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)(39850400004)(346002)(366004)(136003)(376002)(396003)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(26005)(31686004)(6486002)(2616005)(478600001)(6506007)(6666004)(966005)(6512007)(53546011)(38100700002)(31696002)(86362001)(41300700001)(5660300002)(110136005)(66946007)(66476007)(66556008)(7416002)(4001150100001)(316002)(2906002)(4326008)(8676002)(8936002)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bG5XU2F4THhJd2FpSkhqOHRDNDhTRWVSSkxFRXhVU0dvcm5OOENpaUtUN0xN?= =?utf-8?B?dmJwRjRKdGJYWWt6Yi8vcWlzY2VCSURiRE81Mk44ejFDT1NkcDZPcGFTQmg0?= =?utf-8?B?SDdXUVdwZDMvbktpZmU2RjBFV3QrMmhYSFYxQnFGeENvSDBycFd5Y2MvaDFJ?= =?utf-8?B?VWt6UWVCZ0xVWXRTMzZKODhRYkZ2dDVER2plRGNVdVZBZzdXS2l1N1hKZ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xVUQwOW5WVmhVRlFJeCtFREdOSFZyRTAwZWZh?= =?utf-8?B?WVZ3ODN2dFd1bnJzWEpvaENDc0t0dDNYMFMyOVBReUc2SlQrcXF0b1dBZ1cz?= =?utf-8?B?NFJNZEc1QmZuMHBwTU95OERKMEs2dkFEYVk1Zk5uekUwWjRpOG9pRDRaSnNL?= =?utf-8?Q?uhYi3dTxt99f+bT8oB0sk1o=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 720d0133-50cc-4631-47ed-08dbef2001bb X-MS-Exchange-CrossTenant-AuthSource: SN4PR01MB7455.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2023 08:08:15.3089 (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: HjlDUBqxWg+lidbXLN+cxeTyI+MMnSc6OSIL9ppJWYazX2L1sPhZdFAv73VlLHQ3fZkmPN9Dj9lYC8vxq/67BwZokK53mva/IKRlJU+4oEI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR01MB8077 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 00:08:38 -0800 (PST) On 27/11/2023 14:04, Cosmo Chou wrote: > Andrew Jeffery wrote on Mon, 2023-11-27 > at 11:23 AM: >> >> On Mon, 2023-11-20 at 17:17 +0800, Cosmo Chou wrote: >>> commit 2be6b47211e1 ("i2c: aspeed: Acknowledge most interrupts early >>> 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_PROCESSED >>> is handled. >>> >>> Acknowledge Tx ack status after handling SLAVE_READ_PROCESSED to fix >>> the problem that the next byte is not sent correctly. >> >> 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. >> >> Andrew > > 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] > > 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-aspeed.c#L294 > That is, BMC stretches the SCL until ready to send the 1st_B. > > 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. > > 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-aspeed.c#L302 > This looks like the same issue, but we chose to ack them late. Same with INTR_RX_DONE. https://lore.kernel.org/all/20210616031046.2317-3-quan@os.amperecomputing.com/ - Quan