Patchwork KVM: PPC: Make long relocations be ulong

login
register
mail settings
Submitter Alexander Graf
Date July 19, 2010, 2:54 p.m.
Message ID <1279551293-32473-1-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/59204/
State Not Applicable
Headers show

Comments

Alexander Graf - July 19, 2010, 2:54 p.m.
On Book3S KVM we directly expose some asm pointers to C code as
variables. These need to be relocated and thus break on relocatable
kernels.

To make sure we can at least build, let's mark them as long instead
of u32 where 64bit relocations don't work.

This fixes the following build error:

WARNING: 2 bad relocations
> c000000000008590 R_PPC64_ADDR32    .text+0x4000000000008460
> c000000000008594 R_PPC64_ADDR32    .text+0x4000000000008598

Please keep in mind that actually using KVM on a relocated kernel
might still break. This only fixes the compile problem.

Reported-by: Subrata Modak <subrata@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>

---

I'm not sure which tree this should go through. Avi and Ben, please
coordinate this.
---
 arch/powerpc/include/asm/kvm_book3s.h |    4 ++--
 arch/powerpc/kvm/book3s_rmhandlers.S  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
Avi Kivity - July 19, 2010, 3:30 p.m.
On 07/19/2010 05:54 PM, Alexander Graf wrote:
> I'm not sure which tree this should go through. Avi and Ben, please
> coordinate this.
> ---
>   arch/powerpc/include/asm/kvm_book3s.h |    4 ++--
>   arch/powerpc/kvm/book3s_rmhandlers.S  |    4 ++--
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
>    

The diffstat suggests kvm.git.

Is this broken in Linus' tree, or just kvm.git?
Alexander Graf - July 19, 2010, 3:33 p.m.
Avi Kivity wrote:
> On 07/19/2010 05:54 PM, Alexander Graf wrote:
>> I'm not sure which tree this should go through. Avi and Ben, please
>> coordinate this.
>> ---
>>   arch/powerpc/include/asm/kvm_book3s.h |    4 ++--
>>   arch/powerpc/kvm/book3s_rmhandlers.S  |    4 ++--
>>   2 files changed, 4 insertions(+), 4 deletions(-)
>>
>>    
>
> The diffstat suggests kvm.git.
>
> Is this broken in Linus' tree, or just kvm.git?

I got the bug report through linuxppc-dev, so I assume it's broken in
Linus' tree. In fact, that code has been around for a while already, so
it should even be in 2.6.24.

Alex

Patch

diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index b5b1961..b3d763d 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -131,8 +131,8 @@  extern void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat,
 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 u32 kvmppc_trampoline_lowmem;
-extern u32 kvmppc_trampoline_enter;
+extern ulong kvmppc_trampoline_lowmem;
+extern ulong kvmppc_trampoline_enter;
 extern void kvmppc_rmcall(ulong srr0, ulong srr1);
 extern void kvmppc_load_up_fpu(void);
 extern void kvmppc_load_up_altivec(void);
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S
index 506d5c3..20eb908 100644
--- a/arch/powerpc/kvm/book3s_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_rmhandlers.S
@@ -242,10 +242,10 @@  define_load_up(vsx)
 
 .global kvmppc_trampoline_lowmem
 kvmppc_trampoline_lowmem:
-	.long kvmppc_handler_lowmem_trampoline - CONFIG_KERNEL_START
+	PPC_LONG kvmppc_handler_lowmem_trampoline - CONFIG_KERNEL_START
 
 .global kvmppc_trampoline_enter
 kvmppc_trampoline_enter:
-	.long kvmppc_handler_trampoline_enter - CONFIG_KERNEL_START
+	PPC_LONG kvmppc_handler_trampoline_enter - CONFIG_KERNEL_START
 
 #include "book3s_segment.S"