KVM: VMX: Wrap all accesses to IA32_DEBUGCTL with getter/setter APIs
authorMaxim Levitsky <mlevitsk@redhat.com>
Tue, 10 Jun 2025 23:20:09 +0000 (16:20 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 20 Jun 2025 20:05:24 +0000 (13:05 -0700)
commit7d0cce6cbe71af6e9c1831bff101a2b9c249c4a2
tree0eeead25be108fc9c6a50380103915088e01d3c5
parent095686e6fcb4150f0a55b1a25987fad3d8af58d6
KVM: VMX: Wrap all accesses to IA32_DEBUGCTL with getter/setter APIs

Introduce vmx_guest_debugctl_{read,write}() to handle all accesses to
vmcs.GUEST_IA32_DEBUGCTL. This will allow stuffing FREEZE_IN_SMM into
GUEST_IA32_DEBUGCTL based on the host setting without bleeding the state
into the guest, and without needing to copy+paste the FREEZE_IN_SMM
logic into every patch that accesses GUEST_IA32_DEBUGCTL.

No functional change intended.

Cc: stable@vger.kernel.org
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
[sean: massage changelog, make inline, use in all prepare_vmcs02() cases]
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Link: https://lore.kernel.org/r/20250610232010.162191-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/pmu_intel.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h