msm: kgsl: Add support for GPU System Cache usage
Activate and deactivate the GPU slice in the system
cache upon GPU power collapse/restore. Configure the
SCIDs for the slices used by the GPU. Currently, the
GPU uses one slice for all its blocks.
Also enable the right memory attributes for a buffer
to be allocated into the system cache. The memory
attributes used are outer-cacheable, read-allocate,
write-no-allocate.
CRs-Fixed: 1081617
Change-Id: I54d5ddce8056c0ef491a21bb19ce9fd9e30a0540
Signed-off-by: Sushmita Susheelendra <ssusheel@codeaurora.org>
diff --git a/drivers/gpu/msm/kgsl_iommu.c b/drivers/gpu/msm/kgsl_iommu.c
index b32cb63..fdb6e0e 100644
--- a/drivers/gpu/msm/kgsl_iommu.c
+++ b/drivers/gpu/msm/kgsl_iommu.c
@@ -41,6 +41,14 @@
(((_a) >= KGSL_IOMMU_GLOBAL_MEM_BASE) && \
((_a) < (KGSL_IOMMU_GLOBAL_MEM_BASE + KGSL_IOMMU_GLOBAL_MEM_SIZE)))
+/*
+ * Flag to set SMMU memory attributes required to
+ * enable system cache for GPU transactions.
+ */
+#ifndef IOMMU_USE_UPSTREAM_HINT
+#define IOMMU_USE_UPSTREAM_HINT 0
+#endif
+
static struct kgsl_mmu_pt_ops iommu_pt_ops;
static bool need_iommu_sync;
@@ -1709,7 +1717,8 @@
static unsigned int _get_protection_flags(struct kgsl_memdesc *memdesc)
{
- unsigned int flags = IOMMU_READ | IOMMU_WRITE | IOMMU_NOEXEC;
+ unsigned int flags = IOMMU_READ | IOMMU_WRITE |
+ IOMMU_NOEXEC | IOMMU_USE_UPSTREAM_HINT;
if (memdesc->flags & KGSL_MEMFLAGS_GPUREADONLY)
flags &= ~IOMMU_WRITE;