aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Zyngier <[email protected]>2024-02-15 01:49:54 +0000
committerOliver Upton <[email protected]>2024-02-15 01:58:03 +0000
commit9aa030cee1c45d6e962f6bf22ba63d4aff2b1644 (patch)
treec9420e445d9556751c81cb8f80fd085301dcec7e
parent3673d01a2f555603cbf756874c7388b76bfbc967 (diff)
arm64: cpufeatures: Fix FEAT_NV check when checking for FEAT_NV1
Using this_cpu_has_cap() has the potential to go wrong when used system-wide on a preemptible kernel. Instead, use the __system_matches_cap() helper when checking for FEAT_NV in the FEAT_NV1 probing helper. Fixes: 3673d01a2f55 ("arm64: cpufeatures: Only check for NV1 if NV is present") Reported-by: Marek Szyprowski <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Link: https://lore.kernel.org/kvmarm/[email protected]/ Signed-off-by: Oliver Upton <[email protected]>
-rw-r--r--arch/arm64/kernel/cpufeature.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 3421b684d340..f309fd542c20 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1812,7 +1812,7 @@ static bool has_nv1(const struct arm64_cpu_capabilities *entry, int scope)
{}
};
- return (this_cpu_has_cap(ARM64_HAS_NESTED_VIRT) &&
+ return (__system_matches_cap(ARM64_HAS_NESTED_VIRT) &&
!(has_cpuid_feature(entry, scope) ||
is_midr_in_range_list(read_cpuid_id(), nv1_ni_list)));
}