Skip to contentSkip to conversation

bootm: Simplying cache flush code

PATCH In review Trent Piepho 3 participants 3 messages Mar 27, 2019 – Apr 24, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bootm: Simplying cache flush code

The cache flush of the kernel load area needs to be aligned outward to the DMA cache alignment. The operations are simpler if we think of this as aligning the start down, ALIGN_DOWN(load, ARCH_DMA_MINALIGN), and aligning the end up, ALIGN(load_end, ARCH_DMA_MINALIGN), and then find the length of the flushed region by subtracting the former from the latter.

Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Bryan O'Donoghue <[email protected]>
---
 common/bootm.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
common/bootm.c +1 -6
index 8bf84ebcb7..8af8efd169 100644
@@ -453,7 +453,6 @@ static int bootm_load_os(bootm_headers_t *images, int boot_progress)
 	ulong image_start = os.image_start;
 	ulong image_len = os.image_len;
 	ulong flush_start = ALIGN_DOWN(load, ARCH_DMA_MINALIGN);
-	ulong flush_len;
 	bool no_overlap;
 	void *load_buf, *image_buf;
 	int err;
@@ -468,11 +467,7 @@ static int bootm_load_os(bootm_headers_t *images, int boot_progress)
 		return err;
 	}
 
-	flush_len = load_end - load;
-	if (flush_start < load)
-		flush_len += load - flush_start;
-
-	flush_cache(flush_start, ALIGN(flush_len, ARCH_DMA_MINALIGN));
+	flush_cache(flush_start, ALIGN(load_end, ARCH_DMA_MINALIGN) - flush_start);
 
 	debug("   kernel loaded@0x%08lx, end = 0x%08lx\n", load, load_end);
 	bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED);
Signature · 1 line
2.14.5
#1 lore raw

PATCH 1/1 bootm: Simplying cache flush code

Quoted 8 lines · Trent Piepho

The cache flush of the kernel load area needs to be aligned outward to the DMA cache alignment. The operations are simpler if we think of this as aligning the start down, ALIGN_DOWN(load, ARCH_DMA_MINALIGN), and aligning the end up, ALIGN(load_end, ARCH_DMA_MINALIGN), and then find the length of the flushed region by subtracting the former from the latter.

Quoted 7 lines
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Bryan O'Donoghue <[email protected]>
---
 common/bootm.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
#2 lore raw
In reply to Trent Piepho
Quoted 7 lines · Trent Piepho

The cache flush of the kernel load area needs to be aligned outward to the DMA cache alignment. The operations are simpler if we think of this as aligning the start down, ALIGN_DOWN(load, ARCH_DMA_MINALIGN), and aligning the end up, ALIGN(load_end, ARCH_DMA_MINALIGN), and then find the length of the flushed region by subtracting the former from the latter.

Quoted 5 lines

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: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/ee90f68c/attachment.sig>