KVM: PPC: Book3S HV nestedv2: Do not inject certain interrupts
authorJordan Niethe <jniethe5@gmail.com>
Fri, 1 Dec 2023 13:26:12 +0000 (18:56 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 7 Dec 2023 12:33:07 +0000 (23:33 +1100)
There is no need to inject an external interrupt in
kvmppc_book3s_irqprio_deliver() as the test for BOOK3S_IRQPRIO_EXTERNAL
in kvmhv_run_single_vcpu() before guest entry will raise LPCR_MER if
needed. There is also no need to inject the decrementer interrupt as
this will be raised within the L2 if needed. Avoiding these injections
reduces H_GUEST_GET_STATE hcalls by the L1.

Suggested-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231201132618.555031-8-vaibhav@linux.ibm.com
arch/powerpc/kvm/book3s.c

index 6cd20ab9e94eed2a2aa57ba322f565fed377c1d1..8acec144120eaf644cfc05eeaac721f2fa7fdec8 100644 (file)
@@ -302,11 +302,11 @@ static int kvmppc_book3s_irqprio_deliver(struct kvm_vcpu *vcpu,
 
        switch (priority) {
        case BOOK3S_IRQPRIO_DECREMENTER:
-               deliver = (kvmppc_get_msr(vcpu) & MSR_EE) && !crit;
+               deliver = !kvmhv_is_nestedv2() && (kvmppc_get_msr(vcpu) & MSR_EE) && !crit;
                vec = BOOK3S_INTERRUPT_DECREMENTER;
                break;
        case BOOK3S_IRQPRIO_EXTERNAL:
-               deliver = (kvmppc_get_msr(vcpu) & MSR_EE) && !crit;
+               deliver = !kvmhv_is_nestedv2() && (kvmppc_get_msr(vcpu) & MSR_EE) && !crit;
                vec = BOOK3S_INTERRUPT_EXTERNAL;
                break;
        case BOOK3S_IRQPRIO_SYSTEM_RESET: