linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Anton Blanchard <anton@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: [PATCH 3.14 23/23] powerpc: scan_features() updates incorrect bits for REAL_LE
Date: Mon,  9 May 2016 09:17:43 +0200	[thread overview]
Message-ID: <20160509071648.017360787@linuxfoundation.org> (raw)
In-Reply-To: <20160509071646.726412064@linuxfoundation.org>

3.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Anton Blanchard <anton@samba.org>

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")
Signed-off-by: Anton Blanchard <anton@samba.org>
[mpe: Flesh out changelog, add comment reserving 0x4]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/include/uapi/asm/cputable.h |    1 +
 arch/powerpc/kernel/prom.c               |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

--- a/arch/powerpc/include/uapi/asm/cputable.h
+++ b/arch/powerpc/include/uapi/asm/cputable.h
@@ -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
 
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -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,

  parent reply	other threads:[~2016-05-09  7:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09  7:17 [PATCH 3.14 00/23] 3.14.69-stable review Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 01/23] compiler-gcc: integrate the various compiler-gcc[345].h files Greg Kroah-Hartman
2016-05-11  9:27   ` Jiri Slaby
2016-05-14 23:41     ` Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 02/23] compiler-gcc: disable -ftracer for __noclone functions Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 04/23] ipvs: correct initial offset of Call-ID header search in SIP persistence engine Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 05/23] nbd: ratelimit error msgs after socket close Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 06/23] clk: versatile: sp810: support reentrance Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 07/23] lpfc: fix misleading indentation Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 08/23] tracing: Dont display trigger file for events that cant be enabled Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 09/23] ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 10/23] Input: zforce_ts - fix dual touch recognition Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 11/23] proc: prevent accessing /proc/<PID>/environ until its ready Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 12/23] batman-adv: Check skb size before using encapsulated ETH+VLAN header Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 14/23] batman-adv: Reduce refcnt of removed router when updating route Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 15/23] MAINTAINERS: Remove asterisk from EFI directory names Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 16/23] x86/tsc: Read all ratio bits from MSR_PLATFORM_INFO Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 17/23] x86/sysfb_efi: Fix valid BAR address range check Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 18/23] ACPICA: Dispatcher: Update thread ID for recursive method calls Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 19/23] USB: serial: cp210x: add ID for Link ECU Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 20/23] USB: serial: cp210x: add Straizona Focusers device ids Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 21/23] iio: ak8975: Fix NULL pointer exception on early interrupt Greg Kroah-Hartman
2016-05-09  7:17 ` [PATCH 3.14 22/23] Input: ads7846 - correct the value got from SPI Greg Kroah-Hartman
2016-05-09  7:17 ` Greg Kroah-Hartman [this message]
2016-05-09 13:20 ` [PATCH 3.14 00/23] 3.14.69-stable review Guenter Roeck
2016-05-09 19:40 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160509071648.017360787@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).