Comment 22 for bug 1773162

Revision history for this message
Michael Ellerman (michael-ellerman) wrote :

This kernel seems to be missing a change that is present in the upstream version of the patch.

See:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/lib/feature-fixups.c?commit=a048a07d7f4535baa4cbad6bc024f175317ab938#n189

--- a/arch/powerpc/lib/feature-fixups.c 2018-05-24 23:31:52.497801437 +1000
+++ b/arch/powerpc/lib/feature-fixups.c 2018-05-24 23:29:18.141606123 +1000
@@ -185,12 +186,21 @@

  i = 0;
  if (types & STF_BARRIER_FALLBACK || types & STF_BARRIER_SYNC_ORI) {
- instrs[i++] = 0x7db243a6; /* mtsprg 2,r13 */
- instrs[i++] = 0x7db142a6; /* mfsprg r13,1 */
+ if (cpu_has_feature(CPU_FTR_HVMODE)) {
+ instrs[i++] = 0x7db14ba6; /* mtspr 0x131, r13 (HSPRG1) */
+ instrs[i++] = 0x7db04aa6; /* mfspr r13, 0x130 (HSPRG0) */
+ } else {
+ instrs[i++] = 0x7db243a6; /* mtsprg 2,r13 */
+ instrs[i++] = 0x7db142a6; /* mfsprg r13,1 */
+ }
   instrs[i++] = 0x7c0004ac; /* hwsync */
   instrs[i++] = 0xe9ad0000; /* ld r13,0(r13) */
   instrs[i++] = 0x63ff0000; /* ori 31,31,0 speculation barrier */
- instrs[i++] = 0x7db242a6; /* mfsprg r13,2 */
+ if (cpu_has_feature(CPU_FTR_HVMODE)) {
+ instrs[i++] = 0x7db14aa6; /* mfspr r13, 0x131 (HSPRG1) */
+ } else {
+ instrs[i++] = 0x7db242a6; /* mfsprg r13,2 */
+ }
  } else if (types & STF_BARRIER_EIEIO) {
   instrs[i++] = 0x7e0006ac; /* eieio + bit 6 hint */
  }