From patchwork Tue Mar 16 09:02:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Salvaterra X-Patchwork-Id: 1453763 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=Aug6W4kz; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=JJGfZR8c; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 ozlabs.org (Postfix) with ESMTPS id 4F06mc5J4Pz9sRf for ; Tue, 16 Mar 2021 20:04:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=VQetXvUlCojoOvK286U0DF5mfMK4vylrJbaZc70fPLM=; b=Aug6W4kzEAJwhTs88OmnIXKk0j PoG6zZWPKRDykcXWmOkAEn7Sr8juIlT/nKn50NHVBzvIkeXoIQp4eogiLBDH/IwH0z+HrPigoX3QE mzc8cQ6u30RrDJuqMYx/FCY3lkeoSoeuRCv2jsPhCoNr3F1vk4sM8wboE9qPdOqRDOLfFzkIzyaKU UT1NLmYzYLblP0blbBRsJIwrK1e10A56/4iFXGig/WCK3xObYix0K+4EZweFIQj/nLLvN8afUCWK3 /dIcegFex1ZN5VbXHf4nbMXf4ODOrY3hfcI4ubOVup47miieHjDNew1HA1je0m7LzzIVgh8yornc0 g6Ou2fzw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lM5bQ-000CJf-IM; Tue, 16 Mar 2021 09:03:00 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lM5bK-000CHy-PI for openwrt-devel@lists.openwrt.org; Tue, 16 Mar 2021 09:02:57 +0000 Received: by mail-wr1-x436.google.com with SMTP id v4so7011769wrp.13 for ; Tue, 16 Mar 2021 02:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EGQxNzc3HGa/MePAsR+bKirb7V6sy6GX7tn4aB/kMso=; b=JJGfZR8cnwIsVbwY8fJ5ao209gxJvLXuj9K/4TLZmcBvuKezJc1atGlTTtazQK5zyO ak8rPP58Fl4DtmJJZMO8bUmEXG9iLNP95Ko6GrCjgg6sCF9qw/3WU0yIq4kk+VOeukHz weFbYwmiptEpDTyNIxhvRlTgCjNzRDJ98Tw5ZPkwiSiw5gBGE5OvxdbOjm5+7jVXehos ZDfdHLR+BLhehwLQcTZWtut43gV7jj53fO+U6YoFbs/QR3DGkJoyoJI2pWrrvQBuEdZd 3xjJklgAqtzeQvWVEQ06LjMHQo6D+EivjuBoVFWzUWEkmXDnd1D+d0sQ+FBs70rwOHmt vxJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EGQxNzc3HGa/MePAsR+bKirb7V6sy6GX7tn4aB/kMso=; b=a1MZxVrT5eYD/oOajeSKFC+GDbAfbQqO5f4YTjWwzq3XR0PvIXl2AX4Um6G8PN8BAu J/ivypea5rP1etwH9lejyqw+VBCG1eEHbtmjoxIeKPEYnp8YJeWlY0hqbLVRZ+Bh4rbB YngH4o/qB40g+d4MFM6GehcrB5Rh+c8sp+AQuhg1OS81jlEQmfuNKYcUwk7GT8cA9SVa O0iCcfP5Anox998My6cJIIzb4S5eCk/4hdstRlkSbfCZS8dq7rEoRGwYf2zfGmtFdUd7 EcN3WARElVUsOuacJ3K8f55HWvscv3fKiF2ymzC2wBV7slDGlyla0HAZ2U47AIT5SAbj wjKw== X-Gm-Message-State: AOAM5323EV52ptaMFG+szDbstQAVYcDLOsM7f+m4OAnZ1bsl3wioqR1r TkKWRiVJzYToIdwxweaZpaXjnAHB5Q== X-Google-Smtp-Source: ABdhPJwqbbyMM9rkz+ZDuwjoIxp5m69VOkY/uOSWuyQWWZ5FEXXLQSzZgJKdXI+fIQq+WCqEApKEpw== X-Received: by 2002:a5d:58c9:: with SMTP id o9mr3733589wrf.181.1615885369948; Tue, 16 Mar 2021 02:02:49 -0700 (PDT) Received: from presler.lan (a95-94-147-174.cpe.netcabo.pt. [95.94.147.174]) by smtp.gmail.com with ESMTPSA id n6sm2775050wmd.27.2021.03.16.02.02.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 02:02:49 -0700 (PDT) From: Rui Salvaterra To: openwrt-devel@lists.openwrt.org Cc: john@phrozen.org, daniel@makrotopia.org, Rui Salvaterra , Ilya Lipnitskiy , Donald Hoskins Subject: [PATCH] ramips/mt7621: drop two obsolete patches Date: Tue, 16 Mar 2021 09:02:36 +0000 Message-Id: <20210316090236.2018-1-rsalvaterra@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210316_090254_877094_33664ED3 X-CRM114-Status: GOOD ( 18.06 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Although the title is trivial, the potential impact of these changes is enough in itself to warrant more extensive justification, which follows: 202-weak_reordering.patch - In order to fix random hangs on MT7621, we've been selecting WEAK_REORDERING_BEYOND_LLSC for years [1]. However, these random hangs have been most likely caused by an overs [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:436 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rsalvaterra[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Although the title is trivial, the potential impact of these changes is enough in itself to warrant more extensive justification, which follows: 202-weak_reordering.patch - In order to fix random hangs on MT7621, we've been selecting WEAK_REORDERING_BEYOND_LLSC for years [1]. However, these random hangs have been most likely caused by an oversight in the MIPS implementation of the kernel memory consistency model, which has already been fixed for some time (and stable-backported) [2]. 321-mt7621-timer.patch - We've also been carrying this patch for many years [3], in order to fix a timer calibration issue on MT7621. Turns out, after retesting with a recent kernel (5.10), the system works perfectly fine without it (no rcu_sched stalls or inconsistent BogoMIPS values across CPUs). The GENERIC_CLOCKEVENTS_BROADCAST selection, however, is an unrelated change, should be kept (although we're not building with cpuidle support), and is thus moved to a new patch, 202-generic-clockevents-broadcast.patch. This change also requires a manual refresh of both 322-mt7621-fix-cpu-clk-add-clkdev.patch and 323-mt7621-memory-detect.patch. [1] https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=5c971cd6fdd7298a2017bdb6bea870088eddb8b9 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/mips?h=linux-5.4.y&id=42344113ba7a1ed7b5654cd5270af0d5698d8521 [3] https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=6f4a903533361a2906a4d94ac6f597cd9c6c47bc Suggested-by: Ilya Lipnitskiy Tested-by: Donald Hoskins Signed-off-by: Rui Salvaterra --- ...> 202-generic-clockevents-broadcast.patch} | 2 +- .../patches-5.10/321-mt7621-timer.patch | 87 ------------------- .../322-mt7621-fix-cpu-clk-add-clkdev.patch | 10 +-- .../323-mt7621-memory-detect.patch | 10 +-- 4 files changed, 11 insertions(+), 98 deletions(-) rename target/linux/ramips/patches-5.10/{202-weak_reordering.patch => 202-generic-clockevents-broadcast.patch} (82%) delete mode 100644 target/linux/ramips/patches-5.10/321-mt7621-timer.patch diff --git a/target/linux/ramips/patches-5.10/202-weak_reordering.patch b/target/linux/ramips/patches-5.10/202-generic-clockevents-broadcast.patch similarity index 82% rename from target/linux/ramips/patches-5.10/202-weak_reordering.patch rename to target/linux/ramips/patches-5.10/202-generic-clockevents-broadcast.patch index 074e16642f..8661c8a3d0 100644 --- a/target/linux/ramips/patches-5.10/202-weak_reordering.patch +++ b/target/linux/ramips/patches-5.10/202-generic-clockevents-broadcast.patch @@ -4,7 +4,7 @@ select CLKSRC_MIPS_GIC select HAVE_PCI if PCI_MT7621 select SOC_BUS -+ select WEAK_REORDERING_BEYOND_LLSC ++ select GENERIC_CLOCKEVENTS_BROADCAST endchoice choice diff --git a/target/linux/ramips/patches-5.10/321-mt7621-timer.patch b/target/linux/ramips/patches-5.10/321-mt7621-timer.patch deleted file mode 100644 index 91e14ad63b..0000000000 --- a/target/linux/ramips/patches-5.10/321-mt7621-timer.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- a/arch/mips/ralink/mt7621.c -+++ b/arch/mips/ralink/mt7621.c -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -16,6 +17,7 @@ - #include - #include - #include -+#include - - #include - -@@ -161,6 +163,58 @@ bool plat_cpu_core_present(int core) - return true; - } - -+#define LPS_PREC 8 -+/* -+* Re-calibration lpj(loop-per-jiffy). -+* (derived from kernel/calibrate.c) -+*/ -+static int udelay_recal(void) -+{ -+ unsigned int i, lpj = 0; -+ unsigned long ticks, loopbit; -+ int lps_precision = LPS_PREC; -+ -+ lpj = (1<<12); -+ -+ while ((lpj <<= 1) != 0) { -+ /* wait for "start of" clock tick */ -+ ticks = jiffies; -+ while (ticks == jiffies) -+ /* nothing */; -+ -+ /* Go .. */ -+ ticks = jiffies; -+ __delay(lpj); -+ ticks = jiffies - ticks; -+ if (ticks) -+ break; -+ } -+ -+ /* -+ * Do a binary approximation to get lpj set to -+ * equal one clock (up to lps_precision bits) -+ */ -+ lpj >>= 1; -+ loopbit = lpj; -+ while (lps_precision-- && (loopbit >>= 1)) { -+ lpj |= loopbit; -+ ticks = jiffies; -+ while (ticks == jiffies) -+ /* nothing */; -+ ticks = jiffies; -+ __delay(lpj); -+ if (jiffies != ticks) /* longer than 1 tick */ -+ lpj &= ~loopbit; -+ } -+ printk(KERN_INFO "%d CPUs re-calibrate udelay(lpj = %d)\n", NR_CPUS, lpj); -+ -+ for(i=0; i< NR_CPUS; i++) -+ cpu_data[i].udelay_val = lpj; -+ -+ return 0; -+} -+device_initcall(udelay_recal); -+ - void prom_soc_init(struct ralink_soc_info *soc_info) - { - void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE); ---- a/arch/mips/ralink/Kconfig -+++ b/arch/mips/ralink/Kconfig -@@ -63,6 +63,7 @@ choice - select HAVE_PCI if PCI_MT7621 - select SOC_BUS - select WEAK_REORDERING_BEYOND_LLSC -+ select GENERIC_CLOCKEVENTS_BROADCAST - endchoice - - choice diff --git a/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch b/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch index 723c628790..be5fee54b2 100644 --- a/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch +++ b/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch @@ -36,10 +36,10 @@ #define MT7621_DDR2_SIZE_MAX 256 --- a/arch/mips/ralink/mt7621.c +++ b/arch/mips/ralink/mt7621.c -@@ -10,6 +10,10 @@ +@@ -9,6 +9,10 @@ + #include #include #include - #include +#include +#include +#include @@ -47,15 +47,15 @@ #include #include -@@ -18,6 +22,7 @@ +@@ -16,6 +20,7 @@ + #include #include #include - #include +#include #include -@@ -108,11 +113,89 @@ static struct rt2880_pmx_group mt7621_pi +@@ -106,11 +111,89 @@ static struct rt2880_pmx_group mt7621_pi { 0 } }; diff --git a/target/linux/ramips/patches-5.10/323-mt7621-memory-detect.patch b/target/linux/ramips/patches-5.10/323-mt7621-memory-detect.patch index 07c7588661..9f80d02638 100644 --- a/target/linux/ramips/patches-5.10/323-mt7621-memory-detect.patch +++ b/target/linux/ramips/patches-5.10/323-mt7621-memory-detect.patch @@ -44,10 +44,10 @@ Signed-off-by: Chuanhong Guo #define MT7621_CHIP_NAME1 0x20203132 --- a/arch/mips/ralink/mt7621.c +++ b/arch/mips/ralink/mt7621.c -@@ -10,11 +10,13 @@ +@@ -9,11 +9,13 @@ + #include #include #include - #include +#include #include #include @@ -58,7 +58,7 @@ Signed-off-by: Chuanhong Guo #include #include #include -@@ -57,6 +59,8 @@ +@@ -55,6 +57,8 @@ #define MT7621_GPIO_MODE_SDHCI_SHIFT 18 #define MT7621_GPIO_MODE_SDHCI_GPIO 1 @@ -67,7 +67,7 @@ Signed-off-by: Chuanhong Guo static struct rt2880_pmx_func uart1_grp[] = { FUNC("uart1", 0, 1, 2) }; static struct rt2880_pmx_func i2c_grp[] = { FUNC("i2c", 0, 3, 2) }; static struct rt2880_pmx_func uart3_grp[] = { -@@ -141,6 +145,26 @@ static struct clk *__init mt7621_add_sys +@@ -139,6 +143,26 @@ static struct clk *__init mt7621_add_sys return clk; } @@ -94,7 +94,7 @@ Signed-off-by: Chuanhong Guo void __init ralink_clk_init(void) { u32 syscfg, xtal_sel, clkcfg, clk_sel, curclk, ffiv, ffrac; -@@ -346,10 +370,7 @@ void prom_soc_init(struct ralink_soc_inf +@@ -292,10 +316,7 @@ void prom_soc_init(struct ralink_soc_inf (rev >> CHIP_REV_VER_SHIFT) & CHIP_REV_VER_MASK, (rev & CHIP_REV_ECO_MASK));