linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Huacai Chen <chenhc@lemote.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	"open list:MIPS" <linux-mips@vger.kernel.org>,
	Fuxin Zhang <zhangfx@lemote.com>,
	Zhangjin Wu <wuzhangjin@gmail.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: Re: [PATCH 1/2] MIPS: Loongson-3: Enable COP2 usage in kernel
Date: Fri, 1 May 2020 01:44:32 +0100 (BST)	[thread overview]
Message-ID: <alpine.LFD.2.21.2005010117200.851719@eddie.linux-mips.org> (raw)
In-Reply-To: <CAAhV-H6KWnzwB-p6aOL+L_ZXiYsMyzN1MbXeeeTYpimg7jG73w@mail.gmail.com>

On Thu, 30 Apr 2020, Huacai Chen wrote:

> > > diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
> > > index ce40fbf..0f71540 100644
> > > --- a/arch/mips/include/asm/mipsregs.h
> > > +++ b/arch/mips/include/asm/mipsregs.h
> > > @@ -386,6 +386,7 @@
> > >  #define ST0_CU1                      0x20000000
> > >  #define ST0_CU2                      0x40000000
> > >  #define ST0_CU3                      0x80000000
> > > +#define ST0_MM                       0x40000000      /* Loongson-3 naming */
> >
> > please use ST0_CU2, so everybody understands it's COO2
> I see that there is already an alias  ST0_XX for ST0_CU3, and I think
> use a ST0_MM for ST0_CU2 is more meaningful in some places (at least
> in traps.c where ST0_XX is also used). If there are places only used
> to describe the CU Mask (such as in stackframe.h), I will use ST0_CU2.

 Well ST0_XX is not an alias, because the bit has a different meaning that 
has nothing to do with CP3.  It just happens to share the bit position in 
CP0.Status with ST0_CU3.  Yes, ST0_XX is misplaced and misnamed as it 
applies to R10k processors only, but it is our legacy from the old days of 
chaos and some three processor types supported.  This is similar to say 
ST0_ERL vs ST0_IEP, which also share the bit position in CP0.Status, but 
have different meanings each.

 All this could have been cleaned up (e.g. s/ST0_XX/R10K_ST0_XX/) if 
someone had the incentive; I occasionally had and poked at these macros, 
but apparently missed this one and a couple of other ones.  Maybe on some 
rainy autumn evening...

 However ST0_MM does enable CP2, even if a specific implementation, making 
it no different from ST0_CU2 really.

  Maciej



  reply	other threads:[~2020-05-13 22:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29  9:38 [PATCH 1/2] MIPS: Loongson-3: Enable COP2 usage in kernel Huacai Chen
2020-04-29  9:38 ` [PATCH 2/2] MIPS: Loongson-3: Calculate ra properly when unwinding the stack Huacai Chen
2020-04-29 18:33 ` [PATCH 1/2] MIPS: Loongson-3: Enable COP2 usage in kernel Thomas Bogendoerfer
2020-04-30  7:54   ` Huacai Chen
2020-05-01  0:44     ` Maciej W. Rozycki [this message]
2020-05-14  5:44       ` Huacai Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.21.2005010117200.851719@eddie.linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=chenhc@lemote.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).