All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v4 3/3] net: stmmac: Add driver support for DWMAC5 safety IRQ Support
  2023-12-07  9:21 [PATCH net-next v4 0/3] Ethernet DWMAC5 fault IRQ support Suraj Jaiswal
@ 2023-12-07  9:21 ` Suraj Jaiswal
  0 siblings, 0 replies; 2+ messages in thread
From: Suraj Jaiswal @ 2023-12-07  9:21 UTC (permalink / raw)
  To: quic_jsuraj, 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,
	linux-arm-msm, devicetree, linux-kernel, linux-stm32,
	Prasad Sodagudi, Andrew Halaney
  Cc: kernel

Add IRQ support to listen HW safety IRQ like ECC,DPP,FSM
fault and print the fault information in the kernel
log.

Signed-off-by: Suraj Jaiswal <quic_jsuraj@quicinc.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h   |  1 +
 drivers/net/ethernet/stmicro/stmmac/stmmac.h   |  2 ++
 .../net/ethernet/stmicro/stmmac/stmmac_main.c  | 18 ++++++++++++++++++
 .../ethernet/stmicro/stmmac/stmmac_platform.c  |  9 +++++++++
 4 files changed, 30 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 721c1f8e892f..cb9645fe16d8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -347,6 +347,7 @@ enum request_irq_err {
 	REQ_IRQ_ERR_SFTY_UE,
 	REQ_IRQ_ERR_SFTY_CE,
 	REQ_IRQ_ERR_LPI,
+	REQ_IRQ_ERR_SAFETY,
 	REQ_IRQ_ERR_WOL,
 	REQ_IRQ_ERR_MAC,
 	REQ_IRQ_ERR_NO,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 9f89acf31050..aa2eda6fb927 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -33,6 +33,7 @@ struct stmmac_resources {
 	int irq;
 	int sfty_ce_irq;
 	int sfty_ue_irq;
+	int safety_common_irq;
 	int rx_irq[MTL_MAX_RX_QUEUES];
 	int tx_irq[MTL_MAX_TX_QUEUES];
 };
@@ -299,6 +300,7 @@ struct stmmac_priv {
 	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
 	int sfty_ce_irq;
 	int sfty_ue_irq;
+	int safety_common_irq;
 	int rx_irq[MTL_MAX_RX_QUEUES];
 	int tx_irq[MTL_MAX_TX_QUEUES];
 	/*irq name */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 47de466e432c..e4a0d9ec8b3f 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_SAFETY:
+		if (priv->safety_common_irq > 0 && priv->safety_common_irq != dev->irq)
+			free_irq(priv->safety_common_irq, dev);
+		fallthrough;
 	case REQ_IRQ_ERR_WOL:
 		free_irq(dev->irq, dev);
 		fallthrough;
@@ -3798,6 +3802,18 @@ static int stmmac_request_irq_single(struct net_device *dev)
 		}
 	}
 
+	if (priv->safety_common_irq > 0 && priv->safety_common_irq != dev->irq) {
+		ret = request_irq(priv->safety_common_irq, stmmac_safety_interrupt,
+				  0, "safety", dev);
+		if (unlikely(ret < 0)) {
+			netdev_err(priv->dev,
+				   "%s: alloc safety failed %d (error: %d)\n",
+				   __func__, priv->safety_common_irq, ret);
+			irq_err = REQ_IRQ_ERR_SAFETY;
+			goto irq_error;
+		}
+	}
+
 	return 0;
 
 irq_error:
@@ -7464,6 +7480,8 @@ int stmmac_dvr_probe(struct device *device,
 	priv->lpi_irq = res->lpi_irq;
 	priv->sfty_ce_irq = res->sfty_ce_irq;
 	priv->sfty_ue_irq = res->sfty_ue_irq;
+	priv->safety_common_irq = res->safety_common_irq;
+
 	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..41a4a253d75b 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->safety_common_irq =
+		platform_get_irq_byname_optional(pdev, "safety");
+
+	if (stmmac_res->safety_common_irq < 0) {
+		if (stmmac_res->safety_common_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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v4 3/3] net: stmmac: Add driver support for DWMAC5 safety IRQ Support
@ 2023-12-09 11:35 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-12-09 11:35 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <64edc073307ef9cb1bebf2c999cf2b5f56f3d906.1701939695.git.quic_jsuraj@quicinc.com>
References: <64edc073307ef9cb1bebf2c999cf2b5f56f3d906.1701939695.git.quic_jsuraj@quicinc.com>
TO: Suraj Jaiswal <quic_jsuraj@quicinc.com>
TO: quic_jsuraj@quicinc.com
TO: Vinod Koul <vkoul@kernel.org>
TO: Bhupesh Sharma <bhupesh.sharma@linaro.org>
TO: Andy Gross <agross@kernel.org>
TO: Bjorn Andersson <andersson@kernel.org>
TO: Konrad Dybcio <konrad.dybcio@linaro.org>
TO: "David S. Miller" <davem@davemloft.net>
CC: netdev@vger.kernel.org
TO: Eric Dumazet <edumazet@google.com>
TO: Jakub Kicinski <kuba@kernel.org>
TO: Rob Herring <robh+dt@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Conor Dooley <conor+dt@kernel.org>
TO: Alexandre Torgue <alexandre.torgue@foss.st.com>
TO: Jose Abreu <joabreu@synopsys.com>
TO: Maxime Coquelin <mcoquelin.stm32@gmail.com>
TO: linux-arm-msm@vger.kernel.org
TO: devicetree@vger.kernel.org
TO: linux-kernel@vger.kernel.org
TO: linux-stm32@st-md-mailman.stormreply.com
TO: Prasad Sodagudi <psodagud@quicinc.com>
TO: Andrew Halaney <ahalaney@redhat.com>
CC: kernel@quicinc.com

Hi Suraj,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Suraj-Jaiswal/dt-bindings-net-qcom-ethqos-add-binding-doc-for-safety-IRQ-for-sa8775p/20231207-172835
base:   net-next/main
patch link:    https://lore.kernel.org/r/64edc073307ef9cb1bebf2c999cf2b5f56f3d906.1701939695.git.quic_jsuraj%40quicinc.com
patch subject: [PATCH net-next v4 3/3] net: stmmac: Add driver support for DWMAC5 safety IRQ Support
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-141-20231209 (https://download.01.org/0day-ci/archive/20231209/202312091949.GRIkVREF-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231209/202312091949.GRIkVREF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202312091949.GRIkVREF-lkp@intel.com/

New smatch warnings:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3820 stmmac_request_irq_single() warn: 'priv->lpi_irq' from request_irq() not released on lines: 3820.

Old smatch warnings:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3757 stmmac_request_irq_multi_msi() warn: 'dev->irq' from request_irq() not released on lines: 3757.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3757 stmmac_request_irq_multi_msi() warn: 'priv->lpi_irq' from request_irq() not released on lines: 3757.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3757 stmmac_request_irq_multi_msi() warn: 'priv->sfty_ce_irq' from request_irq() not released on lines: 3757.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3757 stmmac_request_irq_multi_msi() warn: 'priv->sfty_ue_irq' from request_irq() not released on lines: 3757.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3757 stmmac_request_irq_multi_msi() warn: 'priv->wol_irq' from request_irq() not released on lines: 3757.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3820 stmmac_request_irq_single() warn: 'dev->irq' from request_irq() not released on lines: 3820.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3820 stmmac_request_irq_single() warn: 'priv->wol_irq' from request_irq() not released on lines: 3820.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:5566 stmmac_rx() error: 'skb' dereferencing possible ERR_PTR()
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:5578 stmmac_rx() error: 'skb' dereferencing possible ERR_PTR()
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:5604 stmmac_rx() error: 'skb' dereferencing possible ERR_PTR()

vim +3820 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

8532f613bc78b6 Ong Boon Leong 2021-03-26  3759  
8532f613bc78b6 Ong Boon Leong 2021-03-26  3760  static int stmmac_request_irq_single(struct net_device *dev)
8532f613bc78b6 Ong Boon Leong 2021-03-26  3761  {
8532f613bc78b6 Ong Boon Leong 2021-03-26  3762  	struct stmmac_priv *priv = netdev_priv(dev);
3e6dc7b650250f Wong Vee Khee  2021-06-11  3763  	enum request_irq_err irq_err;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3764  	int ret;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3765  
8532f613bc78b6 Ong Boon Leong 2021-03-26  3766  	ret = request_irq(dev->irq, stmmac_interrupt,
8532f613bc78b6 Ong Boon Leong 2021-03-26  3767  			  IRQF_SHARED, dev->name, dev);
8532f613bc78b6 Ong Boon Leong 2021-03-26  3768  	if (unlikely(ret < 0)) {
8532f613bc78b6 Ong Boon Leong 2021-03-26  3769  		netdev_err(priv->dev,
8532f613bc78b6 Ong Boon Leong 2021-03-26  3770  			   "%s: ERROR: allocating the IRQ %d (error: %d)\n",
8532f613bc78b6 Ong Boon Leong 2021-03-26  3771  			   __func__, dev->irq, ret);
8532f613bc78b6 Ong Boon Leong 2021-03-26  3772  		irq_err = REQ_IRQ_ERR_MAC;
3e6dc7b650250f Wong Vee Khee  2021-06-11  3773  		goto irq_error;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3774  	}
8532f613bc78b6 Ong Boon Leong 2021-03-26  3775  
8532f613bc78b6 Ong Boon Leong 2021-03-26  3776  	/* Request the Wake IRQ in case of another line
8532f613bc78b6 Ong Boon Leong 2021-03-26  3777  	 * is used for WoL
8532f613bc78b6 Ong Boon Leong 2021-03-26  3778  	 */
8532f613bc78b6 Ong Boon Leong 2021-03-26  3779  	if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) {
8532f613bc78b6 Ong Boon Leong 2021-03-26  3780  		ret = request_irq(priv->wol_irq, stmmac_interrupt,
8532f613bc78b6 Ong Boon Leong 2021-03-26  3781  				  IRQF_SHARED, dev->name, dev);
8532f613bc78b6 Ong Boon Leong 2021-03-26  3782  		if (unlikely(ret < 0)) {
8532f613bc78b6 Ong Boon Leong 2021-03-26  3783  			netdev_err(priv->dev,
8532f613bc78b6 Ong Boon Leong 2021-03-26  3784  				   "%s: ERROR: allocating the WoL IRQ %d (%d)\n",
8532f613bc78b6 Ong Boon Leong 2021-03-26  3785  				   __func__, priv->wol_irq, ret);
8532f613bc78b6 Ong Boon Leong 2021-03-26  3786  			irq_err = REQ_IRQ_ERR_WOL;
3e6dc7b650250f Wong Vee Khee  2021-06-11  3787  			goto irq_error;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3788  		}
8532f613bc78b6 Ong Boon Leong 2021-03-26  3789  	}
8532f613bc78b6 Ong Boon Leong 2021-03-26  3790  
8532f613bc78b6 Ong Boon Leong 2021-03-26  3791  	/* Request the IRQ lines */
8532f613bc78b6 Ong Boon Leong 2021-03-26  3792  	if (priv->lpi_irq > 0 && priv->lpi_irq != dev->irq) {
8532f613bc78b6 Ong Boon Leong 2021-03-26  3793  		ret = request_irq(priv->lpi_irq, stmmac_interrupt,
8532f613bc78b6 Ong Boon Leong 2021-03-26  3794  				  IRQF_SHARED, dev->name, dev);
8532f613bc78b6 Ong Boon Leong 2021-03-26  3795  		if (unlikely(ret < 0)) {
8532f613bc78b6 Ong Boon Leong 2021-03-26  3796  			netdev_err(priv->dev,
8532f613bc78b6 Ong Boon Leong 2021-03-26  3797  				   "%s: ERROR: allocating the LPI IRQ %d (%d)\n",
8532f613bc78b6 Ong Boon Leong 2021-03-26  3798  				   __func__, priv->lpi_irq, ret);
8532f613bc78b6 Ong Boon Leong 2021-03-26  3799  			irq_err = REQ_IRQ_ERR_LPI;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3800  			goto irq_error;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3801  		}
8532f613bc78b6 Ong Boon Leong 2021-03-26  3802  	}
8532f613bc78b6 Ong Boon Leong 2021-03-26  3803  
6d021ebe71062e Suraj Jaiswal  2023-12-07  3804  	if (priv->safety_common_irq > 0 && priv->safety_common_irq != dev->irq) {
6d021ebe71062e Suraj Jaiswal  2023-12-07  3805  		ret = request_irq(priv->safety_common_irq, stmmac_safety_interrupt,
6d021ebe71062e Suraj Jaiswal  2023-12-07  3806  				  0, "safety", dev);
6d021ebe71062e Suraj Jaiswal  2023-12-07  3807  		if (unlikely(ret < 0)) {
6d021ebe71062e Suraj Jaiswal  2023-12-07  3808  			netdev_err(priv->dev,
6d021ebe71062e Suraj Jaiswal  2023-12-07  3809  				   "%s: alloc safety failed %d (error: %d)\n",
6d021ebe71062e Suraj Jaiswal  2023-12-07  3810  				   __func__, priv->safety_common_irq, ret);
6d021ebe71062e Suraj Jaiswal  2023-12-07  3811  			irq_err = REQ_IRQ_ERR_SAFETY;
6d021ebe71062e Suraj Jaiswal  2023-12-07  3812  			goto irq_error;
6d021ebe71062e Suraj Jaiswal  2023-12-07  3813  		}
6d021ebe71062e Suraj Jaiswal  2023-12-07  3814  	}
6d021ebe71062e Suraj Jaiswal  2023-12-07  3815  
8532f613bc78b6 Ong Boon Leong 2021-03-26  3816  	return 0;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3817  
8532f613bc78b6 Ong Boon Leong 2021-03-26  3818  irq_error:
8532f613bc78b6 Ong Boon Leong 2021-03-26  3819  	stmmac_free_irq(dev, irq_err, 0);
8532f613bc78b6 Ong Boon Leong 2021-03-26 @3820  	return ret;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3821  }
8532f613bc78b6 Ong Boon Leong 2021-03-26  3822  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-09 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-09 11:35 [PATCH net-next v4 3/3] net: stmmac: Add driver support for DWMAC5 safety IRQ Support kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-12-07  9:21 [PATCH net-next v4 0/3] Ethernet DWMAC5 fault IRQ support Suraj Jaiswal
2023-12-07  9:21 ` [PATCH net-next v4 3/3] net: stmmac: Add driver support for DWMAC5 safety IRQ Support Suraj Jaiswal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.