msm: kgsl: Use the right physical addresses in NOMMU mode

In NOMMU mode the gpuaddr was set to the physaddr
for the memdesc which worked great until the memory
wasn't allocated by KGSL, at which point it blew up.
We already went through the due dilligence to turn
all memdescs into sglists, so use the sglist to get the
physaddr (and thus the gpuaddr).  Check to make sure
that we're not trying to map a real sglist (more than one
entry) and if we are, then loudly fail.

Change-Id: Ic0dedbad5d401c505949c92d9a7795f3260dbabb
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
Jordan Crouse
2012-02-06 10:18:23 -07:00
parent e3f80eaff7
commit 40861a40bb

View File

@@ -535,9 +535,16 @@ kgsl_mmu_map(struct kgsl_pagetable *pagetable,
int ret; int ret;
if (kgsl_mmu_type == KGSL_MMU_TYPE_NONE) { if (kgsl_mmu_type == KGSL_MMU_TYPE_NONE) {
memdesc->gpuaddr = memdesc->physaddr; if (memdesc->sglen == 1) {
return 0; memdesc->gpuaddr = sg_phys(memdesc->sg);
return 0;
} else {
KGSL_CORE_ERR("Memory is not contigious "
"(sglen = %d)\n", memdesc->sglen);
return -EINVAL;
}
} }
memdesc->gpuaddr = gen_pool_alloc_aligned(pagetable->pool, memdesc->gpuaddr = gen_pool_alloc_aligned(pagetable->pool,
memdesc->size, KGSL_MMU_ALIGN_SHIFT); memdesc->size, KGSL_MMU_ALIGN_SHIFT);