arm: K3: Make sure to clean caches before jumping to Linux
Subsystems (2)
cover arm: K3: Make sure to clean caches before jumping to Linux
This series make sure that on K3 devices, Linux image is completely written to DDR from L3 and then control is given to Linux from U-Boot.
Lokesh Vutla (3):
boot: arm: Enable support for custom board_prep_linux
cmd: booti: Store OS start and end info in images structure
arm: K3: Clean and invalidate Linux Image before jumping to Linux
arch/arm/lib/bootm.c | 4 ++++ arch/arm/mach-k3/common.c | 11 +++++++++++ cmd/booti.c | 3 +++ 3 files changed, 18 insertions(+)
Signature · 1 line
2.23.0
PATCH 1/3 boot: arm: Enable support for custom board_prep_linux
Once the arch specific boot_prepare_linux completes, boards wants to have a custom preparation for linux. Add support for a custom board_prep_linux.
---
- This is similar to hook available in arch/arc/
https://gitlab.denx.de/u-boot/u-boot/blob/master/arch/arc/lib/bootm.c#L48
arch/arm/lib/bootm.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/lib/bootm.c +4 -0
@@ -224,6 +224,8 @@ static void do_nonsec_virt_switch(void) }#endif +__weak void board_prep_linux (bootm_headers_t *images) { } +/* Subcommand: PREP */ static void boot_prep_linux (bootm_headers_t *images) {
@@ -270,6 +272,8 @@ static void boot_prep_linux(bootm_headers_t *images)printf ("FDT and ATAGS support not compiled in - hanging\n" );hang (); } + +board_prep_linux (images); }__weak bool armv7_boot_nonsec_default (void )
Signature · 1 line
2.23.0
PATCH 1/3 boot: arm: Enable support for custom board_prep_linux
Quoted 5 lines · Lokesh Vutla
Once the arch specific
boot_prepare_linuxcompletes, boards wants to have a custom preparation for linux. Add support for a customboard_prep_linux.Signed-off-by Lokesh Vutla <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191025/b7fd3e9f/attachment.sig>
PATCH 2/3 cmd: booti: Store OS start and end info in images structure
In reply to Lokesh VutlaStore the start and end of the OS image that is loaded in images structure.
--- cmd/booti.c | 3 +++ 1 file changed, 3 insertions(+)
cmd/booti.c +3 -0
@@ -48,6 +48,9 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc, } images->ep = relocated_addr; + images->os.start = relocated_addr; + images->os.end = relocated_addr + image_size; +lmb_reserve (&images->lmb, images->ep,le32_to_cpu (image_size));/*
Signature · 1 line
2.23.0
PATCH 2/3 cmd: booti: Store OS start and end info in images structure
Quoted 4 lines · Lokesh Vutla
Store the start and end of the OS image that is loaded in images structure.
Signed-off-by Lokesh Vutla <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191025/3c598541/attachment.sig>
PATCH 3/3 arm: K3: Clean and invalidate Linux Image before jumping to Linux
In reply to Lokesh VutlaU-Boot cleans and invalidate L1 and L2 caches before jumping to Linux by set/way in cleanup_before_linux(). Additionally there is a custom hook provided to clean and invalidate L3 cache.
Unfortunately on K3 devices(having a coherent architecture), there is no easy way to quickly clean all the cache lines for L3. The entire address range needs to be cleaned and invalidated by Virtual Address. This can be implemented using the L3 custom hook but it take lot of time to clean the entire address range. In the interest of boot time this might not be a viable solution.
The best hit is to make sure the loaded Linux image is flushed so that the entire image is written to DDR from L3. When Linux starts running with caches disabled the full image is available from DDR.
--- arch/arm/mach-k3/common.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/mach-k3/common.c +11 -0
@@ -207,3 +207,14 @@ int print_cpuinfo(void) return 0; }#endif + +#ifdef CONFIG_ARM64 +void board_prep_linux (bootm_headers_t *images) +{ +debug ("Linux kernel Image start = 0x%lx end = 0x%lx\n" , + images->os.start, images->os.end); +__asm_flush_dcache_range (images->os.start, +ROUND (images->os.end, +CONFIG_SYS_CACHELINE_SIZE )); +} +#endif
Signature · 1 line
2.23.0
PATCH 3/3 arm: K3: Clean and invalidate Linux Image before jumping to Linux
Quoted 11 lines · Lokesh Vutla
U-Boot cleans and invalidate L1 and L2 caches before jumping to Linux by set/way in
cleanup_before_linux(). Additionally there is a custom hook provided to clean and invalidate L3 cache.Unfortunately on K3 devices(having a coherent architecture), there is no easy way to quickly clean all the cache lines for L3. The entire address range needs to be cleaned and invalidated by Virtual Address. This can be implemented using the L3 custom hook but it take lot of time to clean the entire address range. In the interest of boot time this might not be a viable solution.
Quoted 7 lines
The best hit is to make sure the loaded Linux image is flushed so that the entire image is written to DDR from L3. When Linux starts running with caches disabled the full image is available from DDR.
Reported-by Andrew F. Davis <[email protected]>Reported-by Faiz Abbas <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191025/107c0d03/attachment.sig>