Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc8d0161 authored by Venkat Devarasetty's avatar Venkat Devarasetty Committed by Mahesh Sivasubramanian
Browse files

qcom: pm: update warmboot code for cluster architecture



Current warmboot code is designed for only single cluster
configuration. Update the logic to store and read the warmboot
address for cores in multicluster configuration.

Change-Id: Idc18ff35ff8ff9097bee2886c2011cd71c2d6376
Signed-off-by: default avatarVenkat Devarasetty <vdevaras@codeaurora.org>
parent c1dda9bc
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -14,10 +14,15 @@
#ifndef _ARCH_ARM_MACH_MSM_IDLE_H_
#define _ARCH_ARM_MACH_MSM_IDLE_H_

#define MAX_CPUS_PER_CLUSTER	4
#define MAX_NUM_CLUSTER	4

#ifndef __ASSEMBLY__
#if defined(CONFIG_CPU_V7) || defined(CONFIG_ARM64)
extern unsigned long msm_pm_boot_vector[NR_CPUS];
extern unsigned long msm_pm_boot_vector[MAX_NUM_CLUSTER * MAX_CPUS_PER_CLUSTER];
void msm_pm_boot_entry(void);
#else
static inline void msm_pm_boot_entry(void) {}
#endif
#endif
#endif
+16 −5
Original line number Diff line number Diff line
@@ -15,9 +15,13 @@
#include <linux/init.h>
#include <soc/qcom/scm-boot.h>
#include <asm/cacheflush.h>
#include <asm/cputype.h>
#include <asm/smp_plat.h>
#include "idle.h"
#include "pm-boot.h"

#define CPU_INDEX(cluster, cpu) (cluster * MAX_CPUS_PER_CLUSTER + cpu)

static void (*msm_pm_boot_before_pc)(unsigned int cpu, unsigned long entry);
static void (*msm_pm_boot_after_pc)(unsigned int cpu);

@@ -43,13 +47,20 @@ static int msm_pm_tz_boot_init(void)
		return scm_set_boot_addr(virt_to_phys(msm_pm_boot_entry), flag);
	}
}

static void msm_pm_write_boot_vector(unsigned int cpu, unsigned long address)
{
	msm_pm_boot_vector[cpu] = address;
	dmac_clean_range((void *)&msm_pm_boot_vector[cpu],
			(void *)(&msm_pm_boot_vector[cpu] +
				sizeof(msm_pm_boot_vector[cpu])));
	uint32_t clust_id = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1);
	uint32_t cpu_id = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0);
	unsigned long *start_address;
	unsigned long *end_address;

	if (clust_id >= MAX_NUM_CLUSTER || cpu_id >= MAX_CPUS_PER_CLUSTER)
		BUG();

	msm_pm_boot_vector[CPU_INDEX(clust_id, cpu_id)] = address;
	start_address = &msm_pm_boot_vector[CPU_INDEX(clust_id, cpu_id)];
	end_address = &msm_pm_boot_vector[CPU_INDEX(clust_id, cpu_id + 1)];
	dmac_clean_range((void *)start_address, (void *)end_address);
}

static void msm_pm_config_tz_before_pc(unsigned int cpu,
+8 −4
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ THUMB( .thumb ) /* switch to Thumb now. */
THUMB(2:			)
	mrc     p15, 0, r0, c0, c0, 5    /* MPIDR                          */
	bic     r0, #0xff000000         /* what CPU am I*/
	bic     r0, #0x00ff0000         /* clear bits 31-16 */

	adr	r3, 3f
	ldr	r1, [r3]
@@ -46,8 +47,11 @@ THUMB(2: )
skip_pc_debug3:
	ldr     r1, =msm_pm_boot_vector
	sub	r1, r1, r3		/* translate virt to phys */
	mov     r2, r0, lsr #8		/* get cluster num */
	add	r1, r1, r2, lsl #4	/* Get offset for the cluster */
	and	r0, r0, #0xff		/* cpu id */
	add	r1, r1, r0, lsl #2	/* Get offset for the cpu */

	add     r1, r1, r0, LSL #2       /* locate boot vector for our cpu */
	ldr     pc, [r1]                 /* jump                    */
ENDPROC(msm_pm_boot_entry)

@@ -57,7 +61,7 @@ ENDPROC(msm_pm_boot_entry)

	.globl msm_pm_boot_vector
msm_pm_boot_vector:
	.space  4 * NR_CPUS
	.space  4 * 4 * 4

	.globl msm_pc_debug_counters_phys
msm_pc_debug_counters_phys:
+7 −4
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@

ENTRY(msm_pm_boot_entry)
	mrs	x0, mpidr_el1
	and     x0, x0, #15              /* what CPU am I */
	and     x0, x0, #0xffff              /* what CPU/cluster affinity */

	adr	x3, align
	ldr	x1, [x3]
@@ -41,8 +41,11 @@ ENTRY(msm_pm_boot_entry)
skip_pc_debug3:
	ldr     x1, =msm_pm_boot_vector
	sub	x1, x1, x3		/* translate virt to phys */
	lsr	x2, x0, #0x8		/* Get cluster id and clear cpu id */
	add	x1, x1, x2, lsl #0x5	/* Get offset for this cluster */
	and	x0, x0, #0x03		/* Get cpu id and clear cluster id */
	add	x1, x1, x0, lsl #3	/* Get offset for this cpu */

	add     x1, x1, x0, LSL #3      /* locate boot vector for our cpu */
	ldr 	x1, [x1]
	ret	x1                 /* jump                           */
ENDPROC(msm_pm_boot_entry)
@@ -52,7 +55,7 @@ align: .quad .
	.data
	.globl msm_pm_boot_vector
msm_pm_boot_vector:
	.space  8 * NR_CPUS
	.space  8 * 4 * 4

	.globl msm_pc_debug_counters_phys
msm_pc_debug_counters_phys: