[U-Boot] [PATCH 4/5] arm/mach-bcm283x/mbox: Flush and invalidate dcache when using fw mailbox

Stephen Warren swarren at wwwdotorg.org
Sat Jul 11 07:24:01 CEST 2015


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.


More information about the U-Boot mailing list