From: Izik Eidus Date: Mon, 19 Nov 2007 09:16:57 +0000 (+0200) Subject: KVM: Simplify kvm_clear_guest_page() X-Git-Tag: v2.6.25-rc1~1138^2~125 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=3e021bf5053bc45448e43cf1d7d020ddf1409714;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Avi Kivity --- diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 595ed323fc5..e83a178dc80 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -46,6 +46,7 @@ #include #include #include +#include MODULE_AUTHOR("Qumranet"); MODULE_LICENSE("GPL"); @@ -633,22 +634,7 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len) { - void *page_virt; - struct page *page; - - page = gfn_to_page(kvm, gfn); - if (is_error_page(page)) { - kvm_release_page(page); - return -EFAULT; - } - page_virt = kmap_atomic(page, KM_USER0); - - memset(page_virt + offset, 0, len); - - kunmap_atomic(page_virt, KM_USER0); - kvm_release_page(page); - mark_page_dirty(kvm, gfn); - return 0; + return kvm_write_guest_page(kvm, gfn, empty_zero_page, offset, len); } EXPORT_SYMBOL_GPL(kvm_clear_guest_page);