stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] DEC: Limit PMAX memory probing to R3k systems
@ 2022-03-04 20:16 Maciej W. Rozycki
  2022-03-07 12:21 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej W. Rozycki @ 2022-03-04 20:16 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Jan-Benedict Glaw, Sudip Mukherjee, Ralf Baechle, linux-mips,
	linux-kernel, stable

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+
---
Hi,

 I'm assuming this won't go back beyond commit 2a11c8ea20bf ("kconfig: 
Introduce IS_ENABLED(), IS_BUILTIN() and IS_MODULE()") or any backport 
will have to be rewritten to avoid IS_ENABLED.

 The original actual change named to fix ought to be commit dd82ef87e4c9 
("PROM interface rework to support a 64-bit kernel.") from the LMO repo: 
<https://git.kernel.org/pub/scm/linux/kernel/git/ralf/linux.git/commit/?id=dd82ef87e4c9>, 
which introduced the `prom_is_rex' macro, which guards this code.  Said 
commit predates the history of our main repository though.

 This change has actually been verified at runtime with a PMIN system 
(effectively a PMAX, but with a slower R2000 CPU) and a 4MAX+ system (an 
R4400SC-based machine), and naturally throughout the three possible build 
configurations: R3k, R4k/32-bit, R4k/64-bit.

 It took longer than expected, but oh well...  Sorry for the inconvenience 
caused.

 Please apply,

  Maciej
---
 arch/mips/dec/prom/Makefile      |    2 +-
 arch/mips/include/asm/dec/prom.h |   15 +++++----------
 2 files changed, 6 insertions(+), 11 deletions(-)

linux-dec-locore-r3000.diff
Index: linux-macro/arch/mips/dec/prom/Makefile
===================================================================
--- linux-macro.orig/arch/mips/dec/prom/Makefile
+++ linux-macro/arch/mips/dec/prom/Makefile
@@ -6,4 +6,4 @@
 
 lib-y			+= init.o memory.o cmdline.o identify.o console.o
 
-lib-$(CONFIG_32BIT)	+= locore.o
+lib-$(CONFIG_CPU_R3000)	+= locore.o
Index: linux-macro/arch/mips/include/asm/dec/prom.h
===================================================================
--- linux-macro.orig/arch/mips/include/asm/dec/prom.h
+++ linux-macro/arch/mips/include/asm/dec/prom.h
@@ -43,16 +43,11 @@
  */
 #define REX_PROM_MAGIC		0x30464354
 
-#ifdef CONFIG_64BIT
-
-#define prom_is_rex(magic)	1	/* KN04 and KN05 are REX PROMs.  */
-
-#else /* !CONFIG_64BIT */
-
-#define prom_is_rex(magic)	((magic) == REX_PROM_MAGIC)
-
-#endif /* !CONFIG_64BIT */
-
+/* KN04 and KN05 are REX PROMs, so only do the check for R3k systems.  */
+static inline bool prom_is_rex(u32 magic)
+{
+	return !IS_ENABLED(CONFIG_CPU_R3000) || magic == REX_PROM_MAGIC;
+}
 
 /*
  * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] DEC: Limit PMAX memory probing to R3k systems
  2022-03-04 20:16 [PATCH] DEC: Limit PMAX memory probing to R3k systems Maciej W. Rozycki
@ 2022-03-07 12:21 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2022-03-07 12:21 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Jan-Benedict Glaw, Sudip Mukherjee, Ralf Baechle, linux-mips,
	linux-kernel, stable

On Fri, Mar 04, 2022 at 08:16:23PM +0000, Maciej W. Rozycki wrote:
> 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+
> ---
> Hi,
> 
>  I'm assuming this won't go back beyond commit 2a11c8ea20bf ("kconfig: 
> Introduce IS_ENABLED(), IS_BUILTIN() and IS_MODULE()") or any backport 
> will have to be rewritten to avoid IS_ENABLED.
> 
>  The original actual change named to fix ought to be commit dd82ef87e4c9 
> ("PROM interface rework to support a 64-bit kernel.") from the LMO repo: 
> <https://git.kernel.org/pub/scm/linux/kernel/git/ralf/linux.git/commit/?id=dd82ef87e4c9>, 
> which introduced the `prom_is_rex' macro, which guards this code.  Said 
> commit predates the history of our main repository though.
> 
>  This change has actually been verified at runtime with a PMIN system 
> (effectively a PMAX, but with a slower R2000 CPU) and a 4MAX+ system (an 
> R4400SC-based machine), and naturally throughout the three possible build 
> configurations: R3k, R4k/32-bit, R4k/64-bit.
> 
>  It took longer than expected, but oh well...  Sorry for the inconvenience 
> caused.
> 
>  Please apply,
> 
>   Maciej
> ---
>  arch/mips/dec/prom/Makefile      |    2 +-
>  arch/mips/include/asm/dec/prom.h |   15 +++++----------
>  2 files changed, 6 insertions(+), 11 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-07 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 20:16 [PATCH] DEC: Limit PMAX memory probing to R3k systems Maciej W. Rozycki
2022-03-07 12:21 ` Thomas Bogendoerfer

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).