Skip to content

Commit bd23a6a

Browse files
committed
Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next
This time mostly cleanups around the runtime power management handling and slightly improved GPU hang handling. Also some additions to the HWDB to get the driver working properly on more NXP i.MX8MP IP cores. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Lucas Stach <l.stach@pengutronix.de> Link: https://patchwork.freedesktop.org/patch/msgid/f40c65f7ecfde2e61f1a6d7fd463f6f739bc0dd1.camel@pengutronix.de
2 parents a8b273a + 88c31d2 commit bd23a6a

File tree

11 files changed

+201
-107
lines changed

11 files changed

+201
-107
lines changed

drivers/gpu/drm/etnaviv/etnaviv_buffer.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ static inline void CMD_END(struct etnaviv_cmdbuf *buffer)
5353
OUT(buffer, VIV_FE_END_HEADER_OP_END);
5454
}
5555

56-
static inline void CMD_WAIT(struct etnaviv_cmdbuf *buffer)
56+
static inline void CMD_WAIT(struct etnaviv_cmdbuf *buffer,
57+
unsigned int waitcycles)
5758
{
5859
buffer->user_size = ALIGN(buffer->user_size, 8);
5960

60-
OUT(buffer, VIV_FE_WAIT_HEADER_OP_WAIT | 200);
61+
OUT(buffer, VIV_FE_WAIT_HEADER_OP_WAIT | waitcycles);
6162
}
6263

6364
static inline void CMD_LINK(struct etnaviv_cmdbuf *buffer,
@@ -168,7 +169,7 @@ u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu)
168169
/* initialize buffer */
169170
buffer->user_size = 0;
170171

171-
CMD_WAIT(buffer);
172+
CMD_WAIT(buffer, gpu->fe_waitcycles);
172173
CMD_LINK(buffer, 2,
173174
etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping)
174175
+ buffer->user_size - 4);
@@ -320,7 +321,7 @@ void etnaviv_sync_point_queue(struct etnaviv_gpu *gpu, unsigned int event)
320321
CMD_END(buffer);
321322

322323
/* Append waitlink */
323-
CMD_WAIT(buffer);
324+
CMD_WAIT(buffer, gpu->fe_waitcycles);
324325
CMD_LINK(buffer, 2,
325326
etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping)
326327
+ buffer->user_size - 4);
@@ -503,7 +504,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
503504

504505
CMD_LOAD_STATE(buffer, VIVS_GL_EVENT, VIVS_GL_EVENT_EVENT_ID(event) |
505506
VIVS_GL_EVENT_FROM_PE);
506-
CMD_WAIT(buffer);
507+
CMD_WAIT(buffer, gpu->fe_waitcycles);
507508
CMD_LINK(buffer, 2,
508509
etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping)
509510
+ buffer->user_size - 4);

drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf)
121121
int order = order_base_2(ALIGN(cmdbuf->size, SUBALLOC_GRANULE) /
122122
SUBALLOC_GRANULE);
123123

124+
if (!suballoc)
125+
return;
126+
124127
mutex_lock(&suballoc->lock);
125128
bitmap_release_region(suballoc->granule_map,
126129
cmdbuf->suballoc_offset / SUBALLOC_GRANULE,

drivers/gpu/drm/etnaviv/etnaviv_drv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
#include <linux/component.h>
77
#include <linux/dma-mapping.h>
88
#include <linux/module.h>
9-
#include <linux/of_platform.h>
9+
#include <linux/of.h>
10+
#include <linux/of_device.h>
11+
#include <linux/platform_device.h>
1012
#include <linux/uaccess.h>
1113

1214
#include <drm/drm_debugfs.h>

drivers/gpu/drm/etnaviv/etnaviv_dump.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
130130
return;
131131
etnaviv_dump_core = false;
132132

133-
mutex_lock(&gpu->mmu_context->lock);
133+
mutex_lock(&submit->mmu_context->lock);
134134

135-
mmu_size = etnaviv_iommu_dump_size(gpu->mmu_context);
135+
mmu_size = etnaviv_iommu_dump_size(submit->mmu_context);
136136

137137
/* We always dump registers, mmu, ring, hanging cmdbuf and end marker */
138138
n_obj = 5;
@@ -162,7 +162,7 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
162162
iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN |
163163
__GFP_NORETRY);
164164
if (!iter.start) {
165-
mutex_unlock(&gpu->mmu_context->lock);
165+
mutex_unlock(&submit->mmu_context->lock);
166166
dev_warn(gpu->dev, "failed to allocate devcoredump file\n");
167167
return;
168168
}
@@ -174,18 +174,18 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
174174
memset(iter.hdr, 0, iter.data - iter.start);
175175

176176
etnaviv_core_dump_registers(&iter, gpu);
177-
etnaviv_core_dump_mmu(&iter, gpu->mmu_context, mmu_size);
177+
etnaviv_core_dump_mmu(&iter, submit->mmu_context, mmu_size);
178178
etnaviv_core_dump_mem(&iter, ETDUMP_BUF_RING, gpu->buffer.vaddr,
179179
gpu->buffer.size,
180180
etnaviv_cmdbuf_get_va(&gpu->buffer,
181-
&gpu->mmu_context->cmdbuf_mapping));
181+
&submit->mmu_context->cmdbuf_mapping));
182182

183183
etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD,
184184
submit->cmdbuf.vaddr, submit->cmdbuf.size,
185185
etnaviv_cmdbuf_get_va(&submit->cmdbuf,
186-
&gpu->mmu_context->cmdbuf_mapping));
186+
&submit->mmu_context->cmdbuf_mapping));
187187

188-
mutex_unlock(&gpu->mmu_context->lock);
188+
mutex_unlock(&submit->mmu_context->lock);
189189

190190
/* Reserve space for the bomap */
191191
if (n_bomap_pages) {

drivers/gpu/drm/etnaviv/etnaviv_gem.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ struct etnaviv_gem_submit {
9797
struct list_head node; /* GPU active submit list */
9898
struct etnaviv_cmdbuf cmdbuf;
9999
struct pid *pid; /* submitting process */
100-
bool runtime_resumed;
101100
u32 exec_state;
102101
u32 flags;
103102
unsigned int nr_pmrs;

drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,6 @@ static void submit_cleanup(struct kref *kref)
362362
container_of(kref, struct etnaviv_gem_submit, refcount);
363363
unsigned i;
364364

365-
if (submit->runtime_resumed)
366-
pm_runtime_put_autosuspend(submit->gpu->dev);
367-
368365
if (submit->cmdbuf.suballoc)
369366
etnaviv_cmdbuf_free(&submit->cmdbuf);
370367

0 commit comments

Comments
 (0)