powerpc fixes for 5.1 #4
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. -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJcoJG4AAoJEFHr6jzI4aWAwTkP/02lEd3G9MTaLLJUsvPTBG1G lUKPzTNqoWLvcqdwDqsr4Cfftn/DQvgQRTDXzFZCDPdIhUizDSDKAw0vf49Aue4l T8rxOiD7O7eFezsbZ86XIKqsRerWmb44NzrE28zkgcW6LEIjJTO6xz7ne6Cd+Xfc SCji4PBHKSHsL5L3mOU769nm5YDjQDszePN8M6WuYAhW/l7xKbQqWUw6m1zNQf/2 pyy+KOpy1dSANCYgORltSyL3k280G3q75RZFEpqZkI8Yz9vuPImZh41L3CeVo7PU ktg2t+vy36r1/BXisENPF9NUBqhxUROU3ji56N1hKOhiocm6BBETRx+e/N2cXakB erKljjF0PMGqjfHgS0L05ZIwqjzme+amMvFDIPmGTW98UVW4+YLViAGMPBtB/NPm k2uap4VLAiBOsaj4XFPsR7y9WPtUyt56JBkB06e3aftUa9D8rwBP9oxBCR9M+MJ0 V4qGaRUF1TIeAUlngbqJ/MBUqwWw6kcoApq+JX0/kf2Wc/lNjXK1+VCXDHSL3qkh 4+WhEWRCf8XC/uTBM+/2a1ULn6kd8hh7LLZpCTt5X3vI0wXf2wGTbejC01jfTcX3 I+PR/w9bSlxv2FfsiQWnn49l0dV4ZrCgQzTZ4wfiaRFWxnwn3z6CemyOiXn1umu7 NK2/Q/nnNIwqquh7nJo+ =Ugv6 -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
6536c5f2c8
|
@ -215,11 +215,20 @@ _GLOBAL_TOC(memcmp)
|
|||
beq .Lzero
|
||||
|
||||
.Lcmp_rest_lt8bytes:
|
||||
/* Here we have only less than 8 bytes to compare with. at least s1
|
||||
* Address is aligned with 8 bytes.
|
||||
* The next double words are load and shift right with appropriate
|
||||
* bits.
|
||||
/*
|
||||
* Here we have less than 8 bytes to compare. At least s1 is aligned to
|
||||
* 8 bytes, but s2 may not be. We must make sure s2 + 7 doesn't cross a
|
||||
* 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
|
||||
slwi r6,r6,3
|
||||
LD rA,0,r3
|
||||
|
|
|
@ -77,18 +77,27 @@ static u32 cpu_to_drc_index(int cpu)
|
|||
|
||||
ret = drc.drc_index_start + (thread_index * drc.sequential_inc);
|
||||
} else {
|
||||
const __be32 *indexes;
|
||||
|
||||
indexes = of_get_property(dn, "ibm,drc-indexes", NULL);
|
||||
if (indexes == NULL)
|
||||
goto err_of_node_put;
|
||||
u32 nr_drc_indexes, thread_drc_index;
|
||||
|
||||
/*
|
||||
* The first element indexes[0] is the number of drc_indexes
|
||||
* returned in the list. Hence thread_index+1 will get the
|
||||
* drc_index corresponding to core number thread_index.
|
||||
* The first element of ibm,drc-indexes array is the
|
||||
* number of drc_indexes returned in the list. Hence
|
||||
* 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;
|
||||
|
|
|
@ -550,6 +550,7 @@ static void pseries_print_mce_info(struct pt_regs *regs,
|
|||
"UE",
|
||||
"SLB",
|
||||
"ERAT",
|
||||
"Unknown",
|
||||
"TLB",
|
||||
"D-Cache",
|
||||
"Unknown",
|
||||
|
|
Loading…
Reference in New Issue