]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
arm64: cpufeature: Add WORKAROUND_DISABLE_CNP capability
authorZeng Heng <zengheng4@huawei.com>
Wed, 3 Jun 2026 06:20:24 +0000 (14:20 +0800)
committerWill Deacon <will@kernel.org>
Wed, 3 Jun 2026 11:43:28 +0000 (12:43 +0100)
The NVIDIA Carmel CNP erratum is not the only case requiring CNP to be
disabled. Abstract this into a common WORKAROUND_DISABLE_CNP capability
to facilitate adding errata for future chips and reduce duplicate
checks in has_useable_cnp().

This serves as a prerequisite for the subsequent Hisilicon erratum
162100125.

Suggested-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Acked-by: Wei Xu <xuwei5@hisilicon.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/Kconfig
arch/arm64/include/asm/cpucaps.h
arch/arm64/kernel/cpu_errata.c
arch/arm64/kernel/cpufeature.c
arch/arm64/tools/cpucaps

index fe60738e5943ba279e5571862423df4fed3db661..f297517a83b908384690fb9af5a1d3bcfdea88aa 100644 (file)
@@ -1315,9 +1315,13 @@ config QCOM_FALKOR_ERRATUM_E1041
 
          If unsure, say Y.
 
+config ARM64_WORKAROUND_DISABLE_CNP
+       bool
+
 config NVIDIA_CARMEL_CNP_ERRATUM
        bool "NVIDIA Carmel CNP: CNP on Carmel semantically different than ARM cores"
        default y
+       select ARM64_WORKAROUND_DISABLE_CNP
        help
          If CNP is enabled on Carmel cores, non-sharable TLBIs on a core will not
          invalidate shared TLB entries installed by a different core, as it would
index d0d3cdd5763cab5321ecb1272b44dfaa8371abe0..25c61cda901c5d27621814713c046492ca35ea54 100644 (file)
@@ -58,8 +58,8 @@ cpucap_is_possible(const unsigned int cap)
                return IS_ENABLED(CONFIG_ARM64_ERRATUM_2658417);
        case ARM64_WORKAROUND_CAVIUM_23154:
                return IS_ENABLED(CONFIG_CAVIUM_ERRATUM_23154);
-       case ARM64_WORKAROUND_NVIDIA_CARMEL_CNP:
-               return IS_ENABLED(CONFIG_NVIDIA_CARMEL_CNP_ERRATUM);
+       case ARM64_WORKAROUND_DISABLE_CNP:
+               return IS_ENABLED(CONFIG_ARM64_WORKAROUND_DISABLE_CNP);
        case ARM64_WORKAROUND_REPEAT_TLBI:
                return IS_ENABLED(CONFIG_ARM64_WORKAROUND_REPEAT_TLBI);
        case ARM64_WORKAROUND_SPECULATIVE_SSBS:
index 5377e4c2eba2beaaeb5af77d9795fa9710d47a82..08eb9d6545d135281671414c3d9f5e9d2e3b9877 100644 (file)
@@ -608,6 +608,15 @@ static const struct midr_range erratum_ac04_cpu_23_list[] = {
 };
 #endif
 
+#ifdef CONFIG_ARM64_WORKAROUND_DISABLE_CNP
+static const struct midr_range cnp_erratum_cpus[] = {
+#ifdef CONFIG_NVIDIA_CARMEL_CNP_ERRATUM
+       MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL),
+#endif
+       {},
+};
+#endif
+
 const struct arm64_cpu_capabilities arm64_errata[] = {
 #ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE
        {
@@ -801,12 +810,12 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
                                  1, 0),
        },
 #endif
-#ifdef CONFIG_NVIDIA_CARMEL_CNP_ERRATUM
+#ifdef CONFIG_ARM64_WORKAROUND_DISABLE_CNP
        {
                /* NVIDIA Carmel */
                .desc = "NVIDIA Carmel CNP erratum",
-               .capability = ARM64_WORKAROUND_NVIDIA_CARMEL_CNP,
-               ERRATA_MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL),
+               .capability = ARM64_WORKAROUND_DISABLE_CNP,
+               ERRATA_MIDR_RANGE_LIST(cnp_erratum_cpus),
        },
 #endif
 #ifdef CONFIG_ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
index 6d53bb15cf7bb48e926330c7ff0c93c0c14b14c2..20c5f24f74a9171f02f513c7113e6fd1ef8eb910 100644 (file)
@@ -1785,7 +1785,7 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope)
        if (is_kdump_kernel())
                return false;
 
-       if (cpus_have_cap(ARM64_WORKAROUND_NVIDIA_CARMEL_CNP))
+       if (cpus_have_cap(ARM64_WORKAROUND_DISABLE_CNP))
                return false;
 
        return has_cpuid_feature(entry, scope);
index 811c2479e82d6eddc225d1da99f20c4760270c99..9b85a84f6fd494bd9fc5fbc111984011a435cb11 100644 (file)
@@ -120,7 +120,7 @@ WORKAROUND_CAVIUM_TX2_219_PRFM
 WORKAROUND_CAVIUM_TX2_219_TVM
 WORKAROUND_CLEAN_CACHE
 WORKAROUND_DEVICE_LOAD_ACQUIRE
-WORKAROUND_NVIDIA_CARMEL_CNP
+WORKAROUND_DISABLE_CNP
 WORKAROUND_PMUV3_IMPDEF_TRAPS
 WORKAROUND_QCOM_FALKOR_E1003
 WORKAROUND_QCOM_ORYON_CNTVOFF