From patchwork Fri Jan 13 13:12:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 9515595 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C058D601DA for ; Fri, 13 Jan 2017 13:13:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3AF3285A1 for ; Fri, 13 Jan 2017 13:13:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A700E2866E; Fri, 13 Jan 2017 13:13:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B586A28649 for ; Fri, 13 Jan 2017 13:13:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cS1fJ-00035I-Hn; Fri, 13 Jan 2017 13:13:09 +0000 Received: from mail-bl2nam02on0067.outbound.protection.outlook.com ([104.47.38.67] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cS1fF-000347-7p for linux-arm-kernel@lists.infradead.org; Fri, 13 Jan 2017 13:13:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=FC50byzXB00PO2EQt2b1gWguPQEXGrJcCkrHaJD6HK4=; b=dRyOHl/S99JpE2+q9CYek8PZv16AbY4aKycO+/GfcfHmu26TrkuL8XhD7mo0NyY8HJWMJpIa9zPEfQpONvW99CoByUYwFIHCEd5ESr6oQ7lvO5jhn66lOTMx6vYqjMJGAhfibkGTvETQGjFObN2sQqW5SRp2FjFmclSq3HCQd/s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@cavium.com; Received: from rric.localdomain (92.229.89.87) by CY1PR07MB2346.namprd07.prod.outlook.com (10.166.194.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Fri, 13 Jan 2017 13:12:40 +0000 From: Robert Richter To: Catalin Marinas , Will Deacon Subject: [PATCH v2] arm64: errata: Provide macro for major and minor cpu revisions Date: Fri, 13 Jan 2017 14:12:09 +0100 Message-ID: <20170113131209.6430-1-rrichter@cavium.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Originating-IP: [92.229.89.87] X-ClientProxiedBy: VI1PR0501CA0003.eurprd05.prod.outlook.com (10.172.9.141) To CY1PR07MB2346.namprd07.prod.outlook.com (10.166.194.145) X-MS-Office365-Filtering-Correlation-Id: 2374915c-8371-42e8-a0eb-08d43bb5db1e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR07MB2346; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2346; 3:w/CnQ3KftFwlV915ZWQZwcgcFWikDi50nHnDf9nQb+ZM3xH1WhrVrlew/uZOklfEHKlxZhdw6NeV+WQyNg5UO6Q4pGurVrVMNT3kzk/UQ7vxL60EVnWLI79rgTZv32lci2yqAPd67GIHGaf8hM8tgdvHH2EVdifLfPBuY23Vxv9VbS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jgaZ2kC1PcOGA97WhKofVm0S0M8U9sAvjBbw639izRdYaPclBw9vdcDi1dR5c1GS1stAMJeshHZ17NulahW5wVrVA1HNxX7RnyzV1q1LMjotPC2yK1at5dNiQjmf0Y8PSdWdDyVlSDPdm6WwPUVkwMYxaO0UzsNZoFLQ86GQks0N2TwqIegkwFxFUa4DPSBMF+UWJNsmWQiNlFuakUdJ2E2rLCwLVolEnfbZnGrEq23CpJcVP+P/gTYjxz3ncw3fXmqKThdKcCxj0x+QGPN4qpGQs9Xj68amdAe9jpbz8jfI8zkr5wzfobdiU4W2LayAycWuvx43VZ10PopAIz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123560025)(20161123564025)(20161123555025)(20161123558021)(20161123562025)(6072148); SRVR:CY1PR07MB2346; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2346; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2346; 4:zof9+KtfxIs/xp0ng8AUlZSsKWa56a5Q66s7792RKtLG4OSyYh/tQrIw1o0sDBeUTEl360SAACwozlbEku0mP2ON1pbzODR95aum2CKUdVDmyen6NiDnlzndEDM2x4L/UFO5XWWCYYLw/W5kTatNpfMdmEi47n7Di1UqT8lMevwQLG6CpyVErTB3GRR4JdJn3qEmiEMurgU/I++IuYvZfDC7V+bvnD/9GTxkt6qSSdWrY4CO7NZ2Fl5R7gb6rmb7Zo92TRFxuGSgGDXRzIVTyHZhs50pjOS63KkszrDq1xpHPBmg7ePaDdtBGIYtRBuFl1B8wR/C4QPpmWGh9/2tjLxEwf6zG8yIVlWP01WhFoq4DdOxrz4sA/Su5CPGjl4v4xe1gISLsHraif1C2SKqWDDLjSNDC9YqQ3dAwrkn7adPsGQ35rFk6tku37fv+6H8U/ysg2qexD+hk4HzIrR59NSk7TzkNf//5HgsVKFJ/hbGzXGTIqrLgGQHmPuwXUrePg7JtHAL3s9Lq67Q3SUV0cvMA983Sfr3yU0baih0wspKO3pA3dQN9qxHLsBmNWIQyJ0SeSql47o5peV495/SCQeJjlj91Unkrm0VcTrOBgU= X-Forefront-PRVS: 018632C080 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(189002)(199003)(47776003)(3846002)(6116002)(33646002)(25786008)(92566002)(48376002)(50466002)(36756003)(575784001)(54906002)(5660300001)(68736007)(38730400001)(66066001)(6486002)(1076002)(81166006)(97736004)(81156014)(6512007)(106356001)(8676002)(6666003)(50226002)(4326007)(6506006)(101416001)(5001770100001)(5003940100001)(42186005)(189998001)(2906002)(7736002)(50986999)(305945005)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2346; H:rric.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2346; 23:M63smRH0/GquzJI9fkwKTrakybJiUoYtnykYwSe4Y?= =?us-ascii?Q?6jP9V5je//NbfbxaqfdGmY6Mc/INuothbzN2eRmFqHYR3dHsmVlZBVMc9dSL?= =?us-ascii?Q?ytNfBs8TwKAE7+poRSIVGy4DxHe4S+jYq7orhN7oKroGv8jBWEZZeAm+M63L?= =?us-ascii?Q?LfMx9keDX1NtNd3OAcj+1EGCOu1qLRG2Z7UXOfiysWVj8QCwkdlmcUrQA+gn?= =?us-ascii?Q?KZLmCk19WXZL0A778WxI23sG2zXu03XMzh6Lqd5jhwNFAMvGS3ofkVBtzGz2?= =?us-ascii?Q?2UeVrOQ1epnfOv4uZOPt+s2TY4NkN5iA8oiuT6Elh+JUdqQGj41YO68cAMxN?= =?us-ascii?Q?RP5cDuP15RTU9mK9p0gZtwsNrA34ufLfvY9qhcd9u2yBa3IxTzgne2XoPmBA?= =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XX+bfHpFTTyu/tQLgILdsA2UlAckaWa+edeHQO4Vit7ZtnOPauVCYNcHvO/uHrRN3Otr2Uy07PIl5jaokr7r1J/TPIOR8GqlCX//zEAPcjFFtOF1C2ZkpDMXYTVzYbkYXXo1W9t5zkYFWBPXZwP3POjsAOTyLVUvVviKPWNhx1VhoLGjtiGVhvwTkmb+NTslgCM+tOUUiGjA7/l4nttWD8tiXeB2tyiYg=; 5:MruT/u6n1fB95GUeX8DS3uNqEdyzBe/43+KQzoTVM7CrYvJ17q4WRFiC++X0Yqt8KAYk6Gv0sYMAK/iGIf2SPYqFc4tXrY1EWzM7Yzho2PWmLsrhmPe0bBaqOU+8G7Uu8YpDim139We7rX3buasmx+pKWDhC/UL7H9kvVW4OP3Q=; 24:HWeG1yP9GfO2HLWnQg7U609oxCesb3rp7A8uYHtHhSuIR93SLgv+eiZvDaJ9iz18vCkOHQxFfB4Pme6TyrxwFyH1VLU1BhIy9SsTlY+EPpo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2346; 7:zmu4iarF2WG81zRobo+n6ZOE1josHpn723lvYDHvDCj/p2JzfGA5+VZzbns8Ao2fFGOm3eHhs6BOakGehSwqznF+Tss8zpcTAK9tfieVzWp9WvTZNakhKatZOpK5bFxTAtKcw/U/pb+Kn9PzrzoQcpc52GlFxToA81CtrKu3xe4DDxZuj954FIttGfpONiXiNPa/5odjPbVOkLH578LMbzsU9XhYuzvTrrBhUogoq6UOawB0UB/Qat8q/I2njvzYdmBhVIhYEFcZ0dp3hXizP/kpR+QZ/swaJmiEz1lQqAQdnbJpy1DF6E0sNTSy64f++1bcXHDjQaLH15QCpLbEfITqgyWFfjltY1dgvvYnniFkSlR3jWfchlRnJdqvauouB6mc58H6vRSrYcXgMimYpIj88CW8igu6wHA9vJV8uX6TY7F/nutZhpqKjD1NsywJV7yLBn0o6bs4TRxwLdSuxA== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2017 13:12:40.4559 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2346 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170113_051305_503073_714ACC5B X-CRM114-Status: UNSURE ( 9.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Richter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Definition of cpu ranges are hard to read if the cpu variant is not zero. Provide MIDR_CPU_VAR_REV() macro to describe the full hardware revision of a cpu including variant and (minor) revision. V2: Renamed macro to MIDR_CPU_VAR_REV() Signed-off-by: Robert Richter --- arch/arm64/include/asm/cputype.h | 3 +++ arch/arm64/kernel/cpu_errata.c | 15 +++++++++------ arch/arm64/kernel/cpufeature.c | 8 +++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h index 26a68ddb11c1..5196f0afaabd 100644 --- a/arch/arm64/include/asm/cputype.h +++ b/arch/arm64/include/asm/cputype.h @@ -56,6 +56,9 @@ (0xf << MIDR_ARCHITECTURE_SHIFT) | \ ((partnum) << MIDR_PARTNUM_SHIFT)) +#define MIDR_CPU_VAR_REV(var, rev) \ + (((var) << MIDR_VARIANT_SHIFT) | (rev)) + #define MIDR_CPU_MODEL_MASK (MIDR_IMPLEMENTOR_MASK | MIDR_PARTNUM_MASK | \ MIDR_ARCHITECTURE_MASK) diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index b75e917aac46..722284eaf51e 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -79,8 +79,9 @@ const struct arm64_cpu_capabilities arm64_errata[] = { /* Cortex-A57 r0p0 - r1p2 */ .desc = "ARM erratum 832075", .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE, - MIDR_RANGE(MIDR_CORTEX_A57, 0x00, - (1 << MIDR_VARIANT_SHIFT) | 2), + MIDR_RANGE(MIDR_CORTEX_A57, + MIDR_CPU_VAR_REV(0, 0), + MIDR_CPU_VAR_REV(1, 2)), }, #endif #ifdef CONFIG_ARM64_ERRATUM_834220 @@ -88,8 +89,9 @@ const struct arm64_cpu_capabilities arm64_errata[] = { /* Cortex-A57 r0p0 - r1p2 */ .desc = "ARM erratum 834220", .capability = ARM64_WORKAROUND_834220, - MIDR_RANGE(MIDR_CORTEX_A57, 0x00, - (1 << MIDR_VARIANT_SHIFT) | 2), + MIDR_RANGE(MIDR_CORTEX_A57, + MIDR_CPU_VAR_REV(0, 0), + MIDR_CPU_VAR_REV(1, 2)), }, #endif #ifdef CONFIG_ARM64_ERRATUM_845719 @@ -113,8 +115,9 @@ const struct arm64_cpu_capabilities arm64_errata[] = { /* Cavium ThunderX, T88 pass 1.x - 2.1 */ .desc = "Cavium erratum 27456", .capability = ARM64_WORKAROUND_CAVIUM_27456, - MIDR_RANGE(MIDR_THUNDERX, 0x00, - (1 << MIDR_VARIANT_SHIFT) | 1), + MIDR_RANGE(MIDR_THUNDERX, + MIDR_CPU_VAR_REV(0, 0), + MIDR_CPU_VAR_REV(1, 1)), }, { /* Cavium ThunderX, T81 pass 1.0 */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index fdf8f045929f..725d3cf0e95b 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -720,13 +720,11 @@ static bool has_useable_gicv3_cpuif(const struct arm64_cpu_capabilities *entry, static bool has_no_hw_prefetch(const struct arm64_cpu_capabilities *entry, int __unused) { u32 midr = read_cpuid_id(); - u32 rv_min, rv_max; /* Cavium ThunderX pass 1.x and 2.x */ - rv_min = 0; - rv_max = (1 << MIDR_VARIANT_SHIFT) | MIDR_REVISION_MASK; - - return MIDR_IS_CPU_MODEL_RANGE(midr, MIDR_THUNDERX, rv_min, rv_max); + return MIDR_IS_CPU_MODEL_RANGE(midr, MIDR_THUNDERX, + MIDR_CPU_VAR_REV(0, 0), + MIDR_CPU_VAR_REV(1, MIDR_REVISION_MASK)); } static bool runs_at_el2(const struct arm64_cpu_capabilities *entry, int __unused)