arm64: dma-mapping: Fix dma_mapping_error() when bypassing SWIOTLB
This commit is contained in:
parent
78ff8fa07f
commit
bc239caff7
|
@ -0,0 +1,66 @@
|
|||
From patchwork Wed Jan 25 18:31:31 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2] arm64: dma-mapping: Fix dma_mapping_error() when bypassing
|
||||
SWIOTLB
|
||||
From: Robin Murphy <robin.murphy@arm.com>
|
||||
X-Patchwork-Id: 9537723
|
||||
Message-Id: <840027acb4750542003dff17b4a8902ba8972754.1485368348.git.robin.murphy@arm.com>
|
||||
To: will.deacon@arm.com,
|
||||
catalin.marinas@arm.com
|
||||
Cc: Jisheng Zhang <jszhang@marvell.com>, arnd@arndb.de,
|
||||
konrad.wilk@oracle.com, aaro.koskinen@iki.fi, stable@vger.kernel.org,
|
||||
linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org
|
||||
Date: Wed, 25 Jan 2017 18:31:31 +0000
|
||||
|
||||
When bypassing SWIOTLB on small-memory systems, we need to avoid calling
|
||||
into swiotlb_dma_mapping_error() in exactly the same way as we avoid
|
||||
swiotlb_dma_supported(), because the former also relies on SWIOTLB state
|
||||
being initialised.
|
||||
|
||||
Under the assumptions for which we skip SWIOTLB, dma_map_{single,page}()
|
||||
will only ever return the DMA-offset-adjusted physical address of the
|
||||
page passed in, thus we can report success unconditionally.
|
||||
|
||||
Fixes: b67a8b29df7e ("arm64: mm: only initialize swiotlb when necessary")
|
||||
CC: stable@vger.kernel.org
|
||||
CC: Jisheng Zhang <jszhang@marvell.com>
|
||||
Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
|
||||
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
|
||||
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
|
||||
---
|
||||
|
||||
v2: Get the return value the right way round this time... After some
|
||||
careful reasoning it really is that simple.
|
||||
|
||||
arch/arm64/mm/dma-mapping.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
|
||||
index e04082700bb1..1ffb7d5d299a 100644
|
||||
--- a/arch/arm64/mm/dma-mapping.c
|
||||
+++ b/arch/arm64/mm/dma-mapping.c
|
||||
@@ -352,6 +352,13 @@ static int __swiotlb_dma_supported(struct device *hwdev, u64 mask)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+static int __swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t addr)
|
||||
+{
|
||||
+ if (swiotlb)
|
||||
+ return swiotlb_dma_mapping_error(hwdev, addr);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static struct dma_map_ops swiotlb_dma_ops = {
|
||||
.alloc = __dma_alloc,
|
||||
.free = __dma_free,
|
||||
@@ -366,7 +373,7 @@ static struct dma_map_ops swiotlb_dma_ops = {
|
||||
.sync_sg_for_cpu = __swiotlb_sync_sg_for_cpu,
|
||||
.sync_sg_for_device = __swiotlb_sync_sg_for_device,
|
||||
.dma_supported = __swiotlb_dma_supported,
|
||||
- .mapping_error = swiotlb_dma_mapping_error,
|
||||
+ .mapping_error = __swiotlb_dma_mapping_error,
|
||||
};
|
||||
|
||||
static int __init atomic_pool_init(void)
|
|
@ -513,6 +513,8 @@ Patch426: usb-phy-tegra-Add-38.4MHz-clock-table-entry.patch
|
|||
# Fix OMAP4 (pandaboard)
|
||||
Patch427: arm-revert-mmc-omap_hsmmc-Use-dma_request_chan-for-reque.patch
|
||||
|
||||
Patch428: arm64-dma-mapping-Fix-dma_mapping_error-when-bypassing-SWIOTLB.patch
|
||||
|
||||
# Not particularly happy we don't yet have a proper upstream resolution this is the right direction
|
||||
# https://www.spinics.net/lists/arm-kernel/msg535191.html
|
||||
Patch429: arm64-mm-Fix-memmap-to-be-initialized-for-the-entire-section.patch
|
||||
|
@ -522,10 +524,10 @@ Patch430: ARM-tegra-usb-no-reset.patch
|
|||
|
||||
Patch431: bcm2837-initial-support.patch
|
||||
|
||||
Patch433: bcm283x-fixes.patch
|
||||
Patch432: bcm283x-fixes.patch
|
||||
|
||||
# http://www.spinics.net/lists/linux-mmc/msg41151.html
|
||||
Patch434: bcm283x-mmc-imp-speed.patch
|
||||
Patch433: bcm283x-mmc-imp-speed.patch
|
||||
|
||||
Patch440: AllWinner-net-emac.patch
|
||||
|
||||
|
@ -2164,6 +2166,9 @@ fi
|
|||
#
|
||||
#
|
||||
%changelog
|
||||
* Thu Jan 26 2017 Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
- arm64: dma-mapping: Fix dma_mapping_error() when bypassing SWIOTLB
|
||||
|
||||
* Thu Jan 26 2017 Laura Abbott <labbott@redhat.com> - 4.9.6-100
|
||||
- Linux v4.9.6
|
||||
- Bring in fix for bogus EFI firmware
|
||||
|
|
Loading…
Reference in New Issue