All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
	Paul Burton <paulburton@kernel.org>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH v3 04/15] target/mips/mips-defs: Introduce CPU_MIPS64 and cpu_type_is_64bit()
Date: Tue, 5 Jan 2021 11:05:55 +0100	[thread overview]
Message-ID: <d8cdb54c-bfd5-1ade-090a-7ad15974a302@amsat.org> (raw)
In-Reply-To: <f351074a-e63e-f39a-c807-9250deca9c39@amsat.org>

Hi Richard,

On 1/5/21 9:34 AM, Philippe Mathieu-Daudé wrote:
> On 1/5/21 12:30 AM, Richard Henderson wrote:
>> On 1/4/21 12:11 PM, Philippe Mathieu-Daudé wrote:
>>> MIPS 64-bit ISA is introduced with MIPS3.
>>>
>>> Introduce the CPU_MIPS64 definition aliased to the MIPS3 ISA,
>>> and the cpu_type_is_64bit() method to check if a CPU supports
>>> this ISA (thus is 64-bit).
>>>
>>> Suggested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>>  target/mips/cpu.h       | 5 +++++
>>>  target/mips/mips-defs.h | 4 +++-
>>>  2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> I still don't understand this as an alias, as opposed to a separate bit.
>> (ISA_MIPS3 | CPU_MIPS64R6) does not make sense, because R6 removes instructions.

Well, FWIW (ISA_MIPS3 | CPU_MIPS64R6) is what we currently have:

#define CPU_MIPS64R6    (CPU_MIPS64R5 | CPU_MIPS32R6 | ISA_MIPS64R6)

#define CPU_MIPS64R5    (CPU_MIPS64R3 | CPU_MIPS32R5 | ISA_MIPS64R5)

#define CPU_MIPS64R3    (CPU_MIPS64R2 | CPU_MIPS32R3 | ISA_MIPS64R3)

#define CPU_MIPS64R2    (CPU_MIPS64 | CPU_MIPS32R2 | ISA_MIPS64R2)

#define CPU_MIPS64      (CPU_MIPS5 | CPU_MIPS32 | ISA_MIPS64)

#define CPU_MIPS5       (CPU_MIPS4 | ISA_MIPS5)

#define CPU_MIPS4       (CPU_MIPS3 | ISA_MIPS4)

#define CPU_MIPS3       (CPU_MIPS2 | ISA_MIPS3)

So CPU_MIPS64R6 -> CPU_MIPS64R5 -> CPU_MIPS64R3 -> CPU_MIPS64R2
 -> CPU_MIPS64 -> CPU_MIPS5 -> CPU_MIPS4 -> CPU_MIPS3 -> ISA_MIPS3

This patch doesn't make it worst :)

> I now understand your concern.
> 
> I based the decodetree logic on the R6 ISA manual, decoding the
> bits from the more recent feature (a leaf) to the root, following
> this tree:
> https://images.anandtech.com/doci/8457/MIPS%20ISA%20Evolution.JPG
> (2.3 Evolution of the Architecture).
> 
> Also "2.1 Historical Perspective":
> 
>   In the MIPS IIITM ISA, 64-bit integers and addresses were added
>   to the instruction set. [...]
>   The MIPS32 Release 6 ISA maintains backward-compatibility, with
>   the exception of a few rarely used instructions, though the use
>   of trap-and-emulate or trap-and-patch; all pre-Release 6 binaries
>   can execute under binary translation. [...]
>   The MIPS64 Architecture is based on the MIPS V ISA and is backward
>   compatible with the MIPS32 Architecture.
> 
>> But if this is an intermediate step,
> 
> As this isn't planned as intermediate step, I'll try to keep
> CPU_MIPS64 as a separate bit and post the result.

I'm not sure it is worth the effort, as I plan to check each ISA /
ASE bit from the CP0_ConfigX bits (similarly target/arm/ does), so
these definitions should disappear eventually.

I.e. for the MSA ASE see:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg767523.html

 /* Check presence of MSA implementation */
 static inline bool ase_msa_available(CPUMIPSState *env)
 {
     return env->CP0_Config3 & (1 << CP0C3_MSAP);
 }

Might I keep your R-b tag for this patch (eventually improving the
commit description with some of the info added in this mail) and
keep going?

Thanks,

Phil.


  reply	other threads:[~2021-01-05 10:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 22:11 [PATCH v3 00/15] target/mips/mips-defs: Simplify ISA definitions Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 01/15] target/mips/mips-defs: Remove USE_HOST_FLOAT_REGS comment Philippe Mathieu-Daudé
2021-01-04 23:24   ` Richard Henderson
2021-01-04 22:11 ` [PATCH v3 02/15] target/mips/mips-defs: Reorder CPU_MIPS5 definition Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 03/15] target/mips/mips-defs: Rename CPU_MIPSxx Release 1 as CPU_MIPSxxR1 Philippe Mathieu-Daudé
2021-01-04 23:25   ` Richard Henderson
2021-01-04 22:11 ` [PATCH v3 04/15] target/mips/mips-defs: Introduce CPU_MIPS64 and cpu_type_is_64bit() Philippe Mathieu-Daudé
2021-01-04 23:30   ` Richard Henderson
2021-01-05  8:34     ` Philippe Mathieu-Daudé
2021-01-05 10:05       ` Philippe Mathieu-Daudé [this message]
2021-01-05 16:01         ` Richard Henderson
2021-01-06 17:55           ` Philippe Mathieu-Daudé
2021-01-06  4:23         ` Jiaxun Yang
2021-01-06  5:22           ` Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 05/15] hw/mips/boston: Check 64-bit support with cpu_type_is_64bit() Philippe Mathieu-Daudé
2021-01-04 23:32   ` Richard Henderson
2021-01-04 22:11 ` [PATCH v3 06/15] target/mips/mips-defs: Use ISA_MIPS32 definition to check Release 1 Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 07/15] target/mips/mips-defs: Use ISA_MIPS32R2 definition to check Release 2 Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 08/15] target/mips/mips-defs: Use ISA_MIPS32R3 definition to check Release 3 Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 09/15] target/mips/mips-defs: Use ISA_MIPS32R5 definition to check Release 5 Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 10/15] target/mips/mips-defs: Use ISA_MIPS32R6 definition to check Release 6 Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 11/15] target/mips/mips-defs: Rename ISA_MIPS32 as ISA_MIPS_R1 Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 12/15] target/mips/mips-defs: Rename ISA_MIPS32R2 as ISA_MIPS_R2 Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 13/15] target/mips/mips-defs: Rename ISA_MIPS32R3 as ISA_MIPS_R3 Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 14/15] target/mips/mips-defs: Rename ISA_MIPS32R5 as ISA_MIPS_R5 Philippe Mathieu-Daudé
2021-01-04 22:11 ` [PATCH v3 15/15] target/mips/mips-defs: Rename ISA_MIPS32R6 as ISA_MIPS_R6 Philippe Mathieu-Daudé
2021-01-06 17:56 ` [PATCH v3 00/15] target/mips/mips-defs: Simplify ISA definitions Philippe Mathieu-Daudé

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=d8cdb54c-bfd5-1ade-090a-7ad15974a302@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=jiaxun.yang@flygoat.com \
    --cc=paulburton@kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.