Commit 6536c5f2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'powerpc-5.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
 "Three non-regression fixes.

   - Our optimised memcmp could read past the end of one of the buffers
     and potentially trigger a page fault leading to an oops.

   - Some of our code to read energy management data on PowerVM had an
     endian bug leading to bogus results.

   - When reporting a machine check exception we incorrectly reported
     TLB multihits as D-Cache multhits due to a missing entry in the
     array of causes.

  Thanks to: Chandan Rajendra, Gautham R. Shenoy, Mahesh Salgaonkar,
  Segher Boessenkool, Vaidyanathan Srinivasan"

* tag 'powerpc-5.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/pseries/mce: Fix misleading print for TLB mutlihit
  powerpc/pseries/energy: Use OF accessor functions to read ibm,drc-indexes
  powerpc/64: Fix memcmp reading past the end of src/dest
parents c877b3df 6f845ebe
...@@ -215,11 +215,20 @@ _GLOBAL_TOC(memcmp) ...@@ -215,11 +215,20 @@ _GLOBAL_TOC(memcmp)
beq .Lzero beq .Lzero
.Lcmp_rest_lt8bytes: .Lcmp_rest_lt8bytes:
/* Here we have only less than 8 bytes to compare with. at least s1 /*
* Address is aligned with 8 bytes. * Here we have less than 8 bytes to compare. At least s1 is aligned to
* The next double words are load and shift right with appropriate * 8 bytes, but s2 may not be. We must make sure s2 + 7 doesn't cross a
* bits. * page boundary, otherwise we might read past the end of the buffer and
* trigger a page fault. We use 4K as the conservative minimum page
* size. If we detect that case we go to the byte-by-byte loop.
*
* Otherwise the next double word is loaded from s1 and s2, and shifted
* right to compare the appropriate bits.
*/ */
clrldi r6,r4,(64-12) // r6 = r4 & 0xfff
cmpdi r6,0xff8
bgt .Lshort
subfic r6,r5,8 subfic r6,r5,8
slwi r6,r6,3 slwi r6,r6,3
LD rA,0,r3 LD rA,0,r3
......
...@@ -77,18 +77,27 @@ static u32 cpu_to_drc_index(int cpu) ...@@ -77,18 +77,27 @@ static u32 cpu_to_drc_index(int cpu)
ret = drc.drc_index_start + (thread_index * drc.sequential_inc); ret = drc.drc_index_start + (thread_index * drc.sequential_inc);
} else { } else {
const __be32 *indexes; u32 nr_drc_indexes, thread_drc_index;
indexes = of_get_property(dn, "ibm,drc-indexes", NULL);
if (indexes == NULL)
goto err_of_node_put;
/* /*
* The first element indexes[0] is the number of drc_indexes * The first element of ibm,drc-indexes array is the
* returned in the list. Hence thread_index+1 will get the * number of drc_indexes returned in the list. Hence
* drc_index corresponding to core number thread_index. * thread_index+1 will get the drc_index corresponding
* to core number thread_index.
*/ */
ret = indexes[thread_index + 1]; rc = of_property_read_u32_index(dn, "ibm,drc-indexes",
0, &nr_drc_indexes);
if (rc)
goto err_of_node_put;
WARN_ON_ONCE(thread_index > nr_drc_indexes);
rc = of_property_read_u32_index(dn, "ibm,drc-indexes",
thread_index + 1,
&thread_drc_index);
if (rc)
goto err_of_node_put;
ret = thread_drc_index;
} }
rc = 0; rc = 0;
......
...@@ -550,6 +550,7 @@ static void pseries_print_mce_info(struct pt_regs *regs, ...@@ -550,6 +550,7 @@ static void pseries_print_mce_info(struct pt_regs *regs,
"UE", "UE",
"SLB", "SLB",
"ERAT", "ERAT",
"Unknown",
"TLB", "TLB",
"D-Cache", "D-Cache",
"Unknown", "Unknown",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment