[PATCH][SRU Bionic] UBUNTU: SAUCE: arm64: capabilities: Move setup_boot_cpu_capabilities() call to correct place

dann frazier dann.frazier at canonical.com
Tue Nov 26 00:30:39 UTC 2019


BugLink: https://bugs.launchpad.net/bugs/1852723

In order to diagnose this issue, I prepared my own "clean-room" backport
of the encompassing patch series. My backport didn't have this bug, and
a git diff between mine and Ubuntu's showed one obvious difference:
in my working backport, the call to setup_boot_cpu_capabilities() was in
init_cpu_features(), while Ubuntu had it in update_cpu_ftr_reg(). Looking
through the history, it appears that the introduction of this issue went
back to an earlier patch that had added a call to
update_cpu_errata_workarounds() in update_cpu_ftr_reg() instead of
init_cpu_features(). The code at this site continued to evolve, eventually
replacing the update_cpu_errata_workarounds() with the one to
setup_boot_cpu_capabilities(), but did so in the wrong function. I verified
that moving this call matches both mainline and stable 4.14.y.

Verified to fix booting on ThunderX2 and Kunpeng920 systems.

Fixes: 2cd18ebbeda69 ("arm64: capabilities: Move errata work around check on boot CPU")
Signed-off-by: dann frazier <dann.frazier at canonical.com>
---
 arch/arm64/kernel/cpufeature.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index d19a7b8bb6fb0..b96d1a635a16a 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -572,6 +572,12 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
 		init_cpu_ftr_reg(SYS_ZCR_EL1, info->reg_zcr);
 		sve_init_vq_map();
 	}
+
+	/*
+	 * Detect and enable early CPU capabilities based on the boot CPU,
+	 * after we have initialised the CPU feature infrastructure.
+	 */
+	setup_boot_cpu_capabilities();
 }
 
 static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
@@ -588,12 +594,6 @@ static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
 		ftr_new = arm64_ftr_safe_value(ftrp, ftr_new, ftr_cur);
 		reg->sys_val = arm64_ftr_set_value(ftrp, reg->sys_val, ftr_new);
 	}
-
-	/*
-	 * Detect and enable early CPU capabilities based on the boot CPU,
-	 * after we have initialised the CPU feature infrastructure.
-	 */
-	setup_boot_cpu_capabilities();
 }
 
 static int check_update_ftr_reg(u32 sys_id, int cpu, u64 val, u64 boot)
-- 
2.24.0




More information about the kernel-team mailing list