Skip to content

Commit e8d4006

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: Remove cpus_have_const_cap()
There are no longer any users of cpus_have_const_cap(), and therefore it can be removed. Remove cpus_have_const_cap(). At the same time, remove __cpus_have_const_cap(), as this is a trivial wrapper of alternative_has_cap_unlikely(), which can be used directly instead. The comment for __system_matches_cap() is updated to no longer refer to cpus_have_const_cap(). As we have a number of ways to check the cpucaps, the specific suggestions are removed. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Kristina Martsenko <kristina.martsenko@arm.com> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 47759ec commit e8d4006

File tree

2 files changed

+2
-37
lines changed

2 files changed

+2
-37
lines changed

arch/arm64/include/asm/cpufeature.h

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -462,19 +462,6 @@ static __always_inline bool cpus_have_cap(unsigned int num)
462462
return arch_test_bit(num, system_cpucaps);
463463
}
464464

465-
/*
466-
* Test for a capability without a runtime check.
467-
*
468-
* Before capabilities are finalized, this returns false.
469-
* After capabilities are finalized, this is patched to avoid a runtime check.
470-
*
471-
* @num must be a compile-time constant.
472-
*/
473-
static __always_inline bool __cpus_have_const_cap(int num)
474-
{
475-
return alternative_has_cap_unlikely(num);
476-
}
477-
478465
/*
479466
* Test for a capability without a runtime check.
480467
*
@@ -487,7 +474,7 @@ static __always_inline bool __cpus_have_const_cap(int num)
487474
static __always_inline bool cpus_have_final_boot_cap(int num)
488475
{
489476
if (boot_capabilities_finalized())
490-
return __cpus_have_const_cap(num);
477+
return alternative_has_cap_unlikely(num);
491478
else
492479
BUG();
493480
}
@@ -504,32 +491,11 @@ static __always_inline bool cpus_have_final_boot_cap(int num)
504491
static __always_inline bool cpus_have_final_cap(int num)
505492
{
506493
if (system_capabilities_finalized())
507-
return __cpus_have_const_cap(num);
494+
return alternative_has_cap_unlikely(num);
508495
else
509496
BUG();
510497
}
511498

512-
/*
513-
* Test for a capability, possibly with a runtime check for non-hyp code.
514-
*
515-
* For hyp code, this behaves the same as cpus_have_final_cap().
516-
*
517-
* For non-hyp code:
518-
* Before capabilities are finalized, this behaves as cpus_have_cap().
519-
* After capabilities are finalized, this is patched to avoid a runtime check.
520-
*
521-
* @num must be a compile-time constant.
522-
*/
523-
static __always_inline bool cpus_have_const_cap(int num)
524-
{
525-
if (is_hyp_code())
526-
return cpus_have_final_cap(num);
527-
else if (system_capabilities_finalized())
528-
return __cpus_have_const_cap(num);
529-
else
530-
return cpus_have_cap(num);
531-
}
532-
533499
static inline int __attribute_const__
534500
cpuid_feature_extract_signed_field_width(u64 features, int field, int width)
535501
{

arch/arm64/kernel/cpufeature.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3322,7 +3322,6 @@ EXPORT_SYMBOL_GPL(this_cpu_has_cap);
33223322
* This helper function is used in a narrow window when,
33233323
* - The system wide safe registers are set with all the SMP CPUs and,
33243324
* - The SYSTEM_FEATURE system_cpucaps may not have been set.
3325-
* In all other cases cpus_have_{const_}cap() should be used.
33263325
*/
33273326
static bool __maybe_unused __system_matches_cap(unsigned int n)
33283327
{

0 commit comments

Comments
 (0)