drm/etnaviv: get cmdbuf physical address through the cmdbuf abstraction
authorLucas Stach <l.stach@pengutronix.de>
Mon, 16 Jan 2017 16:00:08 +0000 (17:00 +0100)
committerLucas Stach <l.stach@pengutronix.de>
Thu, 2 Feb 2017 09:30:27 +0000 (10:30 +0100)
Don't allow IOMMUv2 to peek directly into the cmdbuf, but get the
needed PA through a dedicated function.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c
drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h
drivers/gpu/drm/etnaviv/etnaviv_drv.c
drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c

index 155b1fddca8e6466b678c7c82886ecdfb91dd389..1ad118c6c64e12d59f2a2b39449c50be0add4681 100644 (file)
@@ -57,3 +57,8 @@ u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf)
 {
        return etnaviv_iommu_get_cmdbuf_va(buf->gpu, buf);
 }
+
+dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf)
+{
+       return buf->paddr;
+}
index 6d64685cd3e7aad50d2e6622180d70533a9b2027..24435877840734c6bdfffaf6effd4562576578e8 100644 (file)
@@ -44,5 +44,6 @@ struct etnaviv_cmdbuf {
 };
 
 u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf);
+dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf);
 
 #endif /* __ETNAVIV_CMDBUF_H__ */
index 6b3ca97833e36b5277408c0bf7ce0a2ac09b4eb7..5b6decf856644410767cf2954d1bdb75e1e1e6f0 100644 (file)
@@ -176,7 +176,8 @@ static void etnaviv_buffer_dump(struct etnaviv_gpu *gpu, struct seq_file *m)
        u32 i;
 
        seq_printf(m, "virt %p - phys 0x%llx - free 0x%08x\n",
-                       buf->vaddr, (u64)buf->paddr, size - buf->user_size);
+                       buf->vaddr, (u64)etnaviv_cmdbuf_get_pa(buf),
+                       size - buf->user_size);
 
        for (i = 0; i < size / 4; i++) {
                if (i && !(i % 4))
index 4e68e6d75477d339fe971ef85c967e6f77f2ac44..cbe447ac59747c3a5a8e655308fc74e7721246a0 100644 (file)
@@ -255,7 +255,8 @@ void etnaviv_iommuv2_restore(struct etnaviv_gpu *gpu)
        prefetch = etnaviv_buffer_config_mmuv2(gpu,
                                (u32)etnaviv_domain->mtlb_dma,
                                (u32)etnaviv_domain->bad_page_dma);
-       etnaviv_gpu_start_fe(gpu, gpu->buffer->paddr, prefetch);
+       etnaviv_gpu_start_fe(gpu, (u32)etnaviv_cmdbuf_get_pa(gpu->buffer),
+                            prefetch);
        etnaviv_gpu_wait_idle(gpu, 100);
 
        gpu_write(gpu, VIVS_MMUv2_CONTROL, VIVS_MMUv2_CONTROL_ENABLE);