mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 16:16:15 -04:00
msm: kgsl: Fix DMA API warnings
Currently, we call dma_buf_map_attachment() with dma direction DMA_TO_DEVICE and DMA_FROM_DEVICE while calling dma_buf_unmap_attachment(). A mismatch of DMA direction during map, unmap or sync of a buffer triggers a warning when CONFIG_DMA_API_DEBUG is enabled like the below one: [6.994847] WARNING: CPU: 7 PID: 785 at /buildbot/src/partner-android/r-dev-msm-4.14/private/msm-google/lib/dma-debug.c:1153 check_unmap+0x664/0xd3c [6.994852] Kernel panic - not syncing: panic_on_warn set ... [6.994852] [6.994859] CPU: 7 PID: 785 Comm: android.hardwar Tainted: G S O 4.14.117-g3254dd9dae41-ab6213388 #1 [6.994862] Hardware name: Qualcomm Technologies, Inc. [6.994866] Call trace: [6.994873] dump_backtrace+0x0/0x1f0 [6.994877] show_stack+0x14/0x1c [6.994883] dump_stack+0xa8/0xe0 [6.994887] panic+0x1ac/0x3a4 [6.994890] __stack_chk_fail+0x0/0x18 [6.994893] report_bug+0x148/0x184 [6.994896] bug_handler+0x28/0x84 [6.994899] brk_handler+0x80/0x13c [6.994902] do_debug_exception+0xc4/0x14c [6.994905] el1_dbg+0x18/0x74 [6.994907] check_unmap+0x664/0xd3c [6.994911] debug_dma_unmap_sg+0x8c/0x160 [6.994916] ion_unmap_dma_buf+0x1f4/0x270 [6.994920] dma_buf_unmap_attachment+0x24/0x38 [6.994925] kgsl_destroy_ion+0xa8/0xd0 [6.994928] kgsl_mem_entry_destroy+0x8c/0x14c [6.994932] kgsl_ioctl_gpuobj_free+0x388/0x420 [6.994936] kgsl_ioctl_helper+0x118/0x148 [6.994939] kgsl_ioctl+0x30/0xbc [6.994942] do_vfs_ioctl+0x5cc/0x910 [6.994945] SyS_ioctl+0x88/0x94 [6.994948] el0_svc_naked+0x34/0x38 We can fix these warnings by using a consistent DMA direction during map, unmap and sync which is DMA_BIDIRECTIONAL because GPU may read or write from this buffer. Change-Id: I3f9c7c27418e5e7d0db44761fa68d27560aa8aaf Signed-off-by: Akhil P Oommen <akhilpo@codeaurora.org>
This commit is contained in:
parent
653a9c02c2
commit
badec91c76
1 changed files with 2 additions and 2 deletions
|
|
@ -316,7 +316,7 @@ static void kgsl_destroy_ion(struct kgsl_dma_buf_meta *meta)
|
|||
if (meta != NULL) {
|
||||
remove_dmabuf_list(meta);
|
||||
dma_buf_unmap_attachment(meta->attach, meta->table,
|
||||
DMA_FROM_DEVICE);
|
||||
DMA_BIDIRECTIONAL);
|
||||
dma_buf_detach(meta->dmabuf, meta->attach);
|
||||
dma_buf_put(meta->dmabuf);
|
||||
kfree(meta);
|
||||
|
|
@ -2741,7 +2741,7 @@ static int kgsl_setup_dma_buf(struct kgsl_device *device,
|
|||
entry->memdesc.flags &= ~((uint64_t) KGSL_MEMFLAGS_USE_CPU_MAP);
|
||||
entry->memdesc.flags |= (uint64_t)KGSL_MEMFLAGS_USERMEM_ION;
|
||||
|
||||
sg_table = dma_buf_map_attachment(attach, DMA_TO_DEVICE);
|
||||
sg_table = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
|
||||
|
||||
if (IS_ERR_OR_NULL(sg_table)) {
|
||||
ret = PTR_ERR(sg_table);
|
||||
|
|
|
|||
Loading…
Reference in a new issue