Re: [PATCH 4/6] MIPS: refactor the maybe coherent DMA indicators

From: Christoph Hellwig
Date: Wed Feb 10 2021 - 04:14:11 EST


On Tue, Feb 09, 2021 at 02:12:37PM +0100, Thomas Bogendoerfer wrote:
> > +#ifdef CONFIG_DMA_MAYBE_COHERENT
> > +extern bool dma_default_coherent;
> > static inline bool dev_is_dma_coherent(struct device *dev)
> > {
> > - return coherentio == IO_COHERENCE_ENABLED ||
> > - (coherentio == IO_COHERENCE_DEFAULT && hw_coherentio);
> > + return dma_default_coherent;
>
> this breaks overriding of coherentio via command line. plat_mem_setup/
> plat_setup_iocoherency is called before earlyparams are handled. So
> changing coherentio after that doesn't have any effect.

Hmm. In that case a manual override does actually work for alchemy,
as that initializes coherentio from plat_mem_setup(). But the
elaborate sanity checking that malta performs in plat_setup_iocoherency
is rather pointless then, as coherentio will always be set to
IO_COHERENCE_DISABLED at this point.