From aa06bbb30e62cd770756c9dc2da758a75962dde0 Mon Sep 17 00:00:00 2001 From: Hareesh Gundu Date: Fri, 11 Mar 2016 00:36:33 +0530 Subject: 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 --- drivers/gpu/msm/kgsl_iommu.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'drivers/gpu') 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), -- cgit v1.2.3