Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6054435rdb; Thu, 14 Dec 2023 07:14:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNJCQ2ssRPQhBzDGzwcXicXlwua3rOuVjXZzkICQnSy7Ep1IFs9qa9wZNMfGGGVl+in2Wp X-Received: by 2002:a17:90a:318d:b0:28b:1b31:fff with SMTP id j13-20020a17090a318d00b0028b1b310fffmr284710pjb.21.1702566865242; Thu, 14 Dec 2023 07:14:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702566865; cv=none; d=google.com; s=arc-20160816; b=qLzWuvlQRnbae18908eaM6/xxMjvZZXvKBd615jTsZEFL52ijzXb7c2anKr8+osIgB 2bdmaAMCpfi3imv3XAnaNLstSefXxr9IxfG0SX2DpWRvFsF/ii/F9XAqX2dW3dUiYm3D uDVlwaVN7Zy4axzDunCZk+LodHuuVNtQbEbLPsSbdHNXRxolvUeZd82gweESdFu0i7HO 7veJOHcwgYNKVsIBv28HzI23Q0jxQU4iKl8KRuj1lzJp6+8v4hHJdPpGspyofaIx8PPp hzjZqS7Sq49E3QnkAT8IA0ZaqFlDAcozJeJ7iRf7HwVSHy1+ZsLpDllfgXCjnUWdVhyU Txzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3L9IW1XXYJamkBl9kuyV2sbbsqpozouQnx6/10RpzLw=; fh=buRKIQ8e+vHLSBwPPQaXMKsjw0ipkqKX/92u1Y9CKy0=; b=TlJe7czZLNFMjVnNsViNN80/mCo96RHkOfuvOiYlqQPMIZ62zXS9pib886f3vRO9s2 Jtv8IYkfSwDWXZoUp7zml4LwdN6Mz+dv4I6A38cWpXHaxk2+EcbUiPt0CQqc14jjgxeP l3+i2k5MaoLMdWEd4vnBKds8i7YpDWR6RQzNKl+23HFnwaCactsMlo1OlIgDiWByq0IS clveA9hJMcPQcgmuGxATApCYQDIPr6+8abSK4w92PhzJGyHodaOLkuHaGExJP0riVom4 /7VyXekni6JqEnb2vRguMnoQCblYj/NyvpuUA/T1BZfewGPVqMy126zP/BWG3EBU/mhO 885g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gzb+ab07; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id w6-20020a17090a8a0600b00286b47270b3si12678992pjn.151.2023.12.14.07.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 07:14:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gzb+ab07; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 191AA80EA966; Thu, 14 Dec 2023 07:14:12 -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 S1573734AbjLNPNq (ORCPT + 99 others); Thu, 14 Dec 2023 10:13:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230516AbjLNPN3 (ORCPT ); Thu, 14 Dec 2023 10:13:29 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CBEA19A; Thu, 14 Dec 2023 07:12:20 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50bf32c0140so9344396e87.1; Thu, 14 Dec 2023 07:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702566738; x=1703171538; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3L9IW1XXYJamkBl9kuyV2sbbsqpozouQnx6/10RpzLw=; b=gzb+ab07pqv7oTrWcdnu67tgqKLH7N4iVUzHzJlbmZ0jj2MxkZV1RgxVdo7QSZbbLT 6rGrzZnIO5asF3kBr2xSs6p+BubXOyoahODsnnQmwrT4WSt1rtkVgBIsn2vb9mdQYaPq KOO/VnHe7tk+CiPbf11PZ7hr0iD3j7Qslh8jGfKcR4jpWzj6PoMFEOXk3RKkudqIA5YQ hB1GSAGGv4Zl+yo2J2ee70c11RBGco/J7oVfwM92CzWYXMErhLsSZ6T1ssXt7N5iDr17 Y4N/TdkXvSkb2aEogiUbQxDij4mOdb25EwxiMGhCW2epJi40wlJpWmYgesRqwgU2SUCU PJTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702566738; x=1703171538; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3L9IW1XXYJamkBl9kuyV2sbbsqpozouQnx6/10RpzLw=; b=EBhAuEpgt/hJFR6pMvjHTnmIaTEbuqPCykVI8kdQTtKWv2vWYjqol4N18xxXDuuvbl szzpEZMiEoq6siiO2LTlopls+I0ARKC/zXC5f3ie773iEsjXzXBA0McXwA50PxO1J8fe buKeEL7xCDIAfNkNsS06nbPkiDcMceF21RI0NXerf2eTYoxqhp2GS70HHeZAlSf82cKa gkV2O5w5qOo/XLFL4xg34kx7e3wHNFdE8Q+iUojhR/K+0JMOlX1Z4MRvmqIrNn+gXVon rpHcgwpJbwt2uV5aXDrNXU+bqCQRjlIZhhL/9auMDbafxR9rvOxdUZ676LSgaudrwp3G WhgQ== X-Gm-Message-State: AOJu0Yw/ykaB9IzRwI3iVYMs7xSKLw+fSP/Jxhocih/K+X3dnped22lF vQlsSkBZqOhwPkSPl6NQl+s= X-Received: by 2002:ac2:5201:0:b0:50b:f9b2:cf2 with SMTP id a1-20020ac25201000000b0050bf9b20cf2mr4406925lfl.40.1702566738075; Thu, 14 Dec 2023 07:12:18 -0800 (PST) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id j26-20020ac2455a000000b0050bbad31c64sm1885297lfm.172.2023.12.14.07.12.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 07:12:17 -0800 (PST) Date: Thu, 14 Dec 2023 18:12:14 +0300 From: Serge Semin To: Suraj Jaiswal Cc: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexandre Torgue , Jose Abreu , Maxime Coquelin , netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Prasad Sodagudi , Andrew Halaney , Rob Herring , kernel@quicinc.com Subject: Re: [PATCH net-next v6 3/3] net: stmmac: Add driver support for DWMAC5 common safety IRQ Message-ID: References: <20231212115841.3800241-1-quic_jsuraj@quicinc.com> <20231212115841.3800241-4-quic_jsuraj@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231212115841.3800241-4-quic_jsuraj@quicinc.com> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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]); Thu, 14 Dec 2023 07:14:12 -0800 (PST) Hi Suraj On Tue, Dec 12, 2023 at 05:28:41PM +0530, Suraj Jaiswal wrote: > Add support to listen HW safety IRQ like ECC(error > correction code), DPP(data path parity), FSM(finite state > machine) fault in common IRQ line. > > Signed-off-by: Suraj Jaiswal > --- > drivers/net/ethernet/stmicro/stmmac/common.h | 1 + > drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +++ > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 +++++++++++++++++++ > .../ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++ > 4 files changed, 34 insertions(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h > index 721c1f8e892f..b9233b09b80f 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/common.h > +++ b/drivers/net/ethernet/stmicro/stmmac/common.h > @@ -344,6 +344,7 @@ enum request_irq_err { > REQ_IRQ_ERR_ALL, > REQ_IRQ_ERR_TX, > REQ_IRQ_ERR_RX, > + REQ_IRQ_ERR_SFTY, > REQ_IRQ_ERR_SFTY_UE, > REQ_IRQ_ERR_SFTY_CE, > REQ_IRQ_ERR_LPI, > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > index 9f89acf31050..ca3d93851bed 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > @@ -31,6 +31,7 @@ struct stmmac_resources { > int wol_irq; > int lpi_irq; > int irq; > + int sfty_irq; > int sfty_ce_irq; > int sfty_ue_irq; > int rx_irq[MTL_MAX_RX_QUEUES]; > @@ -297,6 +298,7 @@ struct stmmac_priv { > void __iomem *ptpaddr; > void __iomem *estaddr; > unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; > + int sfty_irq; > int sfty_ce_irq; > int sfty_ue_irq; > int rx_irq[MTL_MAX_RX_QUEUES]; > @@ -305,6 +307,7 @@ struct stmmac_priv { > char int_name_mac[IFNAMSIZ + 9]; > char int_name_wol[IFNAMSIZ + 9]; > char int_name_lpi[IFNAMSIZ + 9]; > + char int_name_sfty[IFNAMSIZ + 10]; > char int_name_sfty_ce[IFNAMSIZ + 10]; > char int_name_sfty_ue[IFNAMSIZ + 10]; > char int_name_rx_irq[MTL_MAX_TX_QUEUES][IFNAMSIZ + 14]; > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 47de466e432c..6cf289f192a7 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -3592,6 +3592,10 @@ static void stmmac_free_irq(struct net_device *dev, > if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) > free_irq(priv->wol_irq, dev); > fallthrough; > + case REQ_IRQ_ERR_SFTY: > + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) > + free_irq(priv->sfty_irq, dev); > + fallthrough; > case REQ_IRQ_ERR_WOL: > free_irq(dev->irq, dev); > fallthrough; > @@ -3759,6 +3763,7 @@ static int stmmac_request_irq_single(struct net_device *dev) > struct stmmac_priv *priv = netdev_priv(dev); > enum request_irq_err irq_err; > int ret; > + char *int_name; See my comment below. > > ret = request_irq(dev->irq, stmmac_interrupt, > IRQF_SHARED, dev->name, dev); > @@ -3798,6 +3803,20 @@ static int stmmac_request_irq_single(struct net_device *dev) > } > } > > + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { > + int_name = priv->int_name_sfty; > + sprintf(int_name, "%s:%s", dev->name, "safety"); > + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, > + 0, int_name, dev); > + if (unlikely(ret < 0)) { > + netdev_err(priv->dev, > + "%s: alloc safety failed %d (error: %d)\n", > + __func__, priv->sfty_irq, ret); > + irq_err = REQ_IRQ_ERR_SFTY; > + goto irq_error; > + } > + } > + Omg, I thought this change belonged to stmmac_request_irq_multi_msi(). My bad, sorry. Please move the code above to stmmac_request_irq_multi_msi() and get back the part in stmmac_request_irq_single() as it was in v5, but instead of specifying "safety" IRQ name use "dev->name" as the rest of similar code snippets in here have: + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, + 0, dev->name, dev); + if (unlikely(ret < 0)) { + netdev_err(priv->dev, + "%s: alloc safety failed %d (error: %d)\n", + __func__, priv->sfty_irq, ret); + irq_err = REQ_IRQ_ERR_SFTY; + goto irq_error; + } + } I guess at some point afterwards we'll need to refactor the IRQs request part of this driver: replace stmmac_request_irq_single() body with the upper part of the stmmac_request_irq_multi_msi() method and then just make the former method being called from the later one... > return 0; > > irq_error: > @@ -7462,8 +7481,10 @@ int stmmac_dvr_probe(struct device *device, > priv->dev->irq = res->irq; > priv->wol_irq = res->wol_irq; > priv->lpi_irq = res->lpi_irq; > + priv->sfty_irq = res->sfty_irq; > priv->sfty_ce_irq = res->sfty_ce_irq; > priv->sfty_ue_irq = res->sfty_ue_irq; > + Please drop this change. The code below is attached to the code above because it basically does the same but in the loop. > for (i = 0; i < MTL_MAX_RX_QUEUES; i++) > priv->rx_irq[i] = res->rx_irq[i]; > for (i = 0; i < MTL_MAX_TX_QUEUES; i++) > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > index 1ffde555da47..3808a3225a7d 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > @@ -726,6 +726,15 @@ int stmmac_get_platform_resources(struct platform_device *pdev, > dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); > } > > + stmmac_res->sfty_irq = > + platform_get_irq_byname_optional(pdev, "sfty"); > + Please drop this change too. It's normal to have a method call attached to the error check statement especially seeing the rest of the similar code snippets are designed that way in this function. -Serge(y) > + if (stmmac_res->sfty_irq < 0) { > + if (stmmac_res->sfty_irq == -EPROBE_DEFER) > + return -EPROBE_DEFER; > + dev_info(&pdev->dev, "IRQ safety IRQ not found\n"); > + } > + > stmmac_res->addr = devm_platform_ioremap_resource(pdev, 0); > > return PTR_ERR_OR_ZERO(stmmac_res->addr); > -- > 2.25.1 > >