xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: julien.grall@linaro.org, tim@xen.org,
	Ian Campbell <ian.campbell@citrix.com>,
	stefano.stabellini@eu.citrix.com
Subject: [PATCH v4 09/11] xen: arm: use symbolic names for MPIDR bits.
Date: Fri, 27 Sep 2013 14:29:54 +0100	[thread overview]
Message-ID: <1380288596-1514-9-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1380288533.29483.192.camel@kazak.uk.xensource.com>

arm32 already uses MPIDR_HWID_MASK, use it on arm64 too. Add MPIDR_{SMP,UP}
(and bitwise equivalents) and use them.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
---
v4: Use U not UL, otherwise MPIDR_INVALID can be a 64-bit number, but the
    register is 32-bit so assigning it to a u32 etc is valid. e.g tmp_map in
    init_cpus_map. Avoids -Werror=overflow issues.
v3: Needs to be unsigned, 1<<31 is undefined on arm32 otherwise
---
 xen/arch/arm/arm32/head.S       |    4 ++--
 xen/arch/arm/arm64/head.S       |    6 +++---
 xen/include/asm-arm/processor.h |   10 ++++++----
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 510ccff..92b3c48 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -127,9 +127,9 @@ common_start:
                                       * find that multiprocessor extensions are
                                       * present and the system is SMP */
         mrc   CP32(r1, MPIDR)
-        tst   r1, #(1<<31)           /* Multiprocessor extension supported? */
+        tst   r1, #MPIDR_SMP         /* Multiprocessor extension supported? */
         beq   1f
-        tst   r1, #(1<<30)           /* Uniprocessor system? */
+        tst   r1, #MPIDR_UP          /* Uniprocessor system? */
         bne   1f
         bic   r7, r1, #(~MPIDR_HWID_MASK) /* Mask out flags to get CPU ID */
 1:
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index b2d44cc..062645e 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -153,10 +153,10 @@ common_start:
                                       * find that multiprocessor extensions are
                                       * present and the system is SMP  */
         mrs   x0, mpidr_el1
-        tbz   x0, 31, 1f             /* Multiprocessor extension not supported? */
-        tbnz  x0, 30, 1f             /* Uniprocessor system? */
+        tbz   x0, _MPIDR_SMP, 1f     /* Multiprocessor extension not supported? */
+        tbnz  x0, _MPIDR_UP, 1f      /* Uniprocessor system? */
 
-        mov   x13, #(0xff << 24)
+        mov   x13, #(~MPIDR_HWID_MASK)
         bic   x24, x0, x13           /* Mask out flags to get CPU ID */
 1:
 
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 0646422..5294421 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -8,11 +8,13 @@
 #define MIDR_MASK    0xff0ffff0
 
 /* MPIDR Multiprocessor Affinity Register */
-#define MPIDR_UP            (1 << 30)
-#define MPIDR_SMP           (1 << 31)
+#define _MPIDR_UP           (30)
+#define MPIDR_UP            (_AC(1,U) << _MPIDR_UP)
+#define _MPIDR_SMP          (31)
+#define MPIDR_SMP           (_AC(1,U) << _MPIDR_SMP)
 #define MPIDR_AFF0_SHIFT    (0)
-#define MPIDR_AFF0_MASK     (0xff << MPIDR_AFF0_SHIFT)
-#define MPIDR_HWID_MASK     0xffffff
+#define MPIDR_AFF0_MASK     (_AC(0xff,U) << MPIDR_AFF0_SHIFT)
+#define MPIDR_HWID_MASK     _AC(0xffffff,U)
 #define MPIDR_INVALID       (~MPIDR_HWID_MASK)
 
 /* TTBCR Translation Table Base Control Register */
-- 
1.7.10.4

  parent reply	other threads:[~2013-09-27 13:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 13:28 [PATCH v4 00/11] xen: arm: rework early bring up Ian Campbell
2013-09-27 13:29 ` [PATCH v4 01/11] xen: arm: Load xen under 4GB on 32-bit Ian Campbell
2013-09-27 13:29 ` [PATCH v4 02/11] xen: arm: build platform support only on the relevant arch Ian Campbell
2013-09-27 13:29 ` [PATCH v4 03/11] xen: arm: Log the raw MIDR on boot Ian Campbell
2013-09-27 13:29 ` [PATCH v4 04/11] xen: arm: make sure we stay within the memory bank during mm setup Ian Campbell
2013-09-27 13:29 ` [PATCH v4 05/11] xen: arm: add two new device tree helpers Ian Campbell
2013-09-27 13:29 ` [PATCH v4 06/11] xen: arm: implement arch/platform SMP and CPU initialisation framework Ian Campbell
2013-09-27 13:29 ` [PATCH v4 07/11] xen: arm: implement smp initialisation callbacks for exynos5 Ian Campbell
2013-09-27 15:12   ` Julien Grall
2013-09-27 13:29 ` [PATCH v4 08/11] xen: arm: rewrite start of day page table and cpu bring up Ian Campbell
2013-09-27 13:29 ` Ian Campbell [this message]
2013-09-27 13:29 ` [PATCH v4 10/11] xen: arm: configure TCR_EL2 for 40 bit physical address space Ian Campbell
2013-09-27 13:29 ` [PATCH v4 11/11] xen: arm: split cpu0's domheap mapping PTs out from xen_second Ian Campbell
2013-09-27 15:44 ` [PATCH EXTRA] xen: arm: move smp_init_cpus to smpboot.c Ian Campbell
2013-09-27 15:47   ` Julien Grall

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=1380288596-1514-9-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).