diff options
author | Matt Fleming <matt@console-pimps.org> | 2009-11-17 16:05:31 -0500 |
---|---|---|
committer | Matt Fleming <matt@console-pimps.org> | 2010-01-16 09:28:57 -0500 |
commit | 8eda55142080f0373b1f0268fe6d6807f193e713 (patch) | |
tree | 6d103af69153dc5bfd78ebe89930cf3c66ec5b2b /arch/sh/mm | |
parent | 7dcaa8e8e67b2cfbe0097c9bb52e23aed5443b8b (diff) |
sh: New extended page flag to wire/unwire TLB entries
Provide a new extended page flag, _PAGE_WIRED and an SH4 implementation
for wiring TLB entries and use it in the fixmap code path so that we can
wire the fixmap TLB entry.
Signed-off-by: Matt Fleming <matt@console-pimps.org>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r-- | arch/sh/mm/tlb-pteaex.c | 66 | ||||
-rw-r--r-- | arch/sh/mm/tlb-sh4.c | 66 |
2 files changed, 132 insertions, 0 deletions
diff --git a/arch/sh/mm/tlb-pteaex.c b/arch/sh/mm/tlb-pteaex.c index 409b7c2b4b9d..88c8bb05e16d 100644 --- a/arch/sh/mm/tlb-pteaex.c +++ b/arch/sh/mm/tlb-pteaex.c | |||
@@ -76,3 +76,69 @@ void __uses_jump_to_uncached local_flush_tlb_one(unsigned long asid, | |||
76 | __raw_writel(asid, MMU_UTLB_ADDRESS_ARRAY2 | MMU_PAGE_ASSOC_BIT); | 76 | __raw_writel(asid, MMU_UTLB_ADDRESS_ARRAY2 | MMU_PAGE_ASSOC_BIT); |
77 | back_to_cached(); | 77 | back_to_cached(); |
78 | } | 78 | } |
79 | |||
80 | /* | ||
81 | * Load the entry for 'addr' into the TLB and wire the entry. | ||
82 | */ | ||
83 | void tlb_wire_entry(struct vm_area_struct *vma, unsigned long addr, pte_t pte) | ||
84 | { | ||
85 | unsigned long status, flags; | ||
86 | int urb; | ||
87 | |||
88 | local_irq_save(flags); | ||
89 | |||
90 | /* Load the entry into the TLB */ | ||
91 | __update_tlb(vma, addr, pte); | ||
92 | |||
93 | /* ... and wire it up. */ | ||
94 | status = ctrl_inl(MMUCR); | ||
95 | urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT; | ||
96 | status &= ~MMUCR_URB; | ||
97 | |||
98 | /* | ||
99 | * Make sure we're not trying to wire the last TLB entry slot. | ||
100 | */ | ||
101 | BUG_ON(!--urb); | ||
102 | |||
103 | urb = urb % MMUCR_URB_NENTRIES; | ||
104 | |||
105 | status |= (urb << MMUCR_URB_SHIFT); | ||
106 | ctrl_outl(status, MMUCR); | ||
107 | ctrl_barrier(); | ||
108 | |||
109 | local_irq_restore(flags); | ||
110 | } | ||
111 | |||
112 | /* | ||
113 | * Unwire the last wired TLB entry. | ||
114 | * | ||
115 | * It should also be noted that it is not possible to wire and unwire | ||
116 | * TLB entries in an arbitrary order. If you wire TLB entry N, followed | ||
117 | * by entry N+1, you must unwire entry N+1 first, then entry N. In this | ||
118 | * respect, it works like a stack or LIFO queue. | ||
119 | */ | ||
120 | void tlb_unwire_entry(void) | ||
121 | { | ||
122 | unsigned long status, flags; | ||
123 | int urb; | ||
124 | |||
125 | local_irq_save(flags); | ||
126 | |||
127 | status = ctrl_inl(MMUCR); | ||
128 | urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT; | ||
129 | status &= ~MMUCR_URB; | ||
130 | |||
131 | /* | ||
132 | * Make sure we're not trying to unwire a TLB entry when none | ||
133 | * have been wired. | ||
134 | */ | ||
135 | BUG_ON(urb++ == MMUCR_URB_NENTRIES); | ||
136 | |||
137 | urb = urb % MMUCR_URB_NENTRIES; | ||
138 | |||
139 | status |= (urb << MMUCR_URB_SHIFT); | ||
140 | ctrl_outl(status, MMUCR); | ||
141 | ctrl_barrier(); | ||
142 | |||
143 | local_irq_restore(flags); | ||
144 | } | ||
diff --git a/arch/sh/mm/tlb-sh4.c b/arch/sh/mm/tlb-sh4.c index 8cf550e2570f..4c6234743318 100644 --- a/arch/sh/mm/tlb-sh4.c +++ b/arch/sh/mm/tlb-sh4.c | |||
@@ -81,3 +81,69 @@ void __uses_jump_to_uncached local_flush_tlb_one(unsigned long asid, | |||
81 | ctrl_outl(data, addr); | 81 | ctrl_outl(data, addr); |
82 | back_to_cached(); | 82 | back_to_cached(); |
83 | } | 83 | } |
84 | |||
85 | /* | ||
86 | * Load the entry for 'addr' into the TLB and wire the entry. | ||
87 | */ | ||
88 | void tlb_wire_entry(struct vm_area_struct *vma, unsigned long addr, pte_t pte) | ||
89 | { | ||
90 | unsigned long status, flags; | ||
91 | int urb; | ||
92 | |||
93 | local_irq_save(flags); | ||
94 | |||
95 | /* Load the entry into the TLB */ | ||
96 | __update_tlb(vma, addr, pte); | ||
97 | |||
98 | /* ... and wire it up. */ | ||
99 | status = ctrl_inl(MMUCR); | ||
100 | urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT; | ||
101 | status &= ~MMUCR_URB; | ||
102 | |||
103 | /* | ||
104 | * Make sure we're not trying to wire the last TLB entry slot. | ||
105 | */ | ||
106 | BUG_ON(!--urb); | ||
107 | |||
108 | urb = urb % MMUCR_URB_NENTRIES; | ||
109 | |||
110 | status |= (urb << MMUCR_URB_SHIFT); | ||
111 | ctrl_outl(status, MMUCR); | ||
112 | ctrl_barrier(); | ||
113 | |||
114 | local_irq_restore(flags); | ||
115 | } | ||
116 | |||
117 | /* | ||
118 | * Unwire the last wired TLB entry. | ||
119 | * | ||
120 | * It should also be noted that it is not possible to wire and unwire | ||
121 | * TLB entries in an arbitrary order. If you wire TLB entry N, followed | ||
122 | * by entry N+1, you must unwire entry N+1 first, then entry N. In this | ||
123 | * respect, it works like a stack or LIFO queue. | ||
124 | */ | ||
125 | void tlb_unwire_entry(void) | ||
126 | { | ||
127 | unsigned long status, flags; | ||
128 | int urb; | ||
129 | |||
130 | local_irq_save(flags); | ||
131 | |||
132 | status = ctrl_inl(MMUCR); | ||
133 | urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT; | ||
134 | status &= ~MMUCR_URB; | ||
135 | |||
136 | /* | ||
137 | * Make sure we're not trying to unwire a TLB entry when none | ||
138 | * have been wired. | ||
139 | */ | ||
140 | BUG_ON(urb++ == MMUCR_URB_NENTRIES); | ||
141 | |||
142 | urb = urb % MMUCR_URB_NENTRIES; | ||
143 | |||
144 | status |= (urb << MMUCR_URB_SHIFT); | ||
145 | ctrl_outl(status, MMUCR); | ||
146 | ctrl_barrier(); | ||
147 | |||
148 | local_irq_restore(flags); | ||
149 | } | ||