Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp119094ybg; Mon, 8 Jun 2020 18:08:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5X8eAcTXlMzA738hoo9kGPpKQ1qkh1aykC/e2k9XCscWPIyvY6/Oiv24J1/YI4FGc5ewc X-Received: by 2002:a17:906:3da1:: with SMTP id y1mr22655121ejh.109.1591664915385; Mon, 08 Jun 2020 18:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664915; cv=none; d=google.com; s=arc-20160816; b=SC6enVvMkZ/ekrC3+PGTxeusg7B9ACejFkbq4tV7VsyMd9vhTeSob1iSJdxdVA5Yxe UGxRDfSVp0GVck16C8gwVFxWMR4vRBNp0F1hgTxJ0C/QE5W+cvlrqJY6yQqDBESGX9fB kCKT41t8oSIwBS/ekf/WMGiyocvhK2wM6lZiCWl+XQ/dF52ppoXbQqLqlWTWHQKf+QXh scvwH2p9dy6K1RHRgzMhsGza6n6/S0m3eUc9exx+7h5cnvB9xKjtdSFSbSvoeqCLvg/r kX/cxu/BuHIaJNmjsIXWr+Mjl2k6VOMWCUTcj2+aK5gGERYMGZdlubJ1gTKFbMhNBbys eTUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xHgAEKXWY3VvlkeXXE1Ra3VHeGHzqACeo4dm03vpoOY=; b=QUxIqAY3JuoSNMqTOB6iA81w4oVg7EOoEpfxSeQ0mp/PjYQ3hptWUV5XFA0ghl3AGa RxUaP/wi4KvuS5Id9gvq6zhBmeaaoqMvUTle7Tln8rBlYbImEstBqotm0OnQ9J9ThGt5 uBdmEjh8R2G/74QKdseFMDRmX9HR1eDuaHsBzv7csGBNZLYJK9Y/6jCIFs74DYOoHYko zP3CrPIzrErV5if2+kcD0lyrDnhX7WHPHh7QQs9maPV+D/8CTq8kGCMngIhunDpdAWs4 HRFTXXI05WE1FTvYdY5jPkwakQq2PFat+qAfhrvbFIg0tYETJQ8grif1oG2QJ1n4JSoo 4WdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hRTpDfTa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id si8si9560601ejb.7.2020.06.08.18.08.12; Mon, 08 Jun 2020 18:08:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hRTpDfTa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728405AbgFIBEY (ORCPT + 99 others); Mon, 8 Jun 2020 21:04:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:51570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727891AbgFHXHZ (ORCPT ); Mon, 8 Jun 2020 19:07:25 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D025320812; Mon, 8 Jun 2020 23:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657645; bh=dUkrinHv1Rv4amfGn74MI+e2YKhyXCrB1nrhBwjAXsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hRTpDfTaL3Gp0YHHVF/pVVfqBW/0xr2ASUfARjvkAgdOl3D6bKs1z6lxdLEI4sAqn H97X82m9CAPc9AxV3Kif1DCa9aRuJgNGOL4Ked6AWOzKOTbWI/KaqHy/ApcIvCfNSh k43dXp/cHWS/QF/MmerUTICdHqLjCYrF30XdypnM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Serge Semin , Alexey Malahov , Thomas Bogendoerfer , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , devicetree@vger.kernel.org, Sasha Levin , linux-mips@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 061/274] mips: Fix cpu_has_mips64r1/2 activation for MIPS32 CPUs Date: Mon, 8 Jun 2020 19:02:34 -0400 Message-Id: <20200608230607.3361041-61-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serge Semin [ Upstream commit a2ac81c6ef4018ea49c034ce165bb9ea1cf99f3e ] Commit 1aeba347b3a9 ("MIPS: Hardcode cpu_has_mips* where target ISA allows") updated the cpu_has_mips* macro to be replaced with a constant expression where it's possible. By mistake it wasn't done correctly for cpu_has_mips64r1/cpu_has_mips64r2 macro. They are defined to be replaced with conditional expression __isa_range_or_flag(), which means either ISA revision being within the range or the corresponding CPU options flag was set at the probe stage or both being true at the same time. But the ISA level value doesn't indicate whether the ISA is MIPS32 or MIPS64. Due to this if we select MIPS32r1 - MIPS32r5 architectures the __isa_range() macro will activate the cpu_has_mips64rX flags, which is incorrect. In order to fix the problem we make sure the 64bits CPU support is enabled by means of checking the flag cpu_has_64bits aside with proper ISA range and specific Revision flag being set. Fixes: 1aeba347b3a9 ("MIPS: Hardcode cpu_has_mips* where target ISA allows") Signed-off-by: Serge Semin Cc: Alexey Malahov Cc: Thomas Bogendoerfer Cc: Paul Burton Cc: Ralf Baechle Cc: Arnd Bergmann Cc: Rob Herring Cc: devicetree@vger.kernel.org Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/include/asm/cpu-features.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index de44c92b1c1f..d4e120464d41 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h @@ -288,10 +288,12 @@ # define cpu_has_mips32r6 __isa_ge_or_flag(6, MIPS_CPU_ISA_M32R6) #endif #ifndef cpu_has_mips64r1 -# define cpu_has_mips64r1 __isa_range_or_flag(1, 6, MIPS_CPU_ISA_M64R1) +# define cpu_has_mips64r1 (cpu_has_64bits && \ + __isa_range_or_flag(1, 6, MIPS_CPU_ISA_M64R1)) #endif #ifndef cpu_has_mips64r2 -# define cpu_has_mips64r2 __isa_range_or_flag(2, 6, MIPS_CPU_ISA_M64R2) +# define cpu_has_mips64r2 (cpu_has_64bits && \ + __isa_range_or_flag(2, 6, MIPS_CPU_ISA_M64R2)) #endif #ifndef cpu_has_mips64r6 # define cpu_has_mips64r6 __isa_ge_and_flag(6, MIPS_CPU_ISA_M64R6) -- 2.25.1