]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: SVM: Remove the need to trigger an UNBLOCK event on AP creation
authorTom Lendacky <thomas.lendacky@amd.com>
Wed, 22 May 2024 18:31:58 +0000 (13:31 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 3 Jun 2024 16:38:17 +0000 (12:38 -0400)
All SNP APs are initially started using the APIC INIT/SIPI sequence in
the guest. This sequence moves the AP MP state from
KVM_MP_STATE_UNINITIALIZED to KVM_MP_STATE_RUNNABLE, so there is no need
to attempt the UNBLOCK.

As it is, the UNBLOCK support in SVM is only enabled when AVIC is
enabled. When AVIC is disabled, AP creation is still successful.

Remove the KVM_REQ_UNBLOCK request from the AP creation code and revert
the changes to the vcpu_unblocking() kvm_x86_ops path.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/svm.h

index 526b9bfb7234ac243ab9d6fc7986ae0a2791e283..20b92f4b09064ee8897c0f2d6f954632af33cbc6 100644 (file)
@@ -3909,10 +3909,6 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm)
 out:
        if (kick) {
                kvm_make_request(KVM_REQ_UPDATE_PROTECTED_GUEST_STATE, target_vcpu);
-
-               if (target_vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)
-                       kvm_make_request(KVM_REQ_UNBLOCK, target_vcpu);
-
                kvm_vcpu_kick(target_vcpu);
        }
 
@@ -4478,16 +4474,6 @@ struct page *snp_safe_alloc_page(struct kvm_vcpu *vcpu)
        return p;
 }
 
-void sev_vcpu_unblocking(struct kvm_vcpu *vcpu)
-{
-       if (!sev_snp_guest(vcpu->kvm))
-               return;
-
-       if (kvm_test_request(KVM_REQ_UPDATE_PROTECTED_GUEST_STATE, vcpu) &&
-           vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)
-               vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
-}
-
 void sev_handle_rmp_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u64 error_code)
 {
        struct kvm_memory_slot *slot;
index 3d0549ca246f5b783b1c6d0d2236ad16ecf59124..4fdfcbbb2e303d9df1806d99a0beb616fc67ce3b 100644 (file)
@@ -4943,12 +4943,6 @@ static void *svm_alloc_apic_backing_page(struct kvm_vcpu *vcpu)
        return page_address(page);
 }
 
-static void svm_vcpu_unblocking(struct kvm_vcpu *vcpu)
-{
-       sev_vcpu_unblocking(vcpu);
-       avic_vcpu_unblocking(vcpu);
-}
-
 static struct kvm_x86_ops svm_x86_ops __initdata = {
        .name = KBUILD_MODNAME,
 
@@ -4971,7 +4965,7 @@ static struct kvm_x86_ops svm_x86_ops __initdata = {
        .vcpu_load = svm_vcpu_load,
        .vcpu_put = svm_vcpu_put,
        .vcpu_blocking = avic_vcpu_blocking,
-       .vcpu_unblocking = svm_vcpu_unblocking,
+       .vcpu_unblocking = avic_vcpu_unblocking,
 
        .update_exception_bitmap = svm_update_exception_bitmap,
        .get_msr_feature = svm_get_msr_feature,
index 555c55f50298b703437425b2d63ef995afbb007c..f0ab0d93cd2067be5b04ab030b7e0f8074c4f2ca 100644 (file)
@@ -734,7 +734,6 @@ int sev_cpu_init(struct svm_cpu_data *sd);
 int sev_dev_get_attr(u32 group, u64 attr, u64 *val);
 extern unsigned int max_sev_asid;
 void sev_handle_rmp_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u64 error_code);
-void sev_vcpu_unblocking(struct kvm_vcpu *vcpu);
 void sev_snp_init_protected_guest_state(struct kvm_vcpu *vcpu);
 int sev_gmem_prepare(struct kvm *kvm, kvm_pfn_t pfn, gfn_t gfn, int max_order);
 void sev_gmem_invalidate(kvm_pfn_t start, kvm_pfn_t end);
@@ -753,7 +752,6 @@ static inline int sev_cpu_init(struct svm_cpu_data *sd) { return 0; }
 static inline int sev_dev_get_attr(u32 group, u64 attr, u64 *val) { return -ENXIO; }
 #define max_sev_asid 0
 static inline void sev_handle_rmp_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u64 error_code) {}
-static inline void sev_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
 static inline void sev_snp_init_protected_guest_state(struct kvm_vcpu *vcpu) {}
 static inline int sev_gmem_prepare(struct kvm *kvm, kvm_pfn_t pfn, gfn_t gfn, int max_order)
 {