[U-Boot] [PATCH 3/8] sun8i: Extend stack size to allow for up to 8 CPUs

--- arch/arm/cpu/armv7/psci.S | 1 + arch/arm/cpu/armv7/sunxi/psci_sun6i.S | 4 ++-- arch/arm/cpu/armv7/sunxi/psci_sun7i.S | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/armv7/psci.S b/arch/arm/cpu/armv7/psci.S index 87c0c0b..18a0cc2 100644 --- a/arch/arm/cpu/armv7/psci.S +++ b/arch/arm/cpu/armv7/psci.S @@ -203,6 +203,7 @@ ENTRY(psci_get_cpu_stack_top) add r5, r5, #0x2000 @ Skip two pages lsr r5, r5, #12 @ Align to start of page lsl r5, r5, #12 + add r5, r5, #0x1000 @ Skip an additional page sub r5, r5, #4 @ reserve 1 word for target PC sub r0, r5, r0 @ here's our stack!
diff --git a/arch/arm/cpu/armv7/sunxi/psci_sun6i.S b/arch/arm/cpu/armv7/sunxi/psci_sun6i.S index 90b5bfd..d35b63e 100644 --- a/arch/arm/cpu/armv7/sunxi/psci_sun6i.S +++ b/arch/arm/cpu/armv7/sunxi/psci_sun6i.S @@ -32,8 +32,8 @@ * ._secure_text section * text_end to ALIGN_PAGE(text_end): * nothing - * ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x1000) - * 1kB of stack per CPU (4 CPUs max). + * ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x2000) + * 1kB of stack per CPU (8 CPUs max). */
.pushsection ._secure.text, "ax" diff --git a/arch/arm/cpu/armv7/sunxi/psci_sun7i.S b/arch/arm/cpu/armv7/sunxi/psci_sun7i.S index e15d587..b8ac50e 100644 --- a/arch/arm/cpu/armv7/sunxi/psci_sun7i.S +++ b/arch/arm/cpu/armv7/sunxi/psci_sun7i.S @@ -32,8 +32,8 @@ * ._secure_text section * text_end to ALIGN_PAGE(text_end): * nothing - * ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x1000) - * 1kB of stack per CPU (4 CPUs max). + * ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x2000) + * 1kB of stack per CPU (8 CPUs max). */
.pushsection ._secure.text, "ax"

Hi,
On Tue, May 17, 2016 at 10:38 AM, tpearson@raptorengineering.com wrote:
arch/arm/cpu/armv7/psci.S | 1 + arch/arm/cpu/armv7/sunxi/psci_sun6i.S | 4 ++-- arch/arm/cpu/armv7/sunxi/psci_sun7i.S | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/armv7/psci.S b/arch/arm/cpu/armv7/psci.S index 87c0c0b..18a0cc2 100644 --- a/arch/arm/cpu/armv7/psci.S +++ b/arch/arm/cpu/armv7/psci.S @@ -203,6 +203,7 @@ ENTRY(psci_get_cpu_stack_top) add r5, r5, #0x2000 @ Skip two pages lsr r5, r5, #12 @ Align to start of page
Why not just change this line instead?
ChenYu
lsl r5, r5, #12
add r5, r5, #0x1000 @ Skip an additional page sub r5, r5, #4 @ reserve 1 word for target PC sub r0, r5, r0 @ here's our stack!
diff --git a/arch/arm/cpu/armv7/sunxi/psci_sun6i.S b/arch/arm/cpu/armv7/sunxi/psci_sun6i.S index 90b5bfd..d35b63e 100644 --- a/arch/arm/cpu/armv7/sunxi/psci_sun6i.S +++ b/arch/arm/cpu/armv7/sunxi/psci_sun6i.S @@ -32,8 +32,8 @@
._secure_text section
- text_end to ALIGN_PAGE(text_end):
nothing
- ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x1000)
1kB of stack per CPU (4 CPUs max).
- ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x2000)
1kB of stack per CPU (8 CPUs max).
*/
.pushsection ._secure.text, "ax"
diff --git a/arch/arm/cpu/armv7/sunxi/psci_sun7i.S b/arch/arm/cpu/armv7/sunxi/psci_sun7i.S index e15d587..b8ac50e 100644 --- a/arch/arm/cpu/armv7/sunxi/psci_sun7i.S +++ b/arch/arm/cpu/armv7/sunxi/psci_sun7i.S @@ -32,8 +32,8 @@
._secure_text section
- text_end to ALIGN_PAGE(text_end):
nothing
- ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x1000)
1kB of stack per CPU (4 CPUs max).
- ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x2000)
1kB of stack per CPU (8 CPUs max).
*/
.pushsection ._secure.text, "ax"
-- 2.8.0.rc3
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On 05/17/2016 12:21 AM, Chen-Yu Tsai wrote:
Hi,
On Tue, May 17, 2016 at 10:38 AM, tpearson@raptorengineering.com wrote:
arch/arm/cpu/armv7/psci.S | 1 + arch/arm/cpu/armv7/sunxi/psci_sun6i.S | 4 ++-- arch/arm/cpu/armv7/sunxi/psci_sun7i.S | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/armv7/psci.S b/arch/arm/cpu/armv7/psci.S index 87c0c0b..18a0cc2 100644 --- a/arch/arm/cpu/armv7/psci.S +++ b/arch/arm/cpu/armv7/psci.S @@ -203,6 +203,7 @@ ENTRY(psci_get_cpu_stack_top) add r5, r5, #0x2000 @ Skip two pages lsr r5, r5, #12 @ Align to start of page
Why not just change this line instead?
ChenYu
That would break page alignment, no? The idea is to align the lower stack range address to a page (possibly wasting up to slightly less than a page in the process); changing this line would result in two pages wasted and the same amount of space available for the stack.

On Wed, May 18, 2016 at 3:19 AM, Timothy Pearson tpearson@raptorengineering.com wrote:
On 05/17/2016 12:21 AM, Chen-Yu Tsai wrote:
Hi,
On Tue, May 17, 2016 at 10:38 AM, tpearson@raptorengineering.com wrote:
arch/arm/cpu/armv7/psci.S | 1 + arch/arm/cpu/armv7/sunxi/psci_sun6i.S | 4 ++-- arch/arm/cpu/armv7/sunxi/psci_sun7i.S | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/armv7/psci.S b/arch/arm/cpu/armv7/psci.S index 87c0c0b..18a0cc2 100644 --- a/arch/arm/cpu/armv7/psci.S +++ b/arch/arm/cpu/armv7/psci.S @@ -203,6 +203,7 @@ ENTRY(psci_get_cpu_stack_top) add r5, r5, #0x2000 @ Skip two pages lsr r5, r5, #12 @ Align to start of page
Why not just change this line instead?
ChenYu
That would break page alignment, no? The idea is to align the lower stack range address to a page (possibly wasting up to slightly less than a page in the process); changing this line would result in two pages wasted and the same amount of space available for the stack.
A page is 4 kiB, or 12 bits of address space. The alignment done above is right shift 12 bits, followed by left shift 12 bits, which does not matter if you add 0x2000 or 0x3000 to the address.
ChenYu
-- Timothy Pearson Raptor Engineering +1 (415) 727-8645 (direct line) +1 (512) 690-0200 (switchboard) https://www.raptorengineering.com
participants (3)
-
Chen-Yu Tsai
-
Timothy Pearson
-
tpearson@raptorengineering.com