[PATCH] ARM: mvebu: select OF_DMA_DEFAULT_COHERENT if MACH_MVEBU_V7

Marek Behún kabel at kernel.org
Tue Oct 4 05:54:34 PDT 2022


On Tue, 4 Oct 2022 10:30:10 +0200
Christoph Hellwig <hch at lst.de> wrote:

> On Tue, Oct 04, 2022 at 10:17:23AM +0200, Marek Behún wrote:
> > Commit ae626eb97376 ("ARM/dma-mapping: use dma-direct unconditionally")
> > caused a regression on the mvebu platform, wherein devices that are
> > dma-coherent are marked as dma-noncoherent, because although
> > mvebu_hwcc_notifier() after that commit still marks then as coherent,
> > the arm_coherent_dma_ops() function, which is called later, overwrites
> > this setting, since it is being called from drivers/of/device.c with
> > coherency parameter determined by of_dma_is_coherent(), and the
> > device-trees do not declare the 'dma-coherent' property.
> > 
> > Fix this by defaulting to dma-coherent for this platform in the
> > of_dma_is_coherent() function, if neither dma-coherent nor
> > dma-noncoherent is declared.  
> 
> Can't mvebu be part of multi-platform builds that would be broken by
> this change?

OK, if selecting that isn't possible, then my opinion is that this
should be handled by OF drivers. There is a precedent for this,
drivers/of/address.c has function of_empty_ranges_quirk().

So maybe something like
  of_dma_coherency_quirk(),
which will be called from of_dma_is_coherent() ?

> Also if we do this, shouldn't we also remove the notifier that set
> ->dma_coherent? 

Yes, the notifier should go away, IMO.



More information about the linux-arm-kernel mailing list