Merge branch 'for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
[deliverable/linux.git] / arch / mips / mm / tlbex.c
index 274da90adf0d682cb00f8811de9c19ba45fc3fa8..4004b659ce50ef439c6782fb70b42c44c1ecd7eb 100644 (file)
@@ -2361,8 +2361,9 @@ static void print_htw_config(void)
                (config & MIPS_PWFIELD_PTEI_MASK) >> MIPS_PWFIELD_PTEI_SHIFT);
 
        config = read_c0_pwsize();
-       pr_debug("PWSize  (0x%0*lx): GDW: 0x%02lx  UDW: 0x%02lx  MDW: 0x%02lx  PTW: 0x%02lx  PTEW: 0x%02lx\n",
+       pr_debug("PWSize  (0x%0*lx): PS: 0x%lx  GDW: 0x%02lx  UDW: 0x%02lx  MDW: 0x%02lx  PTW: 0x%02lx  PTEW: 0x%02lx\n",
                field, config,
+               (config & MIPS_PWSIZE_PS_MASK) >> MIPS_PWSIZE_PS_SHIFT,
                (config & MIPS_PWSIZE_GDW_MASK) >> MIPS_PWSIZE_GDW_SHIFT,
                (config & MIPS_PWSIZE_UDW_MASK) >> MIPS_PWSIZE_UDW_SHIFT,
                (config & MIPS_PWSIZE_MDW_MASK) >> MIPS_PWSIZE_MDW_SHIFT,
@@ -2370,9 +2371,12 @@ static void print_htw_config(void)
                (config & MIPS_PWSIZE_PTEW_MASK) >> MIPS_PWSIZE_PTEW_SHIFT);
 
        pwctl = read_c0_pwctl();
-       pr_debug("PWCtl   (0x%x): PWEn: 0x%x  DPH: 0x%x  HugePg: 0x%x  Psn: 0x%x\n",
+       pr_debug("PWCtl   (0x%x): PWEn: 0x%x  XK: 0x%x  XS: 0x%x  XU: 0x%x  DPH: 0x%x  HugePg: 0x%x  Psn: 0x%x\n",
                pwctl,
                (pwctl & MIPS_PWCTL_PWEN_MASK) >> MIPS_PWCTL_PWEN_SHIFT,
+               (pwctl & MIPS_PWCTL_XK_MASK) >> MIPS_PWCTL_XK_SHIFT,
+               (pwctl & MIPS_PWCTL_XS_MASK) >> MIPS_PWCTL_XS_SHIFT,
+               (pwctl & MIPS_PWCTL_XU_MASK) >> MIPS_PWCTL_XU_SHIFT,
                (pwctl & MIPS_PWCTL_DPH_MASK) >> MIPS_PWCTL_DPH_SHIFT,
                (pwctl & MIPS_PWCTL_HUGEPG_MASK) >> MIPS_PWCTL_HUGEPG_SHIFT,
                (pwctl & MIPS_PWCTL_PSN_MASK) >> MIPS_PWCTL_PSN_SHIFT);
@@ -2427,15 +2431,25 @@ static void config_htw_params(void)
        if (CONFIG_PGTABLE_LEVELS >= 3)
                pwsize |= ilog2(PTRS_PER_PMD) << MIPS_PWSIZE_MDW_SHIFT;
 
-       pwsize |= ilog2(sizeof(pte_t)/4) << MIPS_PWSIZE_PTEW_SHIFT;
+       /* Set pointer size to size of directory pointers */
+       if (config_enabled(CONFIG_64BIT))
+               pwsize |= MIPS_PWSIZE_PS_MASK;
+       /* PTEs may be multiple pointers long (e.g. with XPA) */
+       pwsize |= ((PTE_T_LOG2 - PGD_T_LOG2) << MIPS_PWSIZE_PTEW_SHIFT)
+                       & MIPS_PWSIZE_PTEW_MASK;
 
        write_c0_pwsize(pwsize);
 
        /* Make sure everything is set before we enable the HTW */
        back_to_back_c0_hazard();
 
-       /* Enable HTW and disable the rest of the pwctl fields */
+       /*
+        * Enable HTW (and only for XUSeg on 64-bit), and disable the rest of
+        * the pwctl fields.
+        */
        config = 1 << MIPS_PWCTL_PWEN_SHIFT;
+       if (config_enabled(CONFIG_64BIT))
+               config |= MIPS_PWCTL_XU_MASK;
        write_c0_pwctl(config);
        pr_info("Hardware Page Table Walker enabled\n");
 
This page took 0.026128 seconds and 5 git commands to generate.