ARM: cache-l2x0: add resume entry for l2 in secure mode
PATCH 1/1 ARM: cache-l2x0: add resume entry for l2 in secure mode
we save the l2x0 registers at the first initialization, and restore them after resuming every time.
--- arch/arm/include/asm/outercache.h | 7 +++ arch/arm/mm/cache-l2x0.c | 81 ++++++++++++++++++++++++++++++++---- 2 files changed, 79 insertions(+), 9 deletions(-)
arch/arm/include/asm/outercache.h +7 -0
@@ -34,6 +34,7 @@ struct outer_cache_fns {void (*sync)(void );#endif void (*set_debug)(unsigned long ); +void (*resume)(void ); };#ifdef CONFIG_OUTER_CACHE
@@ -74,6 +75,12 @@ static inline void outer_disable(void) outer_cache.disable(); } +static inline void outer_resume (void ) +{ +if (outer_cache.resume) + outer_cache.resume (); +} +#else static inline void outer_inv_range (phys_addr_t start,phys_addr_t end)
arch/arm/mm/cache-l2x0.c +72 -9
122 lines not on this page · raw message
Signature · 6 lines
1.7.1 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
PATCH 1/1 ARM: cache-l2x0: add resume entry for l2 in secure mode
Hi Barry,
Quoted 3 lines · Barry Song
we save the l2x0 registers at the first initialization, and restore them after resuming every time.
I'm unsure that it will work for cases like imx6q, where L2 cache is retained and the controller needs to be restored at the very beginning of the resume entry (running on physical space).
Regards,
Shawn
Quoted 5 lines
Signed-off-by Barry Song <[email protected]>--- arch/arm/include/asm/outercache.h | 7 +++ arch/arm/mm/cache-l2x0.c | 81 ++++++++++++++++++++++++++++++++---- 2 files changed, 79 insertions(+), 9 deletions(-)
PATCH 1/1 ARM: cache-l2x0: add resume entry for l2 in secure mode
2011/9/21 Shawn Guo <[email protected]>:
Quoted 9 lines
Hi Barry,
Quoted 3 lines · Barry Song
we save the l2x0 registers at the first initialization, and restore them after resuming every time.
I'm unsure that it will work for cases like imx6q, where L2 cache is retained and the controller needs to be restored at the very beginning of the resume entry (running on physical space).
yes. imx6q actually needs to enable l2 earlier than cpu_resume(and mmu resume). so how about letting outer_resume support both phy and virt address restore?
for example, add early resume: outer_early_resume()
Then for your case, you use asm to "bl out_resume", then "b cpu_resume". For those chips which lose l2 in suspend cycle, people can call it in C function after cpu_resume.
Quoted 3 lines
Regards,
Shawn
-barry
PATCH 1/1 ARM: cache-l2x0: add resume entry for l2 in secure mode
Quoted 11 lines · Barry Song
2011/9/21 Shawn Guo <[email protected]>:
Quoted 9 lines
Hi Barry,
Quoted 3 lines · Barry Song
we save the l2x0 registers at the first initialization, and restore them after resuming every time.
I'm unsure that it will work for cases like imx6q, where L2 cache is retained and the controller needs to be restored at the very beginning of the resume entry (running on physical space).
Quoted 9 lines
yes. imx6q actually needs to enable l2 earlier than
cpu_resume(and mmu resume). so how about lettingouter_resumesupport both phy and virt address restore?
for example, add early resume:outer_early_resume()Then for your case, you use asm to "bl
out_resume", then "bcpu_resume". For those chips which lose l2 in suspend cycle, people can call it in C function aftercpu_resume.
It's worth a try. Except that, I have another two comments on the patch.
* To be safe, all the variables used to save L2 registers need to be ensured being written external memory.
* What registers to save seems to be a platform decision. For example, you patch save 5 registers for pl310 while I only need one aux_ctrl on imx6q.
It seems that Lorenzo also has a plan working on this, so I Cc-ed him for comments.
Signature · 2 lines
Regards, Shawn
PATCH 1/1 ARM: cache-l2x0: add resume entry for l2 in secure mode
In reply to Barry SongQuoted 3 lines · Barry Song
yes. imx6q actually needs to enable l2 earlier than
cpu_resume(and mmu resume). so how about lettingouter_resumesupport both phy and virt address restore?
You can't call C functions in the kernel before the MMU is enabled.
PATCH 1/1 ARM: cache-l2x0: add resume entry for l2 in secure mode
2011/9/21 Russell King - ARM Linux <[email protected]>:
Quoted 6 lines · Barry Song
Quoted 3 lines
yes. imx6q actually needs to enable l2 earlier than
cpu_resume(and mmu resume). so how about lettingouter_resumesupport both phy and virt address restore?You can't call C functions in the kernel before the MMU is enabled.
well. a direct call will fall into virtual address. then we need to transfer it to a phy address before calling it.
Quoted 1 line
PATCH 1/1 ARM: cache-l2x0: add resume entry for l2 in secure mode
Quoted 10 lines · Barry Song
2011/9/21 Russell King - ARM Linux <[email protected]>:
Quoted 6 lines · Barry Song
Quoted 3 lines
yes. imx6q actually needs to enable l2 earlier than
cpu_resume(and mmu resume). so how about lettingouter_resumesupport both phy and virt address restore?You can't call C functions in the kernel before the MMU is enabled.
well. a direct call will fall into virtual address. then we need to transfer it to a phy address before calling it.
No. I say again, you can't call C functions in the kernel before the MMU is enabled.
C functions have literal tables that contain absolute virtual addresses of variables and such like. Without the MMU enabled, those addresses are meaningless and won't point at the right place.
PATCH 1/1 ARM: cache-l2x0: add resume entry for l2 in secure mode
In reply to Barry Song2011/9/21 Barry Song <[email protected]>:
Quoted 10 lines
2011/9/21 Russell King - ARM Linux <[email protected]>:
Quoted 6 lines · Barry Song
Quoted 3 lines
yes. imx6q actually needs to enable l2 earlier than
cpu_resume(and mmu resume). so how about lettingouter_resumesupport both phy and virt address restore?You can't call C functions in the kernel before the MMU is enabled.
well. a direct call will fall into virtual address. then we need to transfer it to a phy address before calling it.
stack and global variant is still a problem. then if we want a generic function for resuming before mmu on, it seems it is best to be asm codes.
Quoted 3 lines
Quoted 2 lines
-barry