msm: kgsl: don't clear gpuaddr when unmapping global mappings

Memory mapped through kgsl_mmu_map_global() is supposed to have
the same gpu address in all pagetables. And the memdesc will
persist beyond the lifetime of any single pagetable.
Therefore, memdesc->gpuaddr should not be zeroed for these
memdescs.
This commit is contained in:
securecrt 2012-07-25 21:08:59 +08:00
parent 121a2a91a5
commit 41b9064ec2
2 changed files with 8 additions and 0 deletions

View File

@ -592,6 +592,11 @@ kgsl_mmu_unmap(struct kgsl_pagetable *pagetable,
memdesc->gpuaddr & KGSL_MMU_ALIGN_MASK,
memdesc->size);
/*
* Don't clear the gpuaddr on global mappings because they
* may be in use by other pagetables
*/
if (!(memdesc->priv & KGSL_MEMFLAGS_GLOBAL))
memdesc->gpuaddr = 0;
return 0;
}
@ -624,6 +629,7 @@ int kgsl_mmu_map_global(struct kgsl_pagetable *pagetable,
gpuaddr, memdesc->gpuaddr);
goto error_unmap;
}
memdesc->priv |= KGSL_MEMFLAGS_GLOBAL;
return result;
error_unmap:
kgsl_mmu_unmap(pagetable, memdesc);

View File

@ -33,6 +33,8 @@ struct kgsl_process_private;
/** Set if the memdesc describes cached memory */
#define KGSL_MEMFLAGS_CACHED 0x00000001
/** Set if the memdesc is mapped into all pagetables */
#define KGSL_MEMFLAGS_GLOBAL 0x00000002
extern struct kgsl_memdesc_ops kgsl_vmalloc_ops;