summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorRoy Pledge <Roy.Pledge@freescale.com>2014-12-02 16:19:07 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:41:49 (GMT)
commit6db59e857fc5a41892252b6c2c9a9b8788ad0c04 (patch)
treece8ee0307f0019636b3f7b4f740dbfb6d14203d1 /drivers/staging
parent801a1ef52d3d95d2f0b035f3828baadaccf3bc8c (diff)
downloadlinux-fsl-qoriq-6db59e857fc5a41892252b6c2c9a9b8788ad0c04.tar.xz
Reserve proper length in processes VMA when mapping USDPAA memory
USDPAA memory mapping were not properly reserving the entire length of the memory area when perfoming mapping of not power of 4 regions. This causes issues if the choosen address overlapped with an existing memory area. Signed-off-by: Roy Pledge <Roy.Pledge@freescale.com> Change-Id: I078d12279a43ddf3fc7c5de4b9e4a932d588832e Reviewed-on: http://git.am.freescale.net:8181/25329 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Geoff Thorpe <Geoff.Thorpe@freescale.com> Reviewed-by: Matthew Weigel <Matthew.Weigel@freescale.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/fsl_qbman/fsl_usdpaa.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/staging/fsl_qbman/fsl_usdpaa.c b/drivers/staging/fsl_qbman/fsl_usdpaa.c
index e5e4fa2..8cfdabe 100644
--- a/drivers/staging/fsl_qbman/fsl_usdpaa.c
+++ b/drivers/staging/fsl_qbman/fsl_usdpaa.c
@@ -766,14 +766,13 @@ static unsigned long usdpaa_get_unmapped_area(struct file *file,
if (len % PAGE_SIZE)
return -EINVAL;
- /* Need to align to largest pagesize to ensure all pages
- will be correctly aligned */
- len = largest_page_size(len);
-
if (!len)
return -EINVAL;
- addr = USDPAA_MEM_ROUNDUP(addr, len);
+ /* Need to align the address to the largest pagesize of the mapping
+ * because the MMU requires the virtual address to have the same
+ * alignment as the physical address */
+ addr = USDPAA_MEM_ROUNDUP(addr, largest_page_size(len));
vma = find_vma(current->mm, addr);
/* Keep searching until we reach the end of currently-used virtual
* address-space or we find a big enough gap. */
@@ -781,7 +780,7 @@ static unsigned long usdpaa_get_unmapped_area(struct file *file,
if ((addr + len) < vma->vm_start)
return addr;
- addr = USDPAA_MEM_ROUNDUP(vma->vm_end, len);
+ addr = USDPAA_MEM_ROUNDUP(vma->vm_end, largest_page_size(len));
vma = vma->vm_next;
}
if ((TASK_SIZE - len) < addr)