Re: [PATCH] powerpc/6xx: set High BAT Enable flag on G2 cores

Christophe Leroy
2023-12-22T15:11:55Z

Le 22/12/2023 à 09:34, Matthias Schiffer a écrit :
> [Vous ne recevez pas souvent de courriers de matthias.schiffer@ew.tq-group.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>
> On Fri, 2023-12-22 at 12:16 +1100, Michael Ellerman wrote:
>> Matthias Schiffer <matthias.schiffer@ew.tq-group.com> writes:
>>> MMU_FTR_USE_HIGH_BATS is set for G2-based cores (G2_LE, e300cX), but the
>>> high BATs need to be enabled in HID2 to work. Add register definitions
>>> and introduce a G2 variant of __setup_cpu_603.
>>>
>>> This fixes boot on CPUs like the MPC5200B with STRICT_KERNEL_RWX enabled.
>>
>> Nice find.
>>
>> Minor nit on naming. The 32-bit code mostly uses the numeric names, eg.
>> 603, 603e, 604 etc. Can we stick with that, rather than using "G2"?
>>
>> Wikipedia says G2 == 603e. But looking at your patch you're not changing
>> all the 603e cores, so I guess it's not that clear cut?
>>
>> If using "G2" makes the most sense then it would be nice to update
>> Documentation/arch/powerpc/cpu_families.rst to mention it (not asking
>> you to do it necessarily, more a note for us).
>
> According to the 603e manual I could find (MPR603EUM-01), the HID2 register does not exist in the
> original 603e cores - the register was only added by Freescale in its extended implementations.

As far as I can see, ref G2 core reference manual
(https://www.nxp.com/webapp/Download?colCode=G2CORERM):

The primary objective of this reference manual is to define the
functionality of the G2 core,
a derivative of the original MPC603e PowerPC™ microprocessor design. The
G2 core is
an implementation of the PowerPC microprocessor family. This reference
manual also
describes the G2_LE core, which is a derivative of the G2 core.

So we have three steps: 603e, G2 then G2_LE.

The one that has 8 BATs is the G2_LE.

But it looks like our PVR expectations are not completely right.
According the manual:

0x0081 0011 is the original G2 core, but 0x0082 1010 is also G2 core.
Only 0x0082 2010 is G2_LE core, whereas our kernel/cpu_specs_book3s_32.h
considers all 0x0082 to be G2_LE core.

>
> The manual of the MPC5200 calls its core an "e300", but that seems to be an older implementation
> than the "e300c[1-4]" cores described in the "e300" manual. I'm not sure if "e300" (without "cX")
> and "G2_LE" are synonymous.
>
> So AFAIR either "G2" or "e300" could be an appropriate name for the family, but which is better I
> can't say.

I don't think we can call it e300. Yes MPC5200 manual calls it e300 but
refers to G2 core reference manual.

The e300 reference manual
(https://www.nxp.com/docs/en/reference-manual/e300coreRM.pdf) only deals
with e300c1-e300c4 so that seems to be what e300 is.

However, in e300 manual the PVR values are not in accordance with the
ones given in the G2 core reference manual. Here they say 0x00821010 is
also a G2_LE core. So which manual shall we believe ?

Christophe