public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, broonie@kernel.org,
	catalin.marinas@arm.com, maz@kernel.org, will@kernel.org
Subject: Re: [PATCH v2 3/5] arm64: make ARM64_HAS_GIC_PRIO_MASKING depend on ARM64_HAS_GIC_PRIO_MASKING
Date: Wed, 25 Jan 2023 18:05:09 +0000	[thread overview]
Message-ID: <Y9FvKuI3JmL66NYL@monolith.localdoman> (raw)
In-Reply-To: <20230125163826.496739-4-mark.rutland@arm.com>

Hi,

Very low hanging fruit here, but I think you wanted the commit subject to
say that ARM64_HAS_GIC_PRIO_MASKING should depend on
ARM64_HAS_GIC_CPUIF_SYSREGS instead of depending on itself.

Thanks,
Alex

On Wed, Jan 25, 2023 at 04:38:24PM +0000, Mark Rutland wrote:
> Currently the arm64_cpu_capabilities structure for
> ARM64_HAS_GIC_PRIO_MASKING open-codes the same CPU field definitions as
> the arm64_cpu_capabilities structure for ARM64_HAS_GIC_CPUIF_SYSREGS, so
> that can_use_gic_priorities() can use has_useable_gicv3_cpuif().
> 
> This duplication isn't ideal for the legibility of the code, and sets a
> bad example for any ARM64_HAS_GIC_* definitions added by subsequent
> patches.
> 
> Instead, have ARM64_HAS_GIC_PRIO_MASKING check for the
> ARM64_HAS_GIC_CPUIF_SYSREGS cpucap, and add a comment explaining why
> this is safe. Subsequent patches will use the same pattern where one
> cpucap depends upon another.
> 
> There should be no functional change as a result of this patch.
> 
> 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: Will Deacon <will@kernel.org>
> ---
>  arch/arm64/kernel/cpufeature.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index afd547a5309c7..515975f42d037 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -2046,7 +2046,15 @@ early_param("irqchip.gicv3_pseudo_nmi", early_enable_pseudo_nmi);
>  static bool can_use_gic_priorities(const struct arm64_cpu_capabilities *entry,
>  				   int scope)
>  {
> -	return enable_pseudo_nmi && has_useable_gicv3_cpuif(entry, scope);
> +	/*
> +	 * ARM64_HAS_GIC_CPUIF_SYSREGS has a lower index, and is a boot CPU
> +	 * feature, so will be detected earlier.
> +	 */
> +	BUILD_BUG_ON(ARM64_HAS_GIC_PRIO_MASKING <= ARM64_HAS_GIC_CPUIF_SYSREGS);
> +	if (!cpus_have_cap(ARM64_HAS_GIC_CPUIF_SYSREGS))
> +		return false;
> +
> +	return enable_pseudo_nmi;
>  }
>  #endif
>  
> @@ -2537,11 +2545,6 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
>  		.capability = ARM64_HAS_GIC_PRIO_MASKING,
>  		.type = ARM64_CPUCAP_STRICT_BOOT_CPU_FEATURE,
>  		.matches = can_use_gic_priorities,
> -		.sys_reg = SYS_ID_AA64PFR0_EL1,
> -		.field_pos = ID_AA64PFR0_EL1_GIC_SHIFT,
> -		.field_width = 4,
> -		.sign = FTR_UNSIGNED,
> -		.min_field_value = 1,
>  	},
>  #endif
>  #ifdef CONFIG_ARM64_E0PD
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-01-25 18:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 16:38 [PATCH v2 0/5] arm64: pseudo-nmi: elide code when CONFIG_ARM64_PSEUDO_NMI=n Mark Rutland
2023-01-25 16:38 ` [PATCH v2 1/5] arm64: rename ARM64_HAS_SYSREG_GIC_CPUIF to ARM64_HAS_GIC_CPUIF_SYSREGS Mark Rutland
2023-01-25 16:38 ` [PATCH v2 2/5] arm64: rename ARM64_HAS_IRQ_PRIO_MASKING to ARM64_HAS_GIC_PRIO_MASKING Mark Rutland
2023-01-25 16:38 ` [PATCH v2 3/5] arm64: make ARM64_HAS_GIC_PRIO_MASKING depend on ARM64_HAS_GIC_PRIO_MASKING Mark Rutland
2023-01-25 18:05   ` Alexandru Elisei [this message]
2023-01-25 18:27     ` Mark Rutland
2023-01-25 16:38 ` [PATCH v2 4/5] arm64: add ARM64_HAS_GIC_PRIO_RELAXED_SYNC cpucap Mark Rutland
2023-01-26  8:31   ` Marc Zyngier
2023-01-26 10:24     ` Mark Rutland
2023-01-25 16:38 ` [PATCH v2 5/5] arm64: irqflags: use alternative branches for pseudo-NMI logic Mark Rutland
2023-01-26  8:49   ` Marc Zyngier
2023-01-26 10:31     ` Mark Rutland
2023-01-26  8:51 ` [PATCH v2 0/5] arm64: pseudo-nmi: elide code when CONFIG_ARM64_PSEUDO_NMI=n Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y9FvKuI3JmL66NYL@monolith.localdoman \
    --to=alexandru.elisei@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox