From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 1/7] ARM: kernel: enhance MPIDR macro definitions
Date: Mon, 19 Nov 2012 12:45:00 +0000 [thread overview]
Message-ID: <1353329106-24084-2-git-send-email-lorenzo.pieralisi@arm.com> (raw)
In-Reply-To: <1353329106-24084-1-git-send-email-lorenzo.pieralisi@arm.com>
Kernel subsystems other than the topology layer need the MPIDR
mask definitions to access the MPIDR without relying on hardcoded
masks. This patch moves the MPIDR register masks definition to
a header file and defines a macro to simplify access to MPIDR bit fields
representing affinity levels.
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
arch/arm/include/asm/cputype.h | 13 +++++++++++++
arch/arm/kernel/topology.c | 27 +--------------------------
2 files changed, 14 insertions(+), 26 deletions(-)
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index cb47d28..a59dcb5 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -25,6 +25,19 @@
#define CPUID_EXT_ISAR4 "c2, 4"
#define CPUID_EXT_ISAR5 "c2, 5"
+#define MPIDR_SMP_BITMASK (0x3 << 30)
+#define MPIDR_SMP_VALUE (0x2 << 30)
+
+#define MPIDR_MT_BITMASK (0x1 << 24)
+
+#define MPIDR_HWID_BITMASK 0xFFFFFF
+
+#define MPIDR_LEVEL_BITS 8
+#define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1)
+
+#define MPIDR_AFFINITY_LEVEL(mpidr, level) \
+ ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK)
+
extern unsigned int processor_id;
#ifdef CONFIG_CPU_CP15
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 317dac6..4642c7d 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -196,32 +196,7 @@ static inline void parse_dt_topology(void) {}
static inline void update_cpu_power(unsigned int cpuid, unsigned int mpidr) {}
#endif
-
-/*
- * cpu topology management
- */
-
-#define MPIDR_SMP_BITMASK (0x3 << 30)
-#define MPIDR_SMP_VALUE (0x2 << 30)
-
-#define MPIDR_MT_BITMASK (0x1 << 24)
-
-/*
- * These masks reflect the current use of the affinity levels.
- * The affinity level can be up to 16 bits according to ARM ARM
- */
-#define MPIDR_HWID_BITMASK 0xFFFFFF
-
-#define MPIDR_LEVEL0_MASK 0x3
-#define MPIDR_LEVEL0_SHIFT 0
-
-#define MPIDR_LEVEL1_MASK 0xF
-#define MPIDR_LEVEL1_SHIFT 8
-
-#define MPIDR_LEVEL2_MASK 0xFF
-#define MPIDR_LEVEL2_SHIFT 16
-
-/*
+ /*
* cpu topology table
*/
struct cputopo_arm cpu_topology[NR_CPUS];
--
1.7.12
next prev parent reply other threads:[~2012-11-19 12:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-19 12:44 [PATCH v4 0/7] ARM: multi-cluster aware boot protocol Lorenzo Pieralisi
2012-11-19 12:45 ` Lorenzo Pieralisi [this message]
2012-11-19 13:44 ` [PATCH v4 1/7] ARM: kernel: enhance MPIDR macro definitions Will Deacon
2012-11-19 15:37 ` Nicolas Pitre
2012-11-19 12:45 ` [PATCH v4 2/7] ARM: kernel: update topology to use new MPIDR macros Lorenzo Pieralisi
2012-11-19 13:45 ` Will Deacon
2012-11-19 15:38 ` Nicolas Pitre
2012-11-19 12:45 ` [PATCH v4 3/7] ARM: kernel: smp_setup_processor_id() updates Lorenzo Pieralisi
2012-11-19 13:45 ` Will Deacon
2012-11-19 12:45 ` [PATCH v4 4/7] ARM: kernel: add device tree init map function Lorenzo Pieralisi
2012-11-19 13:54 ` Mark Rutland
2012-11-19 14:07 ` Lorenzo Pieralisi
2012-11-19 12:45 ` [PATCH v4 5/7] ARM: kernel: add cpu logical map DT init in setup_arch Lorenzo Pieralisi
2012-11-19 12:45 ` [PATCH v4 6/7] ARM: kernel: add logical mappings look-up Lorenzo Pieralisi
2012-11-19 12:45 ` [PATCH v4 7/7] ARM: gic: use a private mapping for CPU target interfaces Lorenzo Pieralisi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353329106-24084-2-git-send-email-lorenzo.pieralisi@arm.com \
--to=lorenzo.pieralisi@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox