linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] powerpc/math-emu: two minor cleanup patches for math.c
@ 2013-07-10  1:43 Kevin Hao
  2013-07-10  1:43 ` [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c Kevin Hao
  2013-07-10  1:43 ` [PATCH 2/2] powerpc/math-emu: remove the unneeded check for CONFIG_MATH_EMULATION " Kevin Hao
  0 siblings, 2 replies; 8+ messages in thread
From: Kevin Hao @ 2013-07-10  1:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc

Just remove some dead or unneeded codes in math.c. No function change.

Kevin Hao (2):
  powerpc/math-emu: remove the dead code in math.c
  powerpc/math-emu: remove the unneeded check for CONFIG_MATH_EMULATION
    in     math.c

 arch/powerpc/math-emu/math.c | 46 --------------------------------------------
 1 file changed, 46 deletions(-)

-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c
  2013-07-10  1:43 [PATCH 0/2] powerpc/math-emu: two minor cleanup patches for math.c Kevin Hao
@ 2013-07-10  1:43 ` Kevin Hao
  2013-07-10  2:01   ` Michael Ellerman
  2013-07-10  1:43 ` [PATCH 2/2] powerpc/math-emu: remove the unneeded check for CONFIG_MATH_EMULATION " Kevin Hao
  1 sibling, 1 reply; 8+ messages in thread
From: Kevin Hao @ 2013-07-10  1:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc

The math.c is only built when CONFIG_MATH_EMULATION is enabled.
So we would never get into the case that CONFIG_MATH_EMULATION
is not defined in this file.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 arch/powerpc/math-emu/math.c | 42 ------------------------------------------
 1 file changed, 42 deletions(-)

diff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c
index 0328e66..cefb4f2 100644
--- a/arch/powerpc/math-emu/math.c
+++ b/arch/powerpc/math-emu/math.c
@@ -231,47 +231,6 @@ do_mathemu(struct pt_regs *regs)
 	if (get_user(insn, (u32 *)pc))
 		return -EFAULT;
 
-#ifndef CONFIG_MATH_EMULATION
-	switch (insn >> 26) {
-	case LFD:
-		idx = (insn >> 16) & 0x1f;
-		sdisp = (insn & 0xffff);
-		op0 = (void *)&current->thread.TS_FPR((insn >> 21) & 0x1f);
-		op1 = (void *)((idx ? regs->gpr[idx] : 0) + sdisp);
-		lfd(op0, op1, op2, op3);
-		break;
-	case LFDU:
-		idx = (insn >> 16) & 0x1f;
-		sdisp = (insn & 0xffff);
-		op0 = (void *)&current->thread.TS_FPR((insn >> 21) & 0x1f);
-		op1 = (void *)((idx ? regs->gpr[idx] : 0) + sdisp);
-		lfd(op0, op1, op2, op3);
-		regs->gpr[idx] = (unsigned long)op1;
-		break;
-	case STFD:
-		idx = (insn >> 16) & 0x1f;
-		sdisp = (insn & 0xffff);
-		op0 = (void *)&current->thread.TS_FPR((insn >> 21) & 0x1f);
-		op1 = (void *)((idx ? regs->gpr[idx] : 0) + sdisp);
-		stfd(op0, op1, op2, op3);
-		break;
-	case STFDU:
-		idx = (insn >> 16) & 0x1f;
-		sdisp = (insn & 0xffff);
-		op0 = (void *)&current->thread.TS_FPR((insn >> 21) & 0x1f);
-		op1 = (void *)((idx ? regs->gpr[idx] : 0) + sdisp);
-		stfd(op0, op1, op2, op3);
-		regs->gpr[idx] = (unsigned long)op1;
-		break;
-	case OP63:
-		op0 = (void *)&current->thread.TS_FPR((insn >> 21) & 0x1f);
-		op1 = (void *)&current->thread.TS_FPR((insn >> 11) & 0x1f);
-		fmr(op0, op1, op2, op3);
-		break;
-	default:
-		goto illegal;
-	}
-#else /* CONFIG_MATH_EMULATION */
 	switch (insn >> 26) {
 	case LFS:	func = lfs;	type = D;	break;
 	case LFSU:	func = lfs;	type = DU;	break;
@@ -485,7 +444,6 @@ do_mathemu(struct pt_regs *regs)
 	default:
 		break;
 	}
-#endif /* CONFIG_MATH_EMULATION */
 
 	regs->nip += 4;
 	return 0;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] powerpc/math-emu: remove the unneeded check for CONFIG_MATH_EMULATION in math.c
  2013-07-10  1:43 [PATCH 0/2] powerpc/math-emu: two minor cleanup patches for math.c Kevin Hao
  2013-07-10  1:43 ` [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c Kevin Hao
@ 2013-07-10  1:43 ` Kevin Hao
  1 sibling, 0 replies; 8+ messages in thread
From: Kevin Hao @ 2013-07-10  1:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc

The math.c is only built when CONFIG_MATH_EMULATION is enabled.
So the #ifdef check for CONFIG_MATH_EMULATION in it seems redundant.
Drop all of them.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 arch/powerpc/math-emu/math.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c
index cefb4f2..3fe8e35 100644
--- a/arch/powerpc/math-emu/math.c
+++ b/arch/powerpc/math-emu/math.c
@@ -154,7 +154,6 @@ FLOATFUNC(fsqrts);
 #define XEU	15
 #define XFLB	10
 
-#ifdef CONFIG_MATH_EMULATION
 static int
 record_exception(struct pt_regs *regs, int eflag)
 {
@@ -212,7 +211,6 @@ record_exception(struct pt_regs *regs, int eflag)
 
 	return (fpscr & FPSCR_FEX) ? 1 : 0;
 }
-#endif /* CONFIG_MATH_EMULATION */
 
 int
 do_mathemu(struct pt_regs *regs)
@@ -222,11 +220,9 @@ do_mathemu(struct pt_regs *regs)
 	signed short sdisp;
 	u32 insn = 0;
 	int idx = 0;
-#ifdef CONFIG_MATH_EMULATION
 	int (*func)(void *, void *, void *, void *);
 	int type = 0;
 	int eflag, trap;
-#endif
 
 	if (get_user(insn, (u32 *)pc))
 		return -EFAULT;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c
  2013-07-10  1:43 ` [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c Kevin Hao
@ 2013-07-10  2:01   ` Michael Ellerman
  2013-07-10  2:23     ` Kevin Hao
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Ellerman @ 2013-07-10  2:01 UTC (permalink / raw)
  To: Kevin Hao; +Cc: linuxppc

On Wed, Jul 10, 2013 at 09:43:42AM +0800, Kevin Hao wrote:
> The math.c is only built when CONFIG_MATH_EMULATION is enabled.
> So we would never get into the case that CONFIG_MATH_EMULATION
> is not defined in this file.

Any idea why we have that there? ie. have the config symbols changed
over time or was this always dead code?

cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c
  2013-07-10  2:01   ` Michael Ellerman
@ 2013-07-10  2:23     ` Kevin Hao
  2013-07-10  3:25       ` Michael Ellerman
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Hao @ 2013-07-10  2:23 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

On Wed, Jul 10, 2013 at 12:01:33PM +1000, Michael Ellerman wrote:
> On Wed, Jul 10, 2013 at 09:43:42AM +0800, Kevin Hao wrote:
> > The math.c is only built when CONFIG_MATH_EMULATION is enabled.
> > So we would never get into the case that CONFIG_MATH_EMULATION
> > is not defined in this file.
> 
> Any idea why we have that there? ie. have the config symbols changed
> over time or was this always dead code?

No idea. I tried to trace this before submitting the patch. But it has
been there since the begin of the git history. So I just assume that it is
always dead code. :-)

Thanks,
Kevin

> 
> cheers

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c
  2013-07-10  2:23     ` Kevin Hao
@ 2013-07-10  3:25       ` Michael Ellerman
  2013-07-10  3:46         ` Kevin Hao
  2013-07-10  3:48         ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Ellerman @ 2013-07-10  3:25 UTC (permalink / raw)
  To: Kevin Hao; +Cc: linuxppc

On Wed, Jul 10, 2013 at 10:23:07AM +0800, Kevin Hao wrote:
> On Wed, Jul 10, 2013 at 12:01:33PM +1000, Michael Ellerman wrote:
> > On Wed, Jul 10, 2013 at 09:43:42AM +0800, Kevin Hao wrote:
> > > The math.c is only built when CONFIG_MATH_EMULATION is enabled.
> > > So we would never get into the case that CONFIG_MATH_EMULATION
> > > is not defined in this file.
> > 
> > Any idea why we have that there? ie. have the config symbols changed
> > over time or was this always dead code?
> 
> No idea. I tried to trace this before submitting the patch. But it has
> been there since the begin of the git history. So I just assume that it is
> always dead code. :-)

Yeah looks like it. Even in the git-huge tree I see it in the initial
commit.

You should say that in the commit message though. Otherwise it's not
clear if you're fixing a recent breakage or not.

cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c
  2013-07-10  3:25       ` Michael Ellerman
@ 2013-07-10  3:46         ` Kevin Hao
  2013-07-10  3:48         ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 8+ messages in thread
From: Kevin Hao @ 2013-07-10  3:46 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc

[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]

On Wed, Jul 10, 2013 at 01:25:33PM +1000, Michael Ellerman wrote:
> On Wed, Jul 10, 2013 at 10:23:07AM +0800, Kevin Hao wrote:
> > On Wed, Jul 10, 2013 at 12:01:33PM +1000, Michael Ellerman wrote:
> > > On Wed, Jul 10, 2013 at 09:43:42AM +0800, Kevin Hao wrote:
> > > > The math.c is only built when CONFIG_MATH_EMULATION is enabled.
> > > > So we would never get into the case that CONFIG_MATH_EMULATION
> > > > is not defined in this file.
> > > 
> > > Any idea why we have that there? ie. have the config symbols changed
> > > over time or was this always dead code?
> > 
> > No idea. I tried to trace this before submitting the patch. But it has
> > been there since the begin of the git history. So I just assume that it is
> > always dead code. :-)
> 
> Yeah looks like it. Even in the git-huge tree I see it in the initial
> commit.

Thanks for the confirmation.

> 
> You should say that in the commit message though. Otherwise it's not
> clear if you're fixing a recent breakage or not.

Indeed. I will wait a little to see if there are any other comments. Then
respin a new version to capture such info in the commit log.

Thanks,
Kevin

> 
> cheers

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c
  2013-07-10  3:25       ` Michael Ellerman
  2013-07-10  3:46         ` Kevin Hao
@ 2013-07-10  3:48         ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2013-07-10  3:48 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc, Kevin Hao

On Wed, 2013-07-10 at 13:25 +1000, Michael Ellerman wrote:
> > > Any idea why we have that there? ie. have the config symbols changed
> > > over time or was this always dead code?
> > 
> > No idea. I tried to trace this before submitting the patch. But it has
> > been there since the begin of the git history. So I just assume that it is
> > always dead code. :-)
> 
> Yeah looks like it. Even in the git-huge tree I see it in the initial
> commit.
> 
> You should say that in the commit message though. Otherwise it's not
> clear if you're fixing a recent breakage or not.

This is ancient code that was meant to emulate only load/stores/fmr without
the rest of the emulation. The goal was to be able to boot userspace that
was compiled without -msoft-float to *some* extent (bcs it would potentially
use fp load/stores for things like memcpy) on small CPUs where the kernel
footprint was critical.

It's been obsolete for a while now.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-07-10  3:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-10  1:43 [PATCH 0/2] powerpc/math-emu: two minor cleanup patches for math.c Kevin Hao
2013-07-10  1:43 ` [PATCH 1/2] powerpc/math-emu: remove the dead code in math.c Kevin Hao
2013-07-10  2:01   ` Michael Ellerman
2013-07-10  2:23     ` Kevin Hao
2013-07-10  3:25       ` Michael Ellerman
2013-07-10  3:46         ` Kevin Hao
2013-07-10  3:48         ` Benjamin Herrenschmidt
2013-07-10  1:43 ` [PATCH 2/2] powerpc/math-emu: remove the unneeded check for CONFIG_MATH_EMULATION " Kevin Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).