summaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/dma-nommu.c
diff options
context:
space:
mode:
authorLinus Torvalds2018-04-13 21:27:11 +0200
committerLinus Torvalds2018-04-13 21:27:11 +0200
commit1bad9ce155a7c010a9a5f3261ad12a6a8eccfb2c (patch)
tree68a3c700c16c6fb4fe729f7f5f89b59855a995a8 /arch/sh/kernel/dma-nommu.c
parentMerge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/a... (diff)
parentarch/sh: pcie-sh7786: handle non-zero DMA offset (diff)
downloadkernel-qcow2-linux-1bad9ce155a7c010a9a5f3261ad12a6a8eccfb2c.tar.gz
kernel-qcow2-linux-1bad9ce155a7c010a9a5f3261ad12a6a8eccfb2c.tar.xz
kernel-qcow2-linux-1bad9ce155a7c010a9a5f3261ad12a6a8eccfb2c.zip
Merge tag 'sh-for-4.17' of git://git.libc.org/linux-sh
Pull arch/sh updates from Rich Felker: "Fixes for bugs in futex, device tree, and userspace breakpoint traps, and for PCI issues on SH7786" * tag 'sh-for-4.17' of git://git.libc.org/linux-sh: arch/sh: pcie-sh7786: handle non-zero DMA offset arch/sh: pcie-sh7786: adjust the memory mapping arch/sh: pcie-sh7786: adjust PCI MEM and IO regions arch/sh: pcie-sh7786: exclude unusable PCI MEM areas arch/sh: pcie-sh7786: mark unavailable PCI resource as disabled arch/sh: pci: don't use disabled resources arch/sh: make the DMA mapping operations observe dev->dma_pfn_offset arch/sh: add sh7786_mm_sel() function sh: fix debug trap failure to process signals before return to user sh: fix memory corruption of unflattened device tree sh: fix futex FUTEX_OP_SET op on userspace addresses
Diffstat (limited to 'arch/sh/kernel/dma-nommu.c')
-rw-r--r--arch/sh/kernel/dma-nommu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index 62b485107eae..178457d7620c 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -16,7 +16,8 @@ static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
enum dma_data_direction dir,
unsigned long attrs)
{
- dma_addr_t addr = page_to_phys(page) + offset;
+ dma_addr_t addr = page_to_phys(page) + offset
+ - PFN_PHYS(dev->dma_pfn_offset);
WARN_ON(size == 0);
@@ -36,12 +37,14 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
WARN_ON(nents == 0 || sg[0].length == 0);
for_each_sg(sg, s, nents, i) {
+ dma_addr_t offset = PFN_PHYS(dev->dma_pfn_offset);
+
BUG_ON(!sg_page(s));
if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
sh_sync_dma_for_device(sg_virt(s), s->length, dir);
- s->dma_address = sg_phys(s);
+ s->dma_address = sg_phys(s) - offset;
s->dma_length = s->length;
}