Skip to content

Commit 23e0f5a

Browse files
committed
drm/etnaviv: stop abusing mmu_context as FE running marker
While the DMA frontend can only be active when the MMU context is set, the reverse isn't necessarily true, as the frontend can be stopped while the MMU state is kept. Stop treating mmu_context being set as a indication that the frontend is running and instead add a explicit property. Cc: [email protected] # 5.4 Signed-off-by: Lucas Stach <[email protected]> Tested-by: Michael Walle <[email protected]> Tested-by: Marek Vasut <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
1 parent cda7532 commit 23e0f5a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

drivers/gpu/drm/etnaviv/etnaviv_gpu.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
569569
/* We rely on the GPU running, so program the clock */
570570
etnaviv_gpu_update_clock(gpu);
571571

572+
gpu->fe_running = false;
573+
572574
return 0;
573575
}
574576

@@ -637,6 +639,8 @@ void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch)
637639
VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE |
638640
VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch));
639641
}
642+
643+
gpu->fe_running = true;
640644
}
641645

642646
static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu)
@@ -1370,7 +1374,7 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit)
13701374
goto out_unlock;
13711375
}
13721376

1373-
if (!gpu->mmu_context) {
1377+
if (!gpu->fe_running) {
13741378
gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context);
13751379
etnaviv_gpu_start_fe_idleloop(gpu);
13761380
} else {
@@ -1579,7 +1583,7 @@ int etnaviv_gpu_wait_idle(struct etnaviv_gpu *gpu, unsigned int timeout_ms)
15791583

15801584
static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
15811585
{
1582-
if (gpu->initialized && gpu->mmu_context) {
1586+
if (gpu->initialized && gpu->fe_running) {
15831587
/* Replace the last WAIT with END */
15841588
mutex_lock(&gpu->lock);
15851589
etnaviv_buffer_end(gpu);
@@ -1594,6 +1598,8 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
15941598

15951599
etnaviv_iommu_context_put(gpu->mmu_context);
15961600
gpu->mmu_context = NULL;
1601+
1602+
gpu->fe_running = false;
15971603
}
15981604

15991605
gpu->exec_state = -1;

drivers/gpu/drm/etnaviv/etnaviv_gpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ struct etnaviv_gpu {
101101
struct workqueue_struct *wq;
102102
struct drm_gpu_scheduler sched;
103103
bool initialized;
104+
bool fe_running;
104105

105106
/* 'ring'-buffer: */
106107
struct etnaviv_cmdbuf buffer;

0 commit comments

Comments
 (0)