KVM: PPC: Resolve real-mode handlers through function exports
authorAlexander Graf <agraf@suse.de>
Tue, 7 Jun 2011 18:45:34 +0000 (20:45 +0200)
committerAvi Kivity <avi@redhat.com>
Tue, 12 Jul 2011 10:16:29 +0000 (13:16 +0300)
Up until now, Book3S KVM had variables stored in the kernel that a kernel module
or the kvm code in the kernel could read from to figure out where some real mode
helper functions are located.

This is all unnecessary. The high bits of the EA get ignore in real mode, so we
can just use the pointer as is. Also, it's a lot easier on relocations when we
use the normal way of resolving the address to a function, instead of jumping
through hoops.

This patch fixes compilation with CONFIG_RELOCATABLE=y.

Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/include/asm/kvm_book3s.h
arch/powerpc/kvm/book3s.c
arch/powerpc/kvm/book3s_exports.c
arch/powerpc/kvm/book3s_rmhandlers.S

index d62e703f1214e04a5f06de518ae61af33ceb2eb4..70c409b1d93182bf554bbea48b3ddaab91a4e4cf 100644 (file)
@@ -133,8 +133,8 @@ extern void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr);
 extern int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu);
 extern pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn);
 
-extern ulong kvmppc_trampoline_lowmem;
-extern ulong kvmppc_trampoline_enter;
+extern void kvmppc_handler_lowmem_trampoline(void);
+extern void kvmppc_handler_trampoline_enter(void);
 extern void kvmppc_rmcall(ulong srr0, ulong srr1);
 extern void kvmppc_load_up_fpu(void);
 extern void kvmppc_load_up_altivec(void);
index 0f95b5cce033026ff5e9e02e0357d91c4cdefd7e..73fdab8a567feb41423fa7527f58a8579dcd5bcf 100644 (file)
@@ -1342,8 +1342,8 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
        vcpu_book3s->slb_nr = 64;
 
        /* remember where some real-mode handlers are */
-       vcpu->arch.trampoline_lowmem = kvmppc_trampoline_lowmem;
-       vcpu->arch.trampoline_enter = kvmppc_trampoline_enter;
+       vcpu->arch.trampoline_lowmem = (ulong)kvmppc_handler_lowmem_trampoline;
+       vcpu->arch.trampoline_enter = (ulong)kvmppc_handler_trampoline_enter;
        vcpu->arch.highmem_handler = (ulong)kvmppc_handler_highmem;
 #ifdef CONFIG_PPC_BOOK3S_64
        vcpu->arch.rmcall = *(ulong*)kvmppc_rmcall;
index 1dd5a1ddfd0dfba437043c1aa4cfb3f3ed4aca62..f94fd9a4c69a516d1b8127cf78a287a3cbd09381 100644 (file)
@@ -20,8 +20,8 @@
 #include <linux/module.h>
 #include <asm/kvm_book3s.h>
 
-EXPORT_SYMBOL_GPL(kvmppc_trampoline_enter);
-EXPORT_SYMBOL_GPL(kvmppc_trampoline_lowmem);
+EXPORT_SYMBOL_GPL(kvmppc_handler_trampoline_enter);
+EXPORT_SYMBOL_GPL(kvmppc_handler_lowmem_trampoline);
 EXPORT_SYMBOL_GPL(kvmppc_rmcall);
 EXPORT_SYMBOL_GPL(kvmppc_load_up_fpu);
 #ifdef CONFIG_ALTIVEC
index 1a1b34487e718ecc54d1bf5338100b8a9c05c288..5f5d07475c9154c36cf7d3b124e6ddf839e635fb 100644 (file)
@@ -251,12 +251,4 @@ define_load_up(altivec)
 define_load_up(vsx)
 #endif
 
-.global kvmppc_trampoline_lowmem
-kvmppc_trampoline_lowmem:
-       PPC_LONG kvmppc_handler_lowmem_trampoline - CONFIG_KERNEL_START
-
-.global kvmppc_trampoline_enter
-kvmppc_trampoline_enter:
-       PPC_LONG kvmppc_handler_trampoline_enter - CONFIG_KERNEL_START
-
 #include "book3s_segment.S"