diff mbox series

[v4,3/7] mips: rename macros and files from '64' to 'n64'

Message ID 1544073508-13720-4-git-send-email-firoz.khan@linaro.org
State New
Headers show
Series mips: system call table generation support | expand

Commit Message

Firoz Khan Dec. 6, 2018, 5:18 a.m. UTC
When we get nanoMIPS support we'll be introducing the p32
ABI, and there's a reasonable chance that the equivalent
p64 ABI may come along in the future. Using 'n64' now would
avoid confusion in that case where we may have 2 different
64-bit ABIs.

Suggested-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: Firoz Khan <firoz.khan@linaro.org>

---
 arch/mips/include/asm/asm.h                      | 6 +++---
 arch/mips/include/asm/fpregdef.h                 | 4 ++--
 arch/mips/include/asm/fw/arc/hinv.h              | 2 +-
 arch/mips/include/asm/regdef.h                   | 4 ++--
 arch/mips/include/asm/sigcontext.h               | 4 ++--
 arch/mips/include/uapi/asm/fcntl.h               | 2 +-
 arch/mips/include/uapi/asm/reg.h                 | 4 ++--
 arch/mips/include/uapi/asm/sgidefs.h             | 2 +-
 arch/mips/include/uapi/asm/sigcontext.h          | 4 ++--
 arch/mips/include/uapi/asm/stat.h                | 4 ++--
 arch/mips/include/uapi/asm/statfs.h              | 4 ++--
 arch/mips/include/uapi/asm/unistd.h              | 8 ++++----
 arch/mips/kernel/Makefile                        | 2 +-
 arch/mips/kernel/ftrace.c                        | 4 ++--
 arch/mips/kernel/{scall64-64.S => scall64-n64.S} | 4 ++--
 arch/mips/kvm/entry.c                            | 4 ++--
 arch/mips/vdso/vdso.h                            | 2 +-
 arch/mips/vdso/vdso.lds.S                        | 2 +-
 18 files changed, 33 insertions(+), 33 deletions(-)
 rename arch/mips/kernel/{scall64-64.S => scall64-n64.S} (99%)

-- 
1.9.1

Comments

Paul Burton Dec. 10, 2018, 7:51 p.m. UTC | #1
Hi Firoz,

On Thu, Dec 06, 2018 at 10:48:24AM +0530, Firoz Khan wrote:
> diff --git a/arch/mips/include/uapi/asm/sgidefs.h b/arch/mips/include/uapi/asm/sgidefs.h

> index 26143e3..0364eec 100644

> --- a/arch/mips/include/uapi/asm/sgidefs.h

> +++ b/arch/mips/include/uapi/asm/sgidefs.h

> @@ -40,6 +40,6 @@

>   */

>  #define _MIPS_SIM_ABI32		1

>  #define _MIPS_SIM_NABI32	2

> -#define _MIPS_SIM_ABI64		3

> +#define _MIPS_SIM_ABIN64	3


Whilst I agree with changing our own definitions & filenames to use n64,
this macro actually reflects naming used by the toolchain. ie:

    $ mips-linux-gcc -mips64 -mabi=64 -dM -E - </dev/null | grep ABI64
    #define _ABI64 3
    #define _MIPS_SIM _ABI64

Our macro here is used to compare against _MIPS_SIM provided by the
toolchain, so for consistency I think we should keep the same name for
the macro that the toolchain uses.

And I realise that undoing that but keeping n64 in our own filenames &
macros is another type of inconsistency, but something imperfect is
unavoidable at this point given that the engineers way back when decided
to use "ABI64" for n64.

Thanks,
    Paul
Maciej W. Rozycki Dec. 10, 2018, 11:32 p.m. UTC | #2
On Mon, 10 Dec 2018, Paul Burton wrote:

> And I realise that undoing that but keeping n64 in our own filenames &

> macros is another type of inconsistency, but something imperfect is

> unavoidable at this point given that the engineers way back when decided

> to use "ABI64" for n64.


 My feeling has been n32 was invented at SGI as an afterthought, hence the 
choice of having ABI32 or ABI64 defined for the 32-bit (now o32) and the 
64-bit (now n64) ABI respectively was reasonable.

 FWIW,

  Maciej
Paul Burton Dec. 10, 2018, 11:46 p.m. UTC | #3
Hi Maciej,

On Mon, Dec 10, 2018 at 11:32:46PM +0000, Maciej W. Rozycki wrote:
> On Mon, 10 Dec 2018, Paul Burton wrote:

> 

> > And I realise that undoing that but keeping n64 in our own filenames &

> > macros is another type of inconsistency, but something imperfect is

> > unavoidable at this point given that the engineers way back when decided

> > to use "ABI64" for n64.

> 

>  My feeling has been n32 was invented at SGI as an afterthought, hence the 

> choice of having ABI32 or ABI64 defined for the 32-bit (now o32) and the 

> 64-bit (now n64) ABI respectively was reasonable.


I'd agree if _MIPS_SIM were defined as _ABI32 for o32, but:

  $ mips-linux-gcc -mabi=32 -dM -E - </dev/null | grep ABIO32
  #define _ABIO32 1
  #define _MIPS_SIM _ABIO32

...so _MIPS_SIM is:

  _ABIO32 for o32
  _ABIN32 for n32
  _ABI64 for n64

That doesn't seem very consistent to me, and means that there inevitably
has to be some ugliness once there are multiple 64-bit ABIs.

To me it feels like the result of someone thinking "one 64-bit MIPS ABI
ought to be enough for anybody". I'm undecided whether that person was
shortsighted or a genius whose vision was simply incomprehensible to
those of us that followed.

Thanks,
    Paul
Firoz Khan Dec. 11, 2018, 8:45 a.m. UTC | #4
Hi Paul,

On Tue, 11 Dec 2018 at 01:21, Paul Burton <paul.burton@mips.com> wrote:
>

> Hi Firoz,

>

> On Thu, Dec 06, 2018 at 10:48:24AM +0530, Firoz Khan wrote:

> > diff --git a/arch/mips/include/uapi/asm/sgidefs.h b/arch/mips/include/uapi/asm/sgidefs.h

> > index 26143e3..0364eec 100644

> > --- a/arch/mips/include/uapi/asm/sgidefs.h

> > +++ b/arch/mips/include/uapi/asm/sgidefs.h

> > @@ -40,6 +40,6 @@

> >   */

> >  #define _MIPS_SIM_ABI32              1

> >  #define _MIPS_SIM_NABI32     2

> > -#define _MIPS_SIM_ABI64              3

> > +#define _MIPS_SIM_ABIN64     3

>

> Whilst I agree with changing our own definitions & filenames to use n64,

> this macro actually reflects naming used by the toolchain. ie:

>

>     $ mips-linux-gcc -mips64 -mabi=64 -dM -E - </dev/null | grep ABI64

>     #define _ABI64 3

>     #define _MIPS_SIM _ABI64

>

> Our macro here is used to compare against _MIPS_SIM provided by the

> toolchain, so for consistency I think we should keep the same name for

> the macro that the toolchain uses.


Will this below change will help?

 #define _MIPS_SIM_ABI32              1
 #define _MIPS_SIM_NABI32            2
 #define _MIPS_SIM_ABI64              3
+#define _MIPS_SIM_ABIN64           _MIPS_SIM_ABI64

Thanks
Firoz

>

> And I realise that undoing that but keeping n64 in our own filenames &

> macros is another type of inconsistency, but something imperfect is

> unavoidable at this point given that the engineers way back when decided

> to use "ABI64" for n64.

>

> Thanks,

>     Paul
Maciej W. Rozycki Dec. 11, 2018, 10:58 a.m. UTC | #5
Hi Paul,

> >  My feeling has been n32 was invented at SGI as an afterthought, hence the 

> > choice of having ABI32 or ABI64 defined for the 32-bit (now o32) and the 

> > 64-bit (now n64) ABI respectively was reasonable.

> 

> I'd agree if _MIPS_SIM were defined as _ABI32 for o32, but:

> 

>   $ mips-linux-gcc -mabi=32 -dM -E - </dev/null | grep ABIO32

>   #define _ABIO32 1

>   #define _MIPS_SIM _ABIO32

> 

> ...so _MIPS_SIM is:

> 

>   _ABIO32 for o32

>   _ABIN32 for n32

>   _ABI64 for n64

> 

> That doesn't seem very consistent to me, and means that there inevitably

> has to be some ugliness once there are multiple 64-bit ABIs.


 The _ABI* macros were invented as a GNU feature long after _MIPS_SIM_* 
ones, i.e. IIRC early 2000s vs mid 1990s.  Only _MIPS_SIM_* macros are 
referred in SGI documentation.

 It is inconsistent and I don't know why whoever invented the _ABI* macros 
didn't follow the original naming convention chosen by SGI for _MIPS_SIM_* 
ones, i.e. _ABI32, _NABI32, _ABI64 (but then I don't know either why some 
people have troubles with recognising patterns in existing code and then 
following those patterns when making changes or additions to that code; I 
guess that's just what some people are like).

 BTW in case anybody wondered SIM stands for Subprogram Interface Model.

> To me it feels like the result of someone thinking "one 64-bit MIPS ABI

> ought to be enough for anybody". I'm undecided whether that person was

> shortsighted or a genius whose vision was simply incomprehensible to

> those of us that followed.


 I think back when 64-bit processors were a new invention hardly anyone 
thought about proliferating 64-bit ABIs.  Remember that first MIPS systems 
were high-end workstations and servers and n32 was invented as a means to 
conserve memory, which wasn't seen as a necessity at the beginning.  A 
secondary goal might have been improving the performance of badly-written 
32-bit software, by means of the better function calling convention n32 
has over o32.

 Notice for example that for a long time x86-64 only had a single native 
64-bit ABI, which is LP64 like our n64, and it was only quite recently 
that the x86-64 x32 ILP32 ABI was added, which is like our n32.  And yet 
at this very moment it is being discussed on LKML whether x32 actually has 
any users beyond developers who maintain it and consequently whether it is 
worth it to keep support for it in our kernel.  To me it means in the 
workstation and server segment there is still no need to conserve memory 
(and with the ubiquity of 64-bit systems nowadays the need to maintain 
unportable 32-bit software has largely disappeared).

 So if anything was not expected it was the expansion of 64-bit MIPS 
processors into the embedded market or indeed the scale of the expansion 
of the embedded market itself, but I wouldn't call the lack of such an 
expectation short-sightedness.  It would be too bold a statement to me, 
because the change was simply too revolutionary to be considered some 25 
years ago.  Nobody in early 1990s would think of a 64-bit computer in a 
ballpoint pen or suchlike being a common device and the consequences for 
code design it would have.

 FWIW,

  Maciej
Paul Burton Dec. 11, 2018, 6:59 p.m. UTC | #6
Hi Firoz,

On Tue, Dec 11, 2018 at 02:15:19PM +0530, Firoz Khan wrote:
> > > diff --git a/arch/mips/include/uapi/asm/sgidefs.h b/arch/mips/include/uapi/asm/sgidefs.h

> > > index 26143e3..0364eec 100644

> > > --- a/arch/mips/include/uapi/asm/sgidefs.h

> > > +++ b/arch/mips/include/uapi/asm/sgidefs.h

> > > @@ -40,6 +40,6 @@

> > >   */

> > >  #define _MIPS_SIM_ABI32              1

> > >  #define _MIPS_SIM_NABI32     2

> > > -#define _MIPS_SIM_ABI64              3

> > > +#define _MIPS_SIM_ABIN64     3

> >

> > Whilst I agree with changing our own definitions & filenames to use n64,

> > this macro actually reflects naming used by the toolchain. ie:

> >

> >     $ mips-linux-gcc -mips64 -mabi=64 -dM -E - </dev/null | grep ABI64

> >     #define _ABI64 3

> >     #define _MIPS_SIM _ABI64

> >

> > Our macro here is used to compare against _MIPS_SIM provided by the

> > toolchain, so for consistency I think we should keep the same name for

> > the macro that the toolchain uses.

> 

> Will this below change will help?

> 

>  #define _MIPS_SIM_ABI32              1

>  #define _MIPS_SIM_NABI32            2

>  #define _MIPS_SIM_ABI64              3

> +#define _MIPS_SIM_ABIN64           _MIPS_SIM_ABI64


Hmm, I think I'd prefer that we just keep using _MIPS_SIM_ABI64.

Side note - this snippet of code shows another inconsistency... we have
_MIPS_SIM_NABI32 whilst the toolchain uses _ABIN32... No need to worry
about that here though. In short let's leave _MIPS_SIM_* alone in this
series.

Thanks,
    Paul
Firoz Khan Dec. 12, 2018, 4:34 a.m. UTC | #7
Hi Paul,

On Wed, 12 Dec 2018 at 00:29, Paul Burton <paul.burton@mips.com> wrote:
> > Will this below change will help?

> >

> >  #define _MIPS_SIM_ABI32              1

> >  #define _MIPS_SIM_NABI32            2

> >  #define _MIPS_SIM_ABI64              3

> > +#define _MIPS_SIM_ABIN64           _MIPS_SIM_ABI64

>

> Hmm, I think I'd prefer that we just keep using _MIPS_SIM_ABI64.


Sure, I think '64' to 'n64' conversion must be remove it from this patch
series.I can send v5 without '64' to 'n64' conversion.

If we rename '64' to 'n64' in half of the place and this _MIPS_SIM_ABI64
if we half to keep it in same looks not good (according to me).

(FYI, This macro name - _MIPS_SIM_ABIN64 must be _MIPS_SIM_NABI64
and defintion will be:
+#define _MIPS_SIM_NABI64           _MIPS_SIM_ABI64)

So If you confirm I can send v5 without '64' to 'n64' conversion (not just above
one, completely from this patch series). Or uou can take a call just
keep this macro -
_MIPS_SIM_ABI64 as it is and change it rest of the place.

Thanks
Firoz
Paul Burton Dec. 12, 2018, 10:28 p.m. UTC | #8
Hi Firoz,

On Wed, Dec 12, 2018 at 10:04:47AM +0530, Firoz Khan wrote:
> > > Will this below change will help?

> > >

> > >  #define _MIPS_SIM_ABI32              1

> > >  #define _MIPS_SIM_NABI32            2

> > >  #define _MIPS_SIM_ABI64              3

> > > +#define _MIPS_SIM_ABIN64           _MIPS_SIM_ABI64

> >

> > Hmm, I think I'd prefer that we just keep using _MIPS_SIM_ABI64.

> 

> Sure, I think '64' to 'n64' conversion must be remove it from this patch

> series.I can send v5 without '64' to 'n64' conversion.

> 

> If we rename '64' to 'n64' in half of the place and this _MIPS_SIM_ABI64

> if we half to keep it in same looks not good (according to me).

> 

> (FYI, This macro name - _MIPS_SIM_ABIN64 must be _MIPS_SIM_NABI64

> and defintion will be:

> +#define _MIPS_SIM_NABI64           _MIPS_SIM_ABI64)

> 

> So If you confirm I can send v5 without '64' to 'n64' conversion (not just above

> one, completely from this patch series). Or uou can take a call just

> keep this macro -

> _MIPS_SIM_ABI64 as it is and change it rest of the place.


Let's just go ahead & leave everything as 64, and I'll do the 64 -> n64
rename later. I hoped whilst you were adding n64-specific code this
would be an easy change, but at this point let's just prioritize getting
the series applied without the naming change so it can sit in -next for
a while before the merge window.

Thanks,
    Paul
Firoz Khan Dec. 13, 2018, 8:53 a.m. UTC | #9
Hi Paul,

On Thu, 13 Dec 2018 at 03:58, Paul Burton <paul.burton@mips.com> wrote:
>

> Hi Firoz,

>

> On Wed, Dec 12, 2018 at 10:04:47AM +0530, Firoz Khan wrote:

> >

> > Sure, I think '64' to 'n64' conversion must be remove it from this patch

> > series.I can send v5 without '64' to 'n64' conversion.

> >

> > If we rename '64' to 'n64' in half of the place and this _MIPS_SIM_ABI64

> > if we half to keep it in same looks not good (according to me).

> >

> > (FYI, This macro name - _MIPS_SIM_ABIN64 must be _MIPS_SIM_NABI64

> > and defintion will be:

> > +#define _MIPS_SIM_NABI64           _MIPS_SIM_ABI64)

> >

> > So If you confirm I can send v5 without '64' to 'n64' conversion (not just above

> > one, completely from this patch series). Or uou can take a call just

> > keep this macro -

> > _MIPS_SIM_ABI64 as it is and change it rest of the place.

>

> Let's just go ahead & leave everything as 64, and I'll do the 64 -> n64

> rename later. I hoped whilst you were adding n64-specific code this

> would be an easy change, but at this point let's just prioritize getting

> the series applied without the naming change so it can sit in -next for

> a while before the merge window.


I'll keep the macro - _MIPS_SIM_ABI64 same and will not change the rest
of the patch series. Unfortunately, reverting back to 64 from n64 has lots of
work.

Thanks
Firoz
Paul Burton Dec. 13, 2018, 8:15 p.m. UTC | #10
Hi Firoz,

On Thu, Dec 13, 2018 at 02:23:21PM +0530, Firoz Khan wrote:
> > > So If you confirm I can send v5 without '64' to 'n64' conversion (not just above

> > > one, completely from this patch series). Or uou can take a call just

> > > keep this macro -

> > > _MIPS_SIM_ABI64 as it is and change it rest of the place.

> >

> > Let's just go ahead & leave everything as 64, and I'll do the 64 -> n64

> > rename later. I hoped whilst you were adding n64-specific code this

> > would be an easy change, but at this point let's just prioritize getting

> > the series applied without the naming change so it can sit in -next for

> > a while before the merge window.

> 

> I'll keep the macro - _MIPS_SIM_ABI64 same and will not change the rest

> of the patch series. Unfortunately, reverting back to 64 from n64 has lots of

> work.


I've applied v5 but undone the change from __NR_64_* to __NR_N64_*
because it's part of the UAPI & a github code search showed that it's
actually used.

Could you take a look at this branch & check that you're OK with it
before I push it to mips-next?

  git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git test-syscalls

  https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/log/?h=test-syscalls

Thanks,
    Paul
Firoz Khan Dec. 14, 2018, 5:50 a.m. UTC | #11
Hi Paul,

On Fri, 14 Dec 2018 at 01:45, Paul Burton <paul.burton@mips.com> wrote:
> I've applied v5 but undone the change from __NR_64_* to __NR_N64_*

> because it's part of the UAPI & a github code search showed that it's

> actually used.

>

> Could you take a look at this branch & check that you're OK with it

> before I push it to mips-next?

>

>   git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git test-syscalls

>

>   https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/log/?h=test-syscalls


This looks good to me. Please push to mips-next.

Thanks
Firoz
diff mbox series

Patch

diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
index c23527b..9244a87 100644
--- a/arch/mips/include/asm/asm.h
+++ b/arch/mips/include/asm/asm.h
@@ -110,7 +110,7 @@ 
 #define ALSZ	7
 #define ALMASK	~7
 #endif
-#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
+#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABIN64)
 #define ALSZ	15
 #define ALMASK	~15
 #endif
@@ -138,7 +138,7 @@ 
 #define REG_SUBU	subu
 #define REG_ADDU	addu
 #endif
-#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
+#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABIN64)
 #define REG_S		sd
 #define REG_L		ld
 #define REG_SUBU	dsubu
@@ -291,7 +291,7 @@ 
 #define MFC0		mfc0
 #define MTC0		mtc0
 #endif
-#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
+#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABIN64)
 #define MFC0		dmfc0
 #define MTC0		dmtc0
 #endif
diff --git a/arch/mips/include/asm/fpregdef.h b/arch/mips/include/asm/fpregdef.h
index f184ba0..762ffeb 100644
--- a/arch/mips/include/asm/fpregdef.h
+++ b/arch/mips/include/asm/fpregdef.h
@@ -71,7 +71,7 @@ 
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32
 
 #define fv0	$f0	/* return value */
 #define fv1	$f2
@@ -108,6 +108,6 @@ 
 
 #define fcr31	$31
 
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #endif /* _ASM_FPREGDEF_H */
diff --git a/arch/mips/include/asm/fw/arc/hinv.h b/arch/mips/include/asm/fw/arc/hinv.h
index d67b6a9..c9d0523 100644
--- a/arch/mips/include/asm/fw/arc/hinv.h
+++ b/arch/mips/include/asm/fw/arc/hinv.h
@@ -112,7 +112,7 @@ 
 	ULONG FullKey;
 };
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _MIPS_SIM_ABIN64
 #define SGI_ARCS_VERS	64			/* sgi 64-bit version */
 #define SGI_ARCS_REV	0			/* rev .00 */
 #else
diff --git a/arch/mips/include/asm/regdef.h b/arch/mips/include/asm/regdef.h
index 3c687df..45911d8 100644
--- a/arch/mips/include/asm/regdef.h
+++ b/arch/mips/include/asm/regdef.h
@@ -60,7 +60,7 @@ 
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32
 
 #define zero	$0	/* wired zero */
 #define AT	$at	/* assembler temp - uppercase because of ".set at" */
@@ -101,6 +101,6 @@ 
 #define s8	$30	/* callee saved */
 #define ra	$31	/* return address */
 
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #endif /* _ASM_REGDEF_H */
diff --git a/arch/mips/include/asm/sigcontext.h b/arch/mips/include/asm/sigcontext.h
index eeeb0f4..e3a55d1 100644
--- a/arch/mips/include/asm/sigcontext.h
+++ b/arch/mips/include/asm/sigcontext.h
@@ -11,7 +11,7 @@ 
 
 #include <uapi/asm/sigcontext.h>
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32
 
 struct sigcontext32 {
 	__u32		sc_regmask;	/* Unused */
@@ -33,5 +33,5 @@  struct sigcontext32 {
 	__u32		sc_hi3;
 	__u32		sc_lo3;
 };
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
 #endif /* _ASM_SIGCONTEXT_H */
diff --git a/arch/mips/include/uapi/asm/fcntl.h b/arch/mips/include/uapi/asm/fcntl.h
index 42e13de..34effe6 100644
--- a/arch/mips/include/uapi/asm/fcntl.h
+++ b/arch/mips/include/uapi/asm/fcntl.h
@@ -57,7 +57,7 @@ 
  * contain all the same fields as struct flock.
  */
 
-#if _MIPS_SIM != _MIPS_SIM_ABI64
+#if _MIPS_SIM != _MIPS_SIM_ABIN64
 
 #include <linux/types.h>
 
diff --git a/arch/mips/include/uapi/asm/reg.h b/arch/mips/include/uapi/asm/reg.h
index 56d15cb..57fe259 100644
--- a/arch/mips/include/uapi/asm/reg.h
+++ b/arch/mips/include/uapi/asm/reg.h
@@ -160,7 +160,7 @@ 
 #define EF_UNUSED0		MIPS32_EF_UNUSED0
 #define EF_SIZE			MIPS32_EF_SIZE
 
-#elif _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
+#elif _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32
 
 #define EF_R0			MIPS64_EF_R0
 #define EF_R1			MIPS64_EF_R1
@@ -202,6 +202,6 @@ 
 #define EF_CP0_CAUSE		MIPS64_EF_CP0_CAUSE
 #define EF_SIZE			MIPS64_EF_SIZE
 
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #endif /* __UAPI_ASM_MIPS_REG_H */
diff --git a/arch/mips/include/uapi/asm/sgidefs.h b/arch/mips/include/uapi/asm/sgidefs.h
index 26143e3..0364eec 100644
--- a/arch/mips/include/uapi/asm/sgidefs.h
+++ b/arch/mips/include/uapi/asm/sgidefs.h
@@ -40,6 +40,6 @@ 
  */
 #define _MIPS_SIM_ABI32		1
 #define _MIPS_SIM_NABI32	2
-#define _MIPS_SIM_ABI64		3
+#define _MIPS_SIM_ABIN64	3
 
 #endif /* __ASM_SGIDEFS_H */
diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h
index d0a540e..5e8a562 100644
--- a/arch/mips/include/uapi/asm/sigcontext.h
+++ b/arch/mips/include/uapi/asm/sigcontext.h
@@ -54,7 +54,7 @@  struct sigcontext {
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32
 
 #include <linux/posix_types.h>
 /*
@@ -86,6 +86,6 @@  struct sigcontext {
 };
 
 
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #endif /* _UAPI_ASM_SIGCONTEXT_H */
diff --git a/arch/mips/include/uapi/asm/stat.h b/arch/mips/include/uapi/asm/stat.h
index 95416f3..c1f6433 100644
--- a/arch/mips/include/uapi/asm/stat.h
+++ b/arch/mips/include/uapi/asm/stat.h
@@ -87,7 +87,7 @@  struct stat64 {
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _MIPS_SIM_ABIN64
 
 /* The memory layout is the same as of struct stat64 of the 32-bit kernel.  */
 struct stat {
@@ -126,7 +126,7 @@  struct stat {
 	unsigned long		st_blocks;
 };
 
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABIN64 */
 
 #define STAT_HAVE_NSEC 1
 
diff --git a/arch/mips/include/uapi/asm/statfs.h b/arch/mips/include/uapi/asm/statfs.h
index f4174dc..a9ca452 100644
--- a/arch/mips/include/uapi/asm/statfs.h
+++ b/arch/mips/include/uapi/asm/statfs.h
@@ -61,7 +61,7 @@  struct statfs64 {
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _MIPS_SIM_ABIN64
 
 struct statfs64 {			/* Same as struct statfs */
 	long		f_type;
@@ -96,6 +96,6 @@  struct compat_statfs64 {
 	__u32	f_spare[5];
 };
 
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABIN64 */
 
 #endif /* _ASM_STATFS_H */
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
index c897195..b997f43 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -400,7 +400,7 @@ 
 #define __NR_O32_Linux			4000
 #define __NR_O32_Linux_syscalls		368
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _MIPS_SIM_ABIN64
 
 /*
  * Linux 64-bit syscalls are in the range from 5000 to 5999.
@@ -740,10 +740,10 @@ 
 #define __NR_syscalls			328
 #endif
 
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABIN64 */
 
-#define __NR_64_Linux			5000
-#define __NR_64_Linux_syscalls		328
+#define __NR_N64_Linux			5000
+#define __NR_N64_Linux_syscalls		328
 
 #if _MIPS_SIM == _MIPS_SIM_NABI32
 
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 210c280..25af613 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -72,7 +72,7 @@  obj-$(CONFIG_IRQ_GT641XX)	+= irq-gt641xx.o
 
 obj-$(CONFIG_KPROBES)		+= kprobes.o
 obj-$(CONFIG_32BIT)		+= scall32-o32.o
-obj-$(CONFIG_64BIT)		+= scall64-64.o
+obj-$(CONFIG_64BIT)		+= scall64-n64.o
 obj-$(CONFIG_MIPS32_COMPAT)	+= linux32.o ptrace32.o signal32.o
 obj-$(CONFIG_MIPS32_N32)	+= binfmt_elfn32.o scall64-n32.o signal_n32.o
 obj-$(CONFIG_MIPS32_O32)	+= binfmt_elfo32.o scall64-o32.o signal_o32.o
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index b122cbb..d91a6e7 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -403,8 +403,8 @@  unsigned long __init arch_syscall_addr(int nr)
 	if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls)
 		return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux];
 #endif
-	if (nr >= __NR_64_Linux  && nr <= __NR_64_Linux + __NR_64_Linux_syscalls)
-		return (unsigned long)sys_call_table[nr - __NR_64_Linux];
+	if (nr >= __NR_N64_Linux  && nr <= __NR_N64_Linux + __NR_N64_Linux_syscalls)
+		return (unsigned long)sys_call_table[nr - __NR_N64_Linux];
 #ifdef CONFIG_MIPS32_O32
 	if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls)
 		return (unsigned long)sys32_call_table[nr - __NR_O32_Linux];
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-n64.S
similarity index 99%
rename from arch/mips/kernel/scall64-64.S
rename to arch/mips/kernel/scall64-n64.S
index 358d959..497cd62 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-n64.S
@@ -53,8 +53,8 @@  NESTED(handle_sys64, PT_SIZE, sp)
 	bnez	t0, syscall_trace_entry
 
 syscall_common:
-	dsubu	t2, v0, __NR_64_Linux
-	sltiu   t0, t2, __NR_64_Linux_syscalls + 1
+	dsubu	t2, v0, __NR_N64_Linux
+	sltiu   t0, t2, __NR_N64_Linux_syscalls + 1
 	beqz	t0, illegal_syscall
 
 	dsll	t0, t2, 3		# offset into table
diff --git a/arch/mips/kvm/entry.c b/arch/mips/kvm/entry.c
index 16e1c93..d30f42c 100644
--- a/arch/mips/kvm/entry.c
+++ b/arch/mips/kvm/entry.c
@@ -34,12 +34,12 @@ 
 #define T3		11
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32
 #define T0		12
 #define T1		13
 #define T2		14
 #define T3		15
-#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABIN64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #define S0		16
 #define S1		17
diff --git a/arch/mips/vdso/vdso.h b/arch/mips/vdso/vdso.h
index cfb1be4..1fd1692 100644
--- a/arch/mips/vdso/vdso.h
+++ b/arch/mips/vdso/vdso.h
@@ -10,7 +10,7 @@ 
 
 #include <asm/sgidefs.h>
 
-#if _MIPS_SIM != _MIPS_SIM_ABI64 && defined(CONFIG_64BIT)
+#if _MIPS_SIM != _MIPS_SIM_ABIN64 && defined(CONFIG_64BIT)
 
 /* Building 32-bit VDSO for the 64-bit kernel. Fake a 32-bit Kconfig. */
 #undef CONFIG_64BIT
diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S
index 8df7dd5..4d049e9 100644
--- a/arch/mips/vdso/vdso.lds.S
+++ b/arch/mips/vdso/vdso.lds.S
@@ -10,7 +10,7 @@ 
 
 #include <asm/sgidefs.h>
 
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _MIPS_SIM_ABIN64
 OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradbigmips", "elf64-tradlittlemips")
 #elif _MIPS_SIM == _MIPS_SIM_NABI32
 OUTPUT_FORMAT("elf32-ntradlittlemips", "elf32-ntradbigmips", "elf32-ntradlittlemips")