summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/svm/svm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 272ce4bdbf11..919f98479774 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -29,6 +29,7 @@
#include <linux/cc_platform.h>
#include <linux/smp.h>
#include <linux/string_choices.h>
+#include <linux/mutex.h>
#include <asm/apic.h>
#include <asm/perf_event.h>
@@ -249,6 +250,8 @@ static unsigned long iopm_base;
DEFINE_PER_CPU(struct svm_cpu_data, svm_data);
+static DEFINE_MUTEX(vmcb_dump_mutex);
+
/*
* 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.
@@ -3404,6 +3407,8 @@ static void dump_vmcb(struct kvm_vcpu *vcpu)
return;
}
+ guard(mutex)(&vmcb_dump_mutex);
+
vm_type = sev_snp_guest(vcpu->kvm) ? "SEV-SNP" :
sev_es_guest(vcpu->kvm) ? "SEV-ES" :
sev_guest(vcpu->kvm) ? "SEV" : "SVM";