msm: pm: clean boot vector in outer cache after writing
The boot vector will need to be cleaned in the outer cache
after being written to ensure that it can be read by a CPU
which is waking up from power collapse. Calling
v7_flush_dcache_all is not sufficient on targets which
have an outer cache.
There is currently no requirement for the boot vector write to
happen in an assembly environment, and moving it to C makes
cleaning the outer cache easier.
Change-Id: I64c2577c9159adf25b26995a7e3ac0285d01d0d6
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
diff --git a/arch/arm/mach-msm/idle-v7.S b/arch/arm/mach-msm/idle-v7.S
index 63ac78e..515727c 100644
--- a/arch/arm/mach-msm/idle-v7.S
+++ b/arch/arm/mach-msm/idle-v7.S
@@ -246,17 +246,6 @@
add r1, r1, r0, LSL #2 /* locate boot vector for our cpu */
ldr pc, [r1] /* jump */
-ENTRY(msm_pm_write_boot_vector)
- ldr r2, =msm_pm_boot_vector
- add r2, r2, r0, LSL #2 /* locate boot vector for our cpu */
- str r1, [r2]
- mov r0, r2
- ldr r1, =4
- stmfd sp!, {lr}
- bl v7_flush_kern_dcache_area
- ldmfd sp!, {lr}
- bx lr
-
ENTRY(msm_pm_set_l2_flush_flag)
ldr r1, =msm_pm_flush_l2_flag
str r0, [r1]
@@ -276,6 +265,7 @@
msm_saved_state_phys:
.long 0x0
+ .globl msm_pm_boot_vector
msm_pm_boot_vector:
.space 4 * NR_CPUS
diff --git a/arch/arm/mach-msm/idle.h b/arch/arm/mach-msm/idle.h
index f8f6b3c..df3045a 100644
--- a/arch/arm/mach-msm/idle.h
+++ b/arch/arm/mach-msm/idle.h
@@ -32,9 +32,9 @@
#ifdef CONFIG_CPU_V7
void msm_pm_boot_entry(void);
-void msm_pm_write_boot_vector(unsigned int cpu, unsigned long address);
void msm_pm_set_l2_flush_flag(unsigned int flag);
extern unsigned long msm_pm_pc_pgd;
+extern unsigned long msm_pm_boot_vector[NR_CPUS];
#else
static inline void msm_pm_set_l2_flush_flag(unsigned int flag)
{
diff --git a/arch/arm/mach-msm/pm-boot.c b/arch/arm/mach-msm/pm-boot.c
index 6308453..7039e7d 100644
--- a/arch/arm/mach-msm/pm-boot.c
+++ b/arch/arm/mach-msm/pm-boot.c
@@ -29,6 +29,14 @@
static void (*msm_pm_boot_after_pc)(unsigned int cpu);
#ifdef CONFIG_MSM_SCM
+static void msm_pm_write_boot_vector(unsigned int cpu, unsigned long address)
+{
+ msm_pm_boot_vector[cpu] = address;
+ clean_caches((unsigned long)&msm_pm_boot_vector[cpu],
+ sizeof(msm_pm_boot_vector[cpu]),
+ virt_to_phys(&msm_pm_boot_vector[cpu]));
+}
+
static int __init msm_pm_tz_boot_init(void)
{
int flag = 0;