Home Home > GIT Browse > SLE15-SP1
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2019-07-19 16:50:46 +0200
committerPetr Tesarik <ptesarik@suse.cz>2019-07-19 16:50:46 +0200
commit1da6c6520d26ac382857c88983bcaefbb445f81b (patch)
treed398d7b095900b1407c8f02a59f434f60d137823
parent15980849ec18d7897a44cb69b06cb42260a6044f (diff)
- dma-direct: add support for allocation from ZONE_DMA and
ZONE_DMA32 (jsc#SLE-6197 FATE#327012 bsc#1140559 LTC#173150). - Refresh patches.suse/dma-direct-retry-allocations-using-gfp_dma-for-small-masks.
-rw-r--r--patches.suse/dma-direct-add-support-for-allocation-from-zone_dma-and-zone_dma3250
-rw-r--r--patches.suse/dma-direct-retry-allocations-using-gfp_dma-for-small-masks11
-rw-r--r--series.conf1
3 files changed, 57 insertions, 5 deletions
diff --git a/patches.suse/dma-direct-add-support-for-allocation-from-zone_dma-and-zone_dma32 b/patches.suse/dma-direct-add-support-for-allocation-from-zone_dma-and-zone_dma32
new file mode 100644
index 0000000000..d5b31b04f9
--- /dev/null
+++ b/patches.suse/dma-direct-add-support-for-allocation-from-zone_dma-and-zone_dma32
@@ -0,0 +1,50 @@
+From: Christoph Hellwig <hch@lst.de>
+Date: Tue, 9 Jan 2018 23:39:03 +0100
+Subject: dma-direct: add support for allocation from ZONE_DMA and ZONE_DMA32
+Git-commit: c61e9637340e1d0672c6f0c0b11aa81d7262c49d
+Patch-mainline: v4.16-rc1
+References: jsc#SLE-6197 FATE#327012 bsc#1140559 LTC#173150
+
+This allows to dip into zones for lower memory if they are available.
+If one of the zones is not available the corresponding GFP_* flag
+will evaluate to 0 so they won't change anything. We provide an
+arch tunable for those architectures that do not use GFP_DMA for
+the lowest 24-bits, given that there are a few.
+
+Roughly based on the x86 code.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Acked-by: Petr Tesarik <ptesarik@suse.com>
+---
+ lib/dma-noop.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/lib/dma-noop.c
++++ b/lib/dma-noop.c
+@@ -8,12 +8,26 @@
+ #include <linux/dma-direct.h>
+ #include <linux/scatterlist.h>
+
++/*
++ * Most architectures use ZONE_DMA for the first 16 Megabytes, but
++ * some use it for entirely different regions:
++ */
++#ifndef ARCH_ZONE_DMA_BITS
++#define ARCH_ZONE_DMA_BITS 24
++#endif
++
+ static void *dma_noop_alloc(struct device *dev, size_t size,
+ dma_addr_t *dma_handle, gfp_t gfp,
+ unsigned long attrs)
+ {
+ void *ret;
+
++ /* GFP_DMA32 and GFP_DMA are no ops without the corresponding zones: */
++ if (dev->coherent_dma_mask <= DMA_BIT_MASK(ARCH_ZONE_DMA_BITS))
++ gfp |= GFP_DMA;
++ if (dev->coherent_dma_mask <= DMA_BIT_MASK(32) && !(gfp & GFP_DMA))
++ gfp |= GFP_DMA32;
++
+ ret = (void *)__get_free_pages(gfp, get_order(size));
+ if (ret)
+ *dma_handle = virt_to_phys(ret);
diff --git a/patches.suse/dma-direct-retry-allocations-using-gfp_dma-for-small-masks b/patches.suse/dma-direct-retry-allocations-using-gfp_dma-for-small-masks
index 99ea16639b..42ff797a41 100644
--- a/patches.suse/dma-direct-retry-allocations-using-gfp_dma-for-small-masks
+++ b/patches.suse/dma-direct-retry-allocations-using-gfp_dma-for-small-masks
@@ -23,9 +23,9 @@ Signed-off-by: Petr Tesarik <ptesarik@suse.com>
--- a/lib/dma-noop.c
+++ b/lib/dma-noop.c
-@@ -8,13 +8,29 @@
- #include <linux/dma-direct.h>
- #include <linux/scatterlist.h>
+@@ -16,6 +16,11 @@
+ #define ARCH_ZONE_DMA_BITS 24
+ #endif
+static bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size)
+{
@@ -35,8 +35,9 @@ Signed-off-by: Petr Tesarik <ptesarik@suse.com>
static void *dma_noop_alloc(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp,
unsigned long attrs)
- {
- void *ret;
+@@ -28,7 +33,18 @@ static void *dma_noop_alloc(struct devic
+ if (dev->coherent_dma_mask <= DMA_BIT_MASK(32) && !(gfp & GFP_DMA))
+ gfp |= GFP_DMA32;
+again:
ret = (void *)__get_free_pages(gfp, get_order(size));
diff --git a/series.conf b/series.conf
index 582fe7ae7b..97fa8f8986 100644
--- a/series.conf
+++ b/series.conf
@@ -20216,6 +20216,7 @@
patches.suse/mips-fix-an-off-by-one-in-dma_capable
patches.suse/dma-mapping-move-swiotlb-arch-helpers-to-a-new-header
patches.suse/dma-mapping-move-dma_mark_clean-to-dma-direct-h
+ patches.suse/dma-direct-add-support-for-allocation-from-zone_dma-and-zone_dma32
patches.suse/dma-direct-retry-allocations-using-gfp_dma-for-small-masks
patches.drivers/swiotlb-suppress-warning-when-__GFP_NOWARN-is-set
patches.drivers/dmaengine-dmatest-fix-container_of-member-in-dmatest