Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1209584pxb; Wed, 6 Apr 2022 11:23:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSHJH7EBeEvS4uFiV+MYleCEQeqNk0WMdUp0qe69u4sBICq+AmiPVn1qVuJBkuf6DemH5x X-Received: by 2002:a05:6a00:b8e:b0:4fa:de88:9fc7 with SMTP id g14-20020a056a000b8e00b004fade889fc7mr9993589pfj.56.1649269393401; Wed, 06 Apr 2022 11:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649269393; cv=none; d=google.com; s=arc-20160816; b=f2hQHyLnAtLfyO2KBu992DXF4Y75UvcWKm4429Uz650jNl1JVs7J4HcY+WI3RNCSv5 zmoF1orZ2BuNdYPNBmeD0fg8hbGyf7jLOATBZClRLQUHGhUrhotVU5Q/PdLhX/h871A+ vH3/1Mn/jNJGulmuTYiIJ2bXT20XWlQ81aWvaAYrpP0gwtp4PdYSXCJyQKwgkTMn4U/c fKgMNIxFYrl3ixwoCcBkzhVyvnANG1eFpIWAWbaHcP+1hUkCHvLYmYhexJlBSJayeq+O n+eqGN1P7DDuZPPs3KQUaL5YhyiEZgXC7Y4H88HiELID5rFv85XiNFEGxfm52N5rY8aV 26fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ups3lt1/MpeNLxhIF+gRJhs+UqW2pEkKugouMo7YwsU=; b=a8g6TW4jehsT+gMHU/rpDNCy0ImuJDUHd1z08YAkID+FoRk/b1QG4wxM8fcs13e44j QjyL52tjS7GJPF+hIb54U5JKYMDCmcxjhcIVZUlqRGbzbcFmtf3H4rljdYfakv4k0N+Y 7oCfJJ0iQNUE5yIl0V2RTujjRlEKHNm9AnMmn6L9rwRBIL0BFaNWqbl7b829nlRGCrGS yycMpzHr7jeyBeP+W8QR9HuwlGqomA9cVsA/xqJBXPUvmu2WAnZ6ZBtrzwKnQuoRIxNO pVQE3pFHmxq/XrpCEnomX+45JWYDtJy/w4F4UvoDqlTy9TynBLpyosrGHK63oI0+dSWL IZfw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u14-20020a170903124e00b00153fae68065si19267777plh.538.2022.04.06.11.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 11:23:13 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3C4E16B53D; Wed, 6 Apr 2022 11:06:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239966AbiDFSIN (ORCPT + 99 others); Wed, 6 Apr 2022 14:08:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240310AbiDFSHq (ORCPT ); Wed, 6 Apr 2022 14:07:46 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 300F1100A6D; Wed, 6 Apr 2022 09:45:57 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ED41823A; Wed, 6 Apr 2022 09:45:56 -0700 (PDT) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.218]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4AE5C3F73B; Wed, 6 Apr 2022 09:45:56 -0700 (PDT) From: James Morse To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: James Morse , Catalin Marinas Subject: [stable:PATCH v4.9.309 01/43] arm64: errata: Provide macro for major and minor cpu revisions Date: Wed, 6 Apr 2022 17:45:04 +0100 Message-Id: <20220406164546.1888528-1-james.morse@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <0220406164217.1888053-1-james.morse@arm.com> References: <0220406164217.1888053-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Richter commit fa5ce3d1928c441c3d241c34a00c07c8f5880b1a upstream 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. Signed-off-by: Robert Richter Signed-off-by: Will Deacon [ morse: some parts of this patch were already backported as part of b8c320884eff003581ee61c5970a2e83f513eff1 ] Signed-off-by: James Morse --- arch/arm64/kernel/cpu_errata.c | 15 +++++++++------ arch/arm64/kernel/cpufeature.c | 8 +++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 3b680a32886b..bf4da33d77e3 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -408,8 +408,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 @@ -417,8 +418,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 @@ -442,8 +444,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 8cf001baee21..4130a901ae0d 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -728,13 +728,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) -- 2.30.2