[MIPS] Enable support for the userlocal hardware register
[firefly-linux-kernel-4.4.55.git] / arch / mips / kernel / traps.c
index c598e890a880103ea0af04f5f4f7b85221d1f55f..9b19a84d11ef2f006aedab7f66edc5901860a26c 100644 (file)
@@ -1341,7 +1341,14 @@ void __init per_cpu_trap_init(void)
                set_c0_status(ST0_MX);
 
 #ifdef CONFIG_CPU_MIPSR2
-       write_c0_hwrena (0x0000000f); /* Allow rdhwr to all registers */
+       if (cpu_has_mips_r2) {
+               unsigned int enable = 0x0000000f;
+
+               if (cpu_has_userlocal)
+                       enable |= (1 << 29);
+
+               write_c0_hwrena(enable);
+       }
 #endif
 
 #ifdef CONFIG_MIPS_MT_SMTC