Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

DEC: Limit PMAX memory probing to R3k systems

Recent tightening of the opcode table in binutils so as to consistently
disallow the assembly or disassembly of CP0 instructions not supported
by the processor architecture chosen has caused a regression like below:

arch/mips/dec/prom/locore.S: Assembler messages:
arch/mips/dec/prom/locore.S:29: Error: opcode not supported on this processor: r4600 (mips3) `rfe'

in a piece of code used to probe for memory with PMAX DECstation models,
which have non-REX firmware. Those computers always have an R2000 CPU
and consequently the exception handler used in memory probing uses the
RFE instruction, which those processors use.

While adding 64-bit support this code was correctly excluded for 64-bit
configurations, however it should have also been excluded for irrelevant
32-bit configurations. Do this now then, and only enable PMAX memory
probing for R3k systems.

Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org # v2.6.12+
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Maciej W. Rozycki and committed by
Thomas Bogendoerfer
244eae91 97bf0395

+6 -11
+1 -1
arch/mips/dec/prom/Makefile
··· 6 6 7 7 lib-y += init.o memory.o cmdline.o identify.o console.o 8 8 9 - lib-$(CONFIG_32BIT) += locore.o 9 + lib-$(CONFIG_CPU_R3000) += locore.o
+5 -10
arch/mips/include/asm/dec/prom.h
··· 43 43 */ 44 44 #define REX_PROM_MAGIC 0x30464354 45 45 46 - #ifdef CONFIG_64BIT 47 - 48 - #define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */ 49 - 50 - #else /* !CONFIG_64BIT */ 51 - 52 - #define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC) 53 - 54 - #endif /* !CONFIG_64BIT */ 55 - 46 + /* KN04 and KN05 are REX PROMs, so only do the check for R3k systems. */ 47 + static inline bool prom_is_rex(u32 magic) 48 + { 49 + return !IS_ENABLED(CONFIG_CPU_R3000) || magic == REX_PROM_MAGIC; 50 + } 56 51 57 52 /* 58 53 * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and