mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
KVM: TDX: Use kvm_arch_vcpu.host_debugctl to restore the host's DEBUGCTL
Use the kvm_arch_vcpu.host_debugctl snapshot to restore DEBUGCTL after running a TD vCPU. The final TDX series rebase was mishandled, likely due to commitfb71c79593("KVM: x86: Snapshot the host's DEBUGCTL in common x86") deleting the same line of code from vmx.h, i.e. creating a semantic conflict of sorts, but no syntactic conflict. Using the version in kvm_vcpu_arch picks up the ulong => u64 fix (which isn't relevant to TDX) as well as the IRQ fix from commit189ecdb3e1("KVM: x86: Snapshot the host's DEBUGCTL after disabling IRQs"). Link: https://lore.kernel.org/all/20250307212053.2948340-10-pbonzini@redhat.com Cc: Adrian Hunter <adrian.hunter@intel.com> Fixes:8af0990375("KVM: TDX: Save and restore IA32_DEBUGCTL") Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250610232010.162191-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
28224ef02b
commit
7d390a9da8
|
|
@ -53,8 +53,6 @@ struct vcpu_vt {
|
|||
#ifdef CONFIG_X86_64
|
||||
u64 msr_host_kernel_gs_base;
|
||||
#endif
|
||||
|
||||
unsigned long host_debugctlmsr;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_KVM_INTEL_TDX
|
||||
|
|
|
|||
|
|
@ -785,8 +785,6 @@ void tdx_prepare_switch_to_guest(struct kvm_vcpu *vcpu)
|
|||
else
|
||||
vt->msr_host_kernel_gs_base = read_msr(MSR_KERNEL_GS_BASE);
|
||||
|
||||
vt->host_debugctlmsr = get_debugctlmsr();
|
||||
|
||||
vt->guest_state_loaded = true;
|
||||
}
|
||||
|
||||
|
|
@ -1062,8 +1060,8 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu, bool force_immediate_exit)
|
|||
|
||||
tdx_vcpu_enter_exit(vcpu);
|
||||
|
||||
if (vt->host_debugctlmsr & ~TDX_DEBUGCTL_PRESERVED)
|
||||
update_debugctlmsr(vt->host_debugctlmsr);
|
||||
if (vcpu->arch.host_debugctl & ~TDX_DEBUGCTL_PRESERVED)
|
||||
update_debugctlmsr(vcpu->arch.host_debugctl);
|
||||
|
||||
tdx_load_host_xsave_state(vcpu);
|
||||
tdx->guest_entered = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user