-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add i.MX PSCI CPU off and update i.MX6UL #1577
Conversation
Updated with dropping the two patches merged by #1570 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice change.
Looking a atf psci library integration in optee, i faced the same required sequence: here (edited: in my case,
cache is already off when entering arch_cpu_power_down
).
core/arch/arm/plat-imx/imx-regs.h
Outdated
#define IOMUXC_GPR10_OFFSET 0x28 | ||
|
||
#define IOMUXC_GPR10_OCRAM_TZ_ADDR_OFFSET 5 | ||
#define IOMUXC_GPR10_OCRAM_TZ_ADDR_MASK (0x3f << 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: prefer GENMASK_32(10, 5)
and same below, prefer use of BIT()
and GENMASK_32()
.
core/arch/arm/sm/psci-helper.S
Outdated
FUNC psci_enable_smp, : | ||
UNWIND( .fnstart) | ||
read_actlr r0 | ||
orr r0, r0, #(1 << 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: can use ACTLR_SMP
from arm32.h
core/arch/arm/sm/psci-helper.S
Outdated
|
||
bl psci_disable_smp | ||
|
||
pop {lr} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor; suggest pop {pc}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I use pop {lr}; bx {lr}
to switch between ARM/THUMB. pop {pc}
may cause issue if now is in ARM mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it can cause an issue on pre-ARMv7 architectures, but in ARMv7 I haven't seen an issue related to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I'll give a test on this. If ok, I'll switch to use pop {pc}
core/arch/arm/sm/psci-helper.S
Outdated
|
||
/* Disable Cache */ | ||
read_sctlr r0 | ||
bic r0, r0, #(1 << 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest SCTLR_C
from arm32.h
core/arch/arm/sm/psci-helper.S
Outdated
* | ||
* flush dcache all to PoC | ||
*/ | ||
FUNC psci_armv7_flush_dcache_all , : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may i claim a 2nd look at this?
against core native cache support.
This needs to flush the inner cache only. It so could be renamed cpu_armv7_flush_inner_dcache_all()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is ok for me. I would use psci_armv7_flush_inner_dcache_all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this function rather belong in core/arch/arm/kernel/ssvce_a32.S
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree. I just checked core/arch/arm/kernel/ssvce_a32.S
, seems arm_cl1_d_cleanbysetway
is also for this, but arm_cl1_d_cleanbysetway
is a simplied version. I may need to update ssvce_a32.S.
core/arch/arm/sm/psci-helper.S
Outdated
|
||
bl psci_armv7_flush_dcache_all | ||
|
||
clrex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clrex
really needed ? ___ edited, actually, this was a question :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I have no good idea on this. From my experience of PSCI U-Boot interface, I think this is needed. I am not sure this is correct or not: This core may execute LDREX/STREX before, so when offline, need to execute CLREX to clear-exclusive.
core/arch/arm/plat-imx/psci.c
Outdated
|
||
imx_set_src_gpr(core_id, ~0); | ||
|
||
asm volatile ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provided that we had a wfi()
function (not that hard to add) this could could be written as:
thread_mask_exceptions(THREAD_EXCP_ALL);
while (true)
wfi();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Fix in next version.
core/arch/arm/plat-imx/psci.c
Outdated
vaddr_t gpr5 = core_mmu_get_va(IOMUXC_BASE, MEM_AREA_IO_SEC) + | ||
IOMUXC_GPR5_OFFSET; | ||
uint32_t cpu, val; | ||
uint32_t wfi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type should be bool
core/arch/arm/plat-imx/psci.c
Outdated
|
||
cpu = affinity; | ||
|
||
wfi = !!(read32(gpr5) & ARM_WFI_STAT_MASK(cpu)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to normalize a bool
as that's done by the compiler as required by the standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix in next version
core/arch/arm/plat-imx/psci.c
Outdated
|
||
wfi = !!(read32(gpr5) & ARM_WFI_STAT_MASK(cpu)); | ||
|
||
if ((imx_get_src_gpr(cpu) == 0) || !wfi) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!imx_get_src_gpr(cpu)
is the preferred style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not to check false or true, I just check whether its value is 0 or non-zero
, I prefer use ==
here.
core/arch/arm/sm/psci-helper.S
Outdated
|
||
bl psci_disable_smp | ||
|
||
pop {lr} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it can cause an issue on pre-ARMv7 architectures, but in ARMv7 I haven't seen an issue related to this.
For information, I've started to (re-)import the cache maintenance routines from ARM-TF ( |
@jenswi-linaro that's great. Then I'll directly use your new code in my psci code. |
@jenswi-linaro one more question, about the code importing from ARM-TF, will code be merged before 2.5.0? I would like to upstream more i.mx psci code before 2.5.0. If you do not plan to merge you patch before 2.5.0, I may still need to update ssvce_a32.S. |
Please go ahead with this PR, waiting for my updates will only delay this. |
@etienne-lms @jenswi-linaro Updated. Use During my test, I met failure: |
This is likely a problem with the build, something not cleaned properly. Please make sure there is no |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acked-by: Etienne Carriere <[email protected]>
- commit1
core: arm: mx6ulevk: refine the tee address map
: - commit3
arm: ssvce_a32: introduce cpu_armv7_flush_inner_dcache_all
- commit5 (minor comments)
core: arm: imx: use one imx-regs.h file
- commit7
core: imx6ul: switch to use CFG_SECURE_TIME_SOURCE_REE
- commit8 (minor comments)
core: arm: imx6ul: add platform early init code
- commit9
core: arm: imx: add 6ULL EVK support
Reviewed-by: Etienne Carriere <[email protected]>
- commit2:
core: arm32_macros: add macros
Still open (to me)
- commit4
core: arm: psci: add helper functions
some comments. I am checking some dmb/isb. But looks ok. - commit6
core: arm: imx support psci off and affinity
Some comments + minor comment on commit comment: s/Introuduce/Introduce/, s/is use/is used/
core/arch/arm/plat-imx/imx.h
Outdated
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#ifndef PLAT_IMX_IMX_H
#define PLAT_IMX_IMX_H
...
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix in next version
#define DRAM0_BASE 0x80000000 | ||
#define DRAM0_SIZE 0x20000000 | ||
movw r0, #0x0040 | ||
movt r0, #0x0000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: suggested mov_imm r0, 0x00000040
and below mov_imm r0, 0x00040C00
Macros for these magics would be welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah. Thanks.
@@ -58,3 +58,5 @@ int psci_node_hw_state(uint32_t cpu_id, uint32_t power_level); | |||
int psci_stat_residency(uint32_t cpu_id, uint32_t power_state); | |||
int psci_stat_count(uint32_t cpu_id, uint32_t power_state); | |||
void tee_psci_handler(struct thread_smc_args *args); | |||
|
|||
void psci_armv7_cpu_off(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare also psci_enable/disable_smp();
as they are defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are now only used by psci_armv7_cpu_off. We could export them when we need in future, i think:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -90,14 +90,14 @@ | |||
#endif | |||
|
|||
|
|||
#define CONSOLE_UART_BASE (UART0_BASE) | |||
#define CONSOLE_UART_BASE (UART1_BASE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: useless parenthesis
core/arch/arm/plat-imx/imx-regs.h
Outdated
|
||
#define IOMUXC_GPR4_OFFSET 0x10 | ||
#define IOMUXC_GPR5_OFFSET 0x14 | ||
#define ARM_WFI_STAT_MASK(n) (1 << (n)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: BIT(n)
core/arch/arm/plat-imx/psci.c
Outdated
"wfi \r\n" | ||
"b loop \r\n"); | ||
|
||
return PSCI_RET_SUCCESS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: return value is not reliable.
This should return an error or eventually assert you don't return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. needs to return an error value. Thanks.
core/arch/arm/plat-imx/psci.c
Outdated
/* Kill cpu */ | ||
val = read32(va + SRC_SCR); | ||
val &= ~BIT32(SRC_SCR_CORE1_ENABLE_OFFSET + (cpu - 1)); | ||
val |= BIT32(SRC_SCR_CORE1_RST_OFFSET + (cpu - 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: useless parenthesis (cpu - 1)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix in next version.
03111e0
to
63916d2
Compare
@etienne-lms Updated with your comments addressed. |
commit2: "core: arm32_macros: add macros"
commit3: "arm: ssvce_a32: introduce cpu_armv7_flush_inner_dcache_all "
commit4: "core: arm: psci: add helper functions"
All others commits |
core/arch/arm/plat-imx/psci.c
Outdated
|
||
thread_mask_exceptions(THREAD_EXCP_ALL); | ||
|
||
asm volatile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this preferable over:
while (true)
wfi();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jenswi-linaro if use "while (true)", compiler will complain errors, because this function expects a value returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch to enable usage of the suggested loop is in my opinion the lesser of two evils.
diff --git a/core/arch/arm/plat-imx/sub.mk b/core/arch/arm/plat-imx/sub.mk
index 41b4bbcd8b46..e42213caad9f 100644
--- a/core/arch/arm/plat-imx/sub.mk
+++ b/core/arch/arm/plat-imx/sub.mk
@@ -3,6 +3,7 @@ srcs-y += main.c imx-common.c
srcs-$(CFG_PL310) += imx_pl310.c
srcs-$(CFG_PSCI_ARM32) += psci.c
+cflags-psci.c-y += -Wno-suggest-attribute=noreturn
ifneq (,$(filter y, $(CFG_MX6Q) $(CFG_MX6D) $(CFG_MX6DL)))
srcs-y += a9_plat_init.S imx6.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jenswi-linaro Thanks. fix in next version.
@etienne-lms Thanks. I could follow clearly,"So I think it can be merge as is, and be reviewed once we will merge the 'cache helpers' from Jens (#1606)." you mean this patch needs to be postponed until #1606 merged? |
@MrVan, no, rather let's merge your change as you propose them and we will update (if required) when merging #1606. As @jens pointed: "Please go ahead with this PR, waiting for my updates will only delay this." Note: few of my review comments are still pending, i'll push them... |
core/arch/arm/kernel/ssvce_a32.S
Outdated
@@ -125,6 +125,84 @@ UNWIND( .fnend) | |||
END_FUNC secure_mmu_unifiedtlbinv_byasid | |||
|
|||
/* | |||
* From ARM DDI 0406C.c Page B2-1286 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor generic comment: the code snippet you reference provide few inline comments. Maybe you should preserve them to help understanding the sequence (although the reference you gave is already a good explanation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I'll add them.
@@ -58,3 +58,5 @@ int psci_node_hw_state(uint32_t cpu_id, uint32_t power_level); | |||
int psci_stat_residency(uint32_t cpu_id, uint32_t power_state); | |||
int psci_stat_count(uint32_t cpu_id, uint32_t power_state); | |||
void tee_psci_handler(struct thread_smc_args *args); | |||
|
|||
void psci_armv7_cpu_off(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
FUNC plat_cpu_reset_early , : | ||
UNWIND( .fnstart) | ||
|
||
mov_imm r0, 0x00000040 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cross-check whether you would not prefer an init value of 0x41 : bit FW of ACTRL enables broadcasting of maintenance operations required for SMP.
minor: would look better using a macro (i.e ACTLR_INIT
) from platform_config.h.
Same below with NSACR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@etienne-lms FW of ACTLR is in A9, not in A7. Let me keep it now, Later I could use a follow up patch to use marco.
@@ -76,4 +76,3 @@ void plat_cpu_reset_late(void) | |||
write32(read32(addr) | CSU_SETTING_LOCK, addr); | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: useless change (are better to avoid)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
core/arch/arm/plat-imx/psci.c
Outdated
|
||
core_id = get_core_pos(); | ||
|
||
write32(~0, va + SRC_GPR1 + core_id * 8 + 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks redundant with the imx_set_src_gpr(core_id, ~0);
implemented below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. this needs to be removed.
core/arch/arm/plat-imx/psci.c
Outdated
* Wait secondary cpus ready to be killed | ||
* TODO: Change to non dead loop | ||
*/ | ||
while (read32(va + SRC_GPR1 + cpu * 8 + 4) != (uint32_t)~0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: suggested use of imx_get_src_gpr(cpu)
.
Can use UINT32_MAX
instead of (uint32_t)~0
.
core/arch/arm/plat-imx/psci.c
Outdated
write32(val, va + SRC_SCR); | ||
|
||
/* Clean arg */ | ||
write32(0, va + SRC_GPR1 + cpu * 8 + 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant with the imx_set_src_gpr(cpu, 0);
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Remove.
@etienne-lms @jenswi-linaro Updated
|
core/arch/arm/plat-imx/psci.c
Outdated
|
||
core_id = get_core_pos(); | ||
|
||
DMSG("core_id: %d\n", core_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DMSG("core_id: %" PRIu32 , core_id);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix this globally.
core/arch/arm/plat-imx/psci.c
Outdated
{ | ||
vaddr_t va = core_mmu_get_va(SRC_BASE, MEM_AREA_IO_SEC); | ||
vaddr_t gpr5 = core_mmu_get_va(IOMUXC_BASE, MEM_AREA_IO_SEC) + | ||
IOMUXC_GPR5_OFFSET; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align this with core_mmu_get_va(
at the line above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linux checkpatch does not report warning on this. To open (, need to align, but here ( is closed with ), no need to align?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checkpatch is just a tool helping in some situations. You can probably enter the obfuscated C contest with something that checkpatch groks.
Please align it with the start of "core_mmu_get_va" on the line above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. Fix in next version.
core/arch/arm/plat-imx/psci.c
Outdated
if ((imx_get_src_gpr(cpu) == 0) || !wfi) | ||
return PSCI_AFFINITY_LEVEL_ON; | ||
|
||
DMSG("cpu: %d GPR: %x\n", cpu, imx_get_src_gpr(cpu)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DMSG("cpu: %" PRIu32 "GPR: %" PRIx32, cpu, imx_get_src_gpr(cpu));
core/arch/arm/sm/psci-helper.S
Outdated
|
||
bl cpu_armv7_flush_inner_dcache_all | ||
|
||
dsb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpu_armv7_flush_inner_dcache_all()
just finished with:
dsb st
isb
Isn't that enough? If an additional dsb
is needed please add a comment explaining why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isb could be removed. dsb maybe needed, I may need to move it after disable cache and before the second cpu_armv7_flush_inner_dcache_all. dsb is to make all the load/store in order, the last inst of cpu_armv7_flush_inner_dcache_all read from memory and the first inst store to memory.
0fe8ffa
to
5e31729
Compare
Updated:
|
core/arch/arm/sm/psci-helper.S
Outdated
mov r0, #DCACHE_OP_CLEAN_INV | ||
b dcache_op_all | ||
|
||
isb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isb
is probably redundant as dcache_op_all()
(or do_dcsw_op()
) does an isb
just before returning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove it.
core/arch/arm/sm/psci-helper.S
Outdated
push {lr} | ||
|
||
mov r0, #DCACHE_OP_CLEAN_INV | ||
b dcache_op_all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bl dcache_op_all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh. my bad. pushed wrong patch.
core/arch/arm/sm/psci-helper.S
Outdated
dsb | ||
|
||
mov r0, #DCACHE_OP_CLEAN_INV | ||
b dcache_op_all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bl dcache_op_all
core/arch/arm/sm/psci-helper.S
Outdated
|
||
FUNC psci_armv7_cpu_off, : | ||
UNWIND( .fnstart) | ||
push {lr} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When calling other functions it's more safe to keep the stack pointer 8-byte aligned as some function may expect that, it's a requirement in the calling convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not meet such requirement on i.MX platforms. From "http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf" 5.2.1.1 Universal stack constraints: SP mod 4 = 0. The stack must at all times be aligned to a word boundary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then there's 5.2.1.2 Stack constraints at a public interface:
The stack must also conform to the following constraint at a public interface:
- SP mod 8 = 0. The stack must be double-word aligned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's less code to just push and pop a dummy register like:
push {r12, lr}
pop {r12, pc}
@jenswi-linaro Updated with your comments addressed. Aligned stack to 8 bytes, using "push {r12, lr}" and "pop {r12, pc}", correct "b dcache_op_all" to "bl dcache_op_all", remove the redundant "isb" after dcache_op_all |
Is this patchset ok to be merged or any more comments on this patchset? I still have local patches queued to upstream that depends on this patchset. |
Looks good to me: |
Add helper function psci_armv7_cpu_off. This function will be used when use psci to offline a cpu. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Etienne Carriere <[email protected]> Acked-by: Jens Wiklander <[email protected]>
There is 512M DDR Memory on i.MX6UL-EVK board. Reserve high 32M for TEE usage. The highest 2M for SHMEM. Signed-off-by: Peng Fan <[email protected]> Acked-by: Etienne Carriere <[email protected]> Acked-by: Jens Wiklander <[email protected]>
Clean up to use one imx-regs.h for i.MX SoC family. If there are different IP address, use CFG_MX6[Q,D,UL] and etc to differentiate them. Signed-off-by: Peng Fan <[email protected]> Acked-by: Etienne Carriere <[email protected]> Acked-by: Jens Wiklander <[email protected]>
Support psci off and affinity. To i.MX6, CPU could not offline itself, so needs to use core0 to offline other cores. Introduce imx-common.c to include the common code for i.MX family, SRC operation is used by i.MX6/7, so move them to imx-common.c Use CFG_BOOT_SECONDARY_REQUEST to wrap the psci_cpu_on/off/affinity functions, these functions are only needed by SMP systems.To i.MX6UL, they are not needed. Signed-off-by: Peng Fan <[email protected]> Acked-by: Jens Wiklander <[email protected]>
Switch to use CFG_SECURE_TIME_SOURCE_REE. Since we do not have RTC, and arm counter will lose power when suspend, we use CFG_SECURE_TIME_SOURCE_REE now. Signed-off-by: Peng Fan <[email protected]> Acked-by: Etienne Carriere <[email protected]> Acked-by: Jens Wiklander <[email protected]>
Add platform early init code. Configure ACTLR to enable SMP. Configure NSACR to let NS could access cp10/cp11 and NS_SMP. Signed-off-by: Peng Fan <[email protected]> Acked-by: Etienne Carriere <[email protected]> Acked-by: Jens Wiklander <[email protected]>
Add i.MX6 ULL EVK support. i.MX6ULL is derivative from i.MX6UL, so reuse some code for i.MX6UL. Signed-off-by: Peng Fan <[email protected]> Acked-by: Etienne Carriere <[email protected]> Acked-by: Jens Wiklander <[email protected]>
Rebased and Ack tags applied. |
This patch reset contains the two patches in #1570 which has not been merged. So post all the patches together to avoid function break and requesting comments. After comments addressed and #1570 merged, I'll drop the two patches and resend the pull request.
In this patchset, imx6ul-regs.h imx6-regs.h are replaced by one imx-regs.h. The 6UL TEE mapping is refined to 0x9E000000 and 32M used. The original code use 0x9C000000, and 48M used. Add psci helper function used for psci cpu off and add the support for i.MX6Q-SDB. Testing results shows works well with Linux in non-secure world.