summaryrefslogtreecommitdiff
path: root/arch/csky/mm
diff options
context:
space:
mode:
authorGuo Ren <ren_guo@c-sky.com>2019-07-30 09:43:22 +0300
committerGuo Ren <ren_guo@c-sky.com>2019-07-31 06:05:25 +0300
commit7f80fe207de9602aaff028c79345caa68c90cd31 (patch)
tree4052003f821439f67f8be27a26c016075cf48e7d /arch/csky/mm
parent81b23ba645e6b2b446093b2d927c261a17f7dee3 (diff)
downloadlinux-7f80fe207de9602aaff028c79345caa68c90cd31.tar.xz
csky: Fixup dma_alloc_coherent with PAGE_SO attribute
This bug is from commit: 2b070ccdf8c0 (fixup abiv2 mmap(... O_SYNC) failed). In that patch we remove the _PAGE_SO for memory noncache mapping and this will cause problem when drivers use dma descriptors to control the transcations without dma_w/rmb(). After referencing other archs' implementation, pgprot_writecombine is introduced for mmap(... O_SYNC). Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Diffstat (limited to 'arch/csky/mm')
-rw-r--r--arch/csky/mm/ioremap.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/csky/mm/ioremap.c b/arch/csky/mm/ioremap.c
index 8473b6bdf512..48531115fd9d 100644
--- a/arch/csky/mm/ioremap.c
+++ b/arch/csky/mm/ioremap.c
@@ -29,8 +29,7 @@ void __iomem *ioremap(phys_addr_t addr, size_t size)
vaddr = (unsigned long)area->addr;
- prot = __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE |
- _PAGE_GLOBAL | _CACHE_UNCACHED | _PAGE_SO);
+ prot = pgprot_noncached(PAGE_KERNEL);
if (ioremap_page_range(vaddr, vaddr + size, addr, prot)) {
free_vm_area(area);
@@ -51,10 +50,9 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t vma_prot)
{
if (!pfn_valid(pfn)) {
- vma_prot.pgprot |= _PAGE_SO;
return pgprot_noncached(vma_prot);
} else if (file->f_flags & O_SYNC) {
- return pgprot_noncached(vma_prot);
+ return pgprot_writecombine(vma_prot);
}
return vma_prot;