aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2015-07-21 13:23:26 +0100
committerDavid Brown <david.brown@linaro.org>2015-12-03 16:53:52 -0800
commit9d4409c25dabf13d86e7bf48cc45e7edfc8c89dd (patch)
tree7f81fef1a888db6251a9d55b3e1b87624f8eb351
parent32bb76ad58ad061526a57d10f99912acd67aa894 (diff)
downloadlinux-linaro-stable-9d4409c25dabf13d86e7bf48cc45e7edfc8c89dd.tar.gz
arm64: kernel: Add cpuid_feature_extract_field() for 4bit sign extension
commit 79b0e09a3c9bd74ee54582efdb351179d7c00351 upstream. Based on arch/arm/include/asm/cputype.h, this function does the shifting and sign extension necessary when accessing cpu feature fields. Signed-off-by: James Morse <james.morse@arm.com> Suggested-by: Russell King <linux@arm.linux.org.uk> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: David Brown <david.brown@linaro.org>
-rw-r--r--arch/arm64/include/asm/cpufeature.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index ad54dbf6b5ea..674cadd2e77c 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -70,6 +70,13 @@ static inline void cpus_set_cap(unsigned int num)
__set_bit(num, cpu_hwcaps);
}
+static inline int __attribute_const__ cpuid_feature_extract_field(u64 features,
+ int field)
+{
+ return (s64)(features << (64 - 4 - field)) >> (64 - 4);
+}
+
+
void check_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
const char *info);
void check_local_cpu_errata(void);