Skip to content

Commit 231d4e4

Browse files
npiggingregkh
authored andcommitted
KVM: PPC: Book3S HV Nested: L2 LPCR should inherit L1 LPES setting
[ Upstream commit 2852ebf ] 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 <[email protected]> Reviewed-by: Fabiano Rosas <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent 701a8a4 commit 231d4e4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

arch/powerpc/kvm/book3s_hv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5283,6 +5283,10 @@ static int kvmppc_core_init_vm_hv(struct kvm *kvm)
52835283
kvm->arch.host_lpcr = lpcr = mfspr(SPRN_LPCR);
52845284
lpcr &= LPCR_PECE | LPCR_LPES;
52855285
} else {
5286+
/*
5287+
* The L2 LPES mode will be set by the L0 according to whether
5288+
* or not it needs to take external interrupts in HV mode.
5289+
*/
52865290
lpcr = 0;
52875291
}
52885292
lpcr |= (4UL << LPCR_DPFD_SH) | LPCR_HDICE |

arch/powerpc/kvm/book3s_hv_nested.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ static void load_l2_hv_regs(struct kvm_vcpu *vcpu,
261261
/*
262262
* Don't let L1 change LPCR bits for the L2 except these:
263263
*/
264-
mask = LPCR_DPFD | LPCR_ILE | LPCR_TC | LPCR_AIL | LPCR_LD |
265-
LPCR_LPES | LPCR_MER;
264+
mask = LPCR_DPFD | LPCR_ILE | LPCR_TC | LPCR_AIL | LPCR_LD | LPCR_MER;
266265

267266
/*
268267
* Additional filtering is required depending on hardware

0 commit comments

Comments
 (0)