From patchwork Wed Jan 11 12:11:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 9509989 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 C10F060710 for ; Wed, 11 Jan 2017 12:12:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD71D283FC for ; Wed, 11 Jan 2017 12:12:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A13EE28604; Wed, 11 Jan 2017 12:12:34 +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 2C429283FC for ; Wed, 11 Jan 2017 12:12:34 +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 1cRHlZ-0001Hp-3A; Wed, 11 Jan 2017 12:12:33 +0000 Received: from mail-bn3nam01on0059.outbound.protection.outlook.com ([104.47.33.59] helo=NAM01-BN3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRHlV-000172-NF for linux-arm-kernel@lists.infradead.org; Wed, 11 Jan 2017 12:12:31 +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=fNt/ZD1mQ8KhjGdzEW5eHphcStWxOcgHFYjGiUxCd9g=; b=OEeRWnCbrsEtLov8zcGmtU0D6bWT2BOLDPYFnVqJppHv8vCf+e+BfNlH3hp0PUNhAdaLtixoFM4YTYvSWASMvw6W/PsaRg6yJGiDfxyG4rJDofx5rsv5/63t9KHMHCy08W3lCaLtsvI08xnZmrVLKIscQi81F0nvr50lLj799UQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@cavium.com; Received: from rric.localdomain (92.229.91.120) 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; Wed, 11 Jan 2017 12:12:05 +0000 From: Robert Richter To: Catalin Marinas , Will Deacon Subject: [PATCH] arm64: errata: Provide macro for major and minor cpu revisions Date: Wed, 11 Jan 2017 13:11:42 +0100 Message-ID: <20170111121143.9586-1-rrichter@cavium.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Originating-IP: [92.229.91.120] X-ClientProxiedBy: HE1PR0101CA0002.eurprd01.prod.exchangelabs.com (10.168.141.140) To CY1PR07MB2346.namprd07.prod.outlook.com (10.166.194.145) X-MS-Office365-Filtering-Correlation-Id: be3bc41f-a883-4e93-3e6a-08d43a1b0ff6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR07MB2346; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2346; 3:Z66J9td/DId0CPw+ujsHwjoMd+QnMKfW5n3a5Eeyj9TCueTDqQLhnso/6h2IM2/MZhUCIKY8qH+1oiGUwMm3yufrVEbCCXcRCkj5AJEFFihbAH8rqcfepbEeRUXae2n6QofxCzeE2AJDyUnP6MHUxikI5evA/sGdT4lka2QC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7MPwkufG4sZY1JP4EzWX65JxyMT/E/iRCICBOVdc9Ji5xlrIwV0QGouiJmjFF809yVdiQxQmAlMHiPYT4/R5bA2BcJE06bGNo5nNixsC574sP+jZgP9/bskdx4f4J2eK6biuNV; 20:dBImojNR4aGFUyT/4tKfveKSFimrvxIpW+PI8gXkhVP8t1JWHrUCysRpdhnRKPdwN+yz5V1TmDljtd9IAzVwlMqU6080Rd52lP+1NpLuXJnH7O3A5lFlDNBrlIwjLREficlSZaJtgvMc9pZYeFoi7BK//8PLVRUccw1Pt7wgLAcZomxw1VLcgZtrtsd1+2rMdVzv6C5gr07cnq1Df8E+Blp+Z5DlWf2aP3dHxMue4B5j/fXoV2aA5G4fvwB4fwlFvxqaWyCzjY87k94fRuPTswJGtCX5tSHzfz5n4ESJbXkKBOnBUAVVjd8XTyxVczG6NfcS+IKeTsDYe/LrsF8UQurx9OsI70o7k2aWEbiAMgi6jCITVlDueI+PbjZWVy9PEnbkFQz/1th5ndqkrtjV5roEh4fW/CB77wBgI49CRnrhytjiEBXE83h2pyX6X9G7siRn1LpTzWxTNlh9MRpw9qoq7nFv/h9hZof+mdbNUMWAcKMUS0mnIsea11TYkN7a 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)(20161123558021)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:CY1PR07MB2346; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2346; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2346; 4:WE1KrcwBWjeuoA+lFoDpwtL5eR/ywNN7V4tCP/s8UjxwDVQZwIZbwzcIVsNDnRMtwEjcbEaB7zKqjYa978j6Mt1NYDS5auxGRwHmNGx/COMudJmXGAAZibZhyrAD2cbYcEEaGJHdDBihtpyQGxjUg3EoZOCQw3/NJRFJq4aUwB28pfiPta9nS6GzxbhnO28XBQegQHDAt9XQ0yDTP4FJBjhkFSYy2KrzVoXbxuIYCq277kO85nos4EPsjJnylI8uGsQQJFMr01O9T6b6oV+eZ9R33E6GubfYzJGoHyPnLMJg+7kEGKDzy1lV0pcoaYifv8vmc71TGmYcVVbwISlgaCa87L13+1iG/S7P+wf276hb3nmEtGwhoqxIWArt3pTZ83+P+gD7R03sniEx/JrmyGPWwwkvubgcXXeDFd2Vt9Fv9ce21TqhGODgWPRaYBGZjM814bZqHWrWzUyY59tB4Bq8LrTooT4BBQLtqTY/JUej3pWuueqNWchXinB3uowsSXqYbvTX2qAQVmevVo9cqUTl0thOqCVxu8lCOW9GmcmLXwZftO80e9ICFhdiC2u2e0eBFvasOsUYHjmOfvMhFpeO+12iEmi1fBbm9GZoeoc= X-Forefront-PRVS: 01842C458A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(199003)(189002)(6486002)(66066001)(54906002)(6506006)(25786008)(48376002)(5003940100001)(50466002)(189998001)(5660300001)(68736007)(2906002)(101416001)(7736002)(575784001)(38730400001)(47776003)(305945005)(6666003)(33646002)(92566002)(6116002)(3846002)(6512007)(1076002)(5001770100001)(4326007)(97736004)(36756003)(50986999)(42186005)(105586002)(81166006)(106356001)(81156014)(50226002)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2346; H:rric.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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:X94iQTNI5mn5UE3UhsS0iq8DJPGleyOWlD3oE2ejZ?= =?us-ascii?Q?Ljj71hg1EmJmNdTS25dA/El8DzFfTdWCCDBscwMkMqpJn99CpfK+/6DlOcpi?= =?us-ascii?Q?u+mBMSDQ4lnGeHKNRdrSjiddWhy6ugsun8qeqF1tcmMVMGy+JMe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as9EVlaHmF4116RikBtxcPKgVTS/kD41XgQ?= =?us-ascii?Q?jLToiM=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2346; 6:7SSG4DyM9MWKndyRwUdHb2NUaClM51FHQC1MsUEUjvicS1F/Wn6Yya8lj98h3GDlqBy/Beii/g8LtDK++Nz/RUpQRxJABR05ViblfZwqLQxGyGgJgSVRVCpvxPznLZQLrMenSNyxGOND0nK53ITYta5l1bB5wa2dVrWlktpGqf+iIjBY5gmeTj3NvHgNzfzAdezjMl3Nxw/z+CZFvfKxvRVfFoh5i+2ElVtEsr/RgXmiIxXqEaFq3uf39PlmU39F5t18SAS45RslQRybagWKZJMTUUPc9EwQZjlgDvi9ayhJ+Wslb+tCnjAGcTdvNqkJfNrNRvryq595P3LbHOj6kC3Rx7DOz/uEubopYZOotz4aJajjzu0TV3Yd64GUGe0o+Nb18YjRk33sEwZ8QEWZc9TRylT4A3Q9R3fp4rPvM/Q=; 5:yIEBTyEihzoUl8ht456WFBntB67cadEnsOxaP208+UqpkSRN5rBinfma/CTo9fVTAhQaDbZ3VjmXi918+EuAzDxPw5lU53SCk9ec9JpWYFvpQSRQetIgXPYT8DJSY2Pyc6CLRuEYv3MR3fi4wHM/Aw==; 24:LzoPvfQOXxG8JgwEwSfAfZu0mx68dMU1qLHV1mATGntPnykbwDYPJr1+LgktWvb+3mNikoCGEF1X1jBaGb10kDNuumS0sTk4fFxWP152jus= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2346; 7:7Cmlr35Ovgdlt5d4gjfti86fyHPOLur7mnZYkp6qmxrAszLkVGH0eZkME6txDRleatHP4dpihZKR/sNoO1XQkQjUoia3kNd1ah+/QNVND6dxBOSMITEW3gpbe+tnnQIEs5hY6SCLVfqbn8xLiWdfnoX6LFvL6vBLMuYBulVPdF0nAAEpDbgZMx1AMGfo41qvyd2qGcpquMfkRrmRkNJMdB4wrn5jy+nZxtwl7hnBLbB+PyvBZL34xgUQrjwDDw3b/QnDaX1dzXpmmVGNSO7m1RPnWZXs8akOGVwFhwJbJ5OVyswXwBmFIDQRtNS8bWRRhjNd8ucfDVnXcl+F6IcxEIGPMfVhDNgdPOiEbVy6te/gw4kG8qILbroVT/W57eQoOy3tjr5Z8jipSx7KQ0ARJbzzOAvzrdHxVj+EwGGovPPn3J0Ikej5TwO1ICnLwj2Xl/m8MTXP0DqwIYYLC8nNcg== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2017 12:12:05.6967 (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-20170111_041230_009930_F6C83CD7 X-CRM114-Status: UNSURE ( 9.86 ) 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_FULL_REV() macro to describe the full hardware revision of a cpu including variant and (minor) revision. 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..983e59cbdd54 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_FULL_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..63b61e981e2f 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_FULL_REV(0, 0), + MIDR_CPU_FULL_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_FULL_REV(0, 0), + MIDR_CPU_FULL_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_FULL_REV(0, 0), + MIDR_CPU_FULL_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..f12b13de24f4 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_FULL_REV(0, 0), + MIDR_CPU_FULL_REV(1, MIDR_REVISION_MASK)); } static bool runs_at_el2(const struct arm64_cpu_capabilities *entry, int __unused)