From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Fri, 10 Jul 2015 23:24:01 -0600 Subject: [U-Boot] [PATCH 4/5] arm/mach-bcm283x/mbox: Flush and invalidate dcache when using fw mailbox In-Reply-To: <1436003324-8769-5-git-send-email-alexanders83@web.de> References: <1436003324-8769-1-git-send-email-alexanders83@web.de> <1436003324-8769-5-git-send-email-alexanders83@web.de> Message-ID: <55A0A871.9060706@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 07/04/2015 03:48 AM, Alexander Stein wrote: > When using dcache the setup data for the mailbox must be actually written > into memory before calling into firmware. Thus flush and invalidate the > memory. > diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c > + flush_dcache_range((unsigned long)buffer, > + (unsigned long)((void *)buffer + > + buffer->buf_size)); > + invalidate_dcache_range((unsigned long)buffer, > + (unsigned long)((void *)buffer + > + buffer->buf_size)); > ret = bcm2835_mbox_call_raw(chan, phys_to_bus((u32)buffer), &rbuffer); > if (ret) > return ret; I'm not sure of the details of ARMv6 memory pre-fetching, so perhaps this doesn't matter. However, I think it'd be best if this code did: flush cache execute mailbox operation invalidate cache use results ... rather than doing the invalidate before executing the mailbox operation. This change would guarantee that the invalidate happens after the VideoCore has written the response into RAM, and hence guarantees that the invalidate will cause the response to be picked up.