diff options
author | Hareesh Gundu <hareeshg@codeaurora.org> | 2016-03-11 00:36:33 +0530 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-25 16:03:57 -0700 |
commit | aa06bbb30e62cd770756c9dc2da758a75962dde0 (patch) | |
tree | 53d61a1a2b17626662a288d9ae651676b436a99d /drivers/gpu/msm/kgsl_iommu.c | |
parent | e4d22fbab14df9f08e98c5f0637172103d9877eb (diff) |
msm: kgsl: Allocate guard page on demand
Allocate guard page when the first buffer is
mapped into the IOMMU. This also ensures that
the guard page gets allocated if the guard page
mmu feature is enabled.
CRs-Fixed: 988093
Change-Id: Id97492707463a1f15a4bf1c67b9c0f03214e6283
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Diffstat (limited to 'drivers/gpu/msm/kgsl_iommu.c')
-rw-r--r-- | drivers/gpu/msm/kgsl_iommu.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/gpu/msm/kgsl_iommu.c b/drivers/gpu/msm/kgsl_iommu.c index 95ebe628f823..aecb62cd1543 100644 --- a/drivers/gpu/msm/kgsl_iommu.c +++ b/drivers/gpu/msm/kgsl_iommu.c @@ -1268,16 +1268,6 @@ static int kgsl_iommu_init(struct kgsl_mmu *mmu) } } - if (MMU_FEATURE(mmu, KGSL_MMU_NEED_GUARD_PAGE) - && (kgsl_guard_page == NULL)) { - kgsl_guard_page = alloc_page(GFP_KERNEL | __GFP_ZERO | - __GFP_HIGHMEM); - if (kgsl_guard_page == NULL) { - status = -ENOMEM; - goto done; - } - } - kgsl_iommu_add_global(mmu, &iommu->setstate); done: @@ -1466,8 +1456,16 @@ static int _iommu_map_guard_page(struct kgsl_pagetable *pt, sg = kgsl_secure_guard_page_memdesc.sgt->sgl; physaddr = page_to_phys(sg_page(sg)); - } else + } else { + if (kgsl_guard_page == NULL) { + kgsl_guard_page = alloc_page(GFP_KERNEL | __GFP_ZERO | + __GFP_HIGHMEM); + if (kgsl_guard_page == NULL) + return -ENOMEM; + } + physaddr = page_to_phys(kgsl_guard_page); + } return _iommu_map_sync_pc(pt, memdesc, gpuaddr, physaddr, kgsl_memdesc_guard_page_size(pt->mmu, memdesc), |