Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper" failed to apply to 6.12-stable tree
@ 2026-11-07 10:17 Sasha Levin
  2026-11-10 15:19 ` [PATCH 6.12.y] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2026-11-07 10:17 UTC (permalink / raw)
  To: xiaoyao.li, nik.borisov, seanjc; +Cc: stable

The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 326fa2c9b4d3e6cab58c139eb55aaabd7179192e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '20261107051725-failed-6.12-326fa2c9b4d3@kernel.org' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From 326fa2c9b4d3e6cab58c139eb55aaabd7179192e Mon Sep 17 00:00:00 2001
From: Xiaoyao Li <xiaoyao.li@intel.com>
Date: Wed, 19 Aug 2026 17:49:01 +0800
Subject: [PATCH] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper

Move handle_bus_lock_vmexit() from vmx.c to main.c to make it a shared
helper so that TDX can use it for Bus Lock VM exit handling as well.
Rename it to add vt_ prefix to reflect that it is a helper for both VMX
and TDX.

Cc: stable@vger.kernel.org
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Link: https://patch.msgid.link/20260819094903.3060020-8-xiaoyao.li@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/vmx/common.h |  1 +
 arch/x86/kvm/vmx/main.c   | 11 +++++++++++
 arch/x86/kvm/vmx/vmx.c    | 13 +------------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kvm/vmx/common.h b/arch/x86/kvm/vmx/common.h
index 7fce1bbabc78c..bbeec197a507a 100644
--- a/arch/x86/kvm/vmx/common.h
+++ b/arch/x86/kvm/vmx/common.h
@@ -203,5 +203,6 @@ static inline int __vt_handle_notify(struct kvm_vcpu *vcpu,
 }
 
 noinstr void vmx_handle_nmi(struct kvm_vcpu *vcpu);
+int vt_handle_bus_lock_vmexit(struct kvm_vcpu *vcpu);
 
 #endif /* __KVM_X86_VMX_COMMON_H */
diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
index ea0d825e556d2..835de375e8c8c 100644
--- a/arch/x86/kvm/vmx/main.c
+++ b/arch/x86/kvm/vmx/main.c
@@ -878,6 +878,17 @@ static int vt_gmem_max_mapping_level(struct kvm *kvm, kvm_pfn_t pfn,
 #define vt_op_tdx_only(name) NULL
 #endif /* CONFIG_KVM_INTEL_TDX */
 
+int vt_handle_bus_lock_vmexit(struct kvm_vcpu *vcpu)
+{
+	/*
+	 * Hardware may or may not set the BUS_LOCK_DETECTED flag on BUS_LOCK
+	 * VM-Exits. Unconditionally set the flag here and leave the handling
+	 * to .handle_exit() callback.
+	 */
+	to_vt(vcpu)->exit_reason.bus_lock_detected = true;
+	return 1;
+}
+
 #define VMX_REQUIRED_APICV_INHIBITS				\
 	(BIT(APICV_INHIBIT_REASON_DISABLED) |			\
 	 BIT(APICV_INHIBIT_REASON_ABSENT) |			\
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 6df390ae8708f..3ba1e762e7e75 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6267,17 +6267,6 @@ static int handle_encls(struct kvm_vcpu *vcpu)
 }
 #endif /* CONFIG_X86_SGX_KVM */
 
-static int handle_bus_lock_vmexit(struct kvm_vcpu *vcpu)
-{
-	/*
-	 * Hardware may or may not set the BUS_LOCK_DETECTED flag on BUS_LOCK
-	 * VM-Exits. Unconditionally set the flag here and leave the handling to
-	 * vmx_handle_exit().
-	 */
-	to_vt(vcpu)->exit_reason.bus_lock_detected = true;
-	return 1;
-}
-
 static int handle_notify(struct kvm_vcpu *vcpu)
 {
 	unsigned long exit_qual = vmx_get_exit_qual(vcpu);
@@ -6366,7 +6355,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
 	[EXIT_REASON_VMFUNC]		      = handle_vmx_instruction,
 	[EXIT_REASON_PREEMPTION_TIMER]	      = handle_preemption_timer,
 	[EXIT_REASON_ENCLS]		      = handle_encls,
-	[EXIT_REASON_BUS_LOCK]                = handle_bus_lock_vmexit,
+	[EXIT_REASON_BUS_LOCK]                = vt_handle_bus_lock_vmexit,
 	[EXIT_REASON_NOTIFY]		      = handle_notify,
 	[EXIT_REASON_SEAMCALL]		      = handle_tdx_instruction,
 	[EXIT_REASON_TDCALL]		      = handle_tdx_instruction,
-- 
2.53.0





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 6.12.y] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper
  2026-11-07 10:17 FAILED: patch "[PATCH] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper" failed to apply to 6.12-stable tree Sasha Levin
@ 2026-11-10 15:19 ` Sasha Levin
  2026-11-11  9:44   ` Xiaoyao Li
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2026-11-10 15:19 UTC (permalink / raw)
  To: stable; +Cc: Xiaoyao Li, Nikolay Borisov, Sean Christopherson, Sasha Levin

From: Xiaoyao Li <xiaoyao.li@intel.com>

[ Upstream commit 326fa2c9b4d3e6cab58c139eb55aaabd7179192e ]

Move handle_bus_lock_vmexit() from vmx.c to main.c to make it a shared
helper so that TDX can use it for Bus Lock VM exit handling as well.
Rename it to add vt_ prefix to reflect that it is a helper for both VMX
and TDX.

Cc: stable@vger.kernel.org
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Link: https://patch.msgid.link/20260819094903.3060020-8-xiaoyao.li@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
[ sashal: Replaced to_vt() with to_vmx() to access exit_reason in the existing vCPU structure. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/kvm/vmx/common.h |  2 ++
 arch/x86/kvm/vmx/main.c   | 12 ++++++++++++
 arch/x86/kvm/vmx/vmx.c    | 13 +------------
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kvm/vmx/common.h b/arch/x86/kvm/vmx/common.h
index 27beb9d431e00..86d6753a0d867 100644
--- a/arch/x86/kvm/vmx/common.h
+++ b/arch/x86/kvm/vmx/common.h
@@ -31,4 +31,6 @@ static inline int __vmx_handle_ept_violation(struct kvm_vcpu *vcpu, gpa_t gpa,
 	return kvm_mmu_page_fault(vcpu, gpa, error_code, NULL, 0);
 }
 
+int vt_handle_bus_lock_vmexit(struct kvm_vcpu *vcpu);
+
 #endif /* __KVM_X86_VMX_COMMON_H */
diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
index 8a922ce0d19c4..089a544cba862 100644
--- a/arch/x86/kvm/vmx/main.c
+++ b/arch/x86/kvm/vmx/main.c
@@ -3,10 +3,22 @@
 
 #include "x86_ops.h"
 #include "vmx.h"
+#include "common.h"
 #include "nested.h"
 #include "pmu.h"
 #include "posted_intr.h"
 
+int vt_handle_bus_lock_vmexit(struct kvm_vcpu *vcpu)
+{
+	/*
+	 * Hardware may or may not set the BUS_LOCK_DETECTED flag on BUS_LOCK
+	 * VM-Exits. Unconditionally set the flag here and leave the handling
+	 * to .handle_exit() callback.
+	 */
+	to_vmx(vcpu)->exit_reason.bus_lock_detected = true;
+	return 1;
+}
+
 #define VMX_REQUIRED_APICV_INHIBITS				\
 	(BIT(APICV_INHIBIT_REASON_DISABLED) |			\
 	 BIT(APICV_INHIBIT_REASON_ABSENT) |			\
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 8e23e901a7593..a5614dd74e8cf 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6051,17 +6051,6 @@ static int handle_encls(struct kvm_vcpu *vcpu)
 }
 #endif /* CONFIG_X86_SGX_KVM */
 
-static int handle_bus_lock_vmexit(struct kvm_vcpu *vcpu)
-{
-	/*
-	 * Hardware may or may not set the BUS_LOCK_DETECTED flag on BUS_LOCK
-	 * VM-Exits. Unconditionally set the flag here and leave the handling to
-	 * vmx_handle_exit().
-	 */
-	to_vmx(vcpu)->exit_reason.bus_lock_detected = true;
-	return 1;
-}
-
 static int handle_notify(struct kvm_vcpu *vcpu)
 {
 	unsigned long exit_qual = vmx_get_exit_qual(vcpu);
@@ -6144,7 +6133,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
 	[EXIT_REASON_VMFUNC]		      = handle_vmx_instruction,
 	[EXIT_REASON_PREEMPTION_TIMER]	      = handle_preemption_timer,
 	[EXIT_REASON_ENCLS]		      = handle_encls,
-	[EXIT_REASON_BUS_LOCK]                = handle_bus_lock_vmexit,
+	[EXIT_REASON_BUS_LOCK]                = vt_handle_bus_lock_vmexit,
 	[EXIT_REASON_NOTIFY]		      = handle_notify,
 };
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 6.12.y] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper
  2026-11-10 15:19 ` [PATCH 6.12.y] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper Sasha Levin
@ 2026-11-11  9:44   ` Xiaoyao Li
  2026-11-11 15:54     ` Sean Christopherson
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaoyao Li @ 2026-11-11  9:44 UTC (permalink / raw)
  To: Sasha Levin, stable; +Cc: Nikolay Borisov, Sean Christopherson

On 11/10/2026 11:19 PM, Sasha Levin wrote:
> From: Xiaoyao Li <xiaoyao.li@intel.com>
> 
> [ Upstream commit 326fa2c9b4d3e6cab58c139eb55aaabd7179192e ]
> 
> Move handle_bus_lock_vmexit() from vmx.c to main.c to make it a shared
> helper so that TDX can use it for Bus Lock VM exit handling as well.
> Rename it to add vt_ prefix to reflect that it is a helper for both VMX
> and TDX.

TDX support was merged since 6.16. I think we don't need to backport this patch
before 6.16 since there are no TDX code to share anything and no vt_*()
functions at all.

> Cc: stable@vger.kernel.org
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
> Link: https://patch.msgid.link/20260819094903.3060020-8-xiaoyao.li@intel.com
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> [ sashal: Replaced to_vt() with to_vmx() to access exit_reason in the existing vCPU structure. ]
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  arch/x86/kvm/vmx/common.h |  2 ++
>  arch/x86/kvm/vmx/main.c   | 12 ++++++++++++
>  arch/x86/kvm/vmx/vmx.c    | 13 +------------
>  3 files changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/common.h b/arch/x86/kvm/vmx/common.h
> index 27beb9d431e00..86d6753a0d867 100644
> --- a/arch/x86/kvm/vmx/common.h
> +++ b/arch/x86/kvm/vmx/common.h
> @@ -31,4 +31,6 @@ static inline int __vmx_handle_ept_violation(struct kvm_vcpu *vcpu, gpa_t gpa,
>  	return kvm_mmu_page_fault(vcpu, gpa, error_code, NULL, 0);
>  }
>  
> +int vt_handle_bus_lock_vmexit(struct kvm_vcpu *vcpu);
> +
>  #endif /* __KVM_X86_VMX_COMMON_H */
> diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
> index 8a922ce0d19c4..089a544cba862 100644
> --- a/arch/x86/kvm/vmx/main.c
> +++ b/arch/x86/kvm/vmx/main.c
> @@ -3,10 +3,22 @@
>  
>  #include "x86_ops.h"
>  #include "vmx.h"
> +#include "common.h"
>  #include "nested.h"
>  #include "pmu.h"
>  #include "posted_intr.h"
>  
> +int vt_handle_bus_lock_vmexit(struct kvm_vcpu *vcpu)
> +{
> +	/*
> +	 * Hardware may or may not set the BUS_LOCK_DETECTED flag on BUS_LOCK
> +	 * VM-Exits. Unconditionally set the flag here and leave the handling
> +	 * to .handle_exit() callback.
> +	 */
> +	to_vmx(vcpu)->exit_reason.bus_lock_detected = true;
> +	return 1;
> +}
> +
>  #define VMX_REQUIRED_APICV_INHIBITS				\
>  	(BIT(APICV_INHIBIT_REASON_DISABLED) |			\
>  	 BIT(APICV_INHIBIT_REASON_ABSENT) |			\
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 8e23e901a7593..a5614dd74e8cf 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -6051,17 +6051,6 @@ static int handle_encls(struct kvm_vcpu *vcpu)
>  }
>  #endif /* CONFIG_X86_SGX_KVM */
>  
> -static int handle_bus_lock_vmexit(struct kvm_vcpu *vcpu)
> -{
> -	/*
> -	 * Hardware may or may not set the BUS_LOCK_DETECTED flag on BUS_LOCK
> -	 * VM-Exits. Unconditionally set the flag here and leave the handling to
> -	 * vmx_handle_exit().
> -	 */
> -	to_vmx(vcpu)->exit_reason.bus_lock_detected = true;
> -	return 1;
> -}
> -
>  static int handle_notify(struct kvm_vcpu *vcpu)
>  {
>  	unsigned long exit_qual = vmx_get_exit_qual(vcpu);
> @@ -6144,7 +6133,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
>  	[EXIT_REASON_VMFUNC]		      = handle_vmx_instruction,
>  	[EXIT_REASON_PREEMPTION_TIMER]	      = handle_preemption_timer,
>  	[EXIT_REASON_ENCLS]		      = handle_encls,
> -	[EXIT_REASON_BUS_LOCK]                = handle_bus_lock_vmexit,
> +	[EXIT_REASON_BUS_LOCK]                = vt_handle_bus_lock_vmexit,
>  	[EXIT_REASON_NOTIFY]		      = handle_notify,
>  };
>  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 6.12.y] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper
  2026-11-11  9:44   ` Xiaoyao Li
@ 2026-11-11 15:54     ` Sean Christopherson
  0 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2026-11-11 15:54 UTC (permalink / raw)
  To: Xiaoyao Li; +Cc: Sasha Levin, stable, Nikolay Borisov

On Wed, Nov 11, 2026, Xiaoyao Li wrote:
> On 11/10/2026 11:19 PM, Sasha Levin wrote:
> > From: Xiaoyao Li <xiaoyao.li@intel.com>
> > 
> > [ Upstream commit 326fa2c9b4d3e6cab58c139eb55aaabd7179192e ]
> > 
> > Move handle_bus_lock_vmexit() from vmx.c to main.c to make it a shared
> > helper so that TDX can use it for Bus Lock VM exit handling as well.
> > Rename it to add vt_ prefix to reflect that it is a helper for both VMX
> > and TDX.
> 
> TDX support was merged since 6.16. I think we don't need to backport this patch
> before 6.16 since there are no TDX code to share anything and no vt_*()
> functions at all.

Agreed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-11 15:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07 10:17 FAILED: patch "[PATCH] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper" failed to apply to 6.12-stable tree Sasha Levin
2026-11-10 15:19 ` [PATCH 6.12.y] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper Sasha Levin
2026-11-11  9:44   ` Xiaoyao Li
2026-11-11 15:54     ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox