From f068fe3170bcf06f14fd0a9eec0be12be04ff012 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 27 Apr 2018 09:02:55 +0200 Subject: core, dma-direct: add a flag 32-bit dma limits Various PCI bridges (VIA PCI, Xilinx PCIe) limit DMA to only 32-bits even if the device itself supports more. Add a single bit flag to struct device (to be moved into the dma extension once we get to it) to flag such devices and reject larger DMA to them. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman --- lib/dma-direct.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/dma-direct.c b/lib/dma-direct.c index b824eb218782..a48f94eff62e 100644 --- a/lib/dma-direct.c +++ b/lib/dma-direct.c @@ -172,6 +172,12 @@ int dma_direct_supported(struct device *dev, u64 mask) if (mask < DMA_BIT_MASK(32)) return 0; #endif + /* + * Various PCI/PCIe bridges have broken support for > 32bit DMA even + * if the device itself might support it. + */ + if (dev->dma_32bit_limit && mask > DMA_BIT_MASK(32)) + return 0; return 1; } -- cgit v1.2.3-58-ga151