diff options
Diffstat (limited to 'arch/powerpc/kvm/book3s_hv_rmhandlers.S')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_rmhandlers.S | 66 |
1 files changed, 8 insertions, 58 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 3f6fd78cccd2..fcf3a617cc8a 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -264,7 +264,11 @@ kvm_novcpu_exit: | |||
264 | addi r3, r4, VCPU_TB_RMEXIT | 264 | addi r3, r4, VCPU_TB_RMEXIT |
265 | bl kvmhv_accumulate_time | 265 | bl kvmhv_accumulate_time |
266 | #endif | 266 | #endif |
267 | 13: bl kvmhv_commence_exit | 267 | 13: mr r3, r12 |
268 | stw r12, 112-4(r1) | ||
269 | bl kvmhv_commence_exit | ||
270 | nop | ||
271 | lwz r12, 112-4(r1) | ||
268 | b kvmhv_switch_to_host | 272 | b kvmhv_switch_to_host |
269 | 273 | ||
270 | /* | 274 | /* |
@@ -1161,6 +1165,9 @@ mc_cont: | |||
1161 | 1165 | ||
1162 | /* Increment exit count, poke other threads to exit */ | 1166 | /* Increment exit count, poke other threads to exit */ |
1163 | bl kvmhv_commence_exit | 1167 | bl kvmhv_commence_exit |
1168 | nop | ||
1169 | ld r9, HSTATE_KVM_VCPU(r13) | ||
1170 | lwz r12, VCPU_TRAP(r9) | ||
1164 | 1171 | ||
1165 | /* Save guest CTRL register, set runlatch to 1 */ | 1172 | /* Save guest CTRL register, set runlatch to 1 */ |
1166 | mfspr r6,SPRN_CTRLF | 1173 | mfspr r6,SPRN_CTRLF |
@@ -1614,63 +1621,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | |||
1614 | mtlr r0 | 1621 | mtlr r0 |
1615 | blr | 1622 | blr |
1616 | 1623 | ||
1617 | kvmhv_commence_exit: /* r12 = trap, r13 = paca, doesn't trash r9 */ | ||
1618 | mflr r0 | ||
1619 | std r0, PPC_LR_STKOFF(r1) | ||
1620 | stdu r1, -PPC_MIN_STKFRM(r1) | ||
1621 | |||
1622 | /* Set our bit in the threads-exiting-guest map in the 0xff00 | ||
1623 | bits of vcore->entry_exit_map */ | ||
1624 | ld r5, HSTATE_KVM_VCORE(r13) | ||
1625 | lbz r4, HSTATE_PTID(r13) | ||
1626 | li r7, 0x100 | ||
1627 | sld r7, r7, r4 | ||
1628 | addi r6, r5, VCORE_ENTRY_EXIT | ||
1629 | 41: lwarx r3, 0, r6 | ||
1630 | or r0, r3, r7 | ||
1631 | stwcx. r0, 0, r6 | ||
1632 | bne 41b | ||
1633 | isync /* order stwcx. vs. reading napping_threads */ | ||
1634 | |||
1635 | /* | ||
1636 | * At this point we have an interrupt that we have to pass | ||
1637 | * up to the kernel or qemu; we can't handle it in real mode. | ||
1638 | * Thus we have to do a partition switch, so we have to | ||
1639 | * collect the other threads, if we are the first thread | ||
1640 | * to take an interrupt. To do this, we send a message or | ||
1641 | * IPI to all the threads that have their bit set in the entry | ||
1642 | * map in vcore->entry_exit_map (other than ourselves). | ||
1643 | * However, we don't need to bother if this is an HDEC | ||
1644 | * interrupt, since the other threads will already be on their | ||
1645 | * way here in that case. | ||
1646 | */ | ||
1647 | cmpwi r3,0x100 /* Are we the first here? */ | ||
1648 | bge 43f | ||
1649 | cmpwi r12,BOOK3S_INTERRUPT_HV_DECREMENTER | ||
1650 | beq 43f | ||
1651 | |||
1652 | srwi r0,r7,8 | ||
1653 | andc. r3,r3,r0 /* no sense IPI'ing ourselves */ | ||
1654 | beq 43f | ||
1655 | /* Order entry/exit update vs. IPIs */ | ||
1656 | sync | ||
1657 | mulli r4,r4,PACA_SIZE /* get paca for thread 0 */ | ||
1658 | subf r6,r4,r13 | ||
1659 | 42: andi. r0,r3,1 | ||
1660 | beq 44f | ||
1661 | ld r8,HSTATE_XICS_PHYS(r6) /* get thread's XICS reg addr */ | ||
1662 | li r0,IPI_PRIORITY | ||
1663 | li r7,XICS_MFRR | ||
1664 | stbcix r0,r7,r8 /* trigger the IPI */ | ||
1665 | 44: srdi. r3,r3,1 | ||
1666 | addi r6,r6,PACA_SIZE | ||
1667 | bne 42b | ||
1668 | |||
1669 | 43: ld r0, PPC_MIN_STKFRM+PPC_LR_STKOFF(r1) | ||
1670 | addi r1, r1, PPC_MIN_STKFRM | ||
1671 | mtlr r0 | ||
1672 | blr | ||
1673 | |||
1674 | /* | 1624 | /* |
1675 | * Check whether an HDSI is an HPTE not found fault or something else. | 1625 | * Check whether an HDSI is an HPTE not found fault or something else. |
1676 | * If it is an HPTE not found fault that is due to the guest accessing | 1626 | * If it is an HPTE not found fault that is due to the guest accessing |