KVM: Provide unlocked version of emulator_write_phys()
Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
@@ -1840,20 +1840,27 @@ mmio:
|
|||||||
return X86EMUL_UNHANDLEABLE;
|
return X86EMUL_UNHANDLEABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
|
||||||
|
const void *val, int bytes)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = kvm_write_guest(vcpu->kvm, gpa, val, bytes);
|
||||||
|
if (ret < 0)
|
||||||
|
return 0;
|
||||||
|
kvm_mmu_pte_write(vcpu, gpa, val, bytes);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
|
static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
|
||||||
const void *val, int bytes)
|
const void *val, int bytes)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
down_read(&vcpu->kvm->slots_lock);
|
down_read(&vcpu->kvm->slots_lock);
|
||||||
ret = kvm_write_guest(vcpu->kvm, gpa, val, bytes);
|
ret =__emulator_write_phys(vcpu, gpa, val, bytes);
|
||||||
if (ret < 0) {
|
|
||||||
up_read(&vcpu->kvm->slots_lock);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
kvm_mmu_pte_write(vcpu, gpa, val, bytes);
|
|
||||||
up_read(&vcpu->kvm->slots_lock);
|
up_read(&vcpu->kvm->slots_lock);
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int emulator_write_emulated_onepage(unsigned long addr,
|
static int emulator_write_emulated_onepage(unsigned long addr,
|
||||||
|
@@ -432,6 +432,9 @@ void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages);
|
|||||||
|
|
||||||
int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3);
|
int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3);
|
||||||
|
|
||||||
|
int __emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
|
||||||
|
const void *val, int bytes);
|
||||||
|
|
||||||
enum emulation_result {
|
enum emulation_result {
|
||||||
EMULATE_DONE, /* no further processing */
|
EMULATE_DONE, /* no further processing */
|
||||||
EMULATE_DO_MMIO, /* kvm_run filled with mmio request */
|
EMULATE_DO_MMIO, /* kvm_run filled with mmio request */
|
||||||
|
Reference in New Issue
Block a user