aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2010-08-22 07:10:28 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:51:26 -0400
commit887c08ac191efb103e33e589aacbc2ce1a3f131e (patch)
tree635b2da93109722e5a254041d5b193a8db99b8d9 /include
parent45888a0c6edc305495b6bd72a30e66bc40b324c6 (diff)
KVM: MMU: introduce hva_to_pfn_atomic function
Introduce hva_to_pfn_atomic(), it's the fast path and can used in atomic context, the later patch will use it Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'include')
-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 c13cc48697aa..307d0e2c0f59 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -296,6 +296,7 @@ void kvm_release_page_dirty(struct page *page);
296void kvm_set_page_dirty(struct page *page); 296void kvm_set_page_dirty(struct page *page);
297void kvm_set_page_accessed(struct page *page); 297void kvm_set_page_accessed(struct page *page);
298 298
299pfn_t hva_to_pfn_atomic(struct kvm *kvm, unsigned long addr);
299pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); 300pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
300pfn_t gfn_to_pfn_memslot(struct kvm *kvm, 301pfn_t gfn_to_pfn_memslot(struct kvm *kvm,
301 struct kvm_memory_slot *slot, gfn_t gfn); 302 struct kvm_memory_slot *slot, gfn_t gfn);
@@ -518,6 +519,12 @@ static inline void kvm_guest_exit(void)
518 current->flags &= ~PF_VCPU; 519 current->flags &= ~PF_VCPU;
519} 520}
520 521
522static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot,
523 gfn_t gfn)
524{
525 return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE;
526}
527
521static inline gpa_t gfn_to_gpa(gfn_t gfn) 528static inline gpa_t gfn_to_gpa(gfn_t gfn)
522{ 529{
523 return (gpa_t)gfn << PAGE_SHIFT; 530 return (gpa_t)gfn << PAGE_SHIFT;