diff options
author | David S. Miller <davem@davemloft.net> | 2006-01-31 21:31:20 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:11:17 -0500 |
commit | 98c5584cfc47932c4f3ccf5eee2e0bae1447b85e (patch) | |
tree | c067ac8bfc081bbe0b3073374cb15708458e04ab /include | |
parent | 09f94287f7260e03bbeab497e743691fafcc22c3 (diff) |
[SPARC64]: Add infrastructure for dynamic TSB sizing.
This also cleans up tsb_context_switch(). The assembler
routine is now __tsb_context_switch() and the former is
an inline function that picks out the bits from the mm_struct
and passes it into the assembler code as arguments.
setup_tsb_parms() computes the locked TLB entry to map the
TSB. Later when we support using the physical address quad
load instructions of Cheetah+ and later, we'll simply use
the physical address for the TSB register value and set
the map virtual and PTE both to zero.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-sparc64/mmu.h | 13 | ||||
-rw-r--r-- | include/asm-sparc64/mmu_context.h | 15 | ||||
-rw-r--r-- | include/asm-sparc64/tsb.h | 2 |
3 files changed, 24 insertions, 6 deletions
diff --git a/include/asm-sparc64/mmu.h b/include/asm-sparc64/mmu.h index 36384cf7faa6..2effeba2476c 100644 --- a/include/asm-sparc64/mmu.h +++ b/include/asm-sparc64/mmu.h | |||
@@ -90,9 +90,20 @@ | |||
90 | 90 | ||
91 | #ifndef __ASSEMBLY__ | 91 | #ifndef __ASSEMBLY__ |
92 | 92 | ||
93 | #define TSB_ENTRY_ALIGNMENT 16 | ||
94 | |||
95 | struct tsb { | ||
96 | unsigned long tag; | ||
97 | unsigned long pte; | ||
98 | } __attribute__((aligned(TSB_ENTRY_ALIGNMENT))); | ||
99 | |||
93 | typedef struct { | 100 | typedef struct { |
94 | unsigned long sparc64_ctx_val; | 101 | unsigned long sparc64_ctx_val; |
95 | unsigned long *sparc64_tsb; | 102 | struct tsb *tsb; |
103 | unsigned long tsb_nentries; | ||
104 | unsigned long tsb_reg_val; | ||
105 | unsigned long tsb_map_vaddr; | ||
106 | unsigned long tsb_map_pte; | ||
96 | } mm_context_t; | 107 | } mm_context_t; |
97 | 108 | ||
98 | #endif /* !__ASSEMBLY__ */ | 109 | #endif /* !__ASSEMBLY__ */ |
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h index 0dffb4ce8a1d..0a950f151d2b 100644 --- a/include/asm-sparc64/mmu_context.h +++ b/include/asm-sparc64/mmu_context.h | |||
@@ -22,7 +22,15 @@ extern void get_new_mmu_context(struct mm_struct *mm); | |||
22 | extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | 22 | extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); |
23 | extern void destroy_context(struct mm_struct *mm); | 23 | extern void destroy_context(struct mm_struct *mm); |
24 | 24 | ||
25 | extern unsigned long tsb_context_switch(unsigned long pgd_pa, unsigned long *tsb); | 25 | extern void __tsb_context_switch(unsigned long pgd_pa, unsigned long tsb_reg, |
26 | unsigned long tsb_vaddr, unsigned long tsb_pte); | ||
27 | |||
28 | static inline void tsb_context_switch(struct mm_struct *mm) | ||
29 | { | ||
30 | __tsb_context_switch(__pa(mm->pgd), mm->context.tsb_reg_val, | ||
31 | mm->context.tsb_map_vaddr, | ||
32 | mm->context.tsb_map_pte); | ||
33 | } | ||
26 | 34 | ||
27 | /* Set MMU context in the actual hardware. */ | 35 | /* Set MMU context in the actual hardware. */ |
28 | #define load_secondary_context(__mm) \ | 36 | #define load_secondary_context(__mm) \ |
@@ -52,8 +60,7 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str | |||
52 | 60 | ||
53 | if (!ctx_valid || (old_mm != mm)) { | 61 | if (!ctx_valid || (old_mm != mm)) { |
54 | load_secondary_context(mm); | 62 | load_secondary_context(mm); |
55 | tsb_context_switch(__pa(mm->pgd), | 63 | tsb_context_switch(mm); |
56 | mm->context.sparc64_tsb); | ||
57 | } | 64 | } |
58 | 65 | ||
59 | /* Even if (mm == old_mm) we _must_ check | 66 | /* Even if (mm == old_mm) we _must_ check |
@@ -91,7 +98,7 @@ static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm | |||
91 | 98 | ||
92 | load_secondary_context(mm); | 99 | load_secondary_context(mm); |
93 | __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT); | 100 | __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT); |
94 | tsb_context_switch(__pa(mm->pgd), mm->context.sparc64_tsb); | 101 | tsb_context_switch(mm); |
95 | } | 102 | } |
96 | 103 | ||
97 | #endif /* !(__ASSEMBLY__) */ | 104 | #endif /* !(__ASSEMBLY__) */ |
diff --git a/include/asm-sparc64/tsb.h b/include/asm-sparc64/tsb.h index 03d272e0e477..1f93b7d8cdbc 100644 --- a/include/asm-sparc64/tsb.h +++ b/include/asm-sparc64/tsb.h | |||
@@ -19,7 +19,7 @@ | |||
19 | * stxa %g5, [%g0] ASI_{D,I}TLB_DATA_IN | 19 | * stxa %g5, [%g0] ASI_{D,I}TLB_DATA_IN |
20 | * retry | 20 | * retry |
21 | * | 21 | * |
22 | 22 | * | |
23 | * Each 16-byte slot of the TSB is the 8-byte tag and then the 8-byte | 23 | * Each 16-byte slot of the TSB is the 8-byte tag and then the 8-byte |
24 | * PTE. The TAG is of the same layout as the TLB TAG TARGET mmu | 24 | * PTE. The TAG is of the same layout as the TLB TAG TARGET mmu |
25 | * register which is: | 25 | * register which is: |