diff options
Diffstat (limited to 'arch/powerpc/kvm/book3s_hv_rmhandlers.S')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_rmhandlers.S | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 690d1120402d..b48bd53dd771 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -313,7 +313,33 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) | |||
313 | mtspr SPRN_SDR1,r6 /* switch to partition page table */ | 313 | mtspr SPRN_SDR1,r6 /* switch to partition page table */ |
314 | mtspr SPRN_LPID,r7 | 314 | mtspr SPRN_LPID,r7 |
315 | isync | 315 | isync |
316 | |||
317 | /* See if we need to flush the TLB */ | ||
318 | lhz r6,PACAPACAINDEX(r13) /* test_bit(cpu, need_tlb_flush) */ | ||
319 | clrldi r7,r6,64-6 /* extract bit number (6 bits) */ | ||
320 | srdi r6,r6,6 /* doubleword number */ | ||
321 | sldi r6,r6,3 /* address offset */ | ||
322 | add r6,r6,r9 | ||
323 | addi r6,r6,KVM_NEED_FLUSH /* dword in kvm->arch.need_tlb_flush */ | ||
316 | li r0,1 | 324 | li r0,1 |
325 | sld r0,r0,r7 | ||
326 | ld r7,0(r6) | ||
327 | and. r7,r7,r0 | ||
328 | beq 22f | ||
329 | 23: ldarx r7,0,r6 /* if set, clear the bit */ | ||
330 | andc r7,r7,r0 | ||
331 | stdcx. r7,0,r6 | ||
332 | bne 23b | ||
333 | li r6,128 /* and flush the TLB */ | ||
334 | mtctr r6 | ||
335 | li r7,0x800 /* IS field = 0b10 */ | ||
336 | ptesync | ||
337 | 28: tlbiel r7 | ||
338 | addi r7,r7,0x1000 | ||
339 | bdnz 28b | ||
340 | ptesync | ||
341 | |||
342 | 22: li r0,1 | ||
317 | stb r0,VCORE_IN_GUEST(r5) /* signal secondaries to continue */ | 343 | stb r0,VCORE_IN_GUEST(r5) /* signal secondaries to continue */ |
318 | b 10f | 344 | b 10f |
319 | 345 | ||
@@ -336,36 +362,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) | |||
336 | mr r9,r4 | 362 | mr r9,r4 |
337 | blt hdec_soon | 363 | blt hdec_soon |
338 | 364 | ||
339 | /* | ||
340 | * Invalidate the TLB if we could possibly have stale TLB | ||
341 | * entries for this partition on this core due to the use | ||
342 | * of tlbiel. | ||
343 | * XXX maybe only need this on primary thread? | ||
344 | */ | ||
345 | ld r9,VCPU_KVM(r4) /* pointer to struct kvm */ | ||
346 | lwz r5,VCPU_VCPUID(r4) | ||
347 | lhz r6,PACAPACAINDEX(r13) | ||
348 | rldimi r6,r5,0,62 /* XXX map as if threads 1:1 p:v */ | ||
349 | lhz r8,VCPU_LAST_CPU(r4) | ||
350 | sldi r7,r6,1 /* see if this is the same vcpu */ | ||
351 | add r7,r7,r9 /* as last ran on this pcpu */ | ||
352 | lhz r0,KVM_LAST_VCPU(r7) | ||
353 | cmpw r6,r8 /* on the same cpu core as last time? */ | ||
354 | bne 3f | ||
355 | cmpw r0,r5 /* same vcpu as this core last ran? */ | ||
356 | beq 1f | ||
357 | 3: sth r6,VCPU_LAST_CPU(r4) /* if not, invalidate partition TLB */ | ||
358 | sth r5,KVM_LAST_VCPU(r7) | ||
359 | li r6,128 | ||
360 | mtctr r6 | ||
361 | li r7,0x800 /* IS field = 0b10 */ | ||
362 | ptesync | ||
363 | 2: tlbiel r7 | ||
364 | addi r7,r7,0x1000 | ||
365 | bdnz 2b | ||
366 | ptesync | ||
367 | 1: | ||
368 | |||
369 | /* Save purr/spurr */ | 365 | /* Save purr/spurr */ |
370 | mfspr r5,SPRN_PURR | 366 | mfspr r5,SPRN_PURR |
371 | mfspr r6,SPRN_SPURR | 367 | mfspr r6,SPRN_SPURR |