[PATCH 06/10] soc/qbman: Add ARM equivalent for flush_dcache_range()

Russell King - ARM Linux linux at armlinux.org.uk
Mon Jan 30 07:12:20 PST 2017


On Wed, Jan 18, 2017 at 11:36:18PM +0000, Scott Wood wrote:
> On 01/18/2017 05:12 PM, Russell King - ARM Linux wrote:
> > Please do not fiddle about under the covers, there be dragons there.
> > 
> > It looks to me like you're trying to use __cpuc_flush_dcache_area()
> > on an area that's been ioremap()'d, which is a waste of CPU cycles.
> > ioremap()'d areas are mapped as "device" memory type, which means
> > the region isn't even cached.  So I don't think this is necessary.
> 
> It is mapped cachable, via memremap() (see patch 1/10).  This is RAM
> that the device uses, non-coherently, for its own purposes (but requires
> software to clear it first).

Ok.

> Is there a non-"under the covers" way to say "flush this region" without
> the arch second-guessing whether it really needs to be flushed?

memremap() doesn't have any associated cache flushing functionality
defined for it - it's a relatively new interface added to the kernel.

There are some interfaces defined for memory that was vmalloc'd, but
due to the way kernel/memremap.c works, you can't guarantee that the
pointer you end up with came from vmalloc'd space, so I don't think
suggesting to use those would be correct (as they may have assumptions
that they'll only be called with vmalloc'd addresses.)

As pointed out later in the thread, using dma_map_single() on the
returned address is not permissible either.

The only thing I can say is that it needs a proposal for a new arch-
independent interface.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.



More information about the linux-arm-kernel mailing list