aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>2010-02-24 21:33:19 -0500
committerAvi Kivity <avi@redhat.com>2010-04-25 06:53:29 -0400
commitf5c9803173848864d0c56108b9e102db0bf601de (patch)
treeb977df8c6cf508f196aa73fd012bbcb01ad6be2f /virt
parent197717d5813fc39a7185a3177b76f4a3b2405df7 (diff)
KVM: update gfn_to_hva() to use gfn_to_hva_memslot()
Marcelo introduced gfn_to_hva_memslot() when he implemented gfn_to_pfn_memslot(). Let's use this for gfn_to_hva() too. Note: also remove parentheses next to return as checkpatch said to do. Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c82ae2492634..5bac6eb0f0a9 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -914,6 +914,11 @@ int memslot_id(struct kvm *kvm, gfn_t gfn)
914 return memslot - slots->memslots; 914 return memslot - slots->memslots;
915} 915}
916 916
917static unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn)
918{
919 return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE;
920}
921
917unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn) 922unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn)
918{ 923{
919 struct kvm_memory_slot *slot; 924 struct kvm_memory_slot *slot;
@@ -922,7 +927,7 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn)
922 slot = gfn_to_memslot_unaliased(kvm, gfn); 927 slot = gfn_to_memslot_unaliased(kvm, gfn);
923 if (!slot || slot->flags & KVM_MEMSLOT_INVALID) 928 if (!slot || slot->flags & KVM_MEMSLOT_INVALID)
924 return bad_hva(); 929 return bad_hva();
925 return (slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE); 930 return gfn_to_hva_memslot(slot, gfn);
926} 931}
927EXPORT_SYMBOL_GPL(gfn_to_hva); 932EXPORT_SYMBOL_GPL(gfn_to_hva);
928 933
@@ -972,11 +977,6 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn)
972} 977}
973EXPORT_SYMBOL_GPL(gfn_to_pfn); 978EXPORT_SYMBOL_GPL(gfn_to_pfn);
974 979
975static unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn)
976{
977 return (slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE);
978}
979
980pfn_t gfn_to_pfn_memslot(struct kvm *kvm, 980pfn_t gfn_to_pfn_memslot(struct kvm *kvm,
981 struct kvm_memory_slot *slot, gfn_t gfn) 981 struct kvm_memory_slot *slot, gfn_t gfn)
982{ 982{