Message ID | 20231018155926.3305476-7-Frank.Li@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4894225vqb; Wed, 18 Oct 2023 09:01:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9tY0MoVk+ApT7T1YiLEFjc8KuqITANrRHQXLk6+4sGe4HwQZNPJ0oW3FsLfypDLa2dzu6 X-Received: by 2002:a05:6a20:d80d:b0:163:ab09:193e with SMTP id iv13-20020a056a20d80d00b00163ab09193emr5584947pzb.1.1697644886485; Wed, 18 Oct 2023 09:01:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697644886; cv=pass; d=google.com; s=arc-20160816; b=ZjJkgXuHDiEZQP4pBObnD+sbO4laz1BdC8QpHdHeaWXkLGDQKOOBnitrOClz+24O2u La0p/fzDX70OT9zKWZ18cCjRGxJUemktd5fAwkqAqbNO3LF8JnS6our9J5C5TLEjQqxy cNX+cojHttmreNRSc9JdXibUpyUA6H2zx1MsIE0K9Fj4nqFRVc6v74DWfkBsc960sr91 DijVER5PNTGAzk1oiUHNRHOYJDcsp3e7LDFgXTevvsurnKbyIEC05qw2IcAXOF9Sfs5R smtWmHLOqOlaLFGKRV/VusJIoWp5BK+YQpX5ejwU5c8Piv8xnLQUMWqWX1VWqtAoJ0A5 vtCg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=478803QczRFFXBUKZoVGKqPgxQF91oUCRqBqSsaRd+c=; fh=sDe3TG6/b46JEOvF2xh0f1K4oYWCH8cpxTVfh1/w/G8=; b=u628wYAv2ydZAcvxlXlwzgvhAk8B4zK7FWS56PiwXKmjkpxbMyjvJLzVACiuZcK/TN NFG491p3+zq2a6eoMXrbsPxZll1tShgdVi/+bO+9nph1Q1HovZZSzJytl7XdtO1hANcG 5s3qvZluhb96ncifGCGBWBSFBA4B3DL9i+LVvuj9nLWiVxrXL94fMxhHfPSwZ3EGDLfi Wckt17+WHhai52Ptj9rQCnZgGlUwIw4FfIzhjmSZPiHQt6mmlNp8uElmbPPTeyguQgf1 E79jPjjPdCv7eXR2HGTkg+L2tMX8X0gtmBwa7GJmfDBsdrOwFPA1BCu9JBKWxHYHZSEX XMRw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=I7lSfk6m; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id kb1-20020a17090ae7c100b0027d84544288si138922pjb.177.2023.10.18.09.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 09:01:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=I7lSfk6m; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6F8368078665; Wed, 18 Oct 2023 09:00:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235199AbjJRQAZ (ORCPT <rfc822;zwp10758@gmail.com> + 23 others); Wed, 18 Oct 2023 12:00:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344704AbjJRQAG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 18 Oct 2023 12:00:06 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2047.outbound.protection.outlook.com [40.107.13.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A07B2116 for <linux-kernel@vger.kernel.org>; Wed, 18 Oct 2023 09:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PXIvC6ZLfNB+KGG0DzU8M85j5GIWB56VpQh6c4GPAf3BCF7gjkq4sS/OovCn4OPZvnhwmpxfju1qwYnXfsMj++JqXfeytijqP1tyqfMbYTQJSdc81uHDNlBTNJCXzH0KTnpIFcOkE8sVccj6Lbc/3hTewP8n+sKSNg6ZkrqonZFiBY4dnNlNO9P/s73BAGwOzZeJXOxvnOvGUx9fRNCIbP0QPX+200aSZgFZobtC64FhZQdB+/HOqnj2UX+c0CCUGZWjpgcVw1sTkjj/beoTlquNg5Ywu+sEppUFUfmN4vyYgyot0sv4jiRMY0aXZ5Hp6wzoCUskUckBAW/kC728xg== 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=478803QczRFFXBUKZoVGKqPgxQF91oUCRqBqSsaRd+c=; b=QWeViCOLj9+yWPPu9X2ZaQjBd/Jj427tpv8uOkPEIyJjkQqpTile/Ogeh9282QquzXgDgdmCRhxQJSVmw+7afrBZikW2ovXedm4vXR5j5UVa0IKemmdegdYg//gMHkop68TFjJrewccgz3qFCZg7wLrxZ+zPW3c5Sk8CbiP5zss95ZCNuDRh/A9bv4uR9xHZPLvUdmtOlOTIEtbwpXlZUkwnwOtEI3LffRbjpxIGDz3ywwnNoJDyw1+0mzh+EWoFhCi014fuW3mp74WVgTCAl9pouv0+vgc+UwUqpfTjj2u6HnhR2WMZ9by6WrbehYjpJM5VvsePro1xBmP2Oomj2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=478803QczRFFXBUKZoVGKqPgxQF91oUCRqBqSsaRd+c=; b=I7lSfk6mpf4kco4xiOh1PzN5kobl9au2hHtcGe69DWXLY2mE3VQOrIitd5qc6peg73MI3eN+VrWVMuC5f8leVdxiwtQyC6aN3wyd0qSV6owNX3zRcs3e8D1qYIbA4HQSvCh1hIsdB807ZDfnwlBgdYnTGCBMAilUdYalThj3OZ4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AM7PR04MB6966.eurprd04.prod.outlook.com (2603:10a6:20b:109::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 15:59:58 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2%4]) with mapi id 15.20.6907.022; Wed, 18 Oct 2023 15:59:58 +0000 From: Frank Li <Frank.Li@nxp.com> To: miquel.raynal@bootlin.com Cc: Frank.Li@nxp.com, alexandre.belloni@bootlin.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 Resent 6/6] i3c: master: svc: fix random hot join failure since timeout error Date: Wed, 18 Oct 2023 11:59:26 -0400 Message-Id: <20231018155926.3305476-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018155926.3305476-1-Frank.Li@nxp.com> References: <20231018155926.3305476-1-Frank.Li@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SJ0PR05CA0210.namprd05.prod.outlook.com (2603:10b6:a03:330::35) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AM7PR04MB6966:EE_ X-MS-Office365-Filtering-Correlation-Id: c2be9190-f7fc-45cd-6d61-08dbcff34751 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Smkj3gwC3HUe66vGSDimpNAsvQlq7DV5p1MyVAdR7X+KEKe4PZSZZEj5/VnNVMKgxkC1ozjDt4VaK3YQjPcn37OMmUfFlkzj41AU5k5An8cGQOE5V/Jl4vS89JULr/fdYuXA7NOF5ct6H0nSyPm5wxSWfthKLaPdT5bKPQuFP/SGuhVJtfK1HuLwgIgVCjRXw4t/1sQnWuZogYXKKij9rQ6Q7BnX+VB0pLZwJEiOFEcmxwhN1Y9eh4wHTqj8hgaJWcl4Ob1WUkD5vtGaSG5rccTBGyr1RE30VZQSnSaN8elm2w2Y6fDMPW+0SvmTz4XiK5tSXfz2gIKw9YrWsXDNw6opudtkzNmXxTT5mOl/hc88IEdhqRr1NPzuZo6DcxJz+E2ZNNNp/bUmNAzl9qv1/Gh/I58Kyyp4hsWmM6R6pNbICtflNmFHSfmy/JHws+m2WuCs3Ohv8KsFPUy7hoaAPfFRd2gNrqsObFP1LaqFFn2pDaItddkDveYuJcH6GfWbnlzHO048918hk3yO7A4/8i/OLY0yRDJ8/E5/TL0tnCYdcAo40WlkCHxSYGmJ/pIL2GpUul+kuNf2m0VtW1BEcXiXvfyueL2dE83ZagKmuOiK1rpfJoJb8Z3HWOpwdoO6 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(2906002)(478600001)(6486002)(6666004)(38100700002)(8936002)(5660300002)(8676002)(66556008)(4326008)(66946007)(316002)(36756003)(66476007)(6916009)(86362001)(41300700001)(6512007)(52116002)(1076003)(6506007)(2616005)(26005)(38350700005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Df3UGpJRIP1dUl9V0uktN5AvP+XD?= =?utf-8?q?AmvzFKdcKKO+MchJHsWczJZZpPfvj5irccNurR/nvYlJjK2SWQyljiLVcQ6vUAv2R?= =?utf-8?q?0ig3FBKkRPtl1cr0s+ip4jp8AdWCdhi8UVXJ51LQAWDF8AswuS/cYG/fVQZt7TZPK?= =?utf-8?q?ya56480qSxHSBqafcu7DF70Tx8/UUF4LRSHrI5aQ8mUh/NReZxYUid9ct+SmgQDkE?= =?utf-8?q?ZrCxnB4yNgVK4KNaGBkx6FffUpEFZPVr/LreH5XCS7i0Bwr5JhXrf8BCeQI/zJm0i?= =?utf-8?q?FNrsI6BqyPpcOsGpcRDgxqDtlr1kS11cjOCeu1qHoievopZnHSKS0zVGBQOyIQXLc?= =?utf-8?q?86k8NrRxBrv+577WyWgGJl7GFA+dJQPAJGhrTSB8iXCSpmnbBPL9jm9XSKnBXSfpM?= =?utf-8?q?hYMBL77CRzYj0fmUGFJHcX1GXXOLpyh+zJRtukgfot8R1Ma28jOg05+9n+jHGn1KF?= =?utf-8?q?6pctfFtmiFaOBrAk6Zaj1zo8PDDSQHOW5Cv1u6Jn9H/ywlew7H4/vQOJUuTHtSFdF?= =?utf-8?q?p/6J5mv5MvtVSFz34y3HEWnNyjlDHIfs/2o+JZuh78PJvl17muT1mCC1vLjWn3DQ2?= =?utf-8?q?XlaTfIsK+ODDcuS08aHb0xrHgmRNzKHRxEh1KJ5Depd6riz4w6VRe5qENc4idnh7P?= =?utf-8?q?IMH/9AL7kMAe0VdVXmSajxBARcZmTzwoE1BTHpRS4hCqdxgPv+JAKTquNAvoIHnI/?= =?utf-8?q?6Hmi/jbfhnNe96qSH941qaN0LaKCL5m93jNJw4jAXbo4KTWq7fQ1uaJq79Hyi5MPZ?= =?utf-8?q?n+rylXE1gguy9NmzKeR2p0VN/18dVhgHOFGIizdxVPBYgyIU3wLfY+dGpiYdFMlNM?= =?utf-8?q?zXKlo03fqq3DIOkq8m/nIZfjHdo4H18G+HeJ/i42f6aVehoG1pUDbTr8AfVILQGBW?= =?utf-8?q?F9EIIp9JqTfv9TKMuFBGlPmxsNe4SUIC5ZL518NigkWaOPwAnKzia9tDUb2enTOzU?= =?utf-8?q?v1KhCLubNULOy8f7LAdhCuoUADHf8NRxSRkD0mtyj65vma5QUiD1wIO9n4hc9wWzn?= =?utf-8?q?uZbZajuApruuxW8K+2XPl4wx8lSBGQmFg+/BHk7kdag1mB6prgwozUoBoQBjqhRcp?= =?utf-8?q?VO+hWQleY2a95crkFIaI2m7skXtyNWMdHtqki1w6uTCAFKGIpSBnseBdkdKAMgMVu?= =?utf-8?q?0QsfHlFj7kACECclBFGzearEOZDtS0TIczUzGuuzNTklpodFB0f0i2KbvNVzeYNzR?= =?utf-8?q?ulJ1nJbj3tKBid0raipOgiteRu5/IJRD15WYnUT6m8FDYkk8EKiQkGQB/Cz7yDGwQ?= =?utf-8?q?JqvteIVzSfDUI1xD7OJYjeJYn1yR5akv6owjjwqXMu99ZEA7SrT1xzOzrpBuFUoD5?= =?utf-8?q?Pdjaher533GemtQBqeqM9UlFisB9JCEXcBqWy9TalsO3Zxu8lmGcGnqIsfhUcXrm6?= =?utf-8?q?ZZzUW20O4ojLDi/TaoVYB17MpNKMQzHLbhwNuKdsNEY9FEvWZFonkf+sYunb1X8dO?= =?utf-8?q?qx7HUG10UIcxCxLe3RhGPLNPbk1FHnKiG2hWzINR0fiX0P3+x18cGKqPKpgYhS11p?= =?utf-8?q?Sc+BGHyCDWml?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2be9190-f7fc-45cd-6d61-08dbcff34751 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 15:59:58.5131 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4I63UuGnjXmXnwy8MxQis7lE52/x2VZWoraOOvtBb+ac2OVVWOFq1FgDitYaoM1rPLMYGh/QX9lhRt+GEq1sPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6966 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 18 Oct 2023 09:00:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780109684309358159 X-GMAIL-MSGID: 1780109684309358159 |
Series |
i3c: master: svc: collection of bugs fixes
|
|
Commit Message
Frank Li
Oct. 18, 2023, 3:59 p.m. UTC
master side report:
silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000
BIT 20: TIMEOUT error
The module has stalled too long in a frame. This happens when:
- The TX FIFO or RX FIFO is not handled and the bus is stuck in the
middle of a message,
- No STOP was issued and between messages,
- IBI manual is used and no decision was made.
The maximum stall period is 10 KHz or 100 μs.
This is a just warning. System irq thread schedule latency is possible
bigger than 100us. Just omit this waring.
Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
Cc: stable@vger.kernel.org
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Notes:
Change from v1 to v2
-none
drivers/i3c/master/svc-i3c-master.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
Hi Frank, Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > master side report: > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > BIT 20: TIMEOUT error > The module has stalled too long in a frame. This happens when: > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > middle of a message, > - No STOP was issued and between messages, > - IBI manual is used and no decision was made. I am still not convinced this should be ignored in all cases. Case 1 is a problem because the hardware failed somehow. Case 2 is fine I guess. Case 3 is not possible in Linux, this will not be supported. > The maximum stall period is 10 KHz or 100 μs. s/10 KHz// > > This is a just warning. System irq thread schedule latency is possible > bigger than 100us. Just omit this waring. This can be considered as being just a warning as the system IRQ latency can easily be greater than 100us. > > Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") > Cc: stable@vger.kernel.org > Signed-off-by: Frank Li <Frank.Li@nxp.com> > --- > > Notes: > Change from v1 to v2 > -none > > drivers/i3c/master/svc-i3c-master.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c > index 1a57fdebaa26d..fedb31e0076c4 100644 > --- a/drivers/i3c/master/svc-i3c-master.c > +++ b/drivers/i3c/master/svc-i3c-master.c > @@ -93,6 +93,7 @@ > #define SVC_I3C_MINTMASKED 0x098 > #define SVC_I3C_MERRWARN 0x09C > #define SVC_I3C_MERRWARN_NACK BIT(2) > +#define SVC_I3C_MERRWARN_TIMEOUT BIT(20) > #define SVC_I3C_MDMACTRL 0x0A0 > #define SVC_I3C_MDATACTRL 0x0AC > #define SVC_I3C_MDATACTRL_FLUSHTB BIT(0) > @@ -226,6 +227,11 @@ static bool svc_i3c_master_error(struct svc_i3c_master *master) > if (SVC_I3C_MSTATUS_ERRWARN(mstatus)) { > merrwarn = readl(master->regs + SVC_I3C_MERRWARN); > writel(merrwarn, master->regs + SVC_I3C_MERRWARN); > + > + /* ignore timeout error */ > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > + return false; > + > dev_err(master->dev, > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > mstatus, merrwarn); Thanks, Miquèl
On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > Hi Frank, > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > master side report: > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > BIT 20: TIMEOUT error > > The module has stalled too long in a frame. This happens when: > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > middle of a message, > > - No STOP was issued and between messages, > > - IBI manual is used and no decision was made. > > I am still not convinced this should be ignored in all cases. > > Case 1 is a problem because the hardware failed somehow. But so far, no action to handle this case in current code. In svc_i3c_master_xfer() have not check this flags. also have not enable ERRWARN irq. If we met this case, we can add new functions/argument to handle this. Then we can real debug the code and recover bus. Without this patch, simplest add some debug message before issue SVC_I3C_MCTRL_REQUEST_AUTO_IBI, TIMEOUT will be set. And svc_i3c_master_error() was only called by svc_i3c_master_ibi_work(). So I can think only case 3 happen in svc_i3c_master_ibi_work(). Frank > Case 2 is fine I guess. > Case 3 is not possible in Linux, this will not be supported. > > > The maximum stall period is 10 KHz or 100 μs. > > s/10 KHz// > > > > > This is a just warning. System irq thread schedule latency is possible > > bigger than 100us. Just omit this waring. > > This can be considered as being just a warning as the system IRQ > latency can easily be greater than 100us. > > > > > Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") > > Cc: stable@vger.kernel.org > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > > --- > > > > Notes: > > Change from v1 to v2 > > -none > > > > drivers/i3c/master/svc-i3c-master.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c > > index 1a57fdebaa26d..fedb31e0076c4 100644 > > --- a/drivers/i3c/master/svc-i3c-master.c > > +++ b/drivers/i3c/master/svc-i3c-master.c > > @@ -93,6 +93,7 @@ > > #define SVC_I3C_MINTMASKED 0x098 > > #define SVC_I3C_MERRWARN 0x09C > > #define SVC_I3C_MERRWARN_NACK BIT(2) > > +#define SVC_I3C_MERRWARN_TIMEOUT BIT(20) > > #define SVC_I3C_MDMACTRL 0x0A0 > > #define SVC_I3C_MDATACTRL 0x0AC > > #define SVC_I3C_MDATACTRL_FLUSHTB BIT(0) > > @@ -226,6 +227,11 @@ static bool svc_i3c_master_error(struct svc_i3c_master *master) > > if (SVC_I3C_MSTATUS_ERRWARN(mstatus)) { > > merrwarn = readl(master->regs + SVC_I3C_MERRWARN); > > writel(merrwarn, master->regs + SVC_I3C_MERRWARN); > > + > > + /* ignore timeout error */ > > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > > + return false; > > + > > dev_err(master->dev, > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > mstatus, merrwarn); > > > Thanks, > Miquèl
Hi Frank, Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > Hi Frank, > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > master side report: > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > BIT 20: TIMEOUT error > > > The module has stalled too long in a frame. This happens when: > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > middle of a message, > > > - No STOP was issued and between messages, > > > - IBI manual is used and no decision was made. > > > > I am still not convinced this should be ignored in all cases. > > > > Case 1 is a problem because the hardware failed somehow. > > But so far, no action to handle this case in current code. Yes, but if you detect an issue and ignore it, it's not better than reporting it without handling it. Instead of totally ignoring this I would at least write a debug message (identical to what's below) before returning false, even though I am not convinced unconditionally returning false here is wise. If you fail a hardware sequence because you added a printk, it's a problem. Maybe you consider this line as noise, but I believe it's still an error condition. Maybe, however, this bit gets set after the whole sequence, and this is just a "bus is idle" condition. If that's the case, then you need some additional heuristics to properly ignore the bit? > In svc_i3c_master_xfer() have not check this flags. also have not enable > ERRWARN irq. > > If we met this case, we can add new functions/argument to handle this. > Then we can real debug the code and recover bus. > > Without this patch, simplest add some debug message before issue > SVC_I3C_MCTRL_REQUEST_AUTO_IBI, TIMEOUT will be set. Yes, and sometimes it won't be an issue, but sometimes it may. Maybe we can find more advanced heuristics there. > And svc_i3c_master_error() was only called by svc_i3c_master_ibi_work(). > > So I can think only case 3 happen in svc_i3c_master_ibi_work(). Case 3 cannot be handled by Linux (because of the natural latency of the OS). > > Frank > > > Case 2 is fine I guess. > > Case 3 is not possible in Linux, this will not be supported. > > > > > The maximum stall period is 10 KHz or 100 μs. > > > > s/10 KHz// > > > > > > > > This is a just warning. System irq thread schedule latency is possible > > > bigger than 100us. Just omit this waring. > > > > This can be considered as being just a warning as the system IRQ > > latency can easily be greater than 100us. This was skipped in your v3. > > > Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") > > > Cc: stable@vger.kernel.org > > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > > > --- Thanks, Miquèl
On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > Hi Frank, > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > Hi Frank, > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > master side report: > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > BIT 20: TIMEOUT error > > > > The module has stalled too long in a frame. This happens when: > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > middle of a message, > > > > - No STOP was issued and between messages, > > > > - IBI manual is used and no decision was made. > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > But so far, no action to handle this case in current code. > > Yes, but if you detect an issue and ignore it, it's not better than > reporting it without handling it. Instead of totally ignoring this I > would at least write a debug message (identical to what's below) before > returning false, even though I am not convinced unconditionally > returning false here is wise. If you fail a hardware sequence because > you added a printk, it's a problem. Maybe you consider this line as > noise, but I believe it's still an error condition. Maybe, however, > this bit gets set after the whole sequence, and this is just a "bus > is idle" condition. If that's the case, then you need some > additional heuristics to properly ignore the bit? > dev_err(master->dev, "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", mstatus, merrwarn); + + /* ignore timeout error */ + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) + return false; + Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? Frank > > In svc_i3c_master_xfer() have not check this flags. also have not enable > > ERRWARN irq. > > > > If we met this case, we can add new functions/argument to handle this. > > Then we can real debug the code and recover bus. > > > > Without this patch, simplest add some debug message before issue > > SVC_I3C_MCTRL_REQUEST_AUTO_IBI, TIMEOUT will be set. > > Yes, and sometimes it won't be an issue, but sometimes it may. Maybe we > can find more advanced heuristics there. > > > And svc_i3c_master_error() was only called by svc_i3c_master_ibi_work(). > > > > So I can think only case 3 happen in svc_i3c_master_ibi_work(). > > Case 3 cannot be handled by Linux (because of the natural latency of > the OS). > > > > > Frank > > > > > Case 2 is fine I guess. > > > Case 3 is not possible in Linux, this will not be supported. > > > > > > > The maximum stall period is 10 KHz or 100 μs. > > > > > > s/10 KHz// > > > > > > > > > > > This is a just warning. System irq thread schedule latency is possible > > > > bigger than 100us. Just omit this waring. > > > > > > This can be considered as being just a warning as the system IRQ > > > latency can easily be greater than 100us. > > This was skipped in your v3. > > > > > Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") > > > > Cc: stable@vger.kernel.org > > > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > > > > --- > > Thanks, > Miquèl
Hi Frank, Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:18:55 -0400: > On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > > Hi Frank, > > > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > > Hi Frank, > > > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > > > master side report: > > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > > > BIT 20: TIMEOUT error > > > > > The module has stalled too long in a frame. This happens when: > > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > > middle of a message, > > > > > - No STOP was issued and between messages, > > > > > - IBI manual is used and no decision was made. > > > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > > > But so far, no action to handle this case in current code. > > > > Yes, but if you detect an issue and ignore it, it's not better than > > reporting it without handling it. Instead of totally ignoring this I > > would at least write a debug message (identical to what's below) before > > returning false, even though I am not convinced unconditionally > > returning false here is wise. If you fail a hardware sequence because > > you added a printk, it's a problem. Maybe you consider this line as > > noise, but I believe it's still an error condition. Maybe, however, > > this bit gets set after the whole sequence, and this is just a "bus > > is idle" condition. If that's the case, then you need some > > additional heuristics to properly ignore the bit? > > > > dev_err(master->dev, > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > mstatus, merrwarn); > + > + /* ignore timeout error */ > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > + return false; > + > > Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? I think you mentioned earlier that the problem was not the printk but the return value. So perhaps there is a way to know if the timeout happened after a transaction and was legitimate or not? In any case we should probably lower the log level for this error. Thanks, Miquèl
On Fri, Oct 20, 2023 at 04:35:25PM +0200, Miquel Raynal wrote: > Hi Frank, > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:18:55 -0400: > > > On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > > > Hi Frank, > > > > > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > > > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > > > Hi Frank, > > > > > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > > > > > master side report: > > > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > > > > > BIT 20: TIMEOUT error > > > > > > The module has stalled too long in a frame. This happens when: > > > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > > > middle of a message, > > > > > > - No STOP was issued and between messages, > > > > > > - IBI manual is used and no decision was made. > > > > > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > > > > > But so far, no action to handle this case in current code. > > > > > > Yes, but if you detect an issue and ignore it, it's not better than > > > reporting it without handling it. Instead of totally ignoring this I > > > would at least write a debug message (identical to what's below) before > > > returning false, even though I am not convinced unconditionally > > > returning false here is wise. If you fail a hardware sequence because > > > you added a printk, it's a problem. Maybe you consider this line as > > > noise, but I believe it's still an error condition. Maybe, however, > > > this bit gets set after the whole sequence, and this is just a "bus > > > is idle" condition. If that's the case, then you need some > > > additional heuristics to properly ignore the bit? > > > > > > > dev_err(master->dev, > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > mstatus, merrwarn); > > + > > + /* ignore timeout error */ > > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > > + return false; > > + > > > > Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? > > I think you mentioned earlier that the problem was not the printk but > the return value. So perhaps there is a way to know if the timeout > happened after a transaction and was legitimate or not? Error message just annoise user, don't impact function. But return false let IBI thread running to avoid dead lock. > > In any case we should probably lower the log level for this error. Only SVC_I3C_MERRWARN_TIMEOUT is warning Maybe below logic is better if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) { dev_dbg(master->dev, "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", mstatus, merrwarn); return false; } dev_err(master->dev, "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", mstatus, merrwarn); .... Frank > > Thanks, > Miquèl
On Fri, Oct 20, 2023 at 10:47:52AM -0400, Frank Li wrote: > On Fri, Oct 20, 2023 at 04:35:25PM +0200, Miquel Raynal wrote: > > Hi Frank, > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:18:55 -0400: > > > > > On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > > > > Hi Frank, > > > > > > > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > > > > > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > > > > Hi Frank, > > > > > > > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > > > > > > > master side report: > > > > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > > > > > > > BIT 20: TIMEOUT error > > > > > > > The module has stalled too long in a frame. This happens when: > > > > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > > > > middle of a message, > > > > > > > - No STOP was issued and between messages, > > > > > > > - IBI manual is used and no decision was made. > > > > > > > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > > > > > > > But so far, no action to handle this case in current code. > > > > > > > > Yes, but if you detect an issue and ignore it, it's not better than > > > > reporting it without handling it. Instead of totally ignoring this I > > > > would at least write a debug message (identical to what's below) before > > > > returning false, even though I am not convinced unconditionally > > > > returning false here is wise. If you fail a hardware sequence because > > > > you added a printk, it's a problem. Maybe you consider this line as > > > > noise, but I believe it's still an error condition. Maybe, however, > > > > this bit gets set after the whole sequence, and this is just a "bus > > > > is idle" condition. If that's the case, then you need some > > > > additional heuristics to properly ignore the bit? > > > > > > > > > > dev_err(master->dev, > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > mstatus, merrwarn); > > > + > > > + /* ignore timeout error */ > > > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > > > + return false; > > > + > > > > > > Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? > > > > I think you mentioned earlier that the problem was not the printk but > > the return value. So perhaps there is a way to know if the timeout > > happened after a transaction and was legitimate or not? > > Error message just annoise user, don't impact function. But return false > let IBI thread running to avoid dead lock. I forget mention one thing. Any error message here will make SDA low for longer. Before emit stop, SDA is low. I have not checked I3C spec yet about how long SDA will be allowed. it will worser if message go through uart port. The bus will be locked longer. It's better to print error message after emit_stop to reduce SDA low time. Frank > > > > > In any case we should probably lower the log level for this error. > > Only SVC_I3C_MERRWARN_TIMEOUT is warning > > Maybe below logic is better > > if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) { > dev_dbg(master->dev, > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > mstatus, merrwarn); > return false; > } > > dev_err(master->dev, > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > mstatus, merrwarn); > .... > > Frank > > > > > Thanks, > > Miquèl
Hi Frank, Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:47:52 -0400: > On Fri, Oct 20, 2023 at 04:35:25PM +0200, Miquel Raynal wrote: > > Hi Frank, > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:18:55 -0400: > > > > > On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > > > > Hi Frank, > > > > > > > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > > > > > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > > > > Hi Frank, > > > > > > > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > > > > > > > master side report: > > > > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > > > > > > > BIT 20: TIMEOUT error > > > > > > > The module has stalled too long in a frame. This happens when: > > > > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > > > > middle of a message, > > > > > > > - No STOP was issued and between messages, > > > > > > > - IBI manual is used and no decision was made. > > > > > > > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > > > > > > > But so far, no action to handle this case in current code. > > > > > > > > Yes, but if you detect an issue and ignore it, it's not better than > > > > reporting it without handling it. Instead of totally ignoring this I > > > > would at least write a debug message (identical to what's below) before > > > > returning false, even though I am not convinced unconditionally > > > > returning false here is wise. If you fail a hardware sequence because > > > > you added a printk, it's a problem. Maybe you consider this line as > > > > noise, but I believe it's still an error condition. Maybe, however, > > > > this bit gets set after the whole sequence, and this is just a "bus > > > > is idle" condition. If that's the case, then you need some > > > > additional heuristics to properly ignore the bit? > > > > > > > > > > dev_err(master->dev, > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > mstatus, merrwarn); > > > + > > > + /* ignore timeout error */ > > > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > > > + return false; > > > + > > > > > > Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? > > > > I think you mentioned earlier that the problem was not the printk but > > the return value. So perhaps there is a way to know if the timeout > > happened after a transaction and was legitimate or not? > > Error message just annoise user, don't impact function. But return false > let IBI thread running to avoid dead lock. > > > > > In any case we should probably lower the log level for this error. > > Only SVC_I3C_MERRWARN_TIMEOUT is warning > > Maybe below logic is better > > if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) { > dev_dbg(master->dev, > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > mstatus, merrwarn); > return false; > } > > dev_err(master->dev, > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > mstatus, merrwarn); > .... > Yes, this looks better but I wonder if we should add an additional condition to just return false in this case; something saying "this timeout is legitimate and has no impact". Thanks, Miquèl
Hi Frank, Frank.li@nxp.com wrote on Fri, 20 Oct 2023 11:17:17 -0400: > On Fri, Oct 20, 2023 at 10:47:52AM -0400, Frank Li wrote: > > On Fri, Oct 20, 2023 at 04:35:25PM +0200, Miquel Raynal wrote: > > > Hi Frank, > > > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:18:55 -0400: > > > > > > > On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > > > > > Hi Frank, > > > > > > > > > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > > > > > > > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > > > > > Hi Frank, > > > > > > > > > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > > > > > > > > > master side report: > > > > > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > > > > > > > > > BIT 20: TIMEOUT error > > > > > > > > The module has stalled too long in a frame. This happens when: > > > > > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > > > > > middle of a message, > > > > > > > > - No STOP was issued and between messages, > > > > > > > > - IBI manual is used and no decision was made. > > > > > > > > > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > > > > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > > > > > > > > > But so far, no action to handle this case in current code. > > > > > > > > > > Yes, but if you detect an issue and ignore it, it's not better than > > > > > reporting it without handling it. Instead of totally ignoring this I > > > > > would at least write a debug message (identical to what's below) before > > > > > returning false, even though I am not convinced unconditionally > > > > > returning false here is wise. If you fail a hardware sequence because > > > > > you added a printk, it's a problem. Maybe you consider this line as > > > > > noise, but I believe it's still an error condition. Maybe, however, > > > > > this bit gets set after the whole sequence, and this is just a "bus > > > > > is idle" condition. If that's the case, then you need some > > > > > additional heuristics to properly ignore the bit? > > > > > > > > > > > > > dev_err(master->dev, > > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > > mstatus, merrwarn); > > > > + > > > > + /* ignore timeout error */ > > > > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > > > > + return false; > > > > + > > > > > > > > Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? > > > > > > I think you mentioned earlier that the problem was not the printk but > > > the return value. So perhaps there is a way to know if the timeout > > > happened after a transaction and was legitimate or not? > > > > Error message just annoise user, don't impact function. But return false > > let IBI thread running to avoid dead lock. > > I forget mention one thing. Any error message here will make SDA low for > longer. Before emit stop, SDA is low. > > I have not checked I3C spec yet about how long SDA will be allowed. it will > worser if message go through uart port. The bus will be locked longer. > > It's better to print error message after emit_stop to reduce SDA low time. That's fine I guess. Thanks, Miquèl
On Fri, Oct 20, 2023 at 05:20:06PM +0200, Miquel Raynal wrote: > Hi Frank, > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:47:52 -0400: > > > On Fri, Oct 20, 2023 at 04:35:25PM +0200, Miquel Raynal wrote: > > > Hi Frank, > > > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:18:55 -0400: > > > > > > > On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > > > > > Hi Frank, > > > > > > > > > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > > > > > > > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > > > > > Hi Frank, > > > > > > > > > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > > > > > > > > > master side report: > > > > > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > > > > > > > > > BIT 20: TIMEOUT error > > > > > > > > The module has stalled too long in a frame. This happens when: > > > > > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > > > > > middle of a message, > > > > > > > > - No STOP was issued and between messages, > > > > > > > > - IBI manual is used and no decision was made. > > > > > > > > > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > > > > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > > > > > > > > > But so far, no action to handle this case in current code. > > > > > > > > > > Yes, but if you detect an issue and ignore it, it's not better than > > > > > reporting it without handling it. Instead of totally ignoring this I > > > > > would at least write a debug message (identical to what's below) before > > > > > returning false, even though I am not convinced unconditionally > > > > > returning false here is wise. If you fail a hardware sequence because > > > > > you added a printk, it's a problem. Maybe you consider this line as > > > > > noise, but I believe it's still an error condition. Maybe, however, > > > > > this bit gets set after the whole sequence, and this is just a "bus > > > > > is idle" condition. If that's the case, then you need some > > > > > additional heuristics to properly ignore the bit? > > > > > > > > > > > > > dev_err(master->dev, > > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > > mstatus, merrwarn); > > > > + > > > > + /* ignore timeout error */ > > > > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > > > > + return false; > > > > + > > > > > > > > Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? > > > > > > I think you mentioned earlier that the problem was not the printk but > > > the return value. So perhaps there is a way to know if the timeout > > > happened after a transaction and was legitimate or not? > > > > Error message just annoise user, don't impact function. But return false > > let IBI thread running to avoid dead lock. > > > > > > > > In any case we should probably lower the log level for this error. > > > > Only SVC_I3C_MERRWARN_TIMEOUT is warning > > > > Maybe below logic is better > > > > if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) { > > dev_dbg(master->dev, > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > mstatus, merrwarn); > > return false; > > } > > > > dev_err(master->dev, > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > mstatus, merrwarn); > > .... > > > > Yes, this looks better but I wonder if we should add an additional > condition to just return false in this case; What's additional condition we can check? > something saying "this > timeout is legitimate and has no impact". Add comments "this timeout is legitimate and has no impact" or dev_dbg print that? > > Thanks, > Miquèl
Hi Frank, Frank.li@nxp.com wrote on Fri, 20 Oct 2023 11:47:48 -0400: > On Fri, Oct 20, 2023 at 05:20:06PM +0200, Miquel Raynal wrote: > > Hi Frank, > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:47:52 -0400: > > > > > On Fri, Oct 20, 2023 at 04:35:25PM +0200, Miquel Raynal wrote: > > > > Hi Frank, > > > > > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:18:55 -0400: > > > > > > > > > On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > > > > > > Hi Frank, > > > > > > > > > > > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > > > > > > > > > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > > > > > > Hi Frank, > > > > > > > > > > > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > > > > > > > > > > > master side report: > > > > > > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > > > > > > > > > > > BIT 20: TIMEOUT error > > > > > > > > > The module has stalled too long in a frame. This happens when: > > > > > > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > > > > > > middle of a message, > > > > > > > > > - No STOP was issued and between messages, > > > > > > > > > - IBI manual is used and no decision was made. > > > > > > > > > > > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > > > > > > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > > > > > > > > > > > But so far, no action to handle this case in current code. > > > > > > > > > > > > Yes, but if you detect an issue and ignore it, it's not better than > > > > > > reporting it without handling it. Instead of totally ignoring this I > > > > > > would at least write a debug message (identical to what's below) before > > > > > > returning false, even though I am not convinced unconditionally > > > > > > returning false here is wise. If you fail a hardware sequence because > > > > > > you added a printk, it's a problem. Maybe you consider this line as > > > > > > noise, but I believe it's still an error condition. Maybe, however, > > > > > > this bit gets set after the whole sequence, and this is just a "bus > > > > > > is idle" condition. If that's the case, then you need some > > > > > > additional heuristics to properly ignore the bit? > > > > > > > > > > > > > > > > dev_err(master->dev, > > > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > > > mstatus, merrwarn); > > > > > + > > > > > + /* ignore timeout error */ > > > > > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > > > > > + return false; > > > > > + > > > > > > > > > > Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? > > > > > > > > I think you mentioned earlier that the problem was not the printk but > > > > the return value. So perhaps there is a way to know if the timeout > > > > happened after a transaction and was legitimate or not? > > > > > > Error message just annoise user, don't impact function. But return false > > > let IBI thread running to avoid dead lock. > > > > > > > > > > > In any case we should probably lower the log level for this error. > > > > > > Only SVC_I3C_MERRWARN_TIMEOUT is warning > > > > > > Maybe below logic is better > > > > > > if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) { > > > dev_dbg(master->dev, > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > mstatus, merrwarn); > > > return false; > > > } > > > > > > dev_err(master->dev, > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > mstatus, merrwarn); > > > .... > > > > > > > Yes, this looks better but I wonder if we should add an additional > > condition to just return false in this case; > > What's additional condition we can check? Well, you're the one bothered with an error case which is not a real error. You're saying "this error is never a problem" and I am saying that I believe it is not a problem is your particular case, but in general there might be situations where it *is* a problem. So you need to find proper conditions to check against in order to determine whether this is just an info with no consequence or an error. > > something saying "this > > timeout is legitimate and has no impact". > > Add comments "this timeout is legitimate and has no impact" or dev_dbg > print that? No I'm talking about the additional heuristics. Thanks, Miquèl
On Fri, Oct 20, 2023 at 07:03:37PM +0200, Miquel Raynal wrote: > Hi Frank, > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 11:47:48 -0400: > > > On Fri, Oct 20, 2023 at 05:20:06PM +0200, Miquel Raynal wrote: > > > Hi Frank, > > > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:47:52 -0400: > > > > > > > On Fri, Oct 20, 2023 at 04:35:25PM +0200, Miquel Raynal wrote: > > > > > Hi Frank, > > > > > > > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:18:55 -0400: > > > > > > > > > > > On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > > > > > > > Hi Frank, > > > > > > > > > > > > > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > > > > > > > > > > > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > > > > > > > Hi Frank, > > > > > > > > > > > > > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > > > > > > > > > > > > > master side report: > > > > > > > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > > > > > > > > > > > > > BIT 20: TIMEOUT error > > > > > > > > > > The module has stalled too long in a frame. This happens when: > > > > > > > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > > > > > > > middle of a message, > > > > > > > > > > - No STOP was issued and between messages, > > > > > > > > > > - IBI manual is used and no decision was made. > > > > > > > > > > > > > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > > > > > > > > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > > > > > > > > > > > > > But so far, no action to handle this case in current code. > > > > > > > > > > > > > > Yes, but if you detect an issue and ignore it, it's not better than > > > > > > > reporting it without handling it. Instead of totally ignoring this I > > > > > > > would at least write a debug message (identical to what's below) before > > > > > > > returning false, even though I am not convinced unconditionally > > > > > > > returning false here is wise. If you fail a hardware sequence because > > > > > > > you added a printk, it's a problem. Maybe you consider this line as > > > > > > > noise, but I believe it's still an error condition. Maybe, however, > > > > > > > this bit gets set after the whole sequence, and this is just a "bus > > > > > > > is idle" condition. If that's the case, then you need some > > > > > > > additional heuristics to properly ignore the bit? > > > > > > > > > > > > > > > > > > > dev_err(master->dev, > > > > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > > > > mstatus, merrwarn); > > > > > > + > > > > > > + /* ignore timeout error */ > > > > > > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > > > > > > + return false; > > > > > > + > > > > > > > > > > > > Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? > > > > > > > > > > I think you mentioned earlier that the problem was not the printk but > > > > > the return value. So perhaps there is a way to know if the timeout > > > > > happened after a transaction and was legitimate or not? > > > > > > > > Error message just annoise user, don't impact function. But return false > > > > let IBI thread running to avoid dead lock. > > > > > > > > > > > > > > In any case we should probably lower the log level for this error. > > > > > > > > Only SVC_I3C_MERRWARN_TIMEOUT is warning > > > > > > > > Maybe below logic is better > > > > > > > > if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) { > > > > dev_dbg(master->dev, > > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > > mstatus, merrwarn); > > > > return false; > > > > } > > > > > > > > dev_err(master->dev, > > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > > mstatus, merrwarn); > > > > .... > > > > > > > > > > Yes, this looks better but I wonder if we should add an additional > > > condition to just return false in this case; > > > > What's additional condition we can check? > > Well, you're the one bothered with an error case which is not a real > error. You're saying "this error is never a problem" and I am saying > that I believe it is not a problem is your particular case, but in > general there might be situations where it *is* a problem. So you need > to find proper conditions to check against in order to determine > whether this is just an info with no consequence or an error. I checked R** code of this TIMEOUT, which is quite simple, set to 1 if SDA is low over 100us if I understand correctly. I also checked, if I add delay before emit stop, TIMEOUT will be set. (Read can auto emit stop accoring to RDTERM, so just saw TIMEOUT at write transaction). TIMEOUT just means condition "I3C bus's SDA low over 100us" happened since written 1 to TIMEOUT. I think "I3C bus's SDA over 100us" means nothing for linux drivers. I think there are NO sitation where it *is* a problem. If it was problem, there are NO solution to resolve it at linux driver side. And I think it already happen many times silencely. Frank > > > > something saying "this > > > timeout is legitimate and has no impact". > > > > Add comments "this timeout is legitimate and has no impact" or dev_dbg > > print that? > > No I'm talking about the additional heuristics. > > Thanks, > Miquèl
Hi Frank, Frank.li@nxp.com wrote on Fri, 20 Oct 2023 15:58:25 -0400: > On Fri, Oct 20, 2023 at 07:03:37PM +0200, Miquel Raynal wrote: > > Hi Frank, > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 11:47:48 -0400: > > > > > On Fri, Oct 20, 2023 at 05:20:06PM +0200, Miquel Raynal wrote: > > > > Hi Frank, > > > > > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:47:52 -0400: > > > > > > > > > On Fri, Oct 20, 2023 at 04:35:25PM +0200, Miquel Raynal wrote: > > > > > > Hi Frank, > > > > > > > > > > > > Frank.li@nxp.com wrote on Fri, 20 Oct 2023 10:18:55 -0400: > > > > > > > > > > > > > On Fri, Oct 20, 2023 at 04:06:45PM +0200, Miquel Raynal wrote: > > > > > > > > Hi Frank, > > > > > > > > > > > > > > > > Frank.li@nxp.com wrote on Thu, 19 Oct 2023 11:39:42 -0400: > > > > > > > > > > > > > > > > > On Thu, Oct 19, 2023 at 08:44:52AM +0200, Miquel Raynal wrote: > > > > > > > > > > Hi Frank, > > > > > > > > > > > > > > > > > > > > Frank.Li@nxp.com wrote on Wed, 18 Oct 2023 11:59:26 -0400: > > > > > > > > > > > > > > > > > > > > > master side report: > > > > > > > > > > > silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000 > > > > > > > > > > > > > > > > > > > > > > BIT 20: TIMEOUT error > > > > > > > > > > > The module has stalled too long in a frame. This happens when: > > > > > > > > > > > - The TX FIFO or RX FIFO is not handled and the bus is stuck in the > > > > > > > > > > > middle of a message, > > > > > > > > > > > - No STOP was issued and between messages, > > > > > > > > > > > - IBI manual is used and no decision was made. > > > > > > > > > > > > > > > > > > > > I am still not convinced this should be ignored in all cases. > > > > > > > > > > > > > > > > > > > > Case 1 is a problem because the hardware failed somehow. > > > > > > > > > > > > > > > > > > But so far, no action to handle this case in current code. > > > > > > > > > > > > > > > > Yes, but if you detect an issue and ignore it, it's not better than > > > > > > > > reporting it without handling it. Instead of totally ignoring this I > > > > > > > > would at least write a debug message (identical to what's below) before > > > > > > > > returning false, even though I am not convinced unconditionally > > > > > > > > returning false here is wise. If you fail a hardware sequence because > > > > > > > > you added a printk, it's a problem. Maybe you consider this line as > > > > > > > > noise, but I believe it's still an error condition. Maybe, however, > > > > > > > > this bit gets set after the whole sequence, and this is just a "bus > > > > > > > > is idle" condition. If that's the case, then you need some > > > > > > > > additional heuristics to properly ignore the bit? > > > > > > > > > > > > > > > > > > > > > > dev_err(master->dev, > > > > > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > > > > > mstatus, merrwarn); > > > > > > > + > > > > > > > + /* ignore timeout error */ > > > > > > > + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) > > > > > > > + return false; > > > > > > > + > > > > > > > > > > > > > > Is it okay move SVC_I3C_MERRWARN_TIMEOUT after dev_err? > > > > > > > > > > > > I think you mentioned earlier that the problem was not the printk but > > > > > > the return value. So perhaps there is a way to know if the timeout > > > > > > happened after a transaction and was legitimate or not? > > > > > > > > > > Error message just annoise user, don't impact function. But return false > > > > > let IBI thread running to avoid dead lock. > > > > > > > > > > > > > > > > > In any case we should probably lower the log level for this error. > > > > > > > > > > Only SVC_I3C_MERRWARN_TIMEOUT is warning > > > > > > > > > > Maybe below logic is better > > > > > > > > > > if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) { > > > > > dev_dbg(master->dev, > > > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > > > mstatus, merrwarn); > > > > > return false; > > > > > } > > > > > > > > > > dev_err(master->dev, > > > > > "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", > > > > > mstatus, merrwarn); > > > > > .... > > > > > > > > > > > > > Yes, this looks better but I wonder if we should add an additional > > > > condition to just return false in this case; > > > > > > What's additional condition we can check? > > > > Well, you're the one bothered with an error case which is not a real > > error. You're saying "this error is never a problem" and I am saying > > that I believe it is not a problem is your particular case, but in > > general there might be situations where it *is* a problem. So you need > > to find proper conditions to check against in order to determine > > whether this is just an info with no consequence or an error. > > I checked R** code of this TIMEOUT, which is quite simple, set to 1 if SDA > is low over 100us if I understand correctly. I also checked, if I add delay > before emit stop, TIMEOUT will be set. (Read can auto emit stop accoring to > RDTERM, so just saw TIMEOUT at write transaction). > > TIMEOUT just means condition "I3C bus's SDA low over 100us" happened since > written 1 to TIMEOUT. > > I think "I3C bus's SDA over 100us" means nothing for linux drivers. > > I think there are NO sitation where it *is* a problem. If it was problem, > there are NO solution to resolve it at linux driver side. And I think it > already happen many times silencely. Ok then, I'll opt for your last proposal of printing the error message at the debug loglevel and return false. Thanks, Miquèl
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 1a57fdebaa26d..fedb31e0076c4 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -93,6 +93,7 @@ #define SVC_I3C_MINTMASKED 0x098 #define SVC_I3C_MERRWARN 0x09C #define SVC_I3C_MERRWARN_NACK BIT(2) +#define SVC_I3C_MERRWARN_TIMEOUT BIT(20) #define SVC_I3C_MDMACTRL 0x0A0 #define SVC_I3C_MDATACTRL 0x0AC #define SVC_I3C_MDATACTRL_FLUSHTB BIT(0) @@ -226,6 +227,11 @@ static bool svc_i3c_master_error(struct svc_i3c_master *master) if (SVC_I3C_MSTATUS_ERRWARN(mstatus)) { merrwarn = readl(master->regs + SVC_I3C_MERRWARN); writel(merrwarn, master->regs + SVC_I3C_MERRWARN); + + /* ignore timeout error */ + if (merrwarn & SVC_I3C_MERRWARN_TIMEOUT) + return false; + dev_err(master->dev, "Error condition: MSTATUS 0x%08x, MERRWARN 0x%08x\n", mstatus, merrwarn);