]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: TDX: restore host xsave state when exit from the guest TD
authorIsaku Yamahata <isaku.yamahata@intel.com>
Wed, 29 Jan 2025 09:58:56 +0000 (11:58 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Mar 2025 18:20:54 +0000 (14:20 -0400)
commit6bfa6d8509ad71f26ceec1e2ab64efbe39c58c8d
treed662e2cc281d9be1eac0c80b2b69009d1e2a666a
parent81bf40d54cd56e33b4cd381cc719efaa53832468
KVM: TDX: restore host xsave state when exit from the guest TD

On exiting from the guest TD, xsave state is clobbered; restore it.
Do not use kvm_load_host_xsave_state(), as it relies on vcpu->arch
to find out whether other KVM_RUN code has loaded guest state into
XCR0/PKRU/XSS or not.  In the case of TDX, the exit values are known
independent of the guest CR0 and CR4, and in fact the latter are not
available.

Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Message-ID: <20250129095902.16391-8-adrian.hunter@intel.com>
[Rewrite to not use kvm_load_host_xsave_state. - Paolo]
Reviewed-by: Xiayao Li <xiaoyao.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/tdx.c