Merge "msm: kgsl: Deregister gpu address on memdesc_sg_virt failure"

tirimbino
qctecmdr 4 years ago committed by Gerrit - the friendly Code Review server
commit 7ca2b21c2a
  1. 10
      drivers/gpu/msm/kgsl.c
  2. 3
      drivers/gpu/msm/kgsl_mmu.c

@ -2382,6 +2382,7 @@ static int kgsl_setup_anon_useraddr(struct kgsl_pagetable *pagetable,
size_t offset, size_t size)
{
/* Map an anonymous memory chunk */
int ret;
if (size == 0 || offset != 0 ||
!IS_ALIGNED(size, PAGE_SIZE))
@ -2392,8 +2393,6 @@ static int kgsl_setup_anon_useraddr(struct kgsl_pagetable *pagetable,
entry->memdesc.flags |= (uint64_t)KGSL_MEMFLAGS_USERMEM_ADDR;
if (kgsl_memdesc_use_cpu_map(&entry->memdesc)) {
int ret;
/* Register the address in the database */
ret = kgsl_mmu_set_svm_region(pagetable,
(uint64_t) hostptr, (uint64_t) size);
@ -2404,7 +2403,12 @@ static int kgsl_setup_anon_useraddr(struct kgsl_pagetable *pagetable,
entry->memdesc.gpuaddr = (uint64_t) hostptr;
}
return memdesc_sg_virt(&entry->memdesc, hostptr);
ret = memdesc_sg_virt(&entry->memdesc, hostptr);
if (ret && kgsl_memdesc_use_cpu_map(&entry->memdesc))
kgsl_mmu_put_gpuaddr(&entry->memdesc);
return ret;
}
#ifdef CONFIG_DMA_SHARED_BUFFER

@ -439,7 +439,8 @@ void kgsl_mmu_put_gpuaddr(struct kgsl_memdesc *memdesc)
if (memdesc->size == 0 || memdesc->gpuaddr == 0)
return;
if (!kgsl_memdesc_is_global(memdesc))
if (!kgsl_memdesc_is_global(memdesc) &&
(KGSL_MEMDESC_MAPPED & memdesc->priv))
unmap_fail = kgsl_mmu_unmap(pagetable, memdesc);
/*

Loading…
Cancel
Save