diff mbox series

[3/4] arm64: cpufeature: use cpucap naming

Message ID 20230601100812.2303944-4-mark.rutland@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64: cpucap cleanup | expand

Commit Message

Mark Rutland June 1, 2023, 10:08 a.m. UTC
To more clearly align the various users of the cpucap enumeration, this patch
changes the cpufeature code to use the term `cpucap` in favour of `cpu_hwap`.
This more clearly aligns with other users of the cpucaps, and avoids confusion
with the ELF hwcaps.

There should be no functional change as a result of this patch; this is
purely a renaming exercise.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Suzuki Poulose <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/mmu_context.h |  2 +-
 arch/arm64/kernel/cpufeature.c       | 38 ++++++++++++++--------------
 2 files changed, 20 insertions(+), 20 deletions(-)

Comments

Mark Brown June 1, 2023, 11:07 a.m. UTC | #1
On Thu, Jun 01, 2023 at 11:08:11AM +0100, Mark Rutland wrote:
> To more clearly align the various users of the cpucap enumeration, this patch
> changes the cpufeature code to use the term `cpucap` in favour of `cpu_hwap`.

s/cpu_hwap/cpu_hwcap/

Reviewed-by: Mark Brown <broonie@kernel.org>
Marc Zyngier June 1, 2023, 12:54 p.m. UTC | #2
On Thu, 01 Jun 2023 11:08:11 +0100,
Mark Rutland <mark.rutland@arm.com> wrote:
> 
> To more clearly align the various users of the cpucap enumeration, this patch
> changes the cpufeature code to use the term `cpucap` in favour of `cpu_hwap`.
> This more clearly aligns with other users of the cpucaps, and avoids confusion
> with the ELF hwcaps.
> 
> There should be no functional change as a result of this patch; this is
> purely a renaming exercise.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Suzuki Poulose <suzuki.poulose@arm.com>
> Cc: Will Deacon <will@kernel.org>
> ---
>  arch/arm64/include/asm/mmu_context.h |  2 +-
>  arch/arm64/kernel/cpufeature.c       | 38 ++++++++++++++--------------
>  2 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
> index 56911691bef05..7f332854c961e 100644
> --- a/arch/arm64/include/asm/mmu_context.h
> +++ b/arch/arm64/include/asm/mmu_context.h
> @@ -164,7 +164,7 @@ static inline void cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap)
>  		 * up (i.e. cpufeature framework is not up yet) and
>  		 * latter only when we enable CNP via cpufeature's
>  		 * enable() callback.
> -		 * Also we rely on the cpu_hwcap bit being set before
> +		 * Also we rely on the system_cpucap bit being set before
>  		 * calling the enable() function.
>  		 */
>  		ttbr1 |= TTBR_CNP_BIT;

nit: Shout this be moved to the first patch instead? It only differs
by being singular instead of plural.

On the other hand, I have a series that eradicates this code
altogether, so I can't say I care deeply! ;-)

Thanks,

	M.
Mark Rutland June 1, 2023, 2:31 p.m. UTC | #3
On Thu, Jun 01, 2023 at 01:54:01PM +0100, Marc Zyngier wrote:
> On Thu, 01 Jun 2023 11:08:11 +0100,
> Mark Rutland <mark.rutland@arm.com> wrote:
> > 
> > To more clearly align the various users of the cpucap enumeration, this patch
> > changes the cpufeature code to use the term `cpucap` in favour of `cpu_hwap`.
> > This more clearly aligns with other users of the cpucaps, and avoids confusion
> > with the ELF hwcaps.
> > 
> > There should be no functional change as a result of this patch; this is
> > purely a renaming exercise.
> > 
> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Marc Zyngier <maz@kernel.org>
> > Cc: Mark Brown <broonie@kernel.org>
> > Cc: Suzuki Poulose <suzuki.poulose@arm.com>
> > Cc: Will Deacon <will@kernel.org>
> > ---
> >  arch/arm64/include/asm/mmu_context.h |  2 +-
> >  arch/arm64/kernel/cpufeature.c       | 38 ++++++++++++++--------------
> >  2 files changed, 20 insertions(+), 20 deletions(-)
> > 
> > diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
> > index 56911691bef05..7f332854c961e 100644
> > --- a/arch/arm64/include/asm/mmu_context.h
> > +++ b/arch/arm64/include/asm/mmu_context.h
> > @@ -164,7 +164,7 @@ static inline void cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap)
> >  		 * up (i.e. cpufeature framework is not up yet) and
> >  		 * latter only when we enable CNP via cpufeature's
> >  		 * enable() callback.
> > -		 * Also we rely on the cpu_hwcap bit being set before
> > +		 * Also we rely on the system_cpucap bit being set before
> >  		 * calling the enable() function.
> >  		 */
> >  		ttbr1 |= TTBR_CNP_BIT;
> 
> nit: Shout this be moved to the first patch instead? It only differs
> by being singular instead of plural.

Yes, it should. Moved (and missing 's' added so it'll show up in a grep).

> On the other hand, I have a series that eradicates this code
> altogether, so I can't say I care deeply! ;-)

Even better! :)

Mark.
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
index 56911691bef05..7f332854c961e 100644
--- a/arch/arm64/include/asm/mmu_context.h
+++ b/arch/arm64/include/asm/mmu_context.h
@@ -164,7 +164,7 @@  static inline void cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap)
 		 * up (i.e. cpufeature framework is not up yet) and
 		 * latter only when we enable CNP via cpufeature's
 		 * enable() callback.
-		 * Also we rely on the cpu_hwcap bit being set before
+		 * Also we rely on the system_cpucap bit being set before
 		 * calling the enable() function.
 		 */
 		ttbr1 |= TTBR_CNP_BIT;
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 68e012f4ea080..82e6819528347 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -107,7 +107,7 @@  unsigned int compat_elf_hwcap2 __read_mostly;
 
 DECLARE_BITMAP(system_cpucaps, ARM64_NCAPS);
 EXPORT_SYMBOL(system_cpucaps);
-static struct arm64_cpu_capabilities const __ro_after_init *cpu_hwcaps_ptrs[ARM64_NCAPS];
+static struct arm64_cpu_capabilities const __ro_after_init *cpucap_ptrs[ARM64_NCAPS];
 
 DECLARE_BITMAP(boot_cpucaps, ARM64_NCAPS);
 
@@ -954,24 +954,24 @@  extern const struct arm64_cpu_capabilities arm64_errata[];
 static const struct arm64_cpu_capabilities arm64_features[];
 
 static void __init
-init_cpu_hwcaps_indirect_list_from_array(const struct arm64_cpu_capabilities *caps)
+init_cpucap_indirect_list_from_array(const struct arm64_cpu_capabilities *caps)
 {
 	for (; caps->matches; caps++) {
 		if (WARN(caps->capability >= ARM64_NCAPS,
 			"Invalid capability %d\n", caps->capability))
 			continue;
-		if (WARN(cpu_hwcaps_ptrs[caps->capability],
+		if (WARN(cpucap_ptrs[caps->capability],
 			"Duplicate entry for capability %d\n",
 			caps->capability))
 			continue;
-		cpu_hwcaps_ptrs[caps->capability] = caps;
+		cpucap_ptrs[caps->capability] = caps;
 	}
 }
 
-static void __init init_cpu_hwcaps_indirect_list(void)
+static void __init init_cpucap_indirect_list(void)
 {
-	init_cpu_hwcaps_indirect_list_from_array(arm64_features);
-	init_cpu_hwcaps_indirect_list_from_array(arm64_errata);
+	init_cpucap_indirect_list_from_array(arm64_features);
+	init_cpucap_indirect_list_from_array(arm64_errata);
 }
 
 static void __init setup_boot_cpu_capabilities(void);
@@ -1049,10 +1049,10 @@  void __init init_cpu_features(struct cpuinfo_arm64 *info)
 		init_cpu_ftr_reg(SYS_GMID_EL1, info->reg_gmid);
 
 	/*
-	 * Initialize the indirect array of CPU hwcaps capabilities pointers
-	 * before we handle the boot CPU below.
+	 * Initialize the indirect array of CPU capabilities pointers before we
+	 * handle the boot CPU below.
 	 */
-	init_cpu_hwcaps_indirect_list();
+	init_cpucap_indirect_list();
 
 	/*
 	 * Detect and enable early CPU capabilities based on the boot CPU,
@@ -2048,9 +2048,9 @@  static bool has_address_auth_cpucap(const struct arm64_cpu_capabilities *entry,
 static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry,
 				     int scope)
 {
-	bool api = has_address_auth_cpucap(cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF], scope);
-	bool apa = has_address_auth_cpucap(cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5], scope);
-	bool apa3 = has_address_auth_cpucap(cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3], scope);
+	bool api = has_address_auth_cpucap(cpucap_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF], scope);
+	bool apa = has_address_auth_cpucap(cpucap_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5], scope);
+	bool apa3 = has_address_auth_cpucap(cpucap_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3], scope);
 
 	return apa || apa3 || api;
 }
@@ -2895,7 +2895,7 @@  static void update_cpu_capabilities(u16 scope_mask)
 
 	scope_mask &= ARM64_CPUCAP_SCOPE_MASK;
 	for (i = 0; i < ARM64_NCAPS; i++) {
-		caps = cpu_hwcaps_ptrs[i];
+		caps = cpucap_ptrs[i];
 		if (!caps || !(caps->type & scope_mask) ||
 		    cpus_have_cap(caps->capability) ||
 		    !caps->matches(caps, cpucap_default_scope(caps)))
@@ -2920,7 +2920,7 @@  static int cpu_enable_non_boot_scope_capabilities(void *__unused)
 	u16 non_boot_scope = SCOPE_ALL & ~SCOPE_BOOT_CPU;
 
 	for_each_available_cap(i) {
-		const struct arm64_cpu_capabilities *cap = cpu_hwcaps_ptrs[i];
+		const struct arm64_cpu_capabilities *cap = cpucap_ptrs[i];
 
 		if (WARN_ON(!cap))
 			continue;
@@ -2950,7 +2950,7 @@  static void __init enable_cpu_capabilities(u16 scope_mask)
 	for (i = 0; i < ARM64_NCAPS; i++) {
 		unsigned int num;
 
-		caps = cpu_hwcaps_ptrs[i];
+		caps = cpucap_ptrs[i];
 		if (!caps || !(caps->type & scope_mask))
 			continue;
 		num = caps->capability;
@@ -2995,7 +2995,7 @@  static void verify_local_cpu_caps(u16 scope_mask)
 	scope_mask &= ARM64_CPUCAP_SCOPE_MASK;
 
 	for (i = 0; i < ARM64_NCAPS; i++) {
-		caps = cpu_hwcaps_ptrs[i];
+		caps = cpucap_ptrs[i];
 		if (!caps || !(caps->type & scope_mask))
 			continue;
 
@@ -3194,7 +3194,7 @@  static void __init setup_boot_cpu_capabilities(void)
 bool this_cpu_has_cap(unsigned int n)
 {
 	if (!WARN_ON(preemptible()) && n < ARM64_NCAPS) {
-		const struct arm64_cpu_capabilities *cap = cpu_hwcaps_ptrs[n];
+		const struct arm64_cpu_capabilities *cap = cpucap_ptrs[n];
 
 		if (cap)
 			return cap->matches(cap, SCOPE_LOCAL_CPU);
@@ -3213,7 +3213,7 @@  EXPORT_SYMBOL_GPL(this_cpu_has_cap);
 static bool __maybe_unused __system_matches_cap(unsigned int n)
 {
 	if (n < ARM64_NCAPS) {
-		const struct arm64_cpu_capabilities *cap = cpu_hwcaps_ptrs[n];
+		const struct arm64_cpu_capabilities *cap = cpucap_ptrs[n];
 
 		if (cap)
 			return cap->matches(cap, SCOPE_SYSTEM);