Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp78717rdb; Wed, 20 Dec 2023 06:50:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHtc4DFbWnuAKYOBL9zX52XCy2ZhAXVbMH6JuQKgDQWdVvkhJeWGNwn+eTN/+Fxddi1irh X-Received: by 2002:a05:6a21:3285:b0:18f:ce60:ceeb with SMTP id yt5-20020a056a21328500b0018fce60ceebmr3766843pzb.23.1703083825500; Wed, 20 Dec 2023 06:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703083825; cv=none; d=google.com; s=arc-20160816; b=wfYCuPDibU/v3CE6y2uKopcUhMUBuABR5P1eV2IxLoPUiDClMlGbhr8Eb5uDb0mTJU WcEDusGAQ8/vFlXZDbE5ZDxNTjwjGS68QQvV0ZQi/i7m5xPY27wB9HBpdqssoNwNlYe3 NOHE1YV0eA3O1nIPBV5aDqfOF1+zNlAl2bE3eW6EEPI59ZXcr4F4XsVrez/LP3ItP9CQ PeZYegIsr11z/3TXfCM56dzR2frcSdjfwSCRxjRKpqQhCb9ERbJw9Pg7bhg7qttTzB9L NXmmxKbaw9FAa+oGcQn1nNFFiPqJMVs8YqRxrL2f7P4XxDjIsBAFWaK+5lAlKS/Ykq3A K1Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tQMVlWraizGAsp+Xq1UapuY9LfPT8dVSobx1WZx4NDU=; fh=buRKIQ8e+vHLSBwPPQaXMKsjw0ipkqKX/92u1Y9CKy0=; b=LpdF977/5WAUriIXlB3qEzix5HgFmxY1//u+q4Q/IhonRsg8+Yth0duImUAT+QlY9+ srtAT+BXuaYbHKs3h0vzAL62TESnuVf9crSvZfdcOcHPak4zlPwMhCJho2N3lSVmRj3a /Yp9ukjDut4oRL5S9CFuoAXaJMpU+Exfi0ckby3Ox4RSwVLA/NNEVp9X7FgmdP8n1SZ0 0U6auFF+AhiE8d5X+CCmQaz6SO1xxw1YOKlb57fPgeaEsWON0fOMFaHMBPJKU32VHj8h WQYa7bm0RX/V6Bb9fCq6YxngNoctoKSKXPVqRDO0ZX/Dp+Q+AuRQ+zgCWF76yLx+BZ5l 5hfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QI6FEutV; spf=pass (google.com: domain of linux-kernel+bounces-7085-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7085-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w3-20020a6556c3000000b005644a9be955si21863689pgs.179.2023.12.20.06.50.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:50:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7085-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QI6FEutV; spf=pass (google.com: domain of linux-kernel+bounces-7085-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7085-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id ADC76284B46 for ; Wed, 20 Dec 2023 14:50:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCB9B3D979; Wed, 20 Dec 2023 14:50:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QI6FEutV" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A9DD3D965; Wed, 20 Dec 2023 14:50:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-50e270639d9so5814645e87.3; Wed, 20 Dec 2023 06:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703083811; x=1703688611; 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=tQMVlWraizGAsp+Xq1UapuY9LfPT8dVSobx1WZx4NDU=; b=QI6FEutVk6GvAbKVAQdytDRu2Vk0cLJQ/6nBacPzBJ503h+d+mU3x4urOsCWM99m13 56cjrLMO6Ogn3ISpeQAANjWp7xjjTrFhYct1WcS3FakPYVp617xlRLBBwwUcDl0ypBw7 SvjmRSIqc1FxDXdEuCz7Ujp0tcUaU5dr9WUTWt1Rcw9muib+fIKukIZ+aJzg5pM87IGr xuWNclJWOrLO8pCOIaJcvK/QbAiRaJNcr6dsdvjhzoF9Nl7IswvBgA5FF2QqdGEMlQ6K 1tv5HSbNz1Ba5DMqj1H6iAjTyUmfIV0CcZCdw62UA5IQvwMie4as6yJxUH3QxdTEWxkw ZCtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703083811; x=1703688611; 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=tQMVlWraizGAsp+Xq1UapuY9LfPT8dVSobx1WZx4NDU=; b=EnEfIUtDt6qcRDV5wpk/7RsyxmelsuoW3YAMc2s2DR/T5pkz99tvTfmvicqFyWIsLN Ik/A+TSd+O1dVYftj5DQhiAr54B4c1aXRydqmSTqRRKEeB/MJLh4x/OZw6zXHcoLOWMz 4H7v6FGTMHjrifuiFaRWRGlTreo+kzfyT8lDqNR7x77X3mWgttkiE0PCF2ZDL2gI+R1j uhAe5W974uBuZ0PvvxKiUxBGPbBK7at20E6/B192tJBm5ItG2EfILN5m/CYiZ0iUAYnO ggavaFsnVZ39bBLRxvhKZapcPRbaCEW5QdegtzO2ZhCu/9Y36R218B7k8ucz+4T6mbj9 jqwQ== X-Gm-Message-State: AOJu0YzisTBtJSzgzNqTKkzupfzfzVFiYplZhBrfe27K0N5gPB2RTu3G njjUQ7auxYUZDcUpFkcntNQ= X-Received: by 2002:a05:6512:239a:b0:50e:4ec6:ed15 with SMTP id c26-20020a056512239a00b0050e4ec6ed15mr1194151lfv.107.1703083810905; Wed, 20 Dec 2023 06:50:10 -0800 (PST) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id b11-20020a0565120b8b00b0050e40a2bc97sm615311lfv.13.2023.12.20.06.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:50:10 -0800 (PST) Date: Wed, 20 Dec 2023 17:50:05 +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 v7 3/3] net: stmmac: Add driver support for DWMAC5 common safety IRQ Message-ID: References: <20231219104815.3443231-1-quic_jsuraj@quicinc.com> <20231219104815.3443231-4-quic_jsuraj@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="lffsxbm2gt2npdfi" Content-Disposition: inline In-Reply-To: <20231219104815.3443231-4-quic_jsuraj@quicinc.com> --lffsxbm2gt2npdfi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Suraj On Tue, Dec 19, 2023 at 04:18:15PM +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 | 2 ++ > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 35 +++++++++++++++++++ > .../ethernet/stmicro/stmmac/stmmac_platform.c | 8 +++++ > 4 files changed, 46 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..9aeaca01cace 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]; > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 47de466e432c..f6639ffb017e 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; > @@ -3661,6 +3665,21 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) > } > } > > + /* Request the common Safety Feature Correctible/Uncorrectible > + * Error line in case of another line is used > + */ > + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { > + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, > + 0, dev->name, dev); Not entirely what I asked. What I asked was to make the code unified in the respective IRQ-request methods. You just copy-and-pasted the same code snippet in both functions. To see what I meant please find the diff attached to this message. It's applicable on top of this patch. > + if (unlikely(ret < 0)) { > + netdev_err(priv->dev, > + "%s: alloc safety failed %d (error: %d)\n", > + __func__, priv->sfty_irq, ret); This looks different than the rest of the error messages in this method (see the attached diff). > + irq_err = REQ_IRQ_ERR_SFTY; > + goto irq_error; > + } > + } > + > /* Request the Safety Feature Correctible Error line in > * case of another line is used > */ > @@ -3798,6 +3817,21 @@ static int stmmac_request_irq_single(struct net_device *dev) > } > } > > + /* Request the common Safety Feature Correctible/Uncorrectible > + * Error line in case of another line is used > + */ > + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { > + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, > + 0, dev->name, dev); IRQF_SHARED? > + if (unlikely(ret < 0)) { > + netdev_err(priv->dev, > + "%s: alloc safety failed %d (error: %d)\n", > + __func__, priv->sfty_irq, ret); This also looks different than the rest of the error messages in this method (see the attached diff). Some other comments I'll send to v8 after all the above finally fixed. -Serge(y) > + irq_err = REQ_IRQ_ERR_SFTY; > + goto irq_error; > + } > + } > + > return 0; > > irq_error: > @@ -7462,6 +7496,7 @@ 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; > for (i = 0; i < MTL_MAX_RX_QUEUES; i++) > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > index 70eadc83ca68..ab250161fd79 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > @@ -743,6 +743,14 @@ 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"); > + 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 > > --lffsxbm2gt2npdfi Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="common_sfty_irq.diff" diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index f9d80fc00cb8..2bb3f1adbb61 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -329,6 +329,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 e49b1306b338..93439a14378f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3539,11 +3539,13 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) * Error line in case of another line is used */ 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, dev->name, dev); + 0, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, - "%s: alloc safety failed %d (error: %d)\n", + "%s: alloc sfty MSI %d (error: %d)\n", __func__, priv->sfty_irq, ret); irq_err = REQ_IRQ_ERR_SFTY; goto irq_error; @@ -3692,10 +3694,10 @@ static int stmmac_request_irq_single(struct net_device *dev) */ if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, - 0, dev->name, dev); + IRQF_SHARED, dev->name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, - "%s: alloc safety failed %d (error: %d)\n", + "%s: ERROR: allocating the sfty IRQ %d (%d)\n", __func__, priv->sfty_irq, ret); irq_err = REQ_IRQ_ERR_SFTY; goto irq_error; --lffsxbm2gt2npdfi--