lkml.org 
[lkml]   [2010]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] kvm: Use wbinvd library functions
Date
From: Borislav Petkov <borislav.petkov@amd.com>

Replace local wbinvd helpers with equivalent x86 library functions.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
arch/x86/kvm/x86.c | 14 +++-----------
1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index cdac9e5..8063ac0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -50,6 +50,7 @@

#include <asm/debugreg.h>
#include <asm/msr.h>
+#include <asm/smp.h>
#include <asm/desc.h>
#include <asm/mtrr.h>
#include <asm/mce.h>
@@ -2029,11 +2030,6 @@ out:
return r;
}

-static void wbinvd_ipi(void *garbage)
-{
- wbinvd();
-}
-
static bool need_emulate_wbinvd(struct kvm_vcpu *vcpu)
{
return vcpu->kvm->arch.iommu_domain &&
@@ -2047,8 +2043,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
if (kvm_x86_ops->has_wbinvd_exit())
cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
else if (vcpu->cpu != -1 && vcpu->cpu != cpu)
- smp_call_function_single(vcpu->cpu,
- wbinvd_ipi, NULL, 1);
+ wbinvd_on_cpu(vcpu->cpu);
}

kvm_x86_ops->vcpu_load(vcpu, cpu);
@@ -3978,10 +3973,7 @@ int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu)
return X86EMUL_CONTINUE;

if (kvm_x86_ops->has_wbinvd_exit()) {
- preempt_disable();
- smp_call_function_many(vcpu->arch.wbinvd_dirty_mask,
- wbinvd_ipi, NULL, 1);
- preempt_enable();
+ wbinvd_on_cpus(vcpu->arch.wbinvd_dirty_mask);
cpumask_clear(vcpu->arch.wbinvd_dirty_mask);
}
wbinvd();
--
1.7.3.1.50.g1e633


\
 
 \ /
  Last update: 2010-11-24 18:47    [W:0.038 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site