Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp855240ybt; Fri, 19 Jun 2020 15:57:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvYv0of/9uyCdXm17F1yPjeBtkZA0JR1PBm75W6uBQTtfP0F0n5m9aMB9X1O9G6Wtmf4/Q X-Received: by 2002:a17:906:97cd:: with SMTP id ef13mr5391956ejb.165.1592607463425; Fri, 19 Jun 2020 15:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592607463; cv=none; d=google.com; s=arc-20160816; b=Cal0SPDwWJHqngPOYCzQsS2S096kXRi3ZqgPsnuaFgKhMuqLYlRQ1YZwNFuHuG+Exb uw4JBwUi+Wp6BJYzrX+Vq8cNI64hUnExDPkBT+bR50Mu4iJbX6gnH+/H8HE2RY62e9e8 FjBCYPNSejZWFKf5/KWT1gU3rl9YYCMPY/dnIeReSpL6rjxgOr+OLBQVpl5w73GG4Ee4 mZIqdhctudq8IHgiUv8EHidy6yb1XkJc2Fy/p5cPfYkR2shaHeIDwgEq6GAPU8RNwJ+q HIAwBW/NM5C5wobn9vzyo9YPA9Kxk8tXrj1jYvxTXAU2WJBvIm1WgE3taPsaog2MufbR E2EQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xHgAEKXWY3VvlkeXXE1Ra3VHeGHzqACeo4dm03vpoOY=; b=quyuvDhwC6gMJSU2qyAM24Rf4QjfdeT7UForky7swRvg0tR4/epA32wOPG+vWaIExw eLUXnX3auk1ogK0XUnyL01S14v3QaLkSvGsCkFfFZ1sEZn92yxSmzCREy+viCYKszxYg z+T3jGFMYqZxVxIMqotRZ1Ox6DncnNizfJmmv7VgMRmq4P1k3F8rH/zyMLQaPCiMpBQ2 sjU5BmXS2WQH1CH9WtbEArWLCiNYUh0JgkrO0y6/XYEdABSSeMySKO6ai2S06AsHNKRD C0QkDcMGd2g04kIxPEe8QlY0H5F41sjaN2HLooCxdC+JRxb+IIEvKr/+kbiJ8v7KK4vG psDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zc1X2vCg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si4392141eja.468.2020.06.19.15.57.17; Fri, 19 Jun 2020 15:57:43 -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=Zc1X2vCg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392964AbgFSPWN (ORCPT + 99 others); Fri, 19 Jun 2020 11:22:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:49126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392595AbgFSPSr (ORCPT ); Fri, 19 Jun 2020 11:18:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 356BA2158C; Fri, 19 Jun 2020 15:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592579926; bh=dUkrinHv1Rv4amfGn74MI+e2YKhyXCrB1nrhBwjAXsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zc1X2vCgxJAVmzRiwnE/xp9s3bPO6p/TbbI2VO4WHwOE1BzDCXq59pJ1ZD5jzIjrF KlT3i5ja1Z/twtSKciotvLzZeNLO9dZKmgsTKL/TKM4iUCXYlqq1JWslm+FbNbvnuD Hh+8SlE97CnkPljU5YOhYXnfy8Jg9HlKW4hwQACo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Alexey Malahov , Thomas Bogendoerfer , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , devicetree@vger.kernel.org, Sasha Levin Subject: [PATCH 5.7 057/376] mips: Fix cpu_has_mips64r1/2 activation for MIPS32 CPUs Date: Fri, 19 Jun 2020 16:29:35 +0200 Message-Id: <20200619141713.039466217@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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