drm/amdgpu:impl vgt_flush for VI(v2)
Subsystems (2)
PATCH 1/1 drm/amdgpu:impl vgt_flush for VI(v2)
when shadowing enabled, tesselation app will trigger vm fault because below three tesselation registers:
VGT_TF_RING_SIZE__CI__VI,VGT_HS_OFFCHIP_PARAM__CI__VI,VGT_TF_MEMORY_BASE__CI__VI,
need to be programed after vgt-flush.
Tesselation picture vm fault disappeared after vgt-flush introduced.
v2:implement vgt-flush for CI & SI.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 13 +++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 13 +++++++++++++ 6 files changed, 40 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1630,6 +1630,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)#define amdgpu_ring_emit_fence (r, addr, seq, flags) (r)->funcs->emit_fence((r), (addr), (seq), (flags))#define amdgpu_ring_emit_gds_switch (r, v, db, ds, wb, ws, ab, as) (r)->funcs->emit_gds_switch((r), (v), (db), (ds), (wb), (ws), (ab), (as))#define amdgpu_ring_emit_hdp_flush (r) (r)->funcs->emit_hdp_flush((r)) +#define amdgpu_ring_emit_vgt_flush (r) (r)->funcs->emit_vgt_flush((r))#define amdgpu_ring_emit_hdp_invalidate (r) (r)->funcs->emit_hdp_invalidate((r))#define amdgpu_ring_emit_switch_buffer (r) (r)->funcs->emit_switch_buffer((r))#define amdgpu_ring_emit_cntxcntl (r, d) (r)->funcs->emit_cntxcntl((r), (d))
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +4 -1
@@ -175,11 +175,14 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,if (ring->funcs->emit_hdp_flush)amdgpu_ring_emit_hdp_flush (ring); + need_ctx_switch = ring->current_ctx != fence_ctx; +if (ring->funcs->emit_vgt_flush && need_ctx_switch) +amdgpu_ring_emit_vgt_flush (ring); +/* always set cond_exec_polling to CONTINUE */ *ring->cond_exe_cpu_addr =1 ; skip_preamble = ring->current_ctx == fence_ctx; - need_ctx_switch = ring->current_ctx != fence_ctx;if (job && ring->funcs->emit_cntxcntl) {if (need_ctx_switch) status |=AMDGPU_HAVE_CTX_SWITCH ;
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1 -0
@@ -116,6 +116,7 @@ struct amdgpu_ring_funcs {void (*emit_vm_flush)(struct amdgpu_ring *ring,unsigned vm_id,uint64_t pd_addr);void (*emit_hdp_flush)(struct amdgpu_ring *ring); +void (*emit_vgt_flush)(struct amdgpu_ring *ring);void (*emit_hdp_invalidate)(struct amdgpu_ring *ring); void (*emit_gds_switch)(struct amdgpu_ring *ring, uint32_t vmid, uint32_t gds_base, uint32_t gds_size,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +8 -0
@@ -1463,6 +1463,13 @@ static void gfx_v6_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x1 ); } +static void gfx_v6_0_ring_emit_vgt_flush (struct amdgpu_ring *ring) +{ +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VGT_FLUSH ) | +EVENT_INDEX (0 )); +} +/** * gfx_v6_0_ring_emit_hdp_invalidate - emit an hdp invalidate on the cp *
@@ -3272,6 +3279,7 @@ static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = { .emit_pipeline_sync = gfx_v6_0_ring_emit_pipeline_sync, .emit_vm_flush = gfx_v6_0_ring_emit_vm_flush, .emit_hdp_flush = gfx_v6_0_ring_emit_hdp_flush, + .emit_vgt_flush = gfx_v6_0_ring_emit_vgt_flush, .emit_hdp_invalidate = gfx_v6_0_ring_emit_hdp_invalidate, .test_ring = gfx_v6_0_ring_test_ring, .test_ib = gfx_v6_0_ring_test_ib,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +13 -0
@@ -2105,6 +2105,18 @@ static void gfx_v7_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x20 );/* poll interval */ } +static void gfx_v7_0_ring_emit_vgt_flush (struct amdgpu_ring *ring) +{ +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VS_PARTIAL_FLUSH ) | +EVENT_INDEX (4 )); + +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VGT_FLUSH ) | +EVENT_INDEX (0 )); +} + +/** * gfx_v7_0_ring_emit_hdp_invalidate - emit an hdp invalidate on the cp *
@@ -5155,6 +5167,7 @@ static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = { .emit_vm_flush = gfx_v7_0_ring_emit_vm_flush, .emit_gds_switch = gfx_v7_0_ring_emit_gds_switch, .emit_hdp_flush = gfx_v7_0_ring_emit_hdp_flush, + .emit_vgt_flush = gfx_v7_0_ring_emit_vgt_flush, .emit_hdp_invalidate = gfx_v7_0_ring_emit_hdp_invalidate, .test_ring = gfx_v7_0_ring_test_ring, .test_ib = gfx_v7_0_ring_test_ib,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +13 -0
@@ -6187,6 +6187,18 @@ static void gfx_v8_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x20 );/* poll interval */ } +static void gfx_v8_0_ring_emit_vgt_flush (struct amdgpu_ring *ring) +{ +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VS_PARTIAL_FLUSH ) | +EVENT_INDEX (4 )); + +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VGT_FLUSH ) | +EVENT_INDEX (0 )); +} + +static void gfx_v8_0_ring_emit_hdp_invalidate (struct amdgpu_ring *ring) {amdgpu_ring_write (ring,PACKET3 (PACKET3_WRITE_DATA ,3 ));
@@ -6590,6 +6602,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { .pad_ib = amdgpu_ring_generic_pad_ib, .emit_switch_buffer = gfx_v8_ring_emit_sb, .emit_cntxcntl = gfx_v8_ring_emit_cntxcntl, + .emit_vgt_flush = gfx_v8_0_ring_emit_vgt_flush, };static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1479094665-5938-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org
If no one review it I'm going to push it later
-----邮件原件-----
发件人: amd-gfx [mailto:[email protected]] 代表 Monk Liu 发送时间: Monday, November 14, 2016 11:38 AM
收件人: [email protected]
抄送: Liu, Monk
主题: [PATCH] drm/amdgpu:impl vgt_flush for VI(v2)
when shadowing enabled, tesselation app will trigger vm fault because below three tesselation registers:
VGT_TF_RING_SIZE__CI__VI,VGT_HS_OFFCHIP_PARAM__CI__VI,VGT_TF_MEMORY_BASE__CI__VI,
need to be programed after vgt-flush.
Tesselation picture vm fault disappeared after vgt-flush introduced.
v2:implement vgt-flush for CI & SI.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 13 +++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 13 +++++++++++++ 6 files changed, 40 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1630,6 +1630,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) #define amdgpu_ring_emit_fence(r, addr, seq, flags) (r)->funcs->emit_fence((r), (addr), (seq), (flags)) #define amdgpu_ring_emit_gds_switch(r, v, db, ds, wb, ws, ab, as) (r)->funcs->emit_gds_switch((r), (v), (db), (ds), (wb), (ws), (ab), (as)) #define amdgpu_ring_emit_hdp_flush(r) (r)->funcs->emit_hdp_flush((r)) +#define amdgpu_ring_emit_vgt_flush (r) (r)->funcs->emit_vgt_flush((r))#define amdgpu_ring_emit_hdp_invalidate (r) (r)->funcs->emit_hdp_invalidate((r))#define amdgpu_ring_emit_switch_buffer (r) (r)->funcs->emit_switch_buffer((r))#define amdgpu_ring_emit_cntxcntl (r, d) (r)->funcs->emit_cntxcntl((r), (d)) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index acf48de..c039890 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +4 -1
@@ -175,11 +175,14 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,if (ring->funcs->emit_hdp_flush)amdgpu_ring_emit_hdp_flush (ring); + need_ctx_switch = ring->current_ctx != fence_ctx; +if (ring->funcs->emit_vgt_flush && need_ctx_switch) +amdgpu_ring_emit_vgt_flush (ring); +/* always set cond_exec_polling to CONTINUE */ *ring->cond_exe_cpu_addr =1 ; skip_preamble = ring->current_ctx == fence_ctx; - need_ctx_switch = ring->current_ctx != fence_ctx;if (job && ring->funcs->emit_cntxcntl) {if (need_ctx_switch) status |=AMDGPU_HAVE_CTX_SWITCH ;
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1 -0
@@ -116,6 +116,7 @@ struct amdgpu_ring_funcs {void (*emit_vm_flush)(struct amdgpu_ring *ring,unsigned vm_id,uint64_t pd_addr);void (*emit_hdp_flush)(struct amdgpu_ring *ring); +void (*emit_vgt_flush)(struct amdgpu_ring *ring);void (*emit_hdp_invalidate)(struct amdgpu_ring *ring);void (*emit_gds_switch)(struct amdgpu_ring *ring,uint32_t vmid, uint32_t gds_base, uint32_t gds_size, diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 9423501..77f906e 100644
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +7 -0
@@ -1463,6 +1463,13 @@ static void gfx_v6_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x1 ); } +static void gfx_v6_0_ring_emit_vgt_flush (struct amdgpu_ring *ring) { +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VGT_FLUSH ) | +EVENT_INDEX (0 )); +} +/** * gfx_v6_0_ring_emit_hdp_invalidate - emit an hdp invalidate on the cp *
@@ -3272,6 +3279,7 @@ static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = { .emit_pipeline_sync = gfx_v6_0_ring_emit_pipeline_sync, .emit_vm_flush = gfx_v6_0_ring_emit_vm_flush, .emit_hdp_flush = gfx_v6_0_ring_emit_hdp_flush, + .emit_vgt_flush = gfx_v6_0_ring_emit_vgt_flush, .emit_hdp_invalidate = gfx_v6_0_ring_emit_hdp_invalidate, .test_ring = gfx_v6_0_ring_test_ring, .test_ib = gfx_v6_0_ring_test_ib,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +12 -0
@@ -2105,6 +2105,18 @@ static void gfx_v7_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x20 );/* poll interval */ } +static void gfx_v7_0_ring_emit_vgt_flush (struct amdgpu_ring *ring) { +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VS_PARTIAL_FLUSH ) | +EVENT_INDEX (4 )); + +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VGT_FLUSH ) | +EVENT_INDEX (0 )); +} + +/** * gfx_v7_0_ring_emit_hdp_invalidate - emit an hdp invalidate on the cp *
@@ -5155,6 +5167,7 @@ static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = { .emit_vm_flush = gfx_v7_0_ring_emit_vm_flush, .emit_gds_switch = gfx_v7_0_ring_emit_gds_switch, .emit_hdp_flush = gfx_v7_0_ring_emit_hdp_flush, + .emit_vgt_flush = gfx_v7_0_ring_emit_vgt_flush, .emit_hdp_invalidate = gfx_v7_0_ring_emit_hdp_invalidate, .test_ring = gfx_v7_0_ring_test_ring, .test_ib = gfx_v7_0_ring_test_ib,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +11 -0
@@ -6187,6 +6187,18 @@ static void gfx_v8_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x20 );/* poll interval */ } +static void gfx_v8_0_ring_emit_vgt_flush (struct amdgpu_ring *ring) { +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VS_PARTIAL_FLUSH ) | +EVENT_INDEX (4 )); + +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE ,0 )); +amdgpu_ring_write (ring,EVENT_TYPE (VGT_FLUSH ) | +EVENT_INDEX (0 )); +} + +static void gfx_v8_0_ring_emit_hdp_invalidate (struct amdgpu_ring *ring) { amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); @@ -6590,6 +6602,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { .pad_ib = amdgpu_ring_generic_pad_ib, .emit_switch_buffer = gfx_v8_ring_emit_sb,
.emit_cntxcntl = gfx_v8_ring_emit_cntxcntl,
+ .emit_vgt_flush = gfx_v8_0_ring_emit_vgt_flush,
};
static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
--
1.9.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx