]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: Fix PMD check during page table walk
authorNitin Gupta <nitin.m.gupta@oracle.com>
Thu, 25 Aug 2016 18:16:50 +0000 (11:16 -0700)
committerAllen Pais <allen.pais@oracle.com>
Thu, 15 Sep 2016 07:01:26 +0000 (12:31 +0530)
Currently check for PMD_HUGE during page table
walk uses incorrect instruction sequence:

 be,pt           %xcc, 700f;
   andcc          REG1, REG2, %g0;

This sequence is incorrect since branch decision is
made *before* 'andcc' in the delay slot is executed.

Orabug: 24353511

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/include/asm/tsb.h
arch/sparc/kernel/sun4v_tlb_miss.S

index 18d8f3c20d104edbb2caf685f3bc8612f31cf4f0..ca6a7013bc19f0730f2c5fb84d533d1a99a55581 100644 (file)
@@ -205,10 +205,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
        brz,pn          REG1, FAIL_LABEL;               \
         sethi          %uhi(_PAGE_PMD_HUGE), REG2;     \
        sllx            REG2, 32, REG2;                 \
+       andcc           REG1, REG2, %g0;                \
        be,pt           %xcc, 700f;                     \
-        andcc          REG1, REG2, %g0;                \
-       brlz,pt         REG1, PTE_LABEL;                \
-        andn           REG1, REG2, REG1;               \
+        nop;                                           \
+       brgez,pn        REG1, FAIL_LABEL;               \
+        nop;                                           \
+       ba              PTE_LABEL;                      \
+        nop;                                           \
 700:
 #else
 #define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \
index d95b421d11ec69d3d9897516a1d48dd73997e58f..b5c8edf5233aa00e10a39e61eeaffb7020f6381b 100644 (file)
@@ -227,7 +227,7 @@ sun4v_xl_hugepages:
        sllx    %g2, 32, %g2
        andcc   %g5, %g2, %g0
        be,pt   %xcc, 10f
-       sethi   %uhi(_PAGE_VALID | _PAGE_SPECIAL_4V), %g1;
+       sethi   %uhi(_PAGE_VALID | _PAGE_PMD_HUGE | _PAGE_SPECIAL_4V), %g1;
        sllx    %g1, 32, %g1
        or      %g1, _PAGE_SZALL_4V, %g1
        andn    %g5, %g1, %g1