diff options
author | Gleb Natapov <gleb@redhat.com> | 2010-10-18 09:22:23 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:23:08 -0500 |
commit | 49c7754ce57063b819b01eb8a4290841ad0886c4 (patch) | |
tree | 67561bbc829d93efa5316c246ec84fe2f2493236 /include/linux/kvm_host.h | |
parent | 56028d0861e48f7cc9c573d79f2d8a0a933a2bba (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.h | 7 |
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 | ||
200 | struct kvm_memslots { | 200 | struct 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); |
353 | int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, | 354 | int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, |
354 | unsigned long len); | 355 | unsigned long len); |
356 | int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | ||
357 | void *data, unsigned long len); | ||
358 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | ||
359 | gpa_t gpa); | ||
355 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); | 360 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); |
356 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); | 361 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); |
357 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); | 362 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); |
358 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); | 363 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); |
359 | unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn); | 364 | unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn); |
360 | void mark_page_dirty(struct kvm *kvm, gfn_t gfn); | 365 | void mark_page_dirty(struct kvm *kvm, gfn_t gfn); |
366 | void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot, | ||
367 | gfn_t gfn); | ||
361 | 368 | ||
362 | void kvm_vcpu_block(struct kvm_vcpu *vcpu); | 369 | void kvm_vcpu_block(struct kvm_vcpu *vcpu); |
363 | void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); | 370 | void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); |