linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com,
	ard.biesheuvel@linaro.org, marc.zyngier@arm.com,
	will.deacon@arm.com, linux-kernel@vger.kernel.org,
	kvmarm@lists.cs.columbia.edu,
	Christoffer Dall <christoffer.dall@linaro.org>
Subject: Re: [PATCH v3 2/2] arm64: Support systems without FP/ASIMD
Date: Mon, 14 Nov 2016 11:48:58 +0000	[thread overview]
Message-ID: <20161114114858.GB3096@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <1478613381-5718-3-git-send-email-suzuki.poulose@arm.com>

Hi Suzuki,

On Tue, Nov 08, 2016 at 01:56:21PM +0000, Suzuki K. Poulose wrote:
> diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h
> index 87b4465..4174f09 100644
> --- a/arch/arm64/include/asm/cpucaps.h
> +++ b/arch/arm64/include/asm/cpucaps.h
> @@ -34,7 +34,8 @@
>  #define ARM64_HAS_32BIT_EL0			13
>  #define ARM64_HYP_OFFSET_LOW			14
>  #define ARM64_MISMATCHED_CACHE_LINE_SIZE	15
> +#define ARM64_HAS_NO_FPSIMD			16
>  
> -#define ARM64_NCAPS				16
> +#define ARM64_NCAPS				17
>  
>  #endif /* __ASM_CPUCAPS_H */
> diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
> index 9890d20..ce45770 100644
> --- a/arch/arm64/include/asm/cpufeature.h
> +++ b/arch/arm64/include/asm/cpufeature.h
> @@ -213,6 +213,11 @@ static inline bool system_supports_mixed_endian_el0(void)
>  	return id_aa64mmfr0_mixed_endian_el0(read_system_reg(SYS_ID_AA64MMFR0_EL1));
>  }
>  
> +static inline bool system_supports_fpsimd(void)
> +{
> +	return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD);
> +}

Any particular reason why using negation instead of a ARM64_HAS_FPSIMD?
A potential problem would be the default cpus_have_const_cap()
implementation and the default static key having a slight performance
impact.

> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index fc2bd19..f89385d 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -746,6 +746,14 @@ static bool hyp_offset_low(const struct arm64_cpu_capabilities *entry,
>  	return idmap_addr > GENMASK(VA_BITS - 2, 0) && !is_kernel_in_hyp_mode();
>  }
>  
> +static bool has_no_fpsimd(const struct arm64_cpu_capabilities *entry, int __unused)
> +{
> +	u64 pfr0 = read_system_reg(SYS_ID_AA64PFR0_EL1);
> +
> +	return cpuid_feature_extract_signed_field(pfr0,
> +					ID_AA64PFR0_FP_SHIFT) < 0;
> +}
> +
>  static const struct arm64_cpu_capabilities arm64_features[] = {
>  	{
>  		.desc = "GIC system register CPU interface",
> @@ -829,6 +837,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
>  		.def_scope = SCOPE_SYSTEM,
>  		.matches = hyp_offset_low,
>  	},
> +	{
> +		/* FP/SIMD is not implemented */
> +		.capability = ARM64_HAS_NO_FPSIMD,
> +		.def_scope = SCOPE_SYSTEM,
> +		.min_field_value = 0,
> +		.matches = has_no_fpsimd,
> +	},

If we go for negation, I don't think we need a min_field_value at all,
the matching is done by the has_no_fpsimd() function.

-- 
Catalin

  reply	other threads:[~2016-11-14 11:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08 13:56 [PATCH v3 0/2] " Suzuki K Poulose
2016-11-08 13:56 ` [PATCH v3 1/2] arm64: Add hypervisor safe helper for checking constant capabilities Suzuki K Poulose
2016-11-08 18:11   ` Will Deacon
2016-11-08 13:56 ` [PATCH v3 2/2] arm64: Support systems without FP/ASIMD Suzuki K Poulose
2016-11-14 11:48   ` Catalin Marinas [this message]
2016-11-15 10:42     ` Suzuki K Poulose
2016-11-11 13:41 ` [PATCH v3 0/2] " Marc Zyngier
2016-11-14 11:08   ` Catalin Marinas
2016-11-16 18:11 ` Catalin Marinas

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=20161114114858.GB3096@e104818-lin.cambridge.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will.deacon@arm.com \
    --subject='Re: [PATCH v3 2/2] arm64: Support systems without FP/ASIMD' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).