arm64: Read system wide CPUID value
authorSuzuki K. Poulose <suzuki.poulose@arm.com>
Mon, 19 Oct 2015 13:24:47 +0000 (14:24 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 21 Oct 2015 14:35:56 +0000 (15:35 +0100)
Add an API for reading the safe CPUID value across the
system from the new infrastructure.

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Tested-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/cpufeature.h
arch/arm64/kernel/cpufeature.c

index 01bb5cf995af901008186726f65816b9b999d795..81217220eb92d25b9edf9b75036f4d064efeb2d0 100644 (file)
@@ -144,6 +144,8 @@ void check_local_cpu_features(void);
 bool cpu_supports_mixed_endian_el0(void);
 bool system_supports_mixed_endian_el0(void);
 
+u64 read_system_reg(u32 id);
+
 #endif /* __ASSEMBLY__ */
 
 #endif
index aae181760e1f02af3c6bb55633062c557b18f5be..b4656cabf87f78f71613aee903bdf634650d729d 100644 (file)
@@ -590,6 +590,15 @@ void update_cpu_features(int cpu,
        update_mixed_endian_el0_support(info);
 }
 
+u64 read_system_reg(u32 id)
+{
+       struct arm64_ftr_reg *regp = get_arm64_ftr_reg(id);
+
+       /* We shouldn't get a request for an unsupported register */
+       BUG_ON(!regp);
+       return regp->sys_val;
+}
+
 static bool
 feature_matches(u64 reg, const struct arm64_cpu_capabilities *entry)
 {