[PATCH v3] ARM: advertise availability of v8 Crypto instructions

Russell King - ARM Linux linux at arm.linux.org.uk
Wed Mar 18 04:01:14 PDT 2015


On Tue, Mar 10, 2015 at 08:54:48AM +0100, Ard Biesheuvel wrote:
> @@ -393,6 +393,37 @@ static void __init cpuid_init_hwcaps(void)
>  	vmsa = (read_cpuid_ext(CPUID_EXT_MMFR0) & 0xf) >> 0;
>  	if (vmsa >= 5)
>  		elf_hwcap |= HWCAP_LPAE;
> +
> +	/*
> +	 * ID_ISAR5 contains 4-bit wide signed feature blocks.
> +	 * The blocks we test below represent incremental functionality
> +	 * for non-negative values. Negative values are reserved.
> +	 */
> +	features = read_cpuid_ext(ID_ISAR5);
> +	block = (features >> 4) & 0xf;

Okay, what I'd like to see is something like:

	block = cpuid_feature_extract_field(features, 4);

with this in cputype.h:

static inline int cpuid_feature_extract_field(u32 features, unsigned int field)
{
	int feature = (features >> field) & 15;

	/* feature registers are signed values */
	if (feature > 8)
		feature -= 16;

	return feature;
}

We can then use proper signed tests in the code - and convert all tests
to use this helper.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.



More information about the linux-arm-kernel mailing list