From nobody Sat Feb 7 15:12:18 2026 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76A3D43C067 for ; Fri, 6 Feb 2026 19:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770404968; cv=none; b=POWinoqiYy6s86tmkMMz55WYnccpr+DesirhId/YKQNfiF5JTKLkAJq88KsUvdy9BNZKryF8uRpzcYJJqqcO6z49qGJ2AMfEy5fhxV2BTQGRnFR5olhxMD+ZgATDCAUhdh1iCMGh2EKevZx+7lu0+SzAq4dSjfifndlc/haew2k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770404968; c=relaxed/simple; bh=ODb2/IeBwTyKMp4WD85zCZj6S9Ai9FchMpNcAg0S+no=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WZ642jaL8IaoBLLPYGtgl+Dqrj3BD7kFfiXh+T3Mvm6toMvGMCoeVkkHXbt87BzmGC2gqdgtp3kYlinE9f3TXhx5tgrwFYFR+HOp2vz8ewdkxGPxclHfsUW+Gn6E6qXasqPu9z0aEAGJngSsJ1DGDMPD6gQCfwNVbJOOncnUYq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=cYkUgsYk; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="cYkUgsYk" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1770404967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iUgewoR9hSRJHPl5m11yn7PrfmFETAQcerjNyaq/Mfs=; b=cYkUgsYkjTu4mizejs2EwuPQugsVehayIX12RSQc1G2FjrUPlGmMglVDBoxIVQgJWdOwkh ZGPbabTcSAbIEZiCFOyNX8DDLTNftsppEW5nmSsgEfApvnZ0+nUSdgfGNKU+gRyEzziZPS ZCeV9/r70YY/lGXbMu6MwlnBqemATh8= From: Yosry Ahmed To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed , stable@vger.kernel.org Subject: [PATCH v5 11/26] KVM: nSVM: Call nested_svm_merge_msrpm() from enter_svm_guest_mode() Date: Fri, 6 Feb 2026 19:08:36 +0000 Message-ID: <20260206190851.860662-12-yosry.ahmed@linux.dev> In-Reply-To: <20260206190851.860662-1-yosry.ahmed@linux.dev> References: <20260206190851.860662-1-yosry.ahmed@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" In preparation for unifying the VMRUN failure code paths, move calling nested_svm_merge_msrpm() into enter_svm_guest_mode() next to the nested_svm_load_cr3() call (the other failure path in enter_svm_guest_mode()). Adding more uses of the from_vmrun parameter is not pretty, but it is plumbed all the way to nested_svm_load_cr3() so it's not going away soon anyway. No functional change intended. Cc: stable@vger.kernel.org Signed-off-by: Yosry Ahmed --- arch/x86/kvm/svm/nested.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 6e7238fed7ab..c16b68a07369 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -956,6 +956,12 @@ int enter_svm_guest_mode(struct kvm_vcpu *vcpu, u64 vm= cb12_gpa, if (ret) return ret; =20 + if (from_vmrun) { + ret =3D nested_svm_merge_msrpm(vcpu); + if (ret) + return ret; + } + if (!from_vmrun) kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu); =20 @@ -1034,22 +1040,17 @@ int nested_svm_vmrun(struct kvm_vcpu *vcpu) =20 svm->nested.nested_run_pending =3D 1; =20 - if (enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, true)) - goto out_exit_err; - - if (!nested_svm_merge_msrpm(vcpu)) - goto out; - -out_exit_err: - svm->nested.nested_run_pending =3D 0; - svm->nmi_l1_to_l2 =3D false; - svm->soft_int_injected =3D false; + if (enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, true)) { + svm->nested.nested_run_pending =3D 0; + svm->nmi_l1_to_l2 =3D false; + svm->soft_int_injected =3D false; =20 - svm->vmcb->control.exit_code =3D SVM_EXIT_ERR; - svm->vmcb->control.exit_info_1 =3D 0; - svm->vmcb->control.exit_info_2 =3D 0; + svm->vmcb->control.exit_code =3D SVM_EXIT_ERR; + svm->vmcb->control.exit_info_1 =3D 0; + svm->vmcb->control.exit_info_2 =3D 0; =20 - nested_svm_vmexit(svm); + nested_svm_vmexit(svm); + } =20 out: kvm_vcpu_unmap(vcpu, &map); --=20 2.53.0.rc2.204.g2597b5adb4-goog