diff options
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 12 |
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 | ||
917 | static 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 | |||
917 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn) | 922 | unsigned 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 | } |
927 | EXPORT_SYMBOL_GPL(gfn_to_hva); | 932 | EXPORT_SYMBOL_GPL(gfn_to_hva); |
928 | 933 | ||
@@ -972,11 +977,6 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn) | |||
972 | } | 977 | } |
973 | EXPORT_SYMBOL_GPL(gfn_to_pfn); | 978 | EXPORT_SYMBOL_GPL(gfn_to_pfn); |
974 | 979 | ||
975 | static 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 | |||
980 | pfn_t gfn_to_pfn_memslot(struct kvm *kvm, | 980 | pfn_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 | { |