diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2016-08-19 18:01:24 -0400 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2016-09-15 09:29:41 -0400 |
commit | 2e145a22486610100cb2c6d789f56bd0c6f27718 (patch) | |
tree | 218b6719f6094822e630ba54748dd901ed66cd32 /drivers/gpu | |
parent | de08e8ef71cd7fbc4a89107b295571c4d50f0d66 (diff) |
drm/etnaviv: add flushing logic for MMUv2
Flushing works differently on MMUv2, in that it's only necessary
to set a single bit in the control register to flush all translation
units. A semaphore stall then makes sure that the flush has propagated
properly.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c index 47b93427fecb..cb86c7e5495c 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c | |||
@@ -276,8 +276,12 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, | |||
276 | extra_dwords = 1; | 276 | extra_dwords = 1; |
277 | 277 | ||
278 | /* flush command */ | 278 | /* flush command */ |
279 | if (gpu->mmu->need_flush) | 279 | if (gpu->mmu->need_flush) { |
280 | extra_dwords += 1; | 280 | if (gpu->mmu->version == ETNAVIV_IOMMU_V1) |
281 | extra_dwords += 1; | ||
282 | else | ||
283 | extra_dwords += 3; | ||
284 | } | ||
281 | 285 | ||
282 | /* pipe switch commands */ | 286 | /* pipe switch commands */ |
283 | if (gpu->switch_context) | 287 | if (gpu->switch_context) |
@@ -287,12 +291,23 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, | |||
287 | 291 | ||
288 | if (gpu->mmu->need_flush) { | 292 | if (gpu->mmu->need_flush) { |
289 | /* Add the MMU flush */ | 293 | /* Add the MMU flush */ |
290 | CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_MMU, | 294 | if (gpu->mmu->version == ETNAVIV_IOMMU_V1) { |
291 | VIVS_GL_FLUSH_MMU_FLUSH_FEMMU | | 295 | CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_MMU, |
292 | VIVS_GL_FLUSH_MMU_FLUSH_UNK1 | | 296 | VIVS_GL_FLUSH_MMU_FLUSH_FEMMU | |
293 | VIVS_GL_FLUSH_MMU_FLUSH_UNK2 | | 297 | VIVS_GL_FLUSH_MMU_FLUSH_UNK1 | |
294 | VIVS_GL_FLUSH_MMU_FLUSH_PEMMU | | 298 | VIVS_GL_FLUSH_MMU_FLUSH_UNK2 | |
295 | VIVS_GL_FLUSH_MMU_FLUSH_UNK4); | 299 | VIVS_GL_FLUSH_MMU_FLUSH_PEMMU | |
300 | VIVS_GL_FLUSH_MMU_FLUSH_UNK4); | ||
301 | } else { | ||
302 | CMD_LOAD_STATE(buffer, VIVS_MMUv2_CONFIGURATION, | ||
303 | VIVS_MMUv2_CONFIGURATION_MODE_MASK | | ||
304 | VIVS_MMUv2_CONFIGURATION_ADDRESS_MASK | | ||
305 | VIVS_MMUv2_CONFIGURATION_FLUSH_FLUSH); | ||
306 | CMD_SEM(buffer, SYNC_RECIPIENT_FE, | ||
307 | SYNC_RECIPIENT_PE); | ||
308 | CMD_STALL(buffer, SYNC_RECIPIENT_FE, | ||
309 | SYNC_RECIPIENT_PE); | ||
310 | } | ||
296 | 311 | ||
297 | gpu->mmu->need_flush = false; | 312 | gpu->mmu->need_flush = false; |
298 | } | 313 | } |