Skip to contentSkip to conversation

sparc64: Unify kvmap_itlb for generic v9 and sun_4v

PATCH In review Kirill Tkhai 2 participants 2 messages Aug 2, 2013 – Aug 3, 2013 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 sparc64: Unify kvmap_itlb for generic v9 and sun_4v

Compute virtual address before kvmap_itlb call and unify kvmap_itlb and kvmap_itlb_4v.

In itlb_miss.S we use the fact that context is 0. So %g6 is already equal to TAG and we are ready for the call.

---
 arch/sparc/kernel/itlb_miss.S      |    4 ++--
 arch/sparc/kernel/ktlb.S           |   11 +++--------
 arch/sparc/kernel/sun4v_tlb_miss.S |    4 ++--
 3 files changed, 7 insertions(+), 12 deletions(-)
arch/sparc/kernel/itlb_miss.S +2 -2
index 5a8377b..b8afcb9 100644
@@ -2,9 +2,9 @@
 	ldxa	[%g0] ASI_IMMU_TSB_8KB_PTR, %g1	! Get TSB 8K pointer
 	ldxa	[%g0] ASI_IMMU, %g6		! Get TAG TARGET
 	srlx	%g6, 48, %g5			! Get context
-	sllx	%g6, 22, %g6			! Zero out context
 	brz,pn	%g5, kvmap_itlb			! Context 0 processing
-	 srlx	%g6, 22, %g6			! Delay slot
+	 sllx	%g6, 22, %g4			! Zero out context
+	srlx	%g4, 22, %g6			! Get TAG
 	TSB_LOAD_QUAD(%g1, %g4)			! Load TSB entry
 	cmp	%g4, %g6			! Compare TAG
 
arch/sparc/kernel/ktlb.S +3 -8
index fde5a41..2126015 100644
@@ -15,16 +15,11 @@
 	.text
 	.align		32
 
-kvmap_itlb:
-	/* g6: TAG TARGET */
-	mov		TLB_TAG_ACCESS, %g4
-	ldxa		[%g4] ASI_IMMU, %g4
-
-	/* sun4v_itlb_miss branches here with the missing virtual
-	 * address already loaded into %g4
+	/* kernel branches here with the missing virtual address
+	 * loaded into %g4 and the tag loaded into %g6
 	 */
-kvmap_itlb_4v:
 
+kvmap_itlb:
 	/* Catch kernel NULL pointer calls.  */
 	sethi		%hi(PAGE_SIZE), %g5
 	cmp		%g4, %g5
arch/sparc/kernel/sun4v_tlb_miss.S +2 -2
index bde867f..390cd9b 100644
@@ -52,7 +52,7 @@ sun4v_itlb_miss:
 	ldxa	[%g1] ASI_SCRATCHPAD, %g1
 
 	LOAD_ITLB_INFO(%g2, %g4, %g5)
-	COMPUTE_TAG_TARGET(%g6, %g4, %g5, kvmap_itlb_4v)
+	COMPUTE_TAG_TARGET(%g6, %g4, %g5, kvmap_itlb)
 	COMPUTE_TSB_PTR(%g1, %g4, PAGE_SHIFT, %g3, %g7)
 
 	/* Load TSB tag/pte into %g2/%g3 and compare the tag.  */
@@ -154,7 +154,7 @@ sun4v_dtlb_prot:
 sun4v_itsb_miss:
 	mov	SCRATCHPAD_UTSBREG1, %g1
 	ldxa	[%g1] ASI_SCRATCHPAD, %g1
-	brz,pn	%g5, kvmap_itlb_4v
+	brz,pn	%g5, kvmap_itlb
 	 mov	FAULT_CODE_ITLB, %g3
 	ba,a,pt	%xcc, sun4v_tsb_miss_common
 
maintainer
#1 lore raw

From: Kirill Tkhai <[email protected]>
Date: Fri, 02 Aug 2013 19:24:40 +0400

Quoted 7 lines

Compute virtual address before kvmap_itlb call and unify kvmap_itlb and kvmap_itlb_4v.

In itlb_miss.S we use the fact that context is 0. So %g6 is already equal to TAG and we are ready for the call.

This transformation is not correct.

The TAG TARGET register only gives you bits 63 to 22 of the virtual address. The TAG ACCESS gives the full range of bits 63 to 13.