aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kvm_host.h
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-10-18 09:22:23 -0400
committerAvi Kivity <avi@redhat.com>2011-01-12 04:23:08 -0500
commit49c7754ce57063b819b01eb8a4290841ad0886c4 (patch)
tree67561bbc829d93efa5316c246ec84fe2f2493236 /include/linux/kvm_host.h
parent56028d0861e48f7cc9c573d79f2d8a0a933a2bba (diff)
KVM: Add memory slot versioning and use it to provide fast guest write interface
Keep track of memslots changes by keeping generation number in memslots structure. Provide kvm_write_guest_cached() function that skips gfn_to_hva() translation if memslots was not changed since previous invocation. Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r--include/linux/kvm_host.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index e56acc7857e2..e6748204cd56 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -199,6 +199,7 @@ struct kvm_irq_routing_table {};
199 199
200struct kvm_memslots { 200struct kvm_memslots {
201 int nmemslots; 201 int nmemslots;
202 u64 generation;
202 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + 203 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
203 KVM_PRIVATE_MEM_SLOTS]; 204 KVM_PRIVATE_MEM_SLOTS];
204}; 205};
@@ -352,12 +353,18 @@ int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
352 int offset, int len); 353 int offset, int len);
353int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, 354int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
354 unsigned long len); 355 unsigned long len);
356int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
357 void *data, unsigned long len);
358int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
359 gpa_t gpa);
355int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); 360int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
356int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); 361int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
357struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); 362struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
358int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); 363int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
359unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn); 364unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn);
360void mark_page_dirty(struct kvm *kvm, gfn_t gfn); 365void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
366void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot,
367 gfn_t gfn);
361 368
362void kvm_vcpu_block(struct kvm_vcpu *vcpu); 369void kvm_vcpu_block(struct kvm_vcpu *vcpu);
363void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); 370void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu);