All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] bootm: Align cache flush begin address
@ 2018-04-13 15:07 Bryan O'Donoghue
  2018-04-13 16:27 ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:07 UTC (permalink / raw)
  To: u-boot

commit b4d956f6bc0f ("bootm: Align cache flush end address correctly")
aligns the end address of the cache flush operation to a cache-line size to
ensure lower-layers in the code accept the range provided and flush.

A similar action should be taken for the begin address of a cache flush
operation. The load address may not be aligned to a cache-line boundary, so
ensure the passed address is aligned.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reported-by: Breno Matheus Lima <brenomatheus@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
---
 common/bootm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/bootm.c b/common/bootm.c
index adb1213..45d140c 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -447,7 +447,8 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
 		bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 		return err;
 	}
-	flush_cache(load, ALIGN(*load_end - load, ARCH_DMA_MINALIGN));
+	flush_cache(ALIGN(load, ARCH_DMA_MINALIGN),
+		    ALIGN(*load_end - load, ARCH_DMA_MINALIGN));
 
 	debug("   kernel loaded at 0x%08lx, end = 0x%08lx\n", load, *load_end);
 	bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] bootm: Align cache flush begin address
  2018-04-13 15:07 [U-Boot] [PATCH] bootm: Align cache flush begin address Bryan O'Donoghue
@ 2018-04-13 16:27 ` Tom Rini
  2018-04-14  8:10   ` Bryan O'Donoghue
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2018-04-13 16:27 UTC (permalink / raw)
  To: u-boot

On Fri, Apr 13, 2018 at 04:07:20PM +0100, Bryan O'Donoghue wrote:

> commit b4d956f6bc0f ("bootm: Align cache flush end address correctly")
> aligns the end address of the cache flush operation to a cache-line size to
> ensure lower-layers in the code accept the range provided and flush.
> 
> A similar action should be taken for the begin address of a cache flush
> operation. The load address may not be aligned to a cache-line boundary, so
> ensure the passed address is aligned.
> 
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Reported-by: Breno Matheus Lima <brenomatheus@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  common/bootm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/common/bootm.c b/common/bootm.c
> index adb1213..45d140c 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -447,7 +447,8 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
>  		bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
>  		return err;
>  	}
> -	flush_cache(load, ALIGN(*load_end - load, ARCH_DMA_MINALIGN));
> +	flush_cache(ALIGN(load, ARCH_DMA_MINALIGN),
> +		    ALIGN(*load_end - load, ARCH_DMA_MINALIGN));

Am I wrong in thinking that we would want ALIGN_DOWN for load here?

-- 
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/20180413/77af8ccb/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] bootm: Align cache flush begin address
  2018-04-13 16:27 ` Tom Rini
@ 2018-04-14  8:10   ` Bryan O'Donoghue
  0 siblings, 0 replies; 3+ messages in thread
From: Bryan O'Donoghue @ 2018-04-14  8:10 UTC (permalink / raw)
  To: u-boot



On 13/04/18 17:27, Tom Rini wrote:
>> -	flush_cache(load, ALIGN(*load_end - load, ARCH_DMA_MINALIGN));
>> +	flush_cache(ALIGN(load, ARCH_DMA_MINALIGN),
>> +		    ALIGN(*load_end - load, ARCH_DMA_MINALIGN));
> Am I wrong in thinking that we would want ALIGN_DOWN for load here?

No, we'll need to increase the length of the flush too.

I'll change this to an analog of

if (load != ALIGN_DOWN(load)) {
     load_flush = ALIGN_DOWN(load);
     load_flush_len += load - load_flush;
}

etc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-14  8:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-13 15:07 [U-Boot] [PATCH] bootm: Align cache flush begin address Bryan O'Donoghue
2018-04-13 16:27 ` Tom Rini
2018-04-14  8:10   ` Bryan O'Donoghue

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.