aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMarc Zyngier <Marc.Zyngier@arm.com>2013-02-27 13:05:59 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2013-03-20 12:46:42 -0400
commitd9c1951f400942bbdb41e75a73d151e4a9d5469e (patch)
treee2f13c2d6a5c423ad77713fadb3b7a0898e62853 /arch
parent792072066d30372772137be9ee2f4d72d77329f9 (diff)
arm64: add read_cpuid_{implementor,part_number,mpidr}
In order to preserve some kind of source compatibility between arm and arm64, introduce read_cpuid_{implementor,part_number,mpidr} which are used on KVM to find out which CPU we're running on. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/include/asm/cputype.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index ef54125e6c1e..7a317029e735 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -17,6 +17,7 @@
17#define __ASM_CPUTYPE_H 17#define __ASM_CPUTYPE_H
18 18
19#define ID_MIDR_EL1 "midr_el1" 19#define ID_MIDR_EL1 "midr_el1"
20#define ID_MPIDR_EL1 "mpidr_el1"
20#define ID_CTR_EL0 "ctr_el0" 21#define ID_CTR_EL0 "ctr_el0"
21 22
22#define ID_AA64PFR0_EL1 "id_aa64pfr0_el1" 23#define ID_AA64PFR0_EL1 "id_aa64pfr0_el1"
@@ -31,6 +32,12 @@
31 __val; \ 32 __val; \
32}) 33})
33 34
35#define ARM_CPU_IMP_ARM 0x41
36
37#define ARM_CPU_PART_AEM_V8 0xD0F0
38#define ARM_CPU_PART_FOUNDATION 0xD000
39#define ARM_CPU_PART_CORTEX_A57 0xD070
40
34/* 41/*
35 * The CPU ID never changes at run time, so we might as well tell the 42 * The CPU ID never changes at run time, so we might as well tell the
36 * compiler that it's constant. Use this function to read the CPU ID 43 * compiler that it's constant. Use this function to read the CPU ID
@@ -41,6 +48,21 @@ static inline u32 __attribute_const__ read_cpuid_id(void)
41 return read_cpuid(ID_MIDR_EL1); 48 return read_cpuid(ID_MIDR_EL1);
42} 49}
43 50
51static inline u64 __attribute_const__ read_cpuid_mpidr(void)
52{
53 return read_cpuid(ID_MPIDR_EL1);
54}
55
56static inline unsigned int __attribute_const__ read_cpuid_implementor(void)
57{
58 return (read_cpuid_id() & 0xFF000000) >> 24;
59}
60
61static inline unsigned int __attribute_const__ read_cpuid_part_number(void)
62{
63 return (read_cpuid_id() & 0xFFF0);
64}
65
44static inline u32 __attribute_const__ read_cpuid_cachetype(void) 66static inline u32 __attribute_const__ read_cpuid_cachetype(void)
45{ 67{
46 return read_cpuid(ID_CTR_EL0); 68 return read_cpuid(ID_CTR_EL0);