From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Agner Date: Wed, 03 Aug 2016 19:43:24 -0700 Subject: [U-Boot] [PATCH] cmd: net: flush cache cacheline aligned In-Reply-To: References: <20160802072028.26824-1-stefan@agner.ch> Message-ID: <2a0a0850bbdff7bfc83589686fc4af2e@agner.ch> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2016-08-03 16:18, Joe Hershberger wrote: > On Tue, Aug 2, 2016 at 2:20 AM, Stefan Agner wrote: >> From: Stefan Agner >> >> Flush loaded data cacheline aligned. This avoids warnings such as >> CACHE: Misaligned operation at range [81000000, 816d0fa8] >> >> Signed-off-by: Stefan Agner >> --- > > This was already rejected once. > http://lists.denx.de/pipermail/u-boot/2012-April/121564.html Oh I see, and in the end the message was converted to a debug() call, in essence turning the whole problem back under a stone... :-) FWIW, I largely support Mike Frysinger's position in that discussion, and think it should be fine to flush these extra bytes... > >> Why do we actually have to flush caches after load? It seems to >> have worked so far despite the caches did not get flushed (due to >> missalignment). Btw, I need to correct myself here: flush_dcache ultimately calls v7_dcache_clean_inval_range, which does not bail out in the unaligned case. Instead, afaict, it flushes until mva < stop, hence flushes the last line anyway... > > I'm not sure that we do, but it's been there since as far back as the > git history goes. Maybe Wolfgang has memory of a reason. The only reason why it might be preferable to have loaded stuff in main memory is with nowadays heterogeneous architectures (e.g. i.MX 7 with its secondary M4 core). In those cases we need to flush caches since those two cores are no cache coherent. However, I don't think that all load commands are doing the flush, so not sure if can rely on that today... -- Stefan > > -Joe > >> -- >> Stefan >> >> cmd/net.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/cmd/net.c b/cmd/net.c >> index b2f3c7b..540daeb 100644 >> --- a/cmd/net.c >> +++ b/cmd/net.c >> @@ -244,7 +244,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, >> } >> >> /* flush cache */ >> - flush_cache(load_addr, size); >> + flush_cache(load_addr, ALIGN(size, CONFIG_SYS_CACHELINE_SIZE)); >> >> bootstage_mark(BOOTSTAGE_ID_NET_LOADED); >> >> -- >> 2.9.0 >> >> _______________________________________________ >> U-Boot mailing list >> U-Boot at lists.denx.de >> http://lists.denx.de/mailman/listinfo/u-boot