Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp27327ybj; Wed, 6 May 2020 10:46:09 -0700 (PDT) X-Google-Smtp-Source: APiQypLWPcX9C42ztJQbM1lLRvmDnbCb7q4AgLQbaq9k6PLaxZ54wM2hol058XPVxTP/bxpfDg0P X-Received: by 2002:a17:906:9442:: with SMTP id z2mr7971269ejx.249.1588787169326; Wed, 06 May 2020 10:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588787169; cv=none; d=google.com; s=arc-20160816; b=kkzRsmSVC00avL6NVj3kreJDRiM14rQWa5mXGrGGWeKOKyoLOtx7kvVhPl7a1TOfJt MJ4rmpp/W9zE8K7mK3E0TNr5RlvE4BlWSBMxdoUgTFE5odZl3QlLBO+FNzuQnYVVnwoJ Ea6tQPgQgq4Z7l/HEpoEVHapgCjBBrvzU4GwyIVojwNeDKhti3vwiERCxxXdAvj2bTod y2aRu+3oQuI9TzuW9Xrdj0CLvZYodUS31zyPvfnv0p4H7nDmXyLKWJBRZe4zYJiizq5R n3/2FndTuGuGc59PpbpFGDYBoavDNaNBdy+kLpx917WLLnGPt8O6vVlUgqZiI362eiE4 SWBg== 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; bh=I4SjDu0VD//7PQA1cbLQyv/+J+DQXyrRDiTcGnfl1wg=; b=xIjBCoBApcmtL6HjOYJgLmy1sjDf/nhYGR3wb2vj802gAdI1RqT8UveuSMJYG/YjPG LiTc/tgB/AcUTdDoF5v+DlBJFizMZrJM4YRfKjudHw4/BZYzPRaXOnyS8DBIkWGOHGt3 Or9zAODRWs9x8T8xFFTQxat63m/sOzHB+eLoipuIORzez36v+yC/4yj+DxPtpfBiDDPk 3+lzp7n1y4hEnTaH3NdbsUVTPRjNU8Dsw3ydUay94ZDTJUlXcefRcQuZTI10wRoloCtd i7qdpWs0Qm+Fe4i7rXDwS5fu/LQ7SsjgzUj+rsF/2fL8REaZuNiFC9bJYCEaLybbPq7W Z8eQ== ARC-Authentication-Results: i=1; mx.google.com; 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 w1si1668855ejq.325.2020.05.06.10.45.46; Wed, 06 May 2020 10:46:09 -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; 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 S1730090AbgEFRoB (ORCPT + 99 others); Wed, 6 May 2020 13:44:01 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:60848 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728775AbgEFRoA (ORCPT ); Wed, 6 May 2020 13:44:00 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id EE32B8030790; Wed, 6 May 2020 17:43:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dw2DhZ5V0vNK; Wed, 6 May 2020 20:43:57 +0300 (MSK) From: To: Thomas Bogendoerfer , Paul Burton CC: Serge Semin , Serge Semin , Alexey Malahov , Ralf Baechle , Arnd Bergmann , Rob Herring , , , Jiaxun Yang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , , Subject: [PATCH v2 08/20] mips: Fix cpu_has_mips64r1/2 activation for MIPS32 CPUs Date: Wed, 6 May 2020 20:42:26 +0300 Message-ID: <20200506174238.15385-9-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> References: <20200306124807.3596F80307C2@mail.baikalelectronics.ru> <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serge Semin 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 added a new macro __isa_range_and_flag() and use it to define the cpu_has_mips64r1/cpu_has_mips64r2 flags. 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: linux-pm@vger.kernel.org Cc: devicetree@vger.kernel.org --- 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 e2f31bd6363b..7e22b9c1e279 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h @@ -64,6 +64,8 @@ ((MIPS_ISA_REV >= (ge)) && (MIPS_ISA_REV < (lt))) #define __isa_range_or_flag(ge, lt, flag) \ (__isa_range(ge, lt) || ((MIPS_ISA_REV < (lt)) && __isa(flag))) +#define __isa_range_and_flag(ge, lt, flag) \ + (__isa_range(ge, lt) && __isa(flag)) /* * SMP assumption: Options of CPU 0 are a superset of all processors. @@ -291,10 +293,10 @@ # 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 __isa_range_and_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 __isa_range_and_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