diff options
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 84a090644d9d..65417e3d8462 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -841,7 +841,7 @@ int kvm_is_error_hva(unsigned long addr) | |||
841 | } | 841 | } |
842 | EXPORT_SYMBOL_GPL(kvm_is_error_hva); | 842 | EXPORT_SYMBOL_GPL(kvm_is_error_hva); |
843 | 843 | ||
844 | struct kvm_memory_slot *gfn_to_memslot_unaliased(struct kvm *kvm, gfn_t gfn) | 844 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn) |
845 | { | 845 | { |
846 | int i; | 846 | int i; |
847 | struct kvm_memslots *slots = kvm_memslots(kvm); | 847 | struct kvm_memslots *slots = kvm_memslots(kvm); |
@@ -855,20 +855,13 @@ struct kvm_memory_slot *gfn_to_memslot_unaliased(struct kvm *kvm, gfn_t gfn) | |||
855 | } | 855 | } |
856 | return NULL; | 856 | return NULL; |
857 | } | 857 | } |
858 | EXPORT_SYMBOL_GPL(gfn_to_memslot_unaliased); | 858 | EXPORT_SYMBOL_GPL(gfn_to_memslot); |
859 | |||
860 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn) | ||
861 | { | ||
862 | gfn = unalias_gfn(kvm, gfn); | ||
863 | return gfn_to_memslot_unaliased(kvm, gfn); | ||
864 | } | ||
865 | 859 | ||
866 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) | 860 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) |
867 | { | 861 | { |
868 | int i; | 862 | int i; |
869 | struct kvm_memslots *slots = kvm_memslots(kvm); | 863 | struct kvm_memslots *slots = kvm_memslots(kvm); |
870 | 864 | ||
871 | gfn = unalias_gfn_instantiation(kvm, gfn); | ||
872 | for (i = 0; i < KVM_MEMORY_SLOTS; ++i) { | 865 | for (i = 0; i < KVM_MEMORY_SLOTS; ++i) { |
873 | struct kvm_memory_slot *memslot = &slots->memslots[i]; | 866 | struct kvm_memory_slot *memslot = &slots->memslots[i]; |
874 | 867 | ||
@@ -913,7 +906,6 @@ int memslot_id(struct kvm *kvm, gfn_t gfn) | |||
913 | struct kvm_memslots *slots = kvm_memslots(kvm); | 906 | struct kvm_memslots *slots = kvm_memslots(kvm); |
914 | struct kvm_memory_slot *memslot = NULL; | 907 | struct kvm_memory_slot *memslot = NULL; |
915 | 908 | ||
916 | gfn = unalias_gfn(kvm, gfn); | ||
917 | for (i = 0; i < slots->nmemslots; ++i) { | 909 | for (i = 0; i < slots->nmemslots; ++i) { |
918 | memslot = &slots->memslots[i]; | 910 | memslot = &slots->memslots[i]; |
919 | 911 | ||
@@ -934,8 +926,7 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn) | |||
934 | { | 926 | { |
935 | struct kvm_memory_slot *slot; | 927 | struct kvm_memory_slot *slot; |
936 | 928 | ||
937 | gfn = unalias_gfn_instantiation(kvm, gfn); | 929 | slot = gfn_to_memslot(kvm, gfn); |
938 | slot = gfn_to_memslot_unaliased(kvm, gfn); | ||
939 | if (!slot || slot->flags & KVM_MEMSLOT_INVALID) | 930 | if (!slot || slot->flags & KVM_MEMSLOT_INVALID) |
940 | return bad_hva(); | 931 | return bad_hva(); |
941 | return gfn_to_hva_memslot(slot, gfn); | 932 | return gfn_to_hva_memslot(slot, gfn); |
@@ -1202,8 +1193,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn) | |||
1202 | { | 1193 | { |
1203 | struct kvm_memory_slot *memslot; | 1194 | struct kvm_memory_slot *memslot; |
1204 | 1195 | ||
1205 | gfn = unalias_gfn(kvm, gfn); | 1196 | memslot = gfn_to_memslot(kvm, gfn); |
1206 | memslot = gfn_to_memslot_unaliased(kvm, gfn); | ||
1207 | if (memslot && memslot->dirty_bitmap) { | 1197 | if (memslot && memslot->dirty_bitmap) { |
1208 | unsigned long rel_gfn = gfn - memslot->base_gfn; | 1198 | unsigned long rel_gfn = gfn - memslot->base_gfn; |
1209 | 1199 | ||