From: Nitin Gupta Date: Thu, 25 Aug 2016 18:16:50 +0000 (-0700) Subject: sparc64: Fix PMD check during page table walk X-Git-Tag: v4.1.12-92~74^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=87f98c0353a1dbf714f9f61a2a635315b9e08693;p=users%2Fjedix%2Flinux-maple.git sparc64: Fix PMD check during page table walk 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 Signed-off-by: Allen Pais --- diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h index 18d8f3c20d10..ca6a7013bc19 100644 --- a/arch/sparc/include/asm/tsb.h +++ b/arch/sparc/include/asm/tsb.h @@ -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) \ diff --git a/arch/sparc/kernel/sun4v_tlb_miss.S b/arch/sparc/kernel/sun4v_tlb_miss.S index d95b421d11ec..b5c8edf5233a 100644 --- a/arch/sparc/kernel/sun4v_tlb_miss.S +++ b/arch/sparc/kernel/sun4v_tlb_miss.S @@ -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