diff options
author | Roy Pledge <Roy.Pledge@freescale.com> | 2015-07-14 21:22:02 (GMT) |
---|---|---|
committer | Roy Pledge <Roy.Pledge@freescale.com> | 2015-11-03 19:24:40 (GMT) |
commit | e98f36e86bdfbeb1728ab0de4f2be367d6283963 (patch) | |
tree | 5852c15132ec6d6c8631ed30d93a16ceb09d9ae7 /drivers/staging/fsl_qbman | |
parent | 67ef9d132bb8d6e91863160e56ec62291c8b2be7 (diff) | |
download | linux-fsl-qoriq-e98f36e86bdfbeb1728ab0de4f2be367d6283963.tar.xz |
fsl_usdpaa: Remove TLB entries when unmapping memory
TLB1 entries must be removed when unmapping a DMA map from a
process so they don't point to the wrong physical memory if
a new map reuses the same virtual address
Signed-off-by: Roy Pledge <Roy.Pledge@freescale.com>
Diffstat (limited to 'drivers/staging/fsl_qbman')
-rw-r--r-- | drivers/staging/fsl_qbman/fsl_usdpaa.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/staging/fsl_qbman/fsl_usdpaa.c b/drivers/staging/fsl_qbman/fsl_usdpaa.c index 55223cd..0c54657 100644 --- a/drivers/staging/fsl_qbman/fsl_usdpaa.c +++ b/drivers/staging/fsl_qbman/fsl_usdpaa.c @@ -20,6 +20,7 @@ #include <linux/memblock.h> #include <linux/slab.h> #include <linux/mman.h> +#include <mm/mmu_decl.h> /* Physical address range of the memory reservation, exported for mm/mem.c */ static u64 phys_start; @@ -1117,6 +1118,7 @@ static long ioctl_dma_unmap(struct ctx *ctx, void __user *arg) struct mem_fragment *current_frag; size_t sz; unsigned long base; + unsigned long vaddr; down_write(¤t->mm->mmap_sem); vma = find_vma(current->mm, (unsigned long)arg); @@ -1150,9 +1152,19 @@ map_match: } current_frag = map->root_frag; + vaddr = (unsigned long) map->virt_addr; for (i = 0; i < map->frag_count; i++) { DPA_ASSERT(current_frag->refs > 0); --current_frag->refs; + /* + * Make sure we invalidate the TLB entry for + * this fragment, otherwise a remap of a different + * page to this vaddr would give acces to an + * incorrect piece of memory + */ + cleartlbcam(vaddr, mfspr(SPRN_PID)); + + vaddr += current_frag->len; current_frag = list_entry(current_frag->list.prev, struct mem_fragment, list); } |