Commit c3ef4b8c authored by Lucas Stach's avatar Lucas Stach

drm/etnaviv: wire up iova handling in new cmdbuf abstraction

Don't call the IOMMU directly, but go through the new cmdbuf abstraction.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Reviewed-by: default avatarChristian Gmeiner <christian.gmeiner@gmail.com>
parent ea1f5729
...@@ -126,7 +126,7 @@ static void etnaviv_buffer_dump(struct etnaviv_gpu *gpu, ...@@ -126,7 +126,7 @@ static void etnaviv_buffer_dump(struct etnaviv_gpu *gpu,
u32 *ptr = buf->vaddr + off; u32 *ptr = buf->vaddr + off;
dev_info(gpu->dev, "virt %p phys 0x%08x free 0x%08x\n", dev_info(gpu->dev, "virt %p phys 0x%08x free 0x%08x\n",
ptr, etnaviv_iommu_get_cmdbuf_va(gpu, buf) + off, size - len * 4 - off); ptr, etnaviv_cmdbuf_get_va(buf) + off, size - len * 4 - off);
print_hex_dump(KERN_INFO, "cmd ", DUMP_PREFIX_OFFSET, 16, 4, print_hex_dump(KERN_INFO, "cmd ", DUMP_PREFIX_OFFSET, 16, 4,
ptr, len * 4, 0); ptr, len * 4, 0);
...@@ -159,7 +159,7 @@ static u32 etnaviv_buffer_reserve(struct etnaviv_gpu *gpu, ...@@ -159,7 +159,7 @@ static u32 etnaviv_buffer_reserve(struct etnaviv_gpu *gpu,
if (buffer->user_size + cmd_dwords * sizeof(u64) > buffer->size) if (buffer->user_size + cmd_dwords * sizeof(u64) > buffer->size)
buffer->user_size = 0; buffer->user_size = 0;
return etnaviv_iommu_get_cmdbuf_va(gpu, buffer) + buffer->user_size; return etnaviv_cmdbuf_get_va(buffer) + buffer->user_size;
} }
u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu) u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu)
...@@ -170,7 +170,7 @@ u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu) ...@@ -170,7 +170,7 @@ u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu)
buffer->user_size = 0; buffer->user_size = 0;
CMD_WAIT(buffer); CMD_WAIT(buffer);
CMD_LINK(buffer, 2, etnaviv_iommu_get_cmdbuf_va(gpu, buffer) + CMD_LINK(buffer, 2, etnaviv_cmdbuf_get_va(buffer) +
buffer->user_size - 4); buffer->user_size - 4);
return buffer->user_size / 8; return buffer->user_size / 8;
...@@ -262,7 +262,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, ...@@ -262,7 +262,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
if (drm_debug & DRM_UT_DRIVER) if (drm_debug & DRM_UT_DRIVER)
etnaviv_buffer_dump(gpu, buffer, 0, 0x50); etnaviv_buffer_dump(gpu, buffer, 0, 0x50);
link_target = etnaviv_iommu_get_cmdbuf_va(gpu, cmdbuf); link_target = etnaviv_cmdbuf_get_va(cmdbuf);
link_dwords = cmdbuf->size / 8; link_dwords = cmdbuf->size / 8;
/* /*
...@@ -356,12 +356,13 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, ...@@ -356,12 +356,13 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
CMD_LOAD_STATE(buffer, VIVS_GL_EVENT, VIVS_GL_EVENT_EVENT_ID(event) | CMD_LOAD_STATE(buffer, VIVS_GL_EVENT, VIVS_GL_EVENT_EVENT_ID(event) |
VIVS_GL_EVENT_FROM_PE); VIVS_GL_EVENT_FROM_PE);
CMD_WAIT(buffer); CMD_WAIT(buffer);
CMD_LINK(buffer, 2, etnaviv_iommu_get_cmdbuf_va(gpu, buffer) + CMD_LINK(buffer, 2, etnaviv_cmdbuf_get_va(buffer) +
buffer->user_size - 4); buffer->user_size - 4);
if (drm_debug & DRM_UT_DRIVER) if (drm_debug & DRM_UT_DRIVER)
pr_info("stream link to 0x%08x @ 0x%08x %p\n", pr_info("stream link to 0x%08x @ 0x%08x %p\n",
return_target, etnaviv_iommu_get_cmdbuf_va(gpu, cmdbuf), cmdbuf->vaddr); return_target, etnaviv_cmdbuf_get_va(cmdbuf),
cmdbuf->vaddr);
if (drm_debug & DRM_UT_DRIVER) { if (drm_debug & DRM_UT_DRIVER) {
print_hex_dump(KERN_INFO, "cmd ", DUMP_PREFIX_OFFSET, 16, 4, print_hex_dump(KERN_INFO, "cmd ", DUMP_PREFIX_OFFSET, 16, 4,
......
...@@ -52,3 +52,8 @@ void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf) ...@@ -52,3 +52,8 @@ void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf)
cmdbuf->paddr); cmdbuf->paddr);
kfree(cmdbuf); kfree(cmdbuf);
} }
u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf)
{
return etnaviv_iommu_get_cmdbuf_va(buf->gpu, buf);
}
...@@ -43,4 +43,6 @@ struct etnaviv_cmdbuf { ...@@ -43,4 +43,6 @@ struct etnaviv_cmdbuf {
struct etnaviv_vram_mapping *bo_map[0]; struct etnaviv_vram_mapping *bo_map[0];
}; };
u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf);
#endif /* __ETNAVIV_CMDBUF_H__ */ #endif /* __ETNAVIV_CMDBUF_H__ */
...@@ -178,12 +178,11 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu) ...@@ -178,12 +178,11 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
etnaviv_core_dump_mmu(&iter, gpu, mmu_size); etnaviv_core_dump_mmu(&iter, gpu, mmu_size);
etnaviv_core_dump_mem(&iter, ETDUMP_BUF_RING, gpu->buffer->vaddr, etnaviv_core_dump_mem(&iter, ETDUMP_BUF_RING, gpu->buffer->vaddr,
gpu->buffer->size, gpu->buffer->size,
etnaviv_iommu_get_cmdbuf_va(gpu, gpu->buffer)); etnaviv_cmdbuf_get_va(gpu->buffer));
list_for_each_entry(cmd, &gpu->active_cmd_list, node) list_for_each_entry(cmd, &gpu->active_cmd_list, node)
etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD, cmd->vaddr, etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD, cmd->vaddr,
cmd->size, cmd->size, etnaviv_cmdbuf_get_va(cmd));
etnaviv_iommu_get_cmdbuf_va(gpu, cmd));
/* Reserve space for the bomap */ /* Reserve space for the bomap */
if (n_bomap_pages) { if (n_bomap_pages) {
......
...@@ -629,7 +629,7 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu) ...@@ -629,7 +629,7 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
prefetch = etnaviv_buffer_init(gpu); prefetch = etnaviv_buffer_init(gpu);
gpu_write(gpu, VIVS_HI_INTR_ENBL, ~0U); gpu_write(gpu, VIVS_HI_INTR_ENBL, ~0U);
etnaviv_gpu_start_fe(gpu, etnaviv_iommu_get_cmdbuf_va(gpu, gpu->buffer), etnaviv_gpu_start_fe(gpu, etnaviv_cmdbuf_get_va(gpu->buffer),
prefetch); prefetch);
} }
...@@ -703,7 +703,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) ...@@ -703,7 +703,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
} }
if (gpu->mmu->version == ETNAVIV_IOMMU_V1 && if (gpu->mmu->version == ETNAVIV_IOMMU_V1 &&
gpu->buffer->paddr - gpu->memory_base > 0x80000000) { etnaviv_cmdbuf_get_va(gpu->buffer) > 0x80000000) {
ret = -EINVAL; ret = -EINVAL;
dev_err(gpu->dev, dev_err(gpu->dev,
"command buffer outside valid memory window\n"); "command buffer outside valid memory window\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment