diff options
-rw-r--r-- | drivers/kvm/kvm_main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 7826f16271e5..5603000573ec 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1170,8 +1170,10 @@ static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
1170 | return 0; | 1170 | return 0; |
1171 | mark_page_dirty(vcpu->kvm, gpa >> PAGE_SHIFT); | 1171 | mark_page_dirty(vcpu->kvm, gpa >> PAGE_SHIFT); |
1172 | virt = kmap_atomic(page, KM_USER0); | 1172 | virt = kmap_atomic(page, KM_USER0); |
1173 | kvm_mmu_pte_write(vcpu, gpa, virt + offset, val, bytes); | 1173 | if (memcmp(virt + offset_in_page(gpa), val, bytes)) { |
1174 | memcpy(virt + offset_in_page(gpa), val, bytes); | 1174 | kvm_mmu_pte_write(vcpu, gpa, virt + offset, val, bytes); |
1175 | memcpy(virt + offset_in_page(gpa), val, bytes); | ||
1176 | } | ||
1175 | kunmap_atomic(virt, KM_USER0); | 1177 | kunmap_atomic(virt, KM_USER0); |
1176 | return 1; | 1178 | return 1; |
1177 | } | 1179 | } |