gpu: ion: Do not allow cached IOMMU mappings.
Cached IOMMU mapping is not supported.
Add check for clients trying to map buffers
into IOMMU as cached and return error.
Change-Id: Ic63a24bf651d613933633cd81143701f66df566c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index a6c36c8..76e10c8 100644
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
@@ -613,6 +613,11 @@
struct ion_iommu_map *iommu_map;
int ret = 0;
+ if (ION_IS_CACHED(flags)) {
+ pr_err("%s: Cannot map iommu as cached.\n", __func__);
+ return -EINVAL;
+ }
+
mutex_lock(&client->lock);
if (!ion_handle_validate(client, handle)) {
pr_err("%s: invalid handle passed to map_kernel.\n",
@@ -631,11 +636,6 @@
goto out;
}
- if (ion_validate_buffer_flags(buffer, flags)) {
- ret = -EEXIST;
- goto out;
- }
-
/*
* If clients don't want a custom iova length, just use whatever
* the buffer size is