On Tue, Aug 27, 2024 at 10:40 PM Ashish Kalra <Ashish.Kalra@xxxxxxx> wrote: > +void snp_decommision_all(void) Should be spelled snp_decommission_all (with two "s"). > +static DEFINE_SPINLOCK(snp_decommision_lock); Same here. > /* > * Only MSR_TSC_AUX is switched via the user return hook. EFER is switched via > * the VMCB, and the SYSCALL/SYSENTER MSRs are handled by VMLOAD/VMSAVE. > @@ -594,9 +597,97 @@ static inline void kvm_cpu_svm_disable(void) > > static void svm_emergency_disable(void) > { > + static atomic_t waiting_for_cpus_synchronized; > + static bool synchronize_cpus_initiated; > + static bool snp_decommision_handled; Same here, and below throughout the function (also SNP_DECOMMISSION). Please create a new function sev_emergency_disable(), with a stub in svm.h if CONFIG_KVM_AMD_ > @@ -749,6 +749,7 @@ 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); > int sev_private_max_mapping_level(struct kvm *kvm, kvm_pfn_t pfn); > +void snp_decommision_all(void); > #else > static inline struct page *snp_safe_alloc_page_node(int node, gfp_t gfp) > { > @@ -779,7 +780,7 @@ static inline int sev_private_max_mapping_level(struct kvm *kvm, kvm_pfn_t pfn) > { > return 0; > } > - > +static void snp_decommision_all(void); This should be inline (and after the change above it should be sev_emergency_disable(), not snp_decommission_all(), that is exported from sev.c). Thanks, Paolo