diff mbox series

[SRU,N,2/2] KVM: PPC: Book3S HV nestedv2: Fix doorbell emulation

Message ID 20240902083444.1600778-3-frank.heimes@canonical.com
State New
Headers show
Series KOP L2 guest fails to boot with 1 core - SMT8 topology (LP: 2070329) | expand

Commit Message

Frank Heimes Sept. 2, 2024, 8:34 a.m. UTC
From: Gautam Menghani <gautam@linux.ibm.com>

BugLink: https://bugs.launchpad.net/bugs/2070329

Doorbell emulation is broken for KVM on PAPR guests as support for DPDES
was not added in the initial patch series. Due to this, a KVM on PAPR
guest with SMT > 1 cannot be booted with the XICS interrupt controller
as doorbells are setup in the initial probe path when using XICS
(pSeries_smp_probe()).

Command to replicate the above bug:

qemu-system-ppc64 \
	-drive file=rhel.qcow2,format=qcow2 \
	-m 20G \
	-smp 8,cores=1,threads=8 \
	-cpu  host \
	-nographic \
	-machine pseries,ic-mode=xics -accel kvm

Add doorbell state handling support in the host KVM code to fix doorbell
emulation.

Fixes: 19d31c5f1157 ("KVM: PPC: Add support for nestedv2 guests")
Cc: stable@vger.kernel.org # v6.7+
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240605113913.83715-3-gautam@linux.ibm.com
(cherry picked from commit 54ec2bd9e0173b75daf84675d07c56584f96564b)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
---
 arch/powerpc/kvm/book3s_hv.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index e47b954ce266..a03ad93b971d 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -4115,6 +4115,11 @@  static int kvmhv_vcpu_entry_nestedv2(struct kvm_vcpu *vcpu, u64 time_limit,
 	int trap;
 	long rc;
 
+	if (vcpu->arch.doorbell_request) {
+		vcpu->arch.doorbell_request = 0;
+		kvmppc_set_dpdes(vcpu, 1);
+	}
+
 	io = &vcpu->arch.nestedv2_io;
 
 	msr = mfmsr();