Commit 1dbcbfa7 authored by Hari Kanigeri's avatar Hari Kanigeri

SYSLINK:proc-dmm fixes for user space buffers

This patch fixes the DMM for user space buffer.
The Ducati virtual address that was mapped was
initialized to 0 instead of using the one that is
passed to the map function. Also, this includes
the fix for VM_IO part where teh va was incremented
twice.
Signed-off-by: default avatarHari Kanigeri <h-kanigeri2@ti.com>

Signed-off-by:
parent f6c87f30
...@@ -620,7 +620,7 @@ int ducati_mem_map(u32 mpu_addr, u32 ul_virt_addr, ...@@ -620,7 +620,7 @@ int ducati_mem_map(u32 mpu_addr, u32 ul_virt_addr,
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
struct task_struct *curr_task = current; struct task_struct *curr_task = current;
u32 write = 0; u32 write = 0;
u32 va = 0; u32 da = ul_virt_addr;
u32 pa = 0; u32 pa = 0;
int pg_i = 0; int pg_i = 0;
int pg_num = 0; int pg_num = 0;
...@@ -700,10 +700,9 @@ int ducati_mem_map(u32 mpu_addr, u32 ul_virt_addr, ...@@ -700,10 +700,9 @@ int ducati_mem_map(u32 mpu_addr, u32 ul_virt_addr,
} }
if (vma->vm_flags & VM_IO) { if (vma->vm_flags & VM_IO) {
num_usr_pages = num_bytes / PAGE_SIZE; num_usr_pages = num_bytes / PAGE_SIZE;
va = mpu_addr;
/* Get the physical addresses for user buffer */ /* Get the physical addresses for user buffer */
for (pg_i = 0; pg_i < num_usr_pages; pg_i++) { for (pg_i = 0; pg_i < num_usr_pages; pg_i++) {
pa = user_va2pa(mm, va); pa = user_va2pa(mm, mpu_addr);
if (!pa) { if (!pa) {
status = -EFAULT; status = -EFAULT;
pr_err("DSPBRIDGE: VM_IO mapping physical" pr_err("DSPBRIDGE: VM_IO mapping physical"
...@@ -718,12 +717,11 @@ int ducati_mem_map(u32 mpu_addr, u32 ul_virt_addr, ...@@ -718,12 +717,11 @@ int ducati_mem_map(u32 mpu_addr, u32 ul_virt_addr,
bad_page_dump(pa, pg); bad_page_dump(pa, pg);
} }
} }
status = pte_set(pa, va, HW_PAGE_SIZE_4KB, &hw_attrs); status = pte_set(pa, da, HW_PAGE_SIZE_4KB, &hw_attrs);
if (WARN_ON(status < 0)) if (WARN_ON(status < 0))
break; break;
va += HW_PAGE_SIZE_4KB; mpu_addr += HW_PAGE_SIZE_4KB;
va += HW_PAGE_SIZE_4KB; da += HW_PAGE_SIZE_4KB;
pa += HW_PAGE_SIZE_4KB;
} }
} else { } else {
num_usr_pages = num_bytes / PAGE_SIZE; num_usr_pages = num_bytes / PAGE_SIZE;
...@@ -741,11 +739,11 @@ int ducati_mem_map(u32 mpu_addr, u32 ul_virt_addr, ...@@ -741,11 +739,11 @@ int ducati_mem_map(u32 mpu_addr, u32 ul_virt_addr,
bad_page_dump(page_to_phys(mappedPage), bad_page_dump(page_to_phys(mappedPage),
mappedPage); mappedPage);
} }
status = pte_set(page_to_phys(mappedPage), va, status = pte_set(page_to_phys(mappedPage), da,
HW_PAGE_SIZE_4KB, &hw_attrs); HW_PAGE_SIZE_4KB, &hw_attrs);
if (WARN_ON(status < 0)) if (WARN_ON(status < 0))
break; break;
va += HW_PAGE_SIZE_4KB; da += HW_PAGE_SIZE_4KB;
mpu_addr += HW_PAGE_SIZE_4KB; mpu_addr += HW_PAGE_SIZE_4KB;
} else { } else {
pr_err("DSPBRIDGE: get_user_pages FAILED," pr_err("DSPBRIDGE: get_user_pages FAILED,"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment