Skip to content

Commit 6100ad6

Browse files
committed
Merge pull request torvalds#61 from aejsmith/ci20-v3.18-dma-fix
Handle KSEG1 addresses in mips_dma_mmap()
2 parents b581adb + a3d76d3 commit 6100ad6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arch/mips/mm/dma-default.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,16 @@ static int mips_dma_mmap(struct device *dev, struct vm_area_struct *vma,
195195
{
196196
unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
197197
unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
198-
unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr));
198+
unsigned long addr = (unsigned long)cpu_addr;
199199
unsigned long off = vma->vm_pgoff;
200+
unsigned long pfn;
200201
int ret = -ENXIO;
201202

203+
if (!plat_device_is_coherent(dev) && !hw_coherentio)
204+
addr = CAC_ADDR(addr);
205+
206+
pfn = page_to_pfn(virt_to_page((void *)addr));
207+
202208
if (dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs))
203209
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
204210
else

0 commit comments

Comments
 (0)