]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: PPC: Book3S HV Nested: L2 LPCR should inherit L1 LPES setting
authorNicholas Piggin <npiggin@gmail.com>
Thu, 3 Mar 2022 05:33:15 +0000 (15:33 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 13 May 2022 11:34:33 +0000 (21:34 +1000)
The L1 should not be able to adjust LPES mode for the L2. Setting LPES
if the L0 needs it clear would cause external interrupts to be sent to
L2 and missed by the L0.

Clearing LPES when it may be set, as typically happens with XIVE enabled
could cause a performance issue despite having no native XIVE support in
the guest, because it will cause mediated interrupts for the L2 to be
taken in HV mode, which then have to be injected.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Fabiano Rosas <farosas@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220303053315.1056880-7-npiggin@gmail.com
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv_nested.c

index 3d37448ddf445c41bc26936f3e54e4482adad9b1..cd63dd0eea3155f3a4cf38ff790e559f5e9a86f7 100644 (file)
@@ -5317,6 +5317,10 @@ static int kvmppc_core_init_vm_hv(struct kvm *kvm)
                kvm->arch.host_lpcr = lpcr = mfspr(SPRN_LPCR);
                lpcr &= LPCR_PECE | LPCR_LPES;
        } else {
+               /*
+                * The L2 LPES mode will be set by the L0 according to whether
+                * or not it needs to take external interrupts in HV mode.
+                */
                lpcr = 0;
        }
        lpcr |= (4UL << LPCR_DPFD_SH) | LPCR_HDICE |
index 75169e0753cea0f68cd883a25143445d08f959c3..ce08573fc58f840fde51e333c8d5c28549b2e527 100644 (file)
@@ -261,8 +261,7 @@ static void load_l2_hv_regs(struct kvm_vcpu *vcpu,
        /*
         * Don't let L1 change LPCR bits for the L2 except these:
         */
-       mask = LPCR_DPFD | LPCR_ILE | LPCR_TC | LPCR_AIL | LPCR_LD |
-               LPCR_LPES | LPCR_MER;
+       mask = LPCR_DPFD | LPCR_ILE | LPCR_TC | LPCR_AIL | LPCR_LD | LPCR_MER;
 
        /*
         * Additional filtering is required depending on hardware