diff options
| author | Yury Norov (NVIDIA) <yury.norov@gmail.com> | 2025-09-12 20:09:05 -0400 |
|---|---|---|
| committer | Will Deacon <will@kernel.org> | 2025-09-16 21:05:48 +0100 |
| commit | 19dd484cd19c308e2ea763f8d31e43a7f1ab6141 (patch) | |
| tree | ad2a8314bcc0ebdfc2a89cf3e32edb72c3c9580b | |
| parent | 8f5ae30d69d7543eee0d70083daf4de8fe15d585 (diff) | |
| download | linux-19dd484cd19c308e2ea763f8d31e43a7f1ab6141.tar.gz linux-19dd484cd19c308e2ea763f8d31e43a7f1ab6141.zip | |
arm64/fpsimd: simplify sme_setup()
The function checks info->vq_map for emptiness right before calling
find_last_bit().
We can use the find_last_bit() output and save on bitmap_empty() call,
which is O(N).
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Signed-off-by: Will Deacon <will@kernel.org>
| -rw-r--r-- | arch/arm64/kernel/fpsimd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index c37f02d7194e..e3f8f51748bc 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -1265,6 +1265,8 @@ void __init sme_setup(void) if (!system_supports_sme()) return; + min_bit = find_last_bit(info->vq_map, SVE_VQ_MAX); + /* * SME doesn't require any particular vector length be * supported but it does require at least one. We should have @@ -1272,9 +1274,8 @@ void __init sme_setup(void) * let's double check here. The bitmap is SVE_VQ_MAP sized for * sharing with SVE. */ - WARN_ON(bitmap_empty(info->vq_map, SVE_VQ_MAX)); + WARN_ON(min_bit >= SVE_VQ_MAX); - min_bit = find_last_bit(info->vq_map, SVE_VQ_MAX); info->min_vl = sve_vl_from_vq(__bit_to_vq(min_bit)); max_bit = find_first_bit(info->vq_map, SVE_VQ_MAX); |
