diff options
Diffstat (limited to 'arch/sparc/kernel/setup_64.c')
-rw-r--r-- | arch/sparc/kernel/setup_64.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index c965595aa7e9..a854a1c240ff 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -234,40 +234,50 @@ void __init per_cpu_patch(void) | |||
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | void __init sun4v_patch(void) | 237 | void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *start, |
238 | struct sun4v_1insn_patch_entry *end) | ||
238 | { | 239 | { |
239 | extern void sun4v_hvapi_init(void); | 240 | while (start < end) { |
240 | struct sun4v_1insn_patch_entry *p1; | 241 | unsigned long addr = start->addr; |
241 | struct sun4v_2insn_patch_entry *p2; | ||
242 | |||
243 | if (tlb_type != hypervisor) | ||
244 | return; | ||
245 | 242 | ||
246 | p1 = &__sun4v_1insn_patch; | 243 | *(unsigned int *) (addr + 0) = start->insn; |
247 | while (p1 < &__sun4v_1insn_patch_end) { | ||
248 | unsigned long addr = p1->addr; | ||
249 | |||
250 | *(unsigned int *) (addr + 0) = p1->insn; | ||
251 | wmb(); | 244 | wmb(); |
252 | __asm__ __volatile__("flush %0" : : "r" (addr + 0)); | 245 | __asm__ __volatile__("flush %0" : : "r" (addr + 0)); |
253 | 246 | ||
254 | p1++; | 247 | start++; |
255 | } | 248 | } |
249 | } | ||
256 | 250 | ||
257 | p2 = &__sun4v_2insn_patch; | 251 | void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *start, |
258 | while (p2 < &__sun4v_2insn_patch_end) { | 252 | struct sun4v_2insn_patch_entry *end) |
259 | unsigned long addr = p2->addr; | 253 | { |
254 | while (start < end) { | ||
255 | unsigned long addr = start->addr; | ||
260 | 256 | ||
261 | *(unsigned int *) (addr + 0) = p2->insns[0]; | 257 | *(unsigned int *) (addr + 0) = start->insns[0]; |
262 | wmb(); | 258 | wmb(); |
263 | __asm__ __volatile__("flush %0" : : "r" (addr + 0)); | 259 | __asm__ __volatile__("flush %0" : : "r" (addr + 0)); |
264 | 260 | ||
265 | *(unsigned int *) (addr + 4) = p2->insns[1]; | 261 | *(unsigned int *) (addr + 4) = start->insns[1]; |
266 | wmb(); | 262 | wmb(); |
267 | __asm__ __volatile__("flush %0" : : "r" (addr + 4)); | 263 | __asm__ __volatile__("flush %0" : : "r" (addr + 4)); |
268 | 264 | ||
269 | p2++; | 265 | start++; |
270 | } | 266 | } |
267 | } | ||
268 | |||
269 | void __init sun4v_patch(void) | ||
270 | { | ||
271 | extern void sun4v_hvapi_init(void); | ||
272 | |||
273 | if (tlb_type != hypervisor) | ||
274 | return; | ||
275 | |||
276 | sun4v_patch_1insn_range(&__sun4v_1insn_patch, | ||
277 | &__sun4v_1insn_patch_end); | ||
278 | |||
279 | sun4v_patch_2insn_range(&__sun4v_2insn_patch, | ||
280 | &__sun4v_2insn_patch_end); | ||
271 | 281 | ||
272 | sun4v_hvapi_init(); | 282 | sun4v_hvapi_init(); |
273 | } | 283 | } |