[PATCH v2] ARM: v6: avoid remaining accesses to missing CP15 registers on ARM1136 r0

Paul Walmsley paul at pwsan.com
Sun Jul 28 02:00:26 EDT 2013


Ensure that the remaining callers of read_cpuid_ext can't attempt an 
extended CP15 register read on ARMv6 cores that don't support it.  The 
only one that appears dodgy is tlb_ops_need_broadcast().

While here, convert feat_v6_fixup() to use cpu_is_arm1136_r0() to save
a few lines of code.

Signed-off-by: Paul Walmsley <paul at pwsan.com>
Cc: Will Deacon <will.deacon at arm.com>
Cc: Russell King <rmk+kernel at arm.linux.org.uk>
---
 arch/arm/include/asm/smp_plat.h | 3 +++
 arch/arm/kernel/setup.c         | 7 +------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
index 76214cb..ad07564 100644
--- a/arch/arm/include/asm/smp_plat.h
+++ b/arch/arm/include/asm/smp_plat.h
@@ -30,6 +30,9 @@ static inline bool is_smp(void)
 #else
 static inline int tlb_ops_need_broadcast(void)
 {
+	if (cpu_is_arm1136_r0())
+		return 0;
+
 	if (!is_smp())
 		return 0;
 
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 63af9a7..a601843 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -389,16 +389,11 @@ static void __init cpuid_init_hwcaps(void)
 
 static void __init feat_v6_fixup(void)
 {
-	int id = read_cpuid_id();
-
-	if ((id & 0xff0f0000) != 0x41070000)
-		return;
-
 	/*
 	 * HWCAP_TLS is available only on 1136 r1p0 and later,
 	 * see also kuser_get_tls_init.
 	 */
-	if ((((id >> 4) & 0xfff) == 0xb36) && (((id >> 20) & 3) == 0))
+	if (cpu_is_arm1136_r0())
 		elf_hwcap &= ~HWCAP_TLS;
 }
 
-- 
1.8.3.2




More information about the linux-arm-kernel mailing list