Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6536c5f2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -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
+18 −9
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -550,6 +550,7 @@ static void pseries_print_mce_info(struct pt_regs *regs,
		"UE",
		"SLB",
		"ERAT",
		"Unknown",
		"TLB",
		"D-Cache",
		"Unknown",