diff options
author | Simon Guo <wei.guo.simon@gmail.com> | 2018-05-23 09:01:51 +0200 |
---|---|---|
committer | Paul Mackerras <paulus@ozlabs.org> | 2018-06-01 02:29:22 +0200 |
commit | 25ddda07b6e55a12065631e20f7f1e198230502f (patch) | |
tree | 00351ee751d03471f5c356ff56fdad86e2f823be /arch | |
parent | KVM: PPC: Book3S PR: Add C function wrapper for _kvmppc_save/restore_tm() (diff) | |
download | linux-25ddda07b6e55a12065631e20f7f1e198230502f.tar.xz linux-25ddda07b6e55a12065631e20f7f1e198230502f.zip |
KVM: PPC: Book3S PR: Transition to Suspended state when injecting interrupt
This patch simulates interrupt behavior per Power ISA while injecting
interrupt in PR KVM:
- When interrupt happens, transactional state should be suspended.
kvmppc_mmu_book3s_64_reset_msr() will be invoked when injecting an
interrupt. This patch performs this ISA logic in
kvmppc_mmu_book3s_64_reset_msr().
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kvm/book3s_64_mmu.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c index a93d719edc90..cf9d686e8162 100644 --- a/arch/powerpc/kvm/book3s_64_mmu.c +++ b/arch/powerpc/kvm/book3s_64_mmu.c @@ -38,7 +38,16 @@ static void kvmppc_mmu_book3s_64_reset_msr(struct kvm_vcpu *vcpu) { - kvmppc_set_msr(vcpu, vcpu->arch.intr_msr); + unsigned long msr = vcpu->arch.intr_msr; + unsigned long cur_msr = kvmppc_get_msr(vcpu); + + /* If transactional, change to suspend mode on IRQ delivery */ + if (MSR_TM_TRANSACTIONAL(cur_msr)) + msr |= MSR_TS_S; + else + msr |= cur_msr & MSR_TS_MASK; + + kvmppc_set_msr(vcpu, msr); } static struct kvmppc_slb *kvmppc_mmu_book3s_64_find_slbe( |