Patchwork powerpc: mtmsrd not defined

login
register
mail settings
Submitter Sean MacLennan
Date Aug. 22, 2010, 10:48 p.m.
Message ID <20100822184844.37c30d5e@lappy.seanm.ca>
Download mbox | patch
Permalink /patch/62396/
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Sean MacLennan - Aug. 22, 2010, 10:48 p.m.
On Mon, 23 Aug 2010 08:34:54 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> I'd rather have a macro somewhere in ppc_asm.h (MTMSR ?) that does the
> right thing. We might even already have one...

We do.... here is a new, improved patch.

Replace the BOOK3S_64 specific mtmsrd with the generic MTMSRD macro.

Signed-off-by: Sean MacLennan <smaclennan@pikatech.com>
---



Cheers,
   Sean
Paul Mackerras - Aug. 31, 2010, 4:37 a.m.
On Sun, Aug 22, 2010 at 06:48:44PM -0400, Sean MacLennan wrote:

> Replace the BOOK3S_64 specific mtmsrd with the generic MTMSRD macro.
> 
> Signed-off-by: Sean MacLennan <smaclennan@pikatech.com>

Acked-by: Paul Mackerras <paulus@samba.org>
Kumar Gala - Aug. 31, 2010, 4:17 p.m.
On Aug 22, 2010, at 5:48 PM, Sean MacLennan wrote:

> On Mon, 23 Aug 2010 08:34:54 +1000
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> 
>> I'd rather have a macro somewhere in ppc_asm.h (MTMSR ?) that does the
>> right thing. We might even already have one...
> 
> We do.... here is a new, improved patch.
> 
> Replace the BOOK3S_64 specific mtmsrd with the generic MTMSRD macro.
> 
> Signed-off-by: Sean MacLennan <smaclennan@pikatech.com>
> ---

Can we add proper CONFIG_PPC_FPU into this file.

- k
Sean MacLennan - Aug. 31, 2010, 5:46 p.m.
On Tue, 31 Aug 2010 11:17:17 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:

> Can we add proper CONFIG_PPC_FPU into this file.

If nobody beats me to it.... I can try this evening.

Cheers,
   Sean
Sean MacLennan - Sept. 1, 2010, 2:55 a.m.
On Tue, 31 Aug 2010 13:46:05 -0400
Sean MacLennan <smaclennan@pikatech.com> wrote:

> On Tue, 31 Aug 2010 11:17:17 -0500
> Kumar Gala <galak@kernel.crashing.org> wrote:
> 
> > Can we add proper CONFIG_PPC_FPU into this file.  
> 
> If nobody beats me to it.... I can try this evening.

I had to give up. Without the CONFIG_PPC_FPU it compiles fine for an
FPU less 44x. But with the CONFIG_PPC_FPU, I get the following errors:

arch/powerpc/lib/built-in.o: In function `__copy_tofrom_user':
arch/powerpc/lib/copy_32.S:(.kprobes.text+0xf8e): undefined reference to `do_lfs'
arch/powerpc/lib/copy_32.S:(.kprobes.text+0xf96): undefined reference to `do_lfs'
arch/powerpc/lib/copy_32.S:(.kprobes.text+0xfc2): undefined reference to `do_lfd'
arch/powerpc/lib/copy_32.S:(.kprobes.text+0xfca): undefined reference to `do_lfd'
arch/powerpc/lib/copy_32.S:(.kprobes.text+0xff6): undefined reference to `do_stfs'
arch/powerpc/lib/copy_32.S:(.kprobes.text+0xffe): undefined reference to `do_stfs'
arch/powerpc/lib/copy_32.S:(.kprobes.text+0x102a): undefined reference to `do_stfd'
arch/powerpc/lib/copy_32.S:(.kprobes.text+0x1032): undefined reference to `do_stfd'
make: *** [.tmp_vmlinux1] Error 1


Oops, sorry, it will say arch/powerpc/lib/copy32.S... I corrected that.
But I cannot find how copy_32.S is including those functions.

Cheers,
   Sean
Kumar Gala - Sept. 1, 2010, 6:45 a.m.
On Aug 31, 2010, at 9:55 PM, Sean MacLennan wrote:

> On Tue, 31 Aug 2010 13:46:05 -0400
> Sean MacLennan <smaclennan@pikatech.com> wrote:
> 
>> On Tue, 31 Aug 2010 11:17:17 -0500
>> Kumar Gala <galak@kernel.crashing.org> wrote:
>> 
>>> Can we add proper CONFIG_PPC_FPU into this file.  
>> 
>> If nobody beats me to it.... I can try this evening.
> 
> I had to give up. Without the CONFIG_PPC_FPU it compiles fine for an
> FPU less 44x. But with the CONFIG_PPC_FPU, I get the following errors:
> 
> arch/powerpc/lib/built-in.o: In function `__copy_tofrom_user':
> arch/powerpc/lib/copy_32.S:(.kprobes.text+0xf8e): undefined reference to `do_lfs'
> arch/powerpc/lib/copy_32.S:(.kprobes.text+0xf96): undefined reference to `do_lfs'
> arch/powerpc/lib/copy_32.S:(.kprobes.text+0xfc2): undefined reference to `do_lfd'
> arch/powerpc/lib/copy_32.S:(.kprobes.text+0xfca): undefined reference to `do_lfd'
> arch/powerpc/lib/copy_32.S:(.kprobes.text+0xff6): undefined reference to `do_stfs'
> arch/powerpc/lib/copy_32.S:(.kprobes.text+0xffe): undefined reference to `do_stfs'
> arch/powerpc/lib/copy_32.S:(.kprobes.text+0x102a): undefined reference to `do_stfd'
> arch/powerpc/lib/copy_32.S:(.kprobes.text+0x1032): undefined reference to `do_stfd'
> make: *** [.tmp_vmlinux1] Error 1
> 
> 
> Oops, sorry, it will say arch/powerpc/lib/copy32.S... I corrected that.
> But I cannot find how copy_32.S is including those functions.
> 
> Cheers,
>   Sean

For what defconfig setup do you get the errors above?

- k
Sean MacLennan - Sept. 1, 2010, 6:57 a.m.
On Wed, 1 Sep 2010 01:45:46 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:

> For what defconfig setup do you get the errors above?

44x/ebony_defconfig

Then enable KPROBES (or XMON).

Then put an #ifdef CONFIG_PPC_FPU in ldstfp.S.

Cheers,
   Sean
Paul Mackerras - Sept. 1, 2010, 8:02 a.m.
On Tue, Aug 31, 2010 at 10:55:25PM -0400, Sean MacLennan wrote:

> I had to give up. Without the CONFIG_PPC_FPU it compiles fine for an
> FPU less 44x. But with the CONFIG_PPC_FPU, I get the following errors:

Ah, those references would be from arch/powerpc/lib/sstep.c.  Evidently
we need #ifdef CONFIG_PPC_FPU around the emulation of the floating-point
loads and stores.

Do we do any in-kernel emulation of floating-point operations with
CONFIG_PPC_FPU turned off?

Paul.
Kumar Gala - Sept. 1, 2010, 1:01 p.m.
On Sep 1, 2010, at 3:02 AM, Paul Mackerras wrote:

> On Tue, Aug 31, 2010 at 10:55:25PM -0400, Sean MacLennan wrote:
> 
>> I had to give up. Without the CONFIG_PPC_FPU it compiles fine for an
>> FPU less 44x. But with the CONFIG_PPC_FPU, I get the following errors:
> 
> Ah, those references would be from arch/powerpc/lib/sstep.c.  Evidently
> we need #ifdef CONFIG_PPC_FPU around the emulation of the floating-point
> loads and stores.
> 
> Do we do any in-kernel emulation of floating-point operations with
> CONFIG_PPC_FPU turned off?

I'm not aware of any.  I haven't looked at the Program Check exception path to know if we'd handle emulation gracefully or not for !CONFIG_PPC_FPU.

- k
Sean MacLennan - Sept. 1, 2010, 4:40 p.m.
On Wed, 1 Sep 2010 18:02:14 +1000
Paul Mackerras <paulus@samba.org> wrote:

> Ah, those references would be from arch/powerpc/lib/sstep.c.
> Evidently we need #ifdef CONFIG_PPC_FPU around the emulation of the
> floating-point loads and stores.

I tried that yesterday and it didn't help, although maybe I forgot to
mask out a few. I will check again.

Cheers,
   Sean

Patch

diff --git a/arch/powerpc/lib/ldstfp.S b/arch/powerpc/lib/ldstfp.S
index f644863..ce818a5 100644
--- a/arch/powerpc/lib/ldstfp.S
+++ b/arch/powerpc/lib/ldstfp.S
@@ -81,7 +81,7 @@  _GLOBAL(do_lfs)
 	mfmsr	r6
 	ori	r7,r6,MSR_FP
 	cmpwi	cr7,r3,0
-	mtmsrd	r7
+	MTMSRD(r7)
 	isync
 	beq	cr7,1f
 	stfd	fr0,STKFRM-16(r1)
@@ -93,7 +93,7 @@  _GLOBAL(do_lfs)
 	lfd	fr0,STKFRM-16(r1)
 4:	PPC_LL	r0,STKFRM+PPC_LR_STKOFF(r1)
 	mtlr	r0
-	mtmsrd	r6
+	MTMSRD(r6)
 	isync
 	mr	r3,r9
 	addi	r1,r1,STKFRM
@@ -108,7 +108,7 @@  _GLOBAL(do_lfd)
 	mfmsr	r6
 	ori	r7,r6,MSR_FP
 	cmpwi	cr7,r3,0
-	mtmsrd	r7
+	MTMSRD(r7)
 	isync
 	beq	cr7,1f
 	stfd	fr0,STKFRM-16(r1)
@@ -120,7 +120,7 @@  _GLOBAL(do_lfd)
 	lfd	fr0,STKFRM-16(r1)
 4:	PPC_LL	r0,STKFRM+PPC_LR_STKOFF(r1)
 	mtlr	r0
-	mtmsrd	r6
+	MTMSRD(r6)
 	isync
 	mr	r3,r9
 	addi	r1,r1,STKFRM
@@ -135,7 +135,7 @@  _GLOBAL(do_stfs)
 	mfmsr	r6
 	ori	r7,r6,MSR_FP
 	cmpwi	cr7,r3,0
-	mtmsrd	r7
+	MTMSRD(r7)
 	isync
 	beq	cr7,1f
 	stfd	fr0,STKFRM-16(r1)
@@ -147,7 +147,7 @@  _GLOBAL(do_stfs)
 	lfd	fr0,STKFRM-16(r1)
 4:	PPC_LL	r0,STKFRM+PPC_LR_STKOFF(r1)
 	mtlr	r0
-	mtmsrd	r6
+	MTMSRD(r6)
 	isync
 	mr	r3,r9
 	addi	r1,r1,STKFRM
@@ -162,7 +162,7 @@  _GLOBAL(do_stfd)
 	mfmsr	r6
 	ori	r7,r6,MSR_FP
 	cmpwi	cr7,r3,0
-	mtmsrd	r7
+	MTMSRD(r7)
 	isync
 	beq	cr7,1f
 	stfd	fr0,STKFRM-16(r1)
@@ -174,7 +174,7 @@  _GLOBAL(do_stfd)
 	lfd	fr0,STKFRM-16(r1)
 4:	PPC_LL	r0,STKFRM+PPC_LR_STKOFF(r1)
 	mtlr	r0
-	mtmsrd	r6
+	MTMSRD(r6)
 	isync
 	mr	r3,r9
 	addi	r1,r1,STKFRM
@@ -229,7 +229,7 @@  _GLOBAL(do_lvx)
 	oris	r7,r6,MSR_VEC@h
 	cmpwi	cr7,r3,0
 	li	r8,STKFRM-16
-	mtmsrd	r7
+	MTMSRD(r7)
 	isync
 	beq	cr7,1f
 	stvx	vr0,r1,r8
@@ -241,7 +241,7 @@  _GLOBAL(do_lvx)
 	lvx	vr0,r1,r8
 4:	PPC_LL	r0,STKFRM+PPC_LR_STKOFF(r1)
 	mtlr	r0
-	mtmsrd	r6
+	MTMSRD(r6)
 	isync
 	mr	r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