KVM: SVM: Clobber RAX instead of RBX when discarding spec_ctrl_intercepted
authorSean Christopherson <seanjc@google.com>
Fri, 23 Feb 2024 20:42:29 +0000 (12:42 -0800)
committerSean Christopherson <seanjc@google.com>
Tue, 9 Apr 2024 17:20:29 +0000 (10:20 -0700)
POP @spec_ctrl_intercepted into RAX instead of RBX when discarding it from
the stack so that __svm_sev_es_vcpu_run() doesn't modify any non-volatile
registers.  __svm_sev_es_vcpu_run() doesn't return a value, and RAX is
already are clobbered multiple times in the #VMEXIT path.

This will allowing using the host save area to save/restore non-volatile
registers in __svm_sev_es_vcpu_run().

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20240223204233.3337324-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/vmenter.S

index c057866a459b6786c5813cd7d16e8fddfbe26b1e..db94fb6f610aebd79edb31a8ac40f3a3ea522fdb 100644 (file)
@@ -350,8 +350,8 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run)
         */
        UNTRAIN_RET_VM
 
-       /* "Pop" @spec_ctrl_intercepted.  */
-       pop %rbx
+       /* "Pop" and discard @spec_ctrl_intercepted. */
+       pop %rax
 
        pop %rbx