[GIT PULL] KVM: x86: VMX+TDX changes for 7.4
From: Sean Christopherson
Date: Fri Oct 16 2026 - 00:48:58 EST
Tag says "vmx", but this is almost entirely TDX focused.
The INIT_MEM_REGION fixes will conflict with the "coco" branch due to in-place
conversion allowing a null/0 source address:
diff --cc arch/x86/kvm/vmx/tdx.c
index b816331fcc98,2a3acf493cb5..ee1d412b0ee6
--- arch/x86/kvm/vmx/tdx.c
+++ arch/x86/kvm/vmx/tdx.c
@@@ -3233,12 -3274,14 +3272,15 @@@ static int tdx_vcpu_init_mem_region(str
if (copy_from_user(®ion, u64_to_user_ptr(cmd->data), sizeof(region)))
return -EFAULT;
- if (!PAGE_ALIGNED(region.source_addr) || !region.source_addr ||
+ if (!PAGE_ALIGNED(region.source_addr) ||
+ (!gmem_in_place_conversion && !region.source_addr) ||
- !PAGE_ALIGNED(region.gpa) || !region.nr_pages ||
- region.gpa + (region.nr_pages << PAGE_SHIFT) <= region.gpa ||
+ !PAGE_ALIGNED(region.gpa) || !region.nr_pages)
+ return -EINVAL;
+
+ if (check_shl_overflow(region.nr_pages, PAGE_SHIFT, &nr_bytes) ||
+ check_add_overflow(region.gpa, nr_bytes - 1, &end_gpa) ||
!vt_is_tdx_private_gpa(kvm, region.gpa) ||
- !vt_is_tdx_private_gpa(kvm, region.gpa + (region.nr_pages << PAGE_SHIFT) - 1))
+ !vt_is_tdx_private_gpa(kvm, end_gpa))
return -EINVAL;
ret = 0;
The vmx=>vt renames will conflict with the "misc" branch because of a collision
with the change to track kvm_vcpu_arch.pending_ioapic_eoi as a u8 (four lines
of code in a function that's been touched _once_ since it was added in 2013,
and somehow I manage to create a conflict in a single release cycle, *sigh*).
diff --cc arch/x86/kvm/vmx/vmx.c
index 686e586f3290,cf32aee0aab7..b341af4c6057
--- arch/x86/kvm/vmx/vmx.c
+++ arch/x86/kvm/vmx/vmx.c
@@@ -5898,10 -5881,11 +5892,10 @@@ static int handle_apic_access(struct kv
static int handle_apic_eoi_induced(struct kvm_vcpu *vcpu)
{
- unsigned long exit_qualification = vmx_get_exit_qual(vcpu);
+ unsigned long exit_qualification = vt_get_exit_qual(vcpu);
- int vector = exit_qualification & 0xff;
/* EOI-induced VM exit is trap-like and thus no need to adjust IP */
- kvm_apic_set_eoi_accelerated(vcpu, vector);
+ kvm_apic_set_eoi_accelerated(vcpu, exit_qualification & 0xff);
return 1;
}
The following changes since commit d4b7fb647204f0c81dfeae2d1a708e4d858e0c94:
Merge branch 'kvm-xen-longmode' into HEAD (2026-09-04 17:35:03 +0200)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-7.4
for you to fetch changes up to 883719f57f5d3898637b130d6db4742471cad618:
KVM: x86: Clear hardware HLT state when userspace makes a vCPU not-halted (2026-09-28 16:20:35 -0700)
----------------------------------------------------------------
KVM VMX changes for 7.4
- Enable Notify VM-Exits (now called Instruction Timeout in the SDM) and Bus
Lock VM-Exits for TDX guests when they're enabled by userspace (KVM forgot
to wire up the TDX Module knobs).
- Move all common (between VMX and TDX) APIs/helpers to common.h/main.c, and
change all namespace prefixes from "vmx" to "vt".
- Fix a thankfully benign bug (due to other areas of KVM being hardened) where
usersepace can bypass INIT_MEM_REGION's address wrap check by providing a
nr_pages that will overflow a u64 when converted to bytes, and fix an also-
benign off-by-one bug in the check (inclusive vs. exclusive).
- Set the vmcs.GUEST_ACTIVITY_STATE back to ACTIVE when userspace sets KVM's
mp_state to anything other than HALTED, e.g. so that a vCPU doesn't get
stuck in HLT if userspace emulates RESET.
----------------------------------------------------------------
Haotian Jiang (1):
KVM: TDX: Reject INIT_MEM_REGION if number of bytes would overflow a u64
Keqiang Duan (1):
KVM: x86: Clear hardware HLT state when userspace makes a vCPU not-halted
Nikolay Borisov (1):
KVM: TDX: Remove always true ifdef
Sean Christopherson (11):
KVM: VMX: Formally define KVM's "0xdead" exit reason used for failed VM-Enter
KVM: VMX: Disallow using to_vmx() in common VT code
KVM: VMX: Move the shared "IRQs off" exit handler(s) to common code
KVM: VMX: Move the shared NMI handler/trampoline to common code
KVM: VMX: Rename posted interrupt prefixes from "vmx" to "vt"
KVM: VMX: Rename EPT violation handler prefix from "vmx" to "vt"
KVM: VMX: Use dummy pseudo-overlay struct for to_vt() and vt_to_vcpu()
KVM: VMX: Move common VT getters/converters to common.h
KVM: VMX: Rename common exit info getters prefixes from "vmx" to "vt"
KVM: VMX: Move bus lock handler from main.c => common.h
KVM: TDX: Fix a benign off-by-one bug on the end GPA for INIT_MEM_REGION
Xiaoyao Li (9):
KVM: TDX: Enable Notify VM exit
KVM: TDX: Check if there is valid exit infos based on vp_enter_ret
KVM: TDX: Set bits 31:16 to 0 and use UNDEFINED when synthesizing exit reason
KVM: TDX: Don't assume exit_reason[31:16] is all-0 in tdx_to_vmx_exit_reason()
KVM: TDX: Stuff exit_reason with UNDEFINED on wait_for_sept_zap return
KVM: VMX: Preserve negative return value in vmx_handle_exit() with bus lock detected
KVM: VMX: Make handle_bus_lock_vmexit() a shared helper
KVM: TDX: Enable Bus Lock VM exit
KVM: VMX: Consolidate the exit handler for VMX and TDX
arch/x86/include/asm/kvm-x86-ops.h | 1 +
arch/x86/include/asm/kvm_host.h | 7 ++
arch/x86/include/asm/vmx.h | 8 ++
arch/x86/kvm/vmx/common.h | 90 +++++++++++++++-
arch/x86/kvm/vmx/main.c | 145 +++++++++++++++++++++++---
arch/x86/kvm/vmx/nested.c | 36 +++----
arch/x86/kvm/vmx/posted_intr.c | 24 +++--
arch/x86/kvm/vmx/posted_intr.h | 8 +-
arch/x86/kvm/vmx/tdx.c | 112 +++++++++++++-------
arch/x86/kvm/vmx/vmx.c | 205 ++++++++-----------------------------
arch/x86/kvm/vmx/vmx.h | 37 -------
arch/x86/kvm/vmx/x86_ops.h | 2 +-
arch/x86/kvm/x86.c | 13 +++
13 files changed, 397 insertions(+), 291 deletions(-)