Skip to contentSkip to conversation

Patch "powerpc: scan_features() updates incorrect bits for REAL_LE" has been added to the 3.14-stable tree

PATCH [email protected] 1 participant 1 message May 9, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

powerpc: scan_features() updates incorrect bits for REAL_LE

to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
powerpc-scan_features-updates-incorrect-bits-for-real_le.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 6997e57d693b07289694239e52a10d2f02c3a46f Mon Sep 17 00:00:00 2001

From: Anton Blanchard <[email protected]>
Date: Fri, 15 Apr 2016 12:06:13 +1000
Subject: powerpc: scan_features() updates incorrect bits for REAL_LE

From: Anton Blanchard <[email protected]>

commit 6997e57d693b07289694239e52a10d2f02c3a46f upstream.

The REAL_LE feature entry in the ibm_pa_feature struct is missing an MMU feature value, meaning all the remaining elements initialise the wrong values.

This means instead of checking for byte 5, bit 0, we check for byte 0, bit 0, and then we incorrectly set the CPU feature bit as well as MMU feature bit 1 and CPU user feature bits 0 and 2 (5).

Checking byte 0 bit 0 (IBM numbering), means we're looking at the "Memory Management Unit (MMU)" feature - ie. does the CPU have an MMU. In practice that bit is set on all platforms which have the property.

This means we set CPU_FTR_REAL_LE always. In practice that seems not to matter because all the modern cpus which have this property also implement REAL_LE, and we've never needed to disable it.

We're also incorrectly setting MMU feature bit 1, which is:

  #define MMU_FTR_TYPE_8xx		0x00000002

Luckily the only place that looks for MMU_FTR_TYPE_8xx is in Book3E code, which can't run on the same cpus as scan_features(). So this also doesn't matter in practice.

Finally in the CPU user feature mask, we're setting bits 0 and 2. Bit 2 is not currently used, and bit 0 is:

  #define PPC_FEATURE_PPC_LE		0x00000001

Which says the CPU supports the old style "PPC Little Endian" mode. Again this should be harmless in practice as no 64-bit CPUs implement that mode.

Fix the code by adding the missing initialisation of the MMU feature.

Also add a comment marking CPU user feature bit 2 (0x4) as reserved. It would be unsafe to start using it as old kernels incorrectly set it.

Fixes 44ae3ab3358e ("powerpc: Free up some CPU feature bits by moving out MMU-related features")
[mpe: Flesh out changelog, add comment reserving 0x4]
---
 arch/powerpc/include/uapi/asm/cputable.h |    1 +
 arch/powerpc/kernel/prom.c               |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/include/uapi/asm/cputable.h +1 -0
@@ -31,6 +31,7 @@
 #define PPC_FEATURE_PSERIES_PERFMON_COMPAT \
 					0x00000040
 
+/* Reserved - do not use		0x00000004 */
 #define PPC_FEATURE_TRUE_LE		0x00000002
 #define PPC_FEATURE_PPC_LE		0x00000001
 
arch/powerpc/kernel/prom.c +1 -1
@@ -159,7 +159,7 @@ static struct ibm_pa_feature {
 	{CPU_FTR_NOEXECUTE, 0, 0,	0, 6, 0},
 	{CPU_FTR_NODSISRALIGN, 0, 0,	1, 1, 1},
 	{0, MMU_FTR_CI_LARGE_PAGE, 0,	1, 2, 0},
-	{CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
+	{CPU_FTR_REAL_LE, 0, PPC_FEATURE_TRUE_LE, 5, 0, 0},
 };
 
 static void __init scan_features(unsigned long node, unsigned char *ftrs,

Patches currently in stable-queue which might be from [email protected] are

queue-3.14/compiler-gcc-integrate-the-various-compiler-gcc.h-files.patch queue-3.14/powerpc-scan_features-updates-incorrect-bits-for-real_le.patch