[PATCH] powerpc/dma: Fix invalid DMA mmap behavior
hch at lst.de
Fri Jul 19 17:06:59 AEST 2019
On Thu, Jul 18, 2019 at 02:46:00PM -0500, Shawn Anastasio wrote:
> Personally, I'm not a huge fan of an implicit default for something
> inherently architecture-dependent like this at all.
What is inherently architecture specific here over the fact that
the pgprot_* expand to architecture specific bits?
> What I'd like to
> see is a mechanism that forces architecture code to explicitly
> opt in to the default pgprot settings if they don't provide an
> implementation of arch_dma_mmap_pgprot. This could perhaps be done
> by reversing ARCH_HAS_DMA_MMAP_PGPROT to something like
I'd rather not create boilerplate code where we don't have to it. Note
that arch_dma_mmap_pgprot is a little misnamed now, as we also use it
for the in-kernel remapping in kernel/dma/remap.c, which I'm slowly
switching a lot of architectures to. powerpc will follow soon once
I get the ppc44x that was given to me to actually boot with a recent
kernel (not that I've tried much so far).
> This way as more systems are moved to use the common mmap code instead
> of their ops->mmap, the people doing the refactoring have to make an
> explicit decision about the pgprot settings to use. Such a configuration
> would have likely prevented this situation with powerpc from happening.
Every arch except for arm32 now uses dma direct for the direct mapping,
and thus the common code without the indeed odd default. I also have
a series to remove the default fallback, which is inherently a bad idea:
> That being said, if the default behavior doesn't make sense in the
> general case it should probably be fixed as well.
> Curious to hear some thoughts on this.
I think your patch that started this thread is fine for 5.3 and -stable:
Reviewed-by: Christoph Hellwig <hch at lst.de>
But going forward I'd rather have a sane default.
More information about the Linuxppc-dev