Re: [PATCH 1/2] MIPS: Allow MIPS32R2 kernel to run on P5600 and M5150

From: Maciej W. Rozycki
Date: Tue May 30 2023 - 07:07:31 EST

On Tue, 30 May 2023, Jiaxun Yang wrote:

> >> M5150 and P5600 are two MIPS32R5 kernels, however as MIPS32R5 is
> >> backward compatible with MIPS32R2 there is no reason to forbid
> >> M5150 and P5600 on MIPS32R2 kernel.
> >
> > What problem are you trying to solve? The CONFIG_SYS_HAS_CPU_* settings
> > denote overall platform's support for the given CPU and have nothing to do
> > with what architecture level a given kernel has been configured for. You
> > do need to get the settings right for your platform, just as you do in
> > 2/2, but this 1/2 part looks wrong to me.
> Well the universal target is to allow R2 generic kernel to run on R5 CPUs.
> As R5 is backward compatible we can just have one universal kernel binary.

Sure, but this change is not needed for it. You just need to declare
which ISA revisions your platform supports and leave `__get_cpu_type'
alone. It has worked like that for a decade now.

Back in the day I used to run R1 kernels on R2 hardware myself. And
maybe MIPS IV on R1 even, as we had MIPS Malta CPU modules with both MIPS
IV devices (QED RM5261/RM7061) and MIPS64r1 devices (MIPS 5Kc/20Kc/25Kf)
and switching the kernel when swapping modules was a nuisance. The Malta
config still supports these devices although some may not exist anymore.