summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorSunil Khatri <sunilkh@codeaurora.org>2018-07-19 17:10:39 +0530
committerSunil Khatri <sunilkh@codeaurora.org>2018-10-08 18:58:59 +0530
commit3d69d2b9493206838d2c2d7a41b71321a73a802a (patch)
tree21d67d12b1cc0b4ff9d24020afef853681f0a648 /drivers/gpu
parent727593cbf7ebb6782b2b3b45a951cc8ccc03a788 (diff)
msm: kgsl: Add a property to find alignment of secure buffers
Add a property to determine the hardware alignment constraint on secure buffers. XPUv2 and below have a minimum requirement of 1 MBytes alignment and hence driver should allocate memory with minimum alignment on size. Change-Id: Ie3ca5da489bc94ae57ddc6695e402463fd7a88c2 Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/msm/kgsl.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c
index 02f0cb7eb16c..41c9faf3bdd5 100644
--- a/drivers/gpu/msm/kgsl.c
+++ b/drivers/gpu/msm/kgsl.c
@@ -1403,6 +1403,28 @@ long kgsl_ioctl_device_getproperty(struct kgsl_device_private *dev_priv,
kgsl_context_put(context);
break;
}
+ case KGSL_PROP_SECURE_BUFFER_ALIGNMENT:
+ {
+ unsigned int align;
+
+ if (param->sizebytes != sizeof(unsigned int)) {
+ result = -EINVAL;
+ break;
+ }
+ /*
+ * XPUv2 impose the constraint of 1MB memory alignment,
+ * on the other hand Hypervisor does not have such
+ * constraints. So driver should fulfill such
+ * requirements when allocating secure memory.
+ */
+ align = MMU_FEATURE(&dev_priv->device->mmu,
+ KGSL_MMU_HYP_SECURE_ALLOC) ? PAGE_SIZE : SZ_1M;
+
+ if (copy_to_user(param->value, &align, sizeof(align)))
+ result = -EFAULT;
+
+ break;
+ }
default:
if (is_compat_task())
result = dev_priv->device->ftbl->getproperty_compat(