Commit 51b47860 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull powerpc fix from Madhavan Srinivasan:

 - Fix spurious interrupts in Book3S HV Nested KVM

Thanks to Gautam Menghani.

* tag 'powerpc-6.12-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  KVM: PPC: Book3S HV: Mask off LPCR_MER for a vCPU before running it to avoid spurious interrupts
parents 906bd684 a373830f
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -4898,6 +4898,18 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
							   BOOK3S_INTERRUPT_EXTERNAL, 0);
			else
				lpcr |= LPCR_MER;
		} else {
			/*
			 * L1's copy of L2's LPCR (vcpu->arch.vcore->lpcr) can get its MER bit
			 * unexpectedly set - for e.g. during NMI handling when all register
			 * states are synchronized from L0 to L1. L1 needs to inform L0 about
			 * MER=1 only when there are pending external interrupts.
			 * In the above if check, MER bit is set if there are pending
			 * external interrupts. Hence, explicity mask off MER bit
			 * here as otherwise it may generate spurious interrupts in L2 KVM
			 * causing an endless loop, which results in L2 guest getting hung.
			 */
			lpcr &= ~LPCR_MER;
		}
	} else if (vcpu->arch.pending_exceptions ||
		   vcpu->arch.doorbell_request ||