From: Neil Stainton Date: Wed, 19 Sep 2018 09:38:07 +0000 (+0100) Subject: u-boot: align cache flushes in load_elf_image_shdr to line boundaries X-Git-Tag: v2018.11-rc1~20 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=18f201ea207a28aa79d7a485a2dc7b643ec36a31;p=oweals%2Fu-boot.git u-boot: align cache flushes in load_elf_image_shdr to line boundaries Prevent cache warning messages when using the 'bootelf' command on an Arm target. Round down each section start address and round up the respective section end to the nearest cache line. Signed-off-by: Neil Stainton [trini: Manually apply, rework whitespace] Signed-off-by: Tom Rini --- diff --git a/cmd/elf.c b/cmd/elf.c index c8e6e7424c..7bad1f80d4 100644 --- a/cmd/elf.c +++ b/cmd/elf.c @@ -219,7 +219,10 @@ static unsigned long load_elf_image_shdr(unsigned long addr) memcpy((void *)(uintptr_t)shdr->sh_addr, (const void *)image, shdr->sh_size); } - flush_cache(shdr->sh_addr, shdr->sh_size); + flush_cache(rounddown(shdr->sh_addr, ARCH_DMA_MINALIGN), + roundup((shdr->sh_addr + shdr->sh_size), + ARCH_DMA_MINALIGN) - + rounddown(shdr->sh_addr, ARCH_DMA_MINALIGN)); } return ehdr->e_entry;