Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp933276rdd; Wed, 10 Jan 2024 04:07:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmJPXXXe9W5xC82vTAaX6G6bQ7mqnuaiL17uYidIiuy5LUUt9uzaR5hM6FMVaoCtgLGytu X-Received: by 2002:a05:6214:2a8e:b0:680:6223:c582 with SMTP id jr14-20020a0562142a8e00b006806223c582mr967405qvb.107.1704888472547; Wed, 10 Jan 2024 04:07:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704888472; cv=none; d=google.com; s=arc-20160816; b=P8BtRkv5mfNzdDr86mwLIziMbkSNj5bfUG6gPFSuttxmlOkvjGfeZbaFZhJ282j6f0 74xPssizHZKHA09crzG0lId4wXwM+opyiR5xczUkyzNGPeb2Ai4IiwhWeOCj+aSKEgjT c2ujdgmD0s/RanCqzEmuDpL0kSvwsukRDt2y0WMTw6JLVXTK9Ad2S/euXB4ZCP/VZWlb o+EA0acs7CBj0fCtXbFwP7vJm/SU/Q4v2pzKLv6TE/wCa8X0laiB851kFFReq8int2iP jdluYwRkgaHR1eNaiRcQaPhv4ii+tys49MBtceum6AKebopuH0dRVOJnEF3PqyVgH3Yr yeJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=GkPRohHGBk2H8lU4le6T3CfYLQeGNdahHf4aZdqwAOQ=; fh=4EXBCe2eRWRn1DJRKzcK41ZlB9kojxnJyL9l6+1UQlQ=; b=GAGU2a0ZAnNtHFOiQJf4Ao2yLUv2cEAr3iq0LOwqeH1GG/oni2/3Bq53Pu5Kiul863 lXVbMKTv4c37TdH5e+lsdcKmS679MArAvvVmxa02xtOrFhaoifEr8gYBzIZtsgPVpqt9 qeZ4bM7vDAsHn8BOvpvp4bkODi46XUXKYrdvGSci8Mg3vQcK4kDalhrx6/G4JZHftDpk 19DXqAda88M7+M1eHXAYDUTrPrs89hqthSxyDoMBYyGFm0Ia+AHIW3wcSO5Gxp7s8bp3 Eu8uBi2sbOUZtFNg/N9DcbdtJd90O6b1e7DjumZT/Uir2vTvEs9tovN0Fm56Yk+2l9nB Ejkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=GXo0dVIc; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=A7gouSP8; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=qkiPF+SU; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel+bounces-22155-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22155-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x21-20020a0cb215000000b00680607ae94dsi4088584qvd.132.2024.01.10.04.07.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 04:07:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22155-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=GXo0dVIc; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=A7gouSP8; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=qkiPF+SU; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel+bounces-22155-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22155-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3EF771C22024 for ; Wed, 10 Jan 2024 12:07:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 169F5481DD; Wed, 10 Jan 2024 12:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="GXo0dVIc"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="A7gouSP8"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="qkiPF+SU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="5HbnFhyF" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 DEAE947A7D; Wed, 10 Jan 2024 12:07:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B0C2421B33; Wed, 10 Jan 2024 12:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1704888453; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GkPRohHGBk2H8lU4le6T3CfYLQeGNdahHf4aZdqwAOQ=; b=GXo0dVIcry/Ug2colfyMyFtyaGMPbcSfOJ0dPgkWWTIWjEgJgKW4BLQdKRLBFIyazoWkqn IFbOUPGQhm+jVB5Iw3p9Yrq5KYy2npwLzbgOjn6cgfexccABIpxyad2FoBKGrrrYAj7/Dl 1/XoQhEXyLj4WZlHQb23dubAB6qQSlM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1704888453; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GkPRohHGBk2H8lU4le6T3CfYLQeGNdahHf4aZdqwAOQ=; b=A7gouSP8isLENUdI3ZjSwa44IRvIjtey3+W0j7WVVFvuxxHlSuFLzKDgL2SMGCJBJL6s8O fU14qFbLpebdmAAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1704888452; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GkPRohHGBk2H8lU4le6T3CfYLQeGNdahHf4aZdqwAOQ=; b=qkiPF+SUTo1bBsfQ4nDCJvuHKTQBZq3t4O4/PUTWlL+LO8AMf5Kz/3q7/tP4lPDwylWwH8 Tku2YPxze68USwyBVeeZQKfdYnJrbY0JCFySOa9fboZ5eJXeY1u4ettVoDydKnBOgPUFgJ NiBRWpSdrWD78Z70dcM/eD1o6v8Xw2Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1704888452; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GkPRohHGBk2H8lU4le6T3CfYLQeGNdahHf4aZdqwAOQ=; b=5HbnFhyFjuLRk17+6YWbxDDXkVuIsgo/Da+Gio8/OTYLUWOSLETdUXw6BLZCJQsmd04xvv Erm1wrMFiTTWGTCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1113E1398A; Wed, 10 Jan 2024 12:07:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id TRJ9AIOInmV3GgAAD6G6ig (envelope-from ); Wed, 10 Jan 2024 12:07:31 +0000 Message-ID: <633ff61d-f73d-4221-a2fd-79f913880761@suse.de> Date: Wed, 10 Jan 2024 15:07:30 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v9 3/3] net: stmmac: Add driver support for DWMAC5 common safety IRQ Content-Language: en-US To: Suraj Jaiswal , 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 Cc: kernel@quicinc.com References: <20240110111649.2256450-1-quic_jsuraj@quicinc.com> <20240110111649.2256450-4-quic_jsuraj@quicinc.com> From: Denis Kirjanov In-Reply-To: <20240110111649.2256450-4-quic_jsuraj@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Flag: NO X-Spamd-Result: default: False [-3.80 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; TO_DN_SOME(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLxjbr97tr36oppoipqx4dezfa)]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; FREEMAIL_TO(0.00)[quicinc.com,kernel.org,linaro.org,davemloft.net,google.com,foss.st.com,synopsys.com,gmail.com,vger.kernel.org,st-md-mailman.stormreply.com,redhat.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TAGGED_RCPT(0.00)[dt]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWELVE(0.00)[24]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,quicinc.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from] X-Spam-Score: -3.80 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: B0C2421B33 X-Spam-Level: Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=qkiPF+SU; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=5HbnFhyF On 1/10/24 14:16, 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. As I see .safety_feat_irq_status available not just in dwmac5 but in dwxgmac2_core and that means that the subject line is not just about dwmac5 > > 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 | 41 ++++++++++++++++++- > .../ethernet/stmicro/stmmac/stmmac_platform.c | 8 ++++ > 4 files changed, 51 insertions(+), 2 deletions(-) > > 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..e0192a282121 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,23 @@ 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) { > + 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 sfty MSI %d (error: %d)\n", > + __func__, priv->sfty_irq, ret); > + 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 +3819,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, > + IRQF_SHARED, dev->name, dev); > + if (unlikely(ret < 0)) { > + netdev_err(priv->dev, > + "%s: ERROR: allocating the sfty IRQ %d (%d)\n", > + __func__, priv->sfty_irq, ret); > + irq_err = REQ_IRQ_ERR_SFTY; > + goto irq_error; > + } > + } > + > return 0; > > irq_error: > @@ -6022,8 +6058,8 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) > if (test_bit(STMMAC_DOWN, &priv->state)) > return IRQ_HANDLED; > > - /* Check if a fatal error happened */ > - if (stmmac_safety_feat_interrupt(priv)) > + /* Check ASP error if it isn't delivered via an individual IRQ */ > + if (priv->sfty_irq <= 0 && stmmac_safety_feat_interrupt(priv)) > return IRQ_HANDLED; > > /* To handle Common interrupts */ > @@ -7462,6 +7498,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);