Re: [PATCH v5 4/4] ARM: Add support for Hisilicon Kunpeng L3 cache controller
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Date: 2021-01-29 11:13:54
On Fri, Jan 29, 2021 at 11:53:20AM +0100, Arnd Bergmann wrote:
On Fri, Jan 29, 2021 at 11:33 AM Russell King - ARM Linux admin [off-list ref] wrote:quoted
It is safer to put explicit barriers where it is necessary. Also remember that the barrier in readl() etc is _after_ the read, not before, and the barrier in writel() is _before_ the write, not after. The point is to ensure that DMA memory accesses are properly ordered with the IO-accessing instructions. So, using readl_relaxed() with a read-modify-write is entirely sensible provided you do not access DMA memory inbetween.The part I was not sure about is what happens when you have a store to memory immediately before flushing the cache, and there are no barriers inbetween.
If the caches are non-coherent, we have to flush L1 before we flush L2 to ensure writebacks get pushed out properly, and L1 will already have the necessary barriers. If we have the situation where L1 is coherent but L2 isn't, then I think we have an "interesting situation" that we haven't considered whether it be in DT or elsewhere. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel