diff options
author | Izik Eidus <izike@qumranet.com> | 2007-11-19 04:16:57 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:06 -0500 |
commit | 3e021bf5053bc45448e43cf1d7d020ddf1409714 (patch) | |
tree | 77068aa73bcb6db4af655fce0a48b9c375c2d758 | |
parent | ec8d4eaefc06636eb8fc83610c6605168796b4f7 (diff) |
KVM: Simplify kvm_clear_guest_page()
Use kvm_write_guest_page() with empty_zero_page, instead of doing
kmap and memset.
Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r-- | drivers/kvm/kvm_main.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 595ed323fc53..e83a178dc80f 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/io.h> | 46 | #include <asm/io.h> |
47 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
48 | #include <asm/desc.h> | 48 | #include <asm/desc.h> |
49 | #include <asm/pgtable.h> | ||
49 | 50 | ||
50 | MODULE_AUTHOR("Qumranet"); | 51 | MODULE_AUTHOR("Qumranet"); |
51 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
@@ -633,22 +634,7 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, | |||
633 | 634 | ||
634 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len) | 635 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len) |
635 | { | 636 | { |
636 | void *page_virt; | 637 | return kvm_write_guest_page(kvm, gfn, empty_zero_page, offset, len); |
637 | struct page *page; | ||
638 | |||
639 | page = gfn_to_page(kvm, gfn); | ||
640 | if (is_error_page(page)) { | ||
641 | kvm_release_page(page); | ||
642 | return -EFAULT; | ||
643 | } | ||
644 | page_virt = kmap_atomic(page, KM_USER0); | ||
645 | |||
646 | memset(page_virt + offset, 0, len); | ||
647 | |||
648 | kunmap_atomic(page_virt, KM_USER0); | ||
649 | kvm_release_page(page); | ||
650 | mark_page_dirty(kvm, gfn); | ||
651 | return 0; | ||
652 | } | 638 | } |
653 | EXPORT_SYMBOL_GPL(kvm_clear_guest_page); | 639 | EXPORT_SYMBOL_GPL(kvm_clear_guest_page); |
654 | 640 | ||