aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-03-02 07:06:05 -0500
committerAvi Kivity <avi@qumranet.com>2008-04-27 05:00:26 -0400
commit9f81128591ca1e9907f2e7a7b195e33232167d60 (patch)
tree2abca5f4181f3bc0570bab60d85b473a595f1285 /arch/x86/kvm/x86.c
parent0cf1bfd2737f41e59f974a61eab11af206d2042a (diff)
KVM: Provide unlocked version of emulator_write_phys()
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1b9e695cc641..03ba402c476a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1840,22 +1840,29 @@ mmio:
1840 return X86EMUL_UNHANDLEABLE; 1840 return X86EMUL_UNHANDLEABLE;
1841} 1841}
1842 1842
1843static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, 1843int __emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
1844 const void *val, int bytes) 1844 const void *val, int bytes)
1845{ 1845{
1846 int ret; 1846 int ret;
1847 1847
1848 down_read(&vcpu->kvm->slots_lock);
1849 ret = kvm_write_guest(vcpu->kvm, gpa, val, bytes); 1848 ret = kvm_write_guest(vcpu->kvm, gpa, val, bytes);
1850 if (ret < 0) { 1849 if (ret < 0)
1851 up_read(&vcpu->kvm->slots_lock);
1852 return 0; 1850 return 0;
1853 }
1854 kvm_mmu_pte_write(vcpu, gpa, val, bytes); 1851 kvm_mmu_pte_write(vcpu, gpa, val, bytes);
1855 up_read(&vcpu->kvm->slots_lock);
1856 return 1; 1852 return 1;
1857} 1853}
1858 1854
1855static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
1856 const void *val, int bytes)
1857{
1858 int ret;
1859
1860 down_read(&vcpu->kvm->slots_lock);
1861 ret =__emulator_write_phys(vcpu, gpa, val, bytes);
1862 up_read(&vcpu->kvm->slots_lock);
1863 return ret;
1864}
1865
1859static int emulator_write_emulated_onepage(unsigned long addr, 1866static int emulator_write_emulated_onepage(unsigned long addr,
1860 const void *val, 1867 const void *val,
1861 unsigned int bytes, 1868 unsigned int bytes,