Commit 319e76a1ae835c34a2838c2bfebe3db4d5a6b387

Authored by David Gibson
Committed by Linus Torvalds
1 parent 7eaa414ee8

[PATCH] Fix bug in ppc64 dynamic hugepage support

In adjusting the logic for SLB miss for the dynamic hugepage stuff, I
messed up the !CONFIG_HUGETLB_PAGE case, failing to set the SLB flags
properly.

This fixes it.  It also streamlines the logic for the HUGETLB_PAGE case
(removing a couple of branches) while we're at it.

Booted, and roughly tested on POWER5 (with and without HUGETLB_PAGE),
iSeries/RS64 (no hugepage available), and G5 (with and without
HUGETLB_PAGE).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 9 additions and 13 deletions Side-by-side Diff

arch/ppc64/mm/slb_low.S
... ... @@ -97,25 +97,21 @@
97 97 lhz r9,PACAHIGHHTLBAREAS(r13)
98 98 srdi r11,r3,(HTLB_AREA_SHIFT-SID_SHIFT)
99 99 srd r9,r9,r11
100   - andi. r9,r9,1
101   - bne 5f
  100 + lhz r11,PACALOWHTLBAREAS(r13)
  101 + srd r11,r11,r3
  102 + or r9,r9,r11
  103 +END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE)
  104 +#endif /* CONFIG_HUGETLB_PAGE */
102 105  
103 106 li r11,SLB_VSID_USER
104 107  
105   - cmpldi r3,16
106   - bge 6f
107   -
108   - lhz r9,PACALOWHTLBAREAS(r13)
109   - srd r9,r9,r3
110   - andi. r9,r9,1
111   -
112   - beq 6f
113   -
114   -5: li r11,SLB_VSID_USER|SLB_VSID_L
  108 +#ifdef CONFIG_HUGETLB_PAGE
  109 +BEGIN_FTR_SECTION
  110 + rldimi r11,r9,8,55 /* shift masked bit into SLB_VSID_L */
115 111 END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE)
116 112 #endif /* CONFIG_HUGETLB_PAGE */
117 113  
118   -6: ld r9,PACACONTEXTID(r13)
  114 + ld r9,PACACONTEXTID(r13)
119 115 rldimi r3,r9,USER_ESID_BITS,0
120 116  
121 117 9: /* r3 = protovsid, r11 = flags, r10 = esid_data, cr7 = <>KERNELBASE */