Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1191644

[RFC PATCH 09/10] arm64: Read system wide CPUID value

From "Suzuki K. Poulose" <suzuki.poulose@arm.com>
Newsgroups linux.kernel
Subject [RFC PATCH 09/10] arm64: Read system wide CPUID value
Date 2015-07-24 11:50 +0200
Message-ID <pPHM6-1ZQ-27@gated-at.bofh.it> (permalink)
References <pPHM5-1ZQ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: "Suzuki K. Poulose" <suzuki.poulose@arm.com>

Add an API for reading a safe CPUID value across the system

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/include/asm/cpu.h |    2 ++
 arch/arm64/kernel/cpuinfo.c  |    9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h
index cb25cb9..17a871d 100644
--- a/arch/arm64/include/asm/cpu.h
+++ b/arch/arm64/include/asm/cpu.h
@@ -177,6 +177,7 @@ struct arm64_ftr_reg {
 		.ftr_bits = &((ftr_table)[0]),		\
 	}
 
+#define read_system_cpuid(id)	read_system_reg(SYS_##id)
 /*
  * Records attributes of an individual CPU.
  */
@@ -226,4 +227,5 @@ static inline u64 arm64_ftr_value(struct arm64_ftr_bits *ftrp, u64 reg)
 	return ((reg >> ftrp->shift) & ftrp->mask);
 }
 
+u64 read_system_reg(enum sys_id id);
 #endif /* __ASM_CPU_H */
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 9145eef..7d140f7 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -310,6 +310,15 @@ static struct arm64_ftr_reg* get_arm64_sys_reg(enum sys_id sys_id)
 	return NULL;
 }
 
+u64 read_system_reg(enum sys_id id)
+{
+	struct arm64_ftr_reg *regp = get_arm64_sys_reg(id);
+
+	/* We shouldn't get a request for an unsupported register */
+	BUG_ON(!regp);
+	return regp->sys_val;
+}
+
 static u64 arm64_ftr_set_value(struct arm64_ftr_bits *ftrp, u64 reg, u64 ftr_val)
 {
 	u64 mask = ftrp->mask << ftrp->shift;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 00/10] arm64: Expose CPU feature registers "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  [RFC PATCH 02/10] arm64: Make the CPU information more clear "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  [RFC PATCH 06/10] arm64: Add helper to decode register from instruction "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  [RFC PATCH 10/10] arm64: Use system-wide safe value of CPU feature register "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  sample: arm64 cpu feature: Test program "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  [RFC PATCH 03/10] arm64: Delay ELF HWCAP initialisation until all CPUs are up "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  [RFC PATCH 09/10] arm64: Read system wide CPUID value "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  [RFC PATCH 05/10] arm64: Keep track of CPU feature registers "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  [RFC PATCH 01/10] arm64: feature registers: Documentation "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  [RFC PATCH 08/10] arm64: Emulate ID registers "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200
  [RFC PATCH 04/10] arm64: Consolidate cpuinfo handling "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-07-24 11:50 +0200

csiph-web