KVM: SVM: improve split between svm_prepare_guest_switch and sev_es_prepare_guest_switch
[linux-2.6-microblaze.git] / arch / x86 / kvm / svm / sev.c
index 17b5345..b82eeef 100644 (file)
@@ -2907,20 +2907,16 @@ void sev_es_vcpu_reset(struct vcpu_svm *svm)
                                            sev_enc_bit));
 }
 
-void sev_es_prepare_guest_switch(struct vcpu_svm *svm, unsigned int cpu)
+void sev_es_prepare_guest_switch(struct vmcb_save_area *hostsa)
 {
-       struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
-       struct vmcb_save_area *hostsa;
-
        /*
         * As an SEV-ES guest, hardware will restore the host state on VMEXIT,
-        * of which one step is to perform a VMLOAD. Since hardware does not
-        * perform a VMSAVE on VMRUN, the host savearea must be updated.
+        * of which one step is to perform a VMLOAD.  KVM performs the
+        * corresponding VMSAVE in svm_prepare_guest_switch for both
+        * traditional and SEV-ES guests.
         */
-       vmsave(__sme_page_pa(sd->save_area));
 
        /* XCR0 is restored on VMEXIT, save the current host value */
-       hostsa = (struct vmcb_save_area *)(page_address(sd->save_area) + 0x400);
        hostsa->xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
 
        /* PKRU is restored on VMEXIT, save the current host value */