sparc64: make tsb pointer computation symbolic
PATCH 1/3 sparc64: make tsb pointer computation symbolic
From: bob picco <[email protected]>
Define some symbolic names for tsb/tlb miss trap tsb pointer computation.
--- arch/sparc/include/asm/spitfire.h | 5 +++++ arch/sparc/kernel/sun4v_tlb_miss.S | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-)
arch/sparc/include/asm/spitfire.h +5 -0
@@ -37,6 +37,11 @@#define SPITFIRE_HIGHEST_LOCKED_TLBENT (64 - 1)#define CHEETAH_HIGHEST_LOCKED_TLBENT (16 - 1) +#define HV_TSB_SIZE_BASE 0x200/* 512 TTE-s minimum. */ +#define HV_TSB_SIZE_BASE_SHIFT 0x09/* Shift of minimum tsb size. */ +#define HV_TSB_SIZE_MASK 0x07/* Size encoding of tsb. */ +#define HV_TSB_TTE_SIZE_SHIFT 0x04/* Sixteen byte tte size. */ +#define L1DCACHE_SIZE 0x4000#define SUN4V_CHIP_INVALID 0x00
arch/sparc/kernel/sun4v_tlb_miss.S +12 -12
@@ -27,20 +27,20 @@ /* Create TSB pointer. This is something like: * - * index_mask = (512 << (tsb_reg & 0x7UL)) - 1UL; - * tsb_base = tsb_reg & ~0x7UL; + * tsb_mask = (HV_TSB_SIZE_BASE << (tsb_reg & HV_TSB_SIZE_MASK)) - 1UL; + * tsb_base = tsb_reg & ~HV_TSB_SIZE_MASK; * tsb_index = ((vaddr >> HASH_SHIFT) & tsb_mask); - * tsb_ptr = tsb_base + (tsb_index * 16); + * tsb_ptr = tsb_base + (tsb_index * (1UL << HV_TSB_TTE_SIZE_SHIFT)); */ -#define COMPUTE_TSB_PTR(TSB_PTR, VADDR, HASH_SHIFT, TMP1, TMP2) \ - and TSB_PTR, 0x7, TMP1; \ - mov 512, TMP2; \ - andn TSB_PTR, 0x7, TSB_PTR; \ - sllx TMP2, TMP1, TMP2; \ - srlx VADDR, HASH_SHIFT, TMP1; \ - sub TMP2, 1, TMP2; \ - and TMP1, TMP2, TMP1; \ - sllx TMP1, 4, TMP1; \ +#define COMPUTE_TSB_PTR(TSB_PTR, VADDR, HASH_SHIFT, TMP1, TMP2) \ + and TSB_PTR, HV_TSB_SIZE_MASK, TMP1; \ + mov HV_TSB_SIZE_BASE, TMP2; \ + andn TSB_PTR, HV_TSB_SIZE_MASK, TSB_PTR; \ + sllx TMP2, TMP1, TMP2; \ + srlx VADDR, HASH_SHIFT, TMP1; \ + sub TMP2, 1, TMP2; \ + and TMP1, TMP2, TMP1; \ + sllx TMP1, HV_TSB_TTE_SIZE_SHIFT, TMP1; \ add TSB_PTR, TMP1, TSB_PTR; sun4v_itlb_miss:
Signature · 1 line
2.11.0
Hi Bob.
Nit pick below.
Quoted 15 lines · Bob Picco
From: bob picco <[email protected]>
Define some symbolic names for tsb/tlb miss trap tsb pointer computation.
Signed-off-by Bob Picco <[email protected]>--- arch/sparc/include/asm/spitfire.h | 5 +++++ arch/sparc/kernel/sun4v_tlb_miss.S | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-)arch/sparc/include/asm/spitfire.h +0
-0
arch/sparc/include/asm/spitfire.h line 43
Quoted 7 lines
arch/sparc/include/asm/spitfire.h +4
-0@@ -37,6 +37,11 @@#define SPITFIRE_HIGHEST_LOCKED_TLBENT (64 - 1)#define CHEETAH_HIGHEST_LOCKED_TLBENT (16 - 1) +#define HV_TSB_SIZE_BASE 0x200/* 512 TTE-s minimum. */ +#define HV_TSB_SIZE_BASE_SHIFT 0x09/* Shift of minimum tsb size. */ +#define HV_TSB_SIZE_MASK 0x07/* Size encoding of tsb. */ +#define HV_TSB_TTE_SIZE_SHIFT 0x04/* Sixteen byte tte size. */
If you end up respinning the pacthes please replace the tab after "define" with a space
Sam
Hi Sam,
Sam Ravnborg wrote: [Wed Feb 01 2017, 11:30:18AM EST]
Quoted 24 lines
Hi Bob.
Nit pick below.
Quoted 18 lines · Bob Picco
From: bob picco <[email protected]>
Define some symbolic names for tsb/tlb miss trap tsb pointer computation.
Signed-off-by Bob Picco <[email protected]>--- arch/sparc/include/asm/spitfire.h | 5 +++++ arch/sparc/kernel/sun4v_tlb_miss.S | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-)arch/sparc/include/asm/spitfire.h +0
-0@@ -37,6 +37,11 @@#define SPITFIRE_HIGHEST_LOCKED_TLBENT (64 - 1)#define CHEETAH_HIGHEST_LOCKED_TLBENT (16 - 1)
Quoted 5 lines
arch/sparc/include/asm/spitfire.h line 43
Quoted 4 lines
arch/sparc/include/asm/spitfire.h +4
-0+#define HV_TSB_SIZE_BASE 0x200/* 512 TTE-s minimum. */ +#define HV_TSB_SIZE_BASE_SHIFT 0x09/* Shift of minimum tsb size. */ +#define HV_TSB_SIZE_MASK 0x07/* Size encoding of tsb. */ +#define HV_TSB_TTE_SIZE_SHIFT 0x04/* Sixteen byte tte size. */ If you end up respinning the pacthes please replace the tab after "define" with a space
Will do and thanx.
bob
Quoted 2 lines
Sam