mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm: kgsl: use readonly mappings on the iommu
Userspace passes a flag KGSL_MEMFLAGS_GPUREADONLY when the gpu should not write to a memory region. Use this flag to control IOMMU_WRITE permissions on the buffer. Change-Id: I5d3fc615dc36687252e2242f63fe74d6ce1c4fbc Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org> Signed-off-by: Sakshi Agrawal <sakshia@codeaurora.org>
This commit is contained in:
parent
b7fbe70a95
commit
e503522454
1 changed files with 5 additions and 2 deletions
|
@ -1138,19 +1138,22 @@ kgsl_iommu_map(void *mmu_specific_pt,
|
|||
unsigned int iommu_virt_addr;
|
||||
struct kgsl_iommu_pt *iommu_pt = mmu_specific_pt;
|
||||
int size = kgsl_sg_size(memdesc->sg, memdesc->sglen);
|
||||
unsigned int iommu_flags = IOMMU_READ;
|
||||
|
||||
BUG_ON(NULL == iommu_pt);
|
||||
|
||||
if (protflags & GSL_PT_PAGE_WV)
|
||||
iommu_flags |= IOMMU_WRITE;
|
||||
|
||||
iommu_virt_addr = memdesc->gpuaddr;
|
||||
|
||||
ret = iommu_map_range(iommu_pt->domain, iommu_virt_addr, memdesc->sg,
|
||||
size, (IOMMU_READ | IOMMU_WRITE));
|
||||
size, iommu_flags);
|
||||
if (ret) {
|
||||
KGSL_CORE_ERR("iommu_map_range(%p, %x, %p, %d, %d) "
|
||||
"failed with err: %d\n", iommu_pt->domain,
|
||||
iommu_virt_addr, memdesc->sg, size,
|
||||
(IOMMU_READ | IOMMU_WRITE), ret);
|
||||
iommu_flags, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue