aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Shan <shangw@linux.vnet.ibm.com>2012-08-24 04:50:28 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-08-27 15:44:20 -0400
commit66a03505a7fcc70187319ef2318832f4d3c451a6 (patch)
tree5d6b87ef9094fb11f9825b4702b29472496dafc5
parentc78aa4c4b94b5b148be576a9f1570e31fe282b46 (diff)
KVM: PPC: book3s: fix build error caused by gfn_to_hva_memslot()
The build error was caused by that builtin functions are calling the functions implemented in modules. This error was introduced by commit 4d8b81abc4 ("KVM: introduce readonly memslot"). The patch fixes the build error by moving function __gfn_to_hva_memslot() from kvm_main.c to kvm_host.h and making that "inline" so that the builtin function (kvmppc_h_enter) can use that. Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c2
-rw-r--r--include/linux/kvm_host.h6
-rw-r--r--virt/kvm/kvm_main.c6
3 files changed, 7 insertions, 7 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 56ac1a5d9912..fb0e821622d4 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -197,7 +197,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
197 pa &= PAGE_MASK; 197 pa &= PAGE_MASK;
198 } else { 198 } else {
199 /* Translate to host virtual address */ 199 /* Translate to host virtual address */
200 hva = gfn_to_hva_memslot(memslot, gfn); 200 hva = __gfn_to_hva_memslot(memslot, gfn);
201 201
202 /* Look up the Linux PTE for the backing page */ 202 /* Look up the Linux PTE for the backing page */
203 pte_size = psize; 203 pte_size = psize;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 5972c9845ddb..9c0b3c3ae0a5 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -773,6 +773,12 @@ __gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn)
773 return search_memslots(slots, gfn); 773 return search_memslots(slots, gfn);
774} 774}
775 775
776static inline unsigned long
777__gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn)
778{
779 return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE;
780}
781
776static inline int memslot_id(struct kvm *kvm, gfn_t gfn) 782static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
777{ 783{
778 return gfn_to_memslot(kvm, gfn)->id; 784 return gfn_to_memslot(kvm, gfn)->id;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 3416f8a31f63..6425906d7cec 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -984,12 +984,6 @@ static bool memslot_is_readonly(struct kvm_memory_slot *slot)
984 return slot->flags & KVM_MEM_READONLY; 984 return slot->flags & KVM_MEM_READONLY;
985} 985}
986 986
987static unsigned long __gfn_to_hva_memslot(struct kvm_memory_slot *slot,
988 gfn_t gfn)
989{
990 return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE;
991}
992
993static unsigned long __gfn_to_hva_many(struct kvm_memory_slot *slot, gfn_t gfn, 987static unsigned long __gfn_to_hva_many(struct kvm_memory_slot *slot, gfn_t gfn,
994 gfn_t *nr_pages, bool write) 988 gfn_t *nr_pages, bool write)
995{ 989{