summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Leach <matthew.leach@arm.com>2014-04-18 12:20:52 +0530
committerIshan Mittal <imittal@nvidia.com>2014-04-30 11:39:16 +0530
commit205ceb964280f52ee2276e60543a5621548a079b (patch)
tree6c30196a57992b4c173e6d4c3a8bd87ae795476c
parentbffb3e05febcc5adf163dc7d87834fdc5bc20689 (diff)
arm64: big-endian: write CPU holding pen address as LE
Currently when CPUs are brought online via a spin-table, the address they should jump to is written to the cpu-release-addr in the kernel's native endianness. As the kernel may switch endianness, secondaries might read the value byte-reversed from what was intended, and they would jump to the wrong address. As the only current arm64 spin-table implementations are little-endian, stricten up the arm64 spin-table definition such that the value written to cpu-release-addr is _always_ little-endian regardless of the endianness of any CPU. If a spinning CPU is operating big-endian, it must byte-reverse the value before jumping to handle this. (cherry picked from commit 710be9ac4ea0d2e02a2c4aa625795e65bf3db5b1) Change-Id: Idf141ebd1be56b7259748cadf3d0982e4397affb Signed-off-by: Matthew Leach <matthew.leach@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/kernel/smp_spin_table.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index 7c35fa682f76..c0bc0977cb14 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -48,7 +48,16 @@ static int __init smp_spin_table_prepare_cpu(int cpu)
return -ENODEV;
release_addr = __va(cpu_release_addr[cpu]);
- release_addr[0] = (void *)__pa(secondary_holding_pen);
+
+ /*
+ * We write the release address as LE regardless of the native
+ * endianess of the kernel. Therefore, any boot-loaders that
+ * read this address need to convert this address to the
+ * boot-loader's endianess before jumping. This is mandated by
+ * the boot protocol.
+ */
+ release_addr[0] = (void *) cpu_to_le64(__pa(secondary_holding_pen));
+
__flush_dcache_area(release_addr, sizeof(release_addr[0]));
/*