summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorKrishna Reddy <vdumpa@nvidia.com>2014-04-16 17:36:07 -0700
committerSeema Khowala <seemaj@nvidia.com>2014-04-23 14:05:55 -0700
commite2e8d40f2953825063f0421d45b60969bb27f28a (patch)
tree0e12c6a25b34c947615edfa9370eaad04d5a30fa /drivers/video
parentcea4309c457f298e297ca67b0419f7c7020b8630 (diff)
video: tegra: nvmap: fix incorrect zapping of handles
Bug 1444151 Change-Id: I0d385d36bd62f6e60c6ad1296a60fc997bc13e80 Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/397420
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/tegra/nvmap/nvmap_mm.c28
-rw-r--r--drivers/video/tegra/nvmap/nvmap_priv.h5
2 files changed, 22 insertions, 11 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_mm.c b/drivers/video/tegra/nvmap/nvmap_mm.c
index 0c6eba223163..8626ffa86450 100644
--- a/drivers/video/tegra/nvmap/nvmap_mm.c
+++ b/drivers/video/tegra/nvmap/nvmap_mm.c
@@ -139,9 +139,7 @@ int nvmap_do_cache_maint_list(struct nvmap_handle **handles, u32 *offsets,
return 0;
}
-void nvmap_zap_handle(struct nvmap_handle *handle,
- u32 offset,
- u32 size)
+void nvmap_zap_handle(struct nvmap_handle *handle, u32 offset, u32 size)
{
struct list_head *vmas;
struct nvmap_vma_list *vma_list;
@@ -155,21 +153,29 @@ void nvmap_zap_handle(struct nvmap_handle *handle,
size = handle->size;
}
- vmas = &handle->pgalloc.vmas;
mutex_lock(&handle->lock);
+ vmas = &handle->pgalloc.vmas;
list_for_each_entry(vma_list, vmas, list) {
+ struct nvmap_vma_priv *priv;
+
vma = vma_list->vma;
- zap_page_range(vma, vma->vm_start + offset,
- offset + size - vma->vm_start,
- NULL);
+ priv = vma->vm_private_data;
+ if (priv->offs || vma->vm_pgoff)
+ /* vma mapping starts in the middle of handle memory.
+ * zapping needs special care. zap entire range for now.
+ * FIXME: optimze zapping.
+ */
+ zap_page_range(vma, vma->vm_start,
+ vma->vm_end - vma->vm_start, NULL);
+ else
+ zap_page_range(vma, vma->vm_start + offset,
+ size, NULL);
}
mutex_unlock(&handle->lock);
}
-void nvmap_zap_handles(struct nvmap_handle **handles,
- u32 *offsets,
- u32 *sizes,
- u32 nr)
+void nvmap_zap_handles(struct nvmap_handle **handles, u32 *offsets,
+ u32 *sizes, u32 nr)
{
int i;
diff --git a/drivers/video/tegra/nvmap/nvmap_priv.h b/drivers/video/tegra/nvmap/nvmap_priv.h
index b04a82829582..81a5183f81f3 100644
--- a/drivers/video/tegra/nvmap/nvmap_priv.h
+++ b/drivers/video/tegra/nvmap/nvmap_priv.h
@@ -501,5 +501,10 @@ static inline struct page **nvmap_pages(struct page **pg_pages, u32 nr_pages)
return pages;
}
+void nvmap_zap_handle(struct nvmap_handle *handle, u32 offset, u32 size);
+
+void nvmap_zap_handles(struct nvmap_handle **handles, u32 *offsets,
+ u32 *sizes, u32 nr);
+
void nvmap_vma_open(struct vm_area_struct *vma);
#endif /* __VIDEO_TEGRA_NVMAP_NVMAP_H */