From patchwork Mon Oct 3 06:20:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathew McBride X-Patchwork-Id: 6031 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4MgrLc6B1Vz3wgq for ; Mon, 3 Oct 2022 06:20:56 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4MgrLY5MpSz2RQ; Mon, 3 Oct 2022 06:20:53 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4MgrLT35Kqz301G; Mon, 3 Oct 2022 06:20:49 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4MgrLR3kKtz2xHF for ; Mon, 3 Oct 2022 06:20:47 +0000 (UTC) Received: from out4-smtp.messagingengine.com (unknown [66.111.4.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4MgrLL3t00zM6 for ; Mon, 3 Oct 2022 06:20:42 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B89CD5C00F9; Mon, 3 Oct 2022 02:20:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 03 Oct 2022 02:20:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=traverse.com.au; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1664778031; x= 1664864431; bh=w00AoMIFAoXP3+tOrEP6a7s/vss3E2Ix1PZRSqJ3wW8=; b=R okRj/5o4SnD8iQ+xq1Uiy9MRNFz/8xtFEDliJ+Sc4nuUhcs1NJvO5XGRDShpMubG gn1ciYP928C/iEmCU9on48pYihWSe2XQK5QfKaXoxAjH6IR3nqZH31+5cdGWja+D lO2YJWWqsEP4dH5ppWQ8pSOh0g/bFxQIQ93YHeYFQlpn9VrNchE+TNmBOQzDSA7O TWxmqFvAARDOF4mP4e7O7y4GtbgTJ2qy/8PKA+VtjAiO/j3z7hc3JZo4UTMgr0R1 uVfxijQaqfY8mTZMOMz/WJuxxvWL+dOtxc9TewU+MKQCg5AhmJi45iEFjKOYyvTH Hu7Q7m+Gfn8/Kk8KzbFWA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1664778031; x=1664864431; bh=w00AoMIFAoXP3 +tOrEP6a7s/vss3E2Ix1PZRSqJ3wW8=; b=XnFIjn5pqQ22hy9BAgRfNuiFy0cCm RP2XgIrNMgzPXEhCHKX6hNOyt8fAIksCJ1Wp7u9i7MxNKEHHqcMwGhB+qAQGxQJP wuUkgWoCTOKuOaKClufZSOkxognagp5XoQjuDVburWegbDPLbtubgjsupKNZoid5 zPaSivBzMsdt+R1crLezl5uHuZNspmdYsJGXG8MHALV+cyypCPLEJtB0TsdgP4kD BcPDNZbh6ncFZkiX5GKExwQso54tTgx3RmqQV1Yt4VDSVzLImrLCo0TnFnf2KtjI hf0cG41uTzU77SW3UWbMe8dD1foWUJ/dDDK0/SZe6zwHRI1YmtYf9HDcA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeehkedguddtkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhgggfestd ekredtredttdenucfhrhhomhepofgrthhhvgifucfotgeurhhiuggvuceomhgrthhtseht rhgrvhgvrhhsvgdrtghomhdrrghuqeenucggtffrrghtthgvrhhnpeeikefhuefhgfehge dujeejudelffehteevleetheeljeeugeefteefieekhfdtfeenucffohhmrghinhepghhi thhlrggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepmhgrthhtsehtrhgrvhgvrhhsvgdrtghomhdrrghu X-ME-Proxy: Feedback-ID: i426947f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 Oct 2022 02:20:30 -0400 (EDT) From: Mathew McBride To: development@lists.ipfire.org Subject: [PATCH 2/4] kernel: add patches for SFP support on NXP Layerscape/DPAA2 (arm64) Date: Mon, 3 Oct 2022 06:20:17 +0000 Message-Id: <20221003062019.19636-3-matt@traverse.com.au> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20221003062019.19636-1-matt@traverse.com.au> References: <20221003062019.19636-1-matt@traverse.com.au> MIME-Version: 1.0 ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1664778042; a=rsa-sha256; cv=none; b=U0cQ5yyrks2t+nMOEhPH/vy5uU8Rdc8Syy1VzDgveBNlZiFt6AISMexelo4FGJTPn8IW4g 6suSb4MPno3O4VHNSFqbpsw2Q/aXr5hSUCdVWDKSUIfr1qGkA9uuZ2XcQ1ycCmD91LGWuR QIqwp0ebh4rTmPruoriV2DjvCl8xRq4wWXUmKvCvtawC2IkWayShI9BWGx34bKSsOf86AW 2fAPlasCfnSvvROoi33XEYN1vpFPQTidjD/eIX6NO+033n0vXm6pdMeB88djmSMDJ7lqC+ dC40jrC4OOSbi2s8pQQoypB4PlZItJP7XkYxaM/mux7iQKvbw9kUaIbzBGQVhw== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=traverse.com.au header.s=fm1 header.b="R okRj/5"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=XnFIjn5p; spf=pass (mail01.ipfire.org: domain of matt@traverse.com.au designates 66.111.4.28 as permitted sender) smtp.mailfrom=matt@traverse.com.au; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1664778042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=w00AoMIFAoXP3+tOrEP6a7s/vss3E2Ix1PZRSqJ3wW8=; b=RsMj0rHDo6wVweMXc6bKsxYWObgf9M37PbUZAs/tdO4uzWZWiOXHv6iECTKY4WVIyJuPGO OqzF/2jLpABc9BLngh9t0Bu2jtYSlfUkorRDEqWXX8YiGwFDLVebovYI1uferJelWxH8ru RVx3pJXj2D31ptp6hX0RQYwyALhbFLc3dumBi++HJi/Rwb3nokn05UoWqReV9zO9PfGaHI u5DCIgTWev9J2qJA0DrP8jnuFYtjkrRKV6EAqCDXgMx+OYZUTwgLc0i9oSuIPYgIMsye9L YGyWaGFG/WDcAax77dZykUQwD6BNSfjglBAzhp5nz1OeI1TasBNhoIttmhE+aA== Authentication-Results: mail01.ipfire.org; dkim=pass header.d=traverse.com.au header.s=fm1 header.b="R okRj/5"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=XnFIjn5p; spf=pass (mail01.ipfire.org: domain of matt@traverse.com.au designates 66.111.4.28 as permitted sender) smtp.mailfrom=matt@traverse.com.au; dmarc=none X-Rspamd-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [-0.03 / 11.00]; HFILTER_HOSTNAME_UNKNOWN(5.00)[]; BAYES_HAM(-3.00)[100.00%]; DWL_DNSWL_LOW(-1.00)[messagingengine.com:dkim]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM(-1.00)[-0.998]; DKIM_REPUTATION(-0.93)[-0.93043022249545]; R_MISSING_CHARSET(0.50)[]; IP_REPUTATION_HAM(-0.38)[asn: 19151(-0.38), country: US(-0.01), ip: 66.111.4.28(0.00)]; R_DKIM_ALLOW(0.29)[traverse.com.au:s=fm1,messagingengine.com:s=fm2]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.28:c]; MIME_GOOD(-0.10)[text/plain]; RCVD_IN_DNSWL_LOW(-0.10)[66.111.4.28:from]; RWL_MAILSPIKE_GOOD(-0.10)[66.111.4.28:from]; MX_GOOD(-0.01)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; DMARC_NA(0.00)[traverse.com.au]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; TO_DN_SOME(0.00)[]; ASN(0.00)[asn:19151, ipnet:66.111.4.0/24, country:US]; RCVD_COUNT_THREE(0.00)[4]; RCPT_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[traverse.com.au:+,messagingengine.com:+]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 4MgrLL3t00zM6 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" These two patches are needed to support SFP's on NXP DPAA2 platforms (e.g Traverse Ten64). The deadlock issue patch was submitted upstream a while ago and rejected, however I am not aware of any better solutions at present. The 10G mode additions are part of mainline since 5.16. These two .patches were sourced from our patchset over here: https://gitlab.com/traversetech/traverse-kernel-patches/-/tree/lts-5-15/patches Signed-off-by: Mathew McBride Reviewed-by: Michael Tremer --- lfs/linux | 3 + ...rm64-dpaa2-add-support-for-10g-modes.patch | 39 +++++++++ ...inux-5.15-arm64-dpaa2-fix-lock-issue.patch | 81 +++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 src/patches/linux/linux-5-15-arm64-dpaa2-add-support-for-10g-modes.patch create mode 100644 src/patches/linux/linux-5.15-arm64-dpaa2-fix-lock-issue.patch diff --git a/lfs/linux b/lfs/linux index a1b32cc25..3a7dbc91d 100644 --- a/lfs/linux +++ b/lfs/linux @@ -153,6 +153,9 @@ endif ifeq "$(BUILD_ARCH)" "aarch64" # Apply Arm-multiarch kernel patches. cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1 + # Apply NXP DPAA2 specific patches + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5.15-arm64-dpaa2-fix-lock-issue.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5-15-arm64-dpaa2-add-support-for-10g-modes.patch endif cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch diff --git a/src/patches/linux/linux-5-15-arm64-dpaa2-add-support-for-10g-modes.patch b/src/patches/linux/linux-5-15-arm64-dpaa2-add-support-for-10g-modes.patch new file mode 100644 index 000000000..ef8d459b7 --- /dev/null +++ b/src/patches/linux/linux-5-15-arm64-dpaa2-add-support-for-10g-modes.patch @@ -0,0 +1,39 @@ +From c314138bd045e050432158ab021160de3ba51c5e Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Thu, 30 Jan 2020 22:42:38 +0000 +Subject: [PATCH 2/4] net: dpaa2-mac: add support for more 10G modes + +Phylink documentation says: + * Note that the PHY may be able to transform from one connection + * technology to another, so, eg, don't clear 1000BaseX just + * because the MAC is unable to BaseX mode. This is more about + * clearing unsupported speeds and duplex settings. The port modes + * should not be cleared; phylink_set_port_modes() will help with this. + +So add the missing 10G modes. + +Signed-off-by: Russell King +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +index 8fe32ed4f6dc..3be849cee47b 100644 +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +@@ -140,6 +140,12 @@ static void dpaa2_mac_validate(struct phylink_config *config, + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_USXGMII: + phylink_set(mask, 10000baseT_Full); ++ phylink_set(mask, 10000baseKR_Full); ++ phylink_set(mask, 10000baseCR_Full); ++ phylink_set(mask, 10000baseSR_Full); ++ phylink_set(mask, 10000baseLR_Full); ++ phylink_set(mask, 10000baseLRM_Full); ++ phylink_set(mask, 10000baseER_Full); + if (state->interface == PHY_INTERFACE_MODE_10GBASER) + break; + phylink_set(mask, 5000baseT_Full); +-- +2.30.1 + diff --git a/src/patches/linux/linux-5.15-arm64-dpaa2-fix-lock-issue.patch b/src/patches/linux/linux-5.15-arm64-dpaa2-fix-lock-issue.patch new file mode 100644 index 000000000..587821bac --- /dev/null +++ b/src/patches/linux/linux-5.15-arm64-dpaa2-fix-lock-issue.patch @@ -0,0 +1,81 @@ +From 3a39dbe0c0c41f8dba5246ce6e2c5c4bcd6ba661 Mon Sep 17 00:00:00 2001 +From: Ioana Ciornei +Date: Thu, 21 Nov 2019 21:15:25 +0200 +Subject: [PATCH 1/4] dpaa2-eth: do not hold rtnl_lock on phylink_create() or + _destroy() + +The rtnl_lock should not be held when calling phylink_create() or +phylink_destroy() since it leads to the deadlock listed below: + +[ 18.656576] rtnl_lock+0x18/0x20 +[ 18.659798] sfp_bus_add_upstream+0x28/0x90 +[ 18.663974] phylink_create+0x2cc/0x828 +[ 18.667803] dpaa2_mac_connect+0x14c/0x2a8 +[ 18.671890] dpaa2_eth_connect_mac+0x94/0xd8 + +Fix this by moving the _lock() and _unlock() calls just outside of +phylink_of_phy_connect() and phylink_disconnect_phy(). + +Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink") +Reported-by: Russell King +Signed-off-by: Ioana Ciornei +Signed-off-by: Russell King +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ---- + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 4 ++++ + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +index 8b7a29e1e221..20e65053f036 100644 +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -4214,12 +4214,10 @@ static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg) + dpaa2_eth_set_mac_addr(netdev_priv(net_dev)); + dpaa2_eth_update_tx_fqids(priv); + +- rtnl_lock(); + if (dpaa2_eth_has_mac(priv)) + dpaa2_eth_disconnect_mac(priv); + else + dpaa2_eth_connect_mac(priv); +- rtnl_unlock(); + } + + return IRQ_HANDLED; +@@ -4513,9 +4511,7 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev) + #endif + + unregister_netdev(net_dev); +- rtnl_lock(); + dpaa2_eth_disconnect_mac(priv); +- rtnl_unlock(); + + dpaa2_eth_dl_port_del(priv); + dpaa2_eth_dl_traps_unregister(priv); +diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +index ae6d382d8735..8fe32ed4f6dc 100644 +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +@@ -351,7 +351,9 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) + if (mac->pcs) + phylink_set_pcs(mac->phylink, &mac->pcs->pcs); + ++ rtnl_lock(); + err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0); ++ rtnl_unlock(); + if (err) { + netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err); + goto err_phylink_destroy; +@@ -372,7 +374,9 @@ void dpaa2_mac_disconnect(struct dpaa2_mac *mac) + if (!mac->phylink) + return; + ++ rtnl_lock(); + phylink_disconnect_phy(mac->phylink); ++ rtnl_unlock(); + phylink_destroy(mac->phylink); + dpaa2_pcs_destroy(mac); + } +-- +2.30.1 +