aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/kvm.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-04-22 02:39:48 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2021-04-22 13:19:01 -0400
commitfd49e8ee70b306a003323a17bbcc0633f322c135 (patch)
treebe0e5f131ee5afdbaa7a6b5fc76bb36baad8c067 /arch/x86/kernel/kvm.c
parentKVM: SVM: Allocate SEV command structures on local stack (diff)
parentsvm/sev: Register SEV and SEV-ES ASIDs to the misc controller (diff)
downloadlinux-dev-fd49e8ee70b306a003323a17bbcc0633f322c135.tar.xz
linux-dev-fd49e8ee70b306a003323a17bbcc0633f322c135.zip
Merge branch 'kvm-sev-cgroup' into HEAD
Diffstat (limited to 'arch/x86/kernel/kvm.c')
-rw-r--r--arch/x86/kernel/kvm.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 224a7a1ed6c3..bd01a6131edf 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -828,28 +828,25 @@ static void kvm_kick_cpu(int cpu)
static void kvm_wait(u8 *ptr, u8 val)
{
- unsigned long flags;
-
if (in_nmi())
return;
- local_irq_save(flags);
-
- if (READ_ONCE(*ptr) != val)
- goto out;
-
/*
* halt until it's our turn and kicked. Note that we do safe halt
* for irq enabled case to avoid hang when lock info is overwritten
* in irq spinlock slowpath and no spurious interrupt occur to save us.
*/
- if (arch_irqs_disabled_flags(flags))
- halt();
- else
- safe_halt();
+ if (irqs_disabled()) {
+ if (READ_ONCE(*ptr) == val)
+ halt();
+ } else {
+ local_irq_disable();
-out:
- local_irq_restore(flags);
+ if (READ_ONCE(*ptr) == val)
+ safe_halt();
+
+ local_irq_enable();
+ }
}
#ifdef CONFIG_X86_32