public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: York Sun <york.sun@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 2/9] ARMv7: PSCI: update function psci_get_cpu_stack_top
Date: Fri, 3 Jun 2016 12:44:36 -0700	[thread overview]
Message-ID: <5751DE24.7070709@nxp.com> (raw)
In-Reply-To: <1464854836-26103-3-git-send-email-hongbo.zhang@nxp.com>

On 06/02/2016 01:07 AM, macro.wave.z at gmail.com wrote:
> From: Hongbo Zhang <hongbo.zhang@nxp.com>
> 
> There are issues of legacy fuction psci_get_cpu_stack_top:
> 
> First, the current algorithm arranges stacks from an fixed adress towards
> psci_text_end, if there are more CPUs, the stacks will overlap with psci text
> segment and even other segments.
> This patch places stacks from psci text segment towards highter address, and
> all the stack space is reserved, so overlap can be avoided.
> 
> Second, even there is one word reserved in each stack for saving target PC, but
> this reserved space isn't used at all, the target PC is still saved to where
> the stack top pointer points.
> This patch doesn't reserve this word as before, new way of saving target PC
> will be introduced in following patch.
> 
> Signed-off-by: Hongbo Zhang <hongbo.zhang@nxp.com>
> Signed-off-by: Wang Dongsheng <dongsheng.wang@nxp.com>
> ---
>  arch/arm/cpu/armv7/psci.S    | 10 +++++-----
>  arch/arm/cpu/armv7/virt-dt.c |  9 +++++++--
>  arch/arm/include/asm/psci.h  |  3 +++
>  3 files changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/psci.S b/arch/arm/cpu/armv7/psci.S
> index 8e25300..91a1dd1 100644
> --- a/arch/arm/cpu/armv7/psci.S
> +++ b/arch/arm/cpu/armv7/psci.S
> @@ -274,16 +274,16 @@ ENDPROC(psci_cpu_off_common)
>  
>  @ expects CPU ID in r0 and returns stack top in r0
>  ENTRY(psci_get_cpu_stack_top)
> -	mov	r5, #0x400			@ 1kB of stack per CPU
> -	mul	r0, r0, r5
> +	mov	r5, #PSCI_PERCPU_STACK_SIZE	@ 1kB of stack per CPU
> +	add	r0, r0, #1
> +	mul	r0, r0, r5			@ offset of each stack
>  
>  	ldr	r5, =psci_text_end		@ end of monitor text
> -	add	r5, r5, #0x2000			@ Skip two pages
> +	add	r5, r5, #0x1000			@ Skip one page
>  	lsr	r5, r5, #12			@ Align to start of page
>  	lsl	r5, r5, #12
> -	sub	r5, r5, #4			@ reserve 1 word for target PC
> -	sub	r0, r5, r0			@ here's our stack!
>  
> +	add	r0, r5, r0			@ here's our stack!
>  	bx	lr
>  ENDPROC(psci_get_cpu_stack_top)
>  
> diff --git a/arch/arm/cpu/armv7/virt-dt.c b/arch/arm/cpu/armv7/virt-dt.c
> index 5e31891..4fe6f58 100644
> --- a/arch/arm/cpu/armv7/virt-dt.c
> +++ b/arch/arm/cpu/armv7/virt-dt.c
> @@ -127,14 +127,19 @@ int armv7_apply_memory_carveout(u64 *start, u64 *size)
>  
>  int psci_update_dt(void *fdt)
>  {
> +	size_t sec_sz = __secure_end - __secure_start;
> +#ifdef CONFIG_ARMV7_PSCI
> +	sec_sz += CONFIG_MAX_CPUS * PSCI_PERCPU_STACK_SIZE;
> +	/* margin to align psci_text_end to page end*/
> +	sec_sz += 0x1000;
> +#endif

This causes a compiling error

+(mx7dsabresd) ../arch/arm/cpu/armv7/virt-dt.c: In function ?psci_update_dt?:
+(mx7dsabresd) ../arch/arm/cpu/armv7/virt-dt.c:132:12: error: ?CONFIG_MAX_CPUS?
undeclared (first use in this function)
+(mx7dsabresd) ../arch/arm/cpu/armv7/virt-dt.c:132:12: note: each undeclared
identifier is reported only once for each function it appears in

York

  reply	other threads:[~2016-06-03 19:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02  8:07 [U-Boot] [PATCH v4 0/9] ARMv7: PSCI: add PSCI v1.0 support macro.wave.z at gmail.com
2016-06-02  8:07 ` [U-Boot] [PATCH v4 1/9] ARMv7: PSCI: add PSCI v1.0 functions skeleton macro.wave.z at gmail.com
2016-06-02  8:07 ` [U-Boot] [PATCH v4 2/9] ARMv7: PSCI: update function psci_get_cpu_stack_top macro.wave.z at gmail.com
2016-06-03 19:44   ` York Sun [this message]
2016-06-06  3:27     ` Hongbo Zhang
2016-06-06  3:43       ` Chen-Yu Tsai
2016-06-06  4:06         ` Hongbo Zhang
2016-06-02  8:07 ` [U-Boot] [PATCH v4 3/9] ARMv7: PSCI: update the place of saving target PC macro.wave.z at gmail.com
2016-06-02  8:07 ` [U-Boot] [PATCH v4 4/9] ARMv7: PSCI: add codes to save context ID for CPU_ON macro.wave.z at gmail.com
2016-06-02  8:07 ` [U-Boot] [PATCH v4 5/9] ARMv7: PSCI: factor out reusable psci_cpu_on_common macro.wave.z at gmail.com
2016-06-02  8:07 ` [U-Boot] [PATCH v4 6/9] ARMv7: PSCI: ls102xa: check target CPU ID before further operations macro.wave.z at gmail.com
2016-06-02  8:07 ` [U-Boot] [PATCH v4 7/9] ARMv7: PSCI: ls102xa: check ALREADY_ON or ON_PENDING for CPU_ON macro.wave.z at gmail.com
2016-06-02  8:07 ` [U-Boot] [PATCH v4 8/9] ARMv7: PSCI: ls102xa: add more PSCI v1.0 functions implemention macro.wave.z at gmail.com
2016-06-02  8:07 ` [U-Boot] [PATCH v4 9/9] ARMv7: PSCI: ls102xa: move secure text section into OCRAM macro.wave.z at gmail.com

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=5751DE24.7070709@nxp.com \
    --to=york.sun@nxp.com \
    --cc=u-boot@lists.denx.de \
    /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