[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190717153135.15507-4-nsaenzjulienne@suse.de>
Date: Wed, 17 Jul 2019 17:31:34 +0200
From: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
To: linux-arm-kernel@...ts.infradead.org,
Christoph Hellwig <hch@....de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>
Cc: catalin.marinas@....com, will@...nel.org, phil@...pberrypi.org,
stefan.wahren@...e.com, f.fainelli@...il.com, mbrugger@...e.com,
Jisheng.Zhang@...aptics.com,
Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: [RFC 3/4] dma-direct: add dma_direct_min_mask
Historically devices with ZONE_DMA32 have been assumed to be able to
address at least the lower 4GB of ram for DMA. This is still the defualt
behavior yet the Raspberry Pi 4 is limited to the first GB of memory.
This has been observed to trigger failures in dma_direct_supported() as
the 'min_mask' isn't properly set.
We create 'dma_direct_min_mask' in order for the arch init code to be
able to fine-tune dma direct's 'min_dma' mask.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
---
kernel/dma/direct.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index b90e1aede743..3c8cd730648b 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -23,6 +23,8 @@
#define ARCH_ZONE_DMA_BITS 24
#endif
+u64 dma_direct_min_mask __ro_after_init = DMA_BIT_MASK(32);
+
/*
* For AMD SEV all DMA must be to unencrypted addresses.
*/
@@ -393,7 +395,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
if (IS_ENABLED(CONFIG_ZONE_DMA))
min_mask = DMA_BIT_MASK(ARCH_ZONE_DMA_BITS);
else
- min_mask = DMA_BIT_MASK(32);
+ min_mask = dma_direct_min_mask;
min_mask = min_t(u64, min_mask, (max_pfn - 1) << PAGE_SHIFT);
--
2.22.0
Powered by blists - more mailing lists