aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/patches-5.10/320-mt7621-core-detect-hack.patch
diff options
context:
space:
mode:
authorIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>2021-02-27 16:00:24 -0800
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2021-03-06 11:24:12 +0100
commitef1e6520164e19451bc9cb8275cf293a699e1684 (patch)
treebd6e06143301ff02a4432227671fb0ec3e781d3d /target/linux/ramips/patches-5.10/320-mt7621-core-detect-hack.patch
parent3149d8e7be6539897e9f3873ed9a2b9213a798a9 (diff)
downloadupstream-ef1e6520164e19451bc9cb8275cf293a699e1684.tar.gz
upstream-ef1e6520164e19451bc9cb8275cf293a699e1684.tar.bz2
upstream-ef1e6520164e19451bc9cb8275cf293a699e1684.zip
ramips: 5.10: rename patches to follow guide
Rename patches to follow the 3-digit classification from the OpenWrt Developer Guide. https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem#naming_patches Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Diffstat (limited to 'target/linux/ramips/patches-5.10/320-mt7621-core-detect-hack.patch')
-rw-r--r--target/linux/ramips/patches-5.10/320-mt7621-core-detect-hack.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/target/linux/ramips/patches-5.10/320-mt7621-core-detect-hack.patch b/target/linux/ramips/patches-5.10/320-mt7621-core-detect-hack.patch
new file mode 100644
index 0000000000..1c8b61f8ef
--- /dev/null
+++ b/target/linux/ramips/patches-5.10/320-mt7621-core-detect-hack.patch
@@ -0,0 +1,61 @@
+There is a variant of MT7621 which contains only one CPU core instead of 2.
+This is not reflected in the config register, so the kernel detects more
+physical cores, which leads to a hang on SMP bringup.
+Add a hack to detect missing cores.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+
+--- a/arch/mips/kernel/smp-cps.c
++++ b/arch/mips/kernel/smp-cps.c
+@@ -43,6 +43,11 @@ static unsigned core_vpe_count(unsigned
+ return mips_cps_numvps(cluster, core);
+ }
+
++bool __weak plat_cpu_core_present(int core)
++{
++ return true;
++}
++
+ static void __init cps_smp_setup(void)
+ {
+ unsigned int nclusters, ncores, nvpes, core_vpes;
+@@ -60,6 +65,8 @@ static void __init cps_smp_setup(void)
+
+ ncores = mips_cps_numcores(cl);
+ for (c = 0; c < ncores; c++) {
++ if (!plat_cpu_core_present(c))
++ continue;
+ core_vpes = core_vpe_count(cl, c);
+
+ if (c > 0)
+--- a/arch/mips/ralink/mt7621.c
++++ b/arch/mips/ralink/mt7621.c
+@@ -13,6 +13,7 @@
+ #include <asm/mips-cps.h>
+ #include <asm/mach-ralink/ralink_regs.h>
+ #include <asm/mach-ralink/mt7621.h>
++#include <asm/mips-boards/launch.h>
+
+ #include <pinmux.h>
+
+@@ -160,6 +161,20 @@ void __init ralink_of_remap(void)
+ panic("Failed to remap core resources");
+ }
+
++bool plat_cpu_core_present(int core)
++{
++ struct cpulaunch *launch = (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH);
++
++ if (!core)
++ return true;
++ launch += core * 2; /* 2 VPEs per core */
++ if (!(launch->flags & LAUNCH_FREADY))
++ return false;
++ if (launch->flags & (LAUNCH_FGO | LAUNCH_FGONE))
++ return false;
++ return true;
++}
++
+ void prom_soc_init(struct ralink_soc_info *soc_info)
+ {
+ void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE);