aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
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,