Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2408024lqp; Sun, 24 Mar 2024 18:19:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUk7J+CrK8DNKaj4d/CPshBPgFhpDQWhSQO4dtqNSW8SV2dqdOg4aAQztW+VTCqydOlKjLHq4gmzIUphKDKOS/vSsaThLj1OzjyNBEr5g== X-Google-Smtp-Source: AGHT+IECkEJQmpVWpvxPTCOtJzEYtRAhS5ULgI8gzPPKWwAIWyPdfdhVDOvS2ug8agr3YySyl2Y3 X-Received: by 2002:a05:6a00:4fce:b0:6e5:78bf:d40d with SMTP id le14-20020a056a004fce00b006e578bfd40dmr6219017pfb.18.1711329560709; Sun, 24 Mar 2024 18:19:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711329560; cv=pass; d=google.com; s=arc-20160816; b=L/Pe75r78B6JOvah9OymflH8NckJHXXTV/6zuZn76XYhvqak5mqZvWYMYS3FajEHeC 8qi+vQVHYs46nQXbtkZXwtjY+nBh7JAsECopbc0JmqEs/Z6vwbNHbe/FIvfj6y55kgAS seKshMocaajYBKRloPo81exGssUkMbVFB5TUcWyEQCTprPlg25PsgI1v2yHmwiDnLesZ CWfl7fF99GwSmSdkDc78Q2SucaYJU1t0FIfoKg+Cr36En43QpRkeeKEad47Psj6PMkkP 62s90wnxtzygvvRrh5qd+14Rs4/T2nDipllDDDlqiLRQUijsAALrc0Zb97NhpusSCzEN x3Vg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=evmOumuN+tEAzbLEBucackRjsYM2YbBTmwv1zKSc4t8=; fh=kAZ7ebVhv4ikgn4Oc1Ss22LPZHnKjSWl/7lYrI4oUxA=; b=pGdG0zTKLoIPbseqqcZyo9p/nHkxzKA8x9HKkoVjwgmVlIqbHixK6+Z4Emo/6aMvv2 Zm94zjFwDVlxOsyI8zQdrTDk/KkSvC06c9fAoz/P9N9hq1DF6eilHSLRf1IpgBmG0W72 Mg4cCI586vUCu5MOHIzYioetRXlgLgHNofoI5fOm1tbbeHaRb3bCbpuuoujeewNCJks3 p1Uwu1VHYUwxvlJ/zukrXHT7MhF23ZGTE/EG0QeX/coH7QOydVfycvjS1AXIbmjb2aAQ SD88530PWUYKImJVXTTQ/+6hV47UE/3x2u8px9rn5YNqzsU2QAu0mqSlgVjPLOjm2noI cEKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L2DFMlnC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113555-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113555-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q22-20020a638c56000000b005dc41faf522si6612018pgn.790.2024.03.24.18.19.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:19:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113555-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L2DFMlnC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113555-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113555-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C1DBDB21DED for ; Mon, 25 Mar 2024 01:02:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C04D21C4B13; Sun, 24 Mar 2024 22:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L2DFMlnC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD2841C4AF3; Sun, 24 Mar 2024 22:45:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320358; cv=none; b=f2fv7oiKCAKg5VQkRX02cOE7S8DAunvf9UzWXWZ0SlMc3SiW0/9qWvPtaizIY6NKI6J4AyQSmwiME0fzYVJzjJFRhIF0N96V2YndtasmxyURj0xs3KPmmsEsyB17YGMHmEMo0IYCStJs8vPqnyiJKI6qHu/pTCn+zyqP9vSiOq0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320358; c=relaxed/simple; bh=pw65f5Q9+o8i87PqoOxrSEIV2LHqb+mEj085S/f9BX8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZvXt55zrMcwgEOh1iESHHgn8ampUvPO9AUkNTAVSGkRoeIxTn1QZSO3ZkJFiW5Uqges0C6fS0Q+V2JdBqM7fr19j3FPRGfkK0iETmdfFWNmOSj6tOV3E4RAHmCLsumrwV+oApGM6Vcxudo5kXiHr0ZZXRUyc3SotdHYZ9zb+J8M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L2DFMlnC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0530FC433C7; Sun, 24 Mar 2024 22:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320357; bh=pw65f5Q9+o8i87PqoOxrSEIV2LHqb+mEj085S/f9BX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L2DFMlnCozf33WxgELAlE+QpiZtDsxzDqFbsR7jBTLzEulv2y8KbFX9eN22h6euAi kX1CZtHuBp/d76v7Y0b6Oo8gAygYDVRg6j1toTU9+eVS/RS1HVNlOBBWAwdk3aAgvk mIs+bj22PhDLVUc8PaKPBLGN+gGeKm0oux9o1W4t18xs7yMJ9dtMze1IFShS4wYas9 IWBzhwlR/LNksUm44fAx5CUSobOcGyNwpzfghGQ7ElUnI1ghqvfzMn1hVT9p67vIRO ycu2KavvdheMVj3TxRwmOhNaFapjUgrSnJsLv9ot9DvTOFrWygwCiAj9D1+gG9vWGk VRePb9G4CPfFA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Golle , Bc-bocun Chen , "David S . Miller" , Sasha Levin Subject: [PATCH 6.8 664/715] net: ethernet: mtk_eth_soc: fix PPE hanging issue Date: Sun, 24 Mar 2024 18:34:03 -0400 Message-ID: <20240324223455.1342824-665-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Daniel Golle [ Upstream commit ea80e3ed09ab2c2b75724faf5484721753e92c31 ] A patch to resolve an issue was found in MediaTek's GPL-licensed SDK: In the mtk_ppe_stop() function, the PPE scan mode is not disabled before disabling the PPE. This can potentially lead to a hang during the process of disabling the PPE. Without this patch, the PPE may experience a hang during the reboot test. Link: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/b40da332dfe763932a82f9f62a4709457a15dd6c Fixes: ba37b7caf1ed ("net: ethernet: mtk_eth_soc: add support for initializing the PPE") Suggested-by: Bc-bocun Chen Signed-off-by: Daniel Golle Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mediatek/mtk_ppe.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c index b2a5d9c3733d4..6ce0db3a1a920 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c @@ -994,7 +994,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe) MTK_PPE_KEEPALIVE_DISABLE) | FIELD_PREP(MTK_PPE_TB_CFG_HASH_MODE, 1) | FIELD_PREP(MTK_PPE_TB_CFG_SCAN_MODE, - MTK_PPE_SCAN_MODE_KEEPALIVE_AGE) | + MTK_PPE_SCAN_MODE_CHECK_AGE) | FIELD_PREP(MTK_PPE_TB_CFG_ENTRY_NUM, MTK_PPE_ENTRIES_SHIFT); if (mtk_is_netsys_v2_or_greater(ppe->eth)) @@ -1090,17 +1090,21 @@ int mtk_ppe_stop(struct mtk_ppe *ppe) mtk_ppe_cache_enable(ppe, false); - /* disable offload engine */ - ppe_clear(ppe, MTK_PPE_GLO_CFG, MTK_PPE_GLO_CFG_EN); - ppe_w32(ppe, MTK_PPE_FLOW_CFG, 0); - /* disable aging */ val = MTK_PPE_TB_CFG_AGE_NON_L4 | MTK_PPE_TB_CFG_AGE_UNBIND | MTK_PPE_TB_CFG_AGE_TCP | MTK_PPE_TB_CFG_AGE_UDP | - MTK_PPE_TB_CFG_AGE_TCP_FIN; + MTK_PPE_TB_CFG_AGE_TCP_FIN | + MTK_PPE_TB_CFG_SCAN_MODE; ppe_clear(ppe, MTK_PPE_TB_CFG, val); - return mtk_ppe_wait_busy(ppe); + if (mtk_ppe_wait_busy(ppe)) + return -ETIMEDOUT; + + /* disable offload engine */ + ppe_clear(ppe, MTK_PPE_GLO_CFG, MTK_PPE_GLO_CFG_EN); + ppe_w32(ppe, MTK_PPE_FLOW_CFG, 0); + + return 0; } -- 2.43.0