Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2290201pxm; Fri, 4 Mar 2022 13:12:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJx18ZMilpQ6NEI7LlEfepEdzTqedRIzbz9RFgj+1VDM9fTfMj+3d3fzdxY5q3SLHHYk2VHj X-Received: by 2002:a05:6a00:2313:b0:4e0:ffa7:bbe0 with SMTP id h19-20020a056a00231300b004e0ffa7bbe0mr593421pfh.53.1646428362749; Fri, 04 Mar 2022 13:12:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646428362; cv=none; d=google.com; s=arc-20160816; b=EcDot0d5YK3jzhV6Tjv8SnT3NTlDi8pwCVWBUA2AxtU97GcfnFENarze9zAOCVfyN+ 6Kyxaj6vFWLN3/qDX4CQbtxM2VgFYzj92Cvgk6R/dDzeZ7MVGvd82oxq7tBW/iKvD8tj JH5aM2HB5v7Cf/0zNypr+ieodz0bkoUjVOArqM2OGLvTdzjbrKUk3jA8CwzvNBlbNYj8 oNYFOFAGHoQe1/+z4ZjX482Ma/rYvH6TqnnS1YkOWATpvxNWwiQy0lX3Mapvh7nNbOFb i0ZDZZd3Nw4z9sJgn8zMD0xothjJYBpT9hr639wbwtL0zY9DKvcfGIjIlv+syC9tvfZv OLOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:subject:cc:to :from:date; bh=FRhGXH8nxXoPU3ioEEnFF/Ui0/jWDpyQc/2OtKfNd9M=; b=PiUXCGo7TJT+7aE2kovTmYccjCvpTu2PNUv7+Q2l0Le6YHy5dpNaakcQN6fnYx8ova 5uw4HW2dZDkyHK7z0Ve73Sd3QIEF0KBJTkpqTbc6rFGYHfirOa3FU6ugq+rnV0tWyXve 8mCsZrlZZgAU3rEtSfzGvdMoVkkLa0AYEcNg+wbweMPRdOOqgu3bU6Wp3YHu0C/2T+OB /pJ8RTTOB5oL6z5Pjkv8nmsplyCvBnTGB3ofYJppZbm5qnG8wXg9SgCNAmHfdn68rzeU h1qDyZBO8/MWS4MYxPLFh1umAqREbz1Ove8WxPiTtcwhpmfahTdYXw3/R++v2c4KXe6V 2tKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id np7-20020a17090b4c4700b001bd14e01f49si685287pjb.55.2022.03.04.13.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 13:12:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3022110A7DB; Fri, 4 Mar 2022 12:25:22 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbiCDUTv (ORCPT + 99 others); Fri, 4 Mar 2022 15:19:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbiCDUSg (ORCPT ); Fri, 4 Mar 2022 15:18:36 -0500 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C4058134DF1; Fri, 4 Mar 2022 12:16:24 -0800 (PST) Received: by angie.orcam.me.uk (Postfix, from userid 500) id E22DE92009C; Fri, 4 Mar 2022 21:16:23 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id DCD4C92009B; Fri, 4 Mar 2022 20:16:23 +0000 (GMT) Date: Fri, 4 Mar 2022 20:16:23 +0000 (GMT) From: "Maciej W. Rozycki" To: Thomas Bogendoerfer cc: Jan-Benedict Glaw , Sudip Mukherjee , Ralf Baechle , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] DEC: Limit PMAX memory probing to R3k systems Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reported-by: Sudip Mukherjee Signed-off-by: Maciej W. Rozycki 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: , 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