diff options
author | Zhang Xiantao <xiantao.zhang@intel.com> | 2007-11-18 07:29:43 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:05 -0500 |
commit | 5bb064dcdeb7ab341e2f8a3e2fc34faa63b1662c (patch) | |
tree | abb976bd8e6f79fca02aeadad31269f281f71c16 /drivers/kvm/kvm_main.c | |
parent | 9327fd1195b77e67b86db8c1c1c4c4f7db009b00 (diff) |
KVM: Portability: Move kvm_vcpu_ioctl_get_dirty_log to arch-specific file
Meanwhile keep the interface in common, and leave as more logic in common
as possible.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r-- | drivers/kvm/kvm_main.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index b0b6ff2a8cbe..5f11e6b09458 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -389,19 +389,14 @@ int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, | |||
389 | return kvm_set_memory_region(kvm, mem, user_alloc); | 389 | return kvm_set_memory_region(kvm, mem, user_alloc); |
390 | } | 390 | } |
391 | 391 | ||
392 | /* | 392 | int kvm_get_dirty_log(struct kvm *kvm, |
393 | * Get (and clear) the dirty memory log for a memory slot. | 393 | struct kvm_dirty_log *log, int *is_dirty) |
394 | */ | ||
395 | static int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | ||
396 | struct kvm_dirty_log *log) | ||
397 | { | 394 | { |
398 | struct kvm_memory_slot *memslot; | 395 | struct kvm_memory_slot *memslot; |
399 | int r, i; | 396 | int r, i; |
400 | int n; | 397 | int n; |
401 | unsigned long any = 0; | 398 | unsigned long any = 0; |
402 | 399 | ||
403 | mutex_lock(&kvm->lock); | ||
404 | |||
405 | r = -EINVAL; | 400 | r = -EINVAL; |
406 | if (log->slot >= KVM_MEMORY_SLOTS) | 401 | if (log->slot >= KVM_MEMORY_SLOTS) |
407 | goto out; | 402 | goto out; |
@@ -420,17 +415,11 @@ static int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
420 | if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n)) | 415 | if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n)) |
421 | goto out; | 416 | goto out; |
422 | 417 | ||
423 | /* If nothing is dirty, don't bother messing with page tables. */ | 418 | if (any) |
424 | if (any) { | 419 | *is_dirty = 1; |
425 | kvm_mmu_slot_remove_write_access(kvm, log->slot); | ||
426 | kvm_flush_remote_tlbs(kvm); | ||
427 | memset(memslot->dirty_bitmap, 0, n); | ||
428 | } | ||
429 | 420 | ||
430 | r = 0; | 421 | r = 0; |
431 | |||
432 | out: | 422 | out: |
433 | mutex_unlock(&kvm->lock); | ||
434 | return r; | 423 | return r; |
435 | } | 424 | } |
436 | 425 | ||