arm64: Filter out SME hwcaps when FEAT_SME isn't implemented
authorMark Brown <broonie@kernel.org>
Fri, 20 Jun 2025 11:28:48 +0000 (12:28 +0100)
committerWill Deacon <will@kernel.org>
Fri, 4 Jul 2025 15:35:30 +0000 (16:35 +0100)
commita75ad2fc76a2ab70817c7eed3163b66ea84ca6ac
tree2dc8754612786d359c76b895b3ccfdc7ba615762
parent6c66bb655ca3fd5e9304163cf70796d08de512ed
arm64: Filter out SME hwcaps when FEAT_SME isn't implemented

We have a number of hwcaps for various SME subfeatures enumerated via
ID_AA64SMFR0_EL1. Currently we advertise these without cross checking
against the main SME feature, advertised in ID_AA64PFR1_EL1.SME which
means that if the two are out of sync userspace can see a confusing
situation where SME subfeatures are advertised without the base SME
hwcap. This can be readily triggered by using the arm64.nosme override
which only masks out ID_AA64PFR1_EL1.SME, and there have also been
reports of VMMs which do the same thing.

Fix this as we did previously for SVE in 064737920bdb ("arm64: Filter
out SVE hwcaps when FEAT_SVE isn't implemented") by filtering out the
SME subfeature hwcaps when FEAT_SME is not present.

Fixes: 5e64b862c482 ("arm64/sme: Basic enumeration support")
Reported-by: Yury Khrustalev <yury.khrustalev@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250620-arm64-sme-filter-hwcaps-v1-1-02b9d3c2d8ef@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/cpufeature.c