From: Wei Chen <wei.chen@linaro.org>
To: xen-devel@lists.xen.org
Cc: julien.grall@arm.com, sstabellini@kernel.org,
Wei Chen <Wei.Chen@linaro.org>,
steve.capper@arm.com
Subject: [PATCH v2 1/4] xen/arm: Change the variable type of cpu_logical_map to register_t
Date: Thu, 26 May 2016 15:58:40 +0800 [thread overview]
Message-ID: <20160526075843.25236-2-Wei.Chen@linaro.org> (raw)
In-Reply-To: <20160526075843.25236-1-Wei.Chen@linaro.org>
The cpu_logical_map is used to store CPU hardware ID from MPIDR_EL1 or
from CPU node of DT. Currently, the cpu_logical_map is using the u32 as
its variable type. It can work properly while Xen is running on ARM32,
because the hardware ID is 32-bits. While Xen is running on ARM64, the
hardware ID expands to 64-bits and then the cpu_logical_map will overflow.
Change the variable type of cpu_logical_map to register_t will make
cpu_logical_map to store hardware IDs correctly on ARM32 and ARM64.
Signed-off-by: Wei Chen <Wei.Chen@linaro.org>
Acked-by: Julien Grall <julien.grall@arm.com>
---
v2:
1. Fix typos in commit messages that were commented by Julien.
2. Add Julien's Acked-by.
---
xen/arch/arm/gic-v3.c | 2 +-
xen/arch/arm/smpboot.c | 13 +++++++------
xen/include/asm-arm/processor.h | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index a095064..9910877 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -674,7 +674,7 @@ static int __init gicv3_populate_rdist(void)
} while ( !(typer & GICR_TYPER_LAST) );
}
- dprintk(XENLOG_ERR, "GICv3: CPU%d: mpidr 0x%x has no re-distributor!\n",
+ dprintk(XENLOG_ERR, "GICv3: CPU%d: mpidr 0x%"PRIregister" has no re-distributor!\n",
smp_processor_id(), cpu_logical_map(smp_processor_id()));
return -ENODEV;
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index c5109bf..ba83406 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -40,7 +40,7 @@ cpumask_t cpu_possible_map;
struct cpuinfo_arm cpu_data[NR_CPUS];
/* CPU logical map: map xen cpuid to an MPIDR */
-u32 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID };
+register_t __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID };
/* Fake one node for now. See also include/asm-arm/numa.h */
nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
@@ -100,7 +100,7 @@ static void __init dt_smp_init_cpus(void)
struct dt_device_node *cpu;
unsigned int i, j;
unsigned int cpuidx = 1;
- static u32 tmp_map[NR_CPUS] __initdata =
+ static register_t tmp_map[NR_CPUS] __initdata =
{
[0 ... NR_CPUS - 1] = MPIDR_INVALID
};
@@ -120,7 +120,8 @@ static void __init dt_smp_init_cpus(void)
{
const __be32 *prop;
u64 addr;
- u32 reg_len, hwid;
+ u32 reg_len;
+ register_t hwid;
if ( !dt_device_type_is_equal(cpu, "cpu") )
continue;
@@ -160,7 +161,7 @@ static void __init dt_smp_init_cpus(void)
*/
if ( hwid & ~MPIDR_HWID_MASK )
{
- printk(XENLOG_WARNING "cpu node `%s`: invalid hwid value (0x%x)\n",
+ printk(XENLOG_WARNING "cpu node `%s`: invalid hwid value (0x%"PRIregister")\n",
dt_node_full_name(cpu), hwid);
continue;
}
@@ -176,7 +177,7 @@ static void __init dt_smp_init_cpus(void)
if ( tmp_map[j] == hwid )
{
printk(XENLOG_WARNING
- "cpu node `%s`: duplicate /cpu reg properties %"PRIx32" in the DT\n",
+ "cpu node `%s`: duplicate /cpu reg properties %"PRIregister" in the DT\n",
dt_node_full_name(cpu), hwid);
break;
}
@@ -211,7 +212,7 @@ static void __init dt_smp_init_cpus(void)
if ( (rc = arch_cpu_init(i, cpu)) < 0 )
{
- printk("cpu%d init failed (hwid %x): %d\n", i, hwid, rc);
+ printk("cpu%d init failed (hwid %"PRIregister"): %d\n", i, hwid, rc);
tmp_map[i] = MPIDR_INVALID;
}
else
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 6789cd0..7de9c8e 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -348,7 +348,7 @@ extern void identify_cpu(struct cpuinfo_arm *);
extern struct cpuinfo_arm cpu_data[];
#define current_cpu_data cpu_data[smp_processor_id()]
-extern u32 __cpu_logical_map[];
+extern register_t __cpu_logical_map[];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
/* HSR data abort size definition */
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-05-26 7:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-26 7:58 [PATCH v2 0/4] xen/arm: arm64: Widen register access to mpidr to 64-bits Wei Chen
2016-05-26 7:58 ` Wei Chen [this message]
2016-05-26 7:58 ` [PATCH v2 2/4] xen/arm: Make AFFINITY_MASK generate correct mask for level3 Wei Chen
2016-05-26 7:58 ` [PATCH v2 3/4] xen:arm: arm64: Add correct MPIDR_HWID_MASK value for ARM64 Wei Chen
2016-05-27 10:50 ` Julien Grall
2016-05-30 1:50 ` Wei Chen
2016-05-26 7:58 ` [PATCH v2 4/4] xen/arm: arm64: Remove MPIDR multiprocessing extensions check Wei Chen
2016-05-27 10:51 ` 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=20160526075843.25236-2-Wei.Chen@linaro.org \
--to=wei.chen@linaro.org \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=steve.capper@arm.com \
--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).