Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 17 ++++++++++-------
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 2 +-
drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 4 ++--
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 4 ++--
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 4 ++--
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 +++---
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 6 +++---
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 4 ++--
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 4 ++--
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++--
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 2 +-
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 2 +-
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 6 +++---
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 6 +++---
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 2 +-
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 2 +-
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 2 +-
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 8 ++++----
18 files changed, 44 insertions(+), 41 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 4e6e9c9..837f9cf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -217,9 +217,10 @@ static void amdgpu_fence_schedule_fallback(struct amdgpu_ring *ring)
* signalled fence value. Wakes the fence queue if the
* sequence number has increased.
*/
-void amdgpu_fence_process(struct amdgpu_ring *ring)
+void amdgpu_fence_process(struct amdgpu_ring *ring, bool sw_fallbak)
{
struct amdgpu_fence_driver *drv = &ring->fence_drv;
+ struct dma_fence *fence = NULL;
uint32_t seq, last_seq;
int r;
@@ -240,7 +241,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
seq &= drv->num_fences_mask;
do {
- struct dma_fence *fence, **ptr;
+ struct dma_fence **ptr;
++last_seq;
last_seq &= drv->num_fences_mask;
@@ -261,6 +262,9 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
dma_fence_put(fence);
} while (last_seq != seq);
+
+ if (sw_fallbak && fence)
+ DRM_WARN("Fence fallback timer expired on ring %s\n", ring->name);
}
/**
@@ -275,8 +279,7 @@ static void amdgpu_fence_fallback(struct timer_list *t)
struct amdgpu_ring *ring = from_timer(ring, t,
fence_drv.fallback_timer);
- DRM_WARN("Fence fallback timer expired on ring %s\n", ring->name);
- amdgpu_fence_process(ring);
+ amdgpu_fence_process(ring , true);
}
/**
@@ -351,7 +354,7 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring)
/* We are not protected by ring lock when reading the last sequence
* but it's ok to report slightly wrong fence count here.
*/
- amdgpu_fence_process(ring);
+ amdgpu_fence_process(ring, false);
emitted = 0x100000000ull;
emitted -= atomic_read(&ring->fence_drv.last_seq);
emitted += READ_ONCE(ring->fence_drv.sync_seq);
@@ -578,7 +581,7 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev)
void amdgpu_fence_driver_force_completion(struct amdgpu_ring *ring)
{
amdgpu_fence_write(ring, ring->fence_drv.sync_seq);
- amdgpu_fence_process(ring);
+ amdgpu_fence_process(ring, false);
}
/*
@@ -667,7 +670,7 @@ static int amdgpu_debugfs_fence_info(struct seq_file *m, void *data)
if (!ring || !ring->fence_drv.initialized)
continue;
- amdgpu_fence_process(ring);
+ amdgpu_fence_process(ring, false);
seq_printf(m, "--- ring %d (%s) ---\n", i, ring->name);
seq_printf(m, "Last signaled fence 0x%08x\n",
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 9cc2399..85956f3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
@@ -97,7 +97,7 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev);
int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **fence,
unsigned flags);
int amdgpu_fence_emit_polling(struct amdgpu_ring *ring, uint32_t *s);
-void amdgpu_fence_process(struct amdgpu_ring *ring);
+void amdgpu_fence_process(struct amdgpu_ring *ring, bool sw_fallbak);
int amdgpu_fence_wait_empty(struct amdgpu_ring *ring);
signed long amdgpu_fence_wait_polling(struct amdgpu_ring *ring,
uint32_t wait_seq,
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index 154b149..c162055 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -1182,7 +1182,7 @@ static int cik_sdma_process_trap_irq(struct amdgpu_device *adev,
case 0:
switch (queue_id) {
case 0:
- amdgpu_fence_process(&adev->sdma.instance[0].ring);
+ amdgpu_fence_process(&adev->sdma.instance[0].ring, false);
break;
case 1:
/* XXX compute */
@@ -1195,7 +1195,7 @@ static int cik_sdma_process_trap_irq(struct amdgpu_device *adev,
case 1:
switch (queue_id) {
case 0:
- amdgpu_fence_process(&adev->sdma.instance[1].ring);
+ amdgpu_fence_process(&adev->sdma.instance[1].ring, false);
break;
case 1:
/* XXX compute */
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index de184a8..85a88db 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
@@ -3381,11 +3381,11 @@ static int gfx_v6_0_eop_irq(struct amdgpu_device *adev,
{
switch (entry->ring_id) {
case 0:
- amdgpu_fence_process(&adev->gfx.gfx_ring[0]);
+ amdgpu_fence_process(&adev->gfx.gfx_ring[0], false);
break;
case 1:
case 2:
- amdgpu_fence_process(&adev->gfx.compute_ring[entry->ring_id - 1]);
+ amdgpu_fence_process(&adev->gfx.compute_ring[entry->ring_id - 1], false);
break;
default:
break;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index fc39ebb..99cc0b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -4945,14 +4945,14 @@ static int gfx_v7_0_eop_irq(struct amdgpu_device *adev,
pipe_id = (entry->ring_id & 0x03) >> 0;
switch (me_id) {
case 0:
- amdgpu_fence_process(&adev->gfx.gfx_ring[0]);
+ amdgpu_fence_process(&adev->gfx.gfx_ring[0], false);
break;
case 1:
case 2:
for (i = 0; i < adev->gfx.num_compute_rings; i++) {
ring = &adev->gfx.compute_ring[i];
if ((ring->me == me_id) && (ring->pipe == pipe_id))
- amdgpu_fence_process(ring);
+ amdgpu_fence_process(ring, false);
}
break;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 470dc80..fff77e3 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -6870,7 +6870,7 @@ static int gfx_v8_0_eop_irq(struct amdgpu_device *adev,
switch (me_id) {
case 0:
- amdgpu_fence_process(&adev->gfx.gfx_ring[0]);
+ amdgpu_fence_process(&adev->gfx.gfx_ring[0], false);
break;
case 1:
case 2:
@@ -6880,7 +6880,7 @@ static int gfx_v8_0_eop_irq(struct amdgpu_device *adev,
* The interrupt can only be enabled/disabled per pipe instead of per queue.
*/
if ((ring->me == me_id) && (ring->pipe == pipe_id) && (ring->queue == queue_id))
- amdgpu_fence_process(ring);
+ amdgpu_fence_process(ring, false);
}
break;
}
@@ -7055,7 +7055,7 @@ static int gfx_v8_0_kiq_irq(struct amdgpu_device *adev,
DRM_DEBUG("IH: CPC GENERIC2_INT, me:%d, pipe:%d, queue:%d\n",
me_id, pipe_id, queue_id);
- amdgpu_fence_process(ring);
+ amdgpu_fence_process(ring, false);
return 0;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index f369d96..4b04ab4 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -4574,7 +4574,7 @@ static int gfx_v9_0_eop_irq(struct amdgpu_device *adev,
switch (me_id) {
case 0:
- amdgpu_fence_process(&adev->gfx.gfx_ring[0]);
+ amdgpu_fence_process(&adev->gfx.gfx_ring[0], false);
break;
case 1:
case 2:
@@ -4584,7 +4584,7 @@ static int gfx_v9_0_eop_irq(struct amdgpu_device *adev,
* The interrupt can only be enabled/disabled per pipe instead of per queue.
*/
if ((ring->me == me_id) && (ring->pipe == pipe_id) && (ring->queue == queue_id))
- amdgpu_fence_process(ring);
+ amdgpu_fence_process(ring, false);
}
break;
}
@@ -4667,7 +4667,7 @@ static int gfx_v9_0_kiq_irq(struct amdgpu_device *adev,
DRM_DEBUG("IH: CPC GENERIC2_INT, me:%d, pipe:%d, queue:%d\n",
me_id, pipe_id, queue_id);
- amdgpu_fence_process(ring);
+ amdgpu_fence_process(ring, false);
return 0;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index c403bdf..011d680 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
@@ -1116,7 +1116,7 @@ static int sdma_v2_4_process_trap_irq(struct amdgpu_device *adev,
case 0:
switch (queue_id) {
case 0:
- amdgpu_fence_process(&adev->sdma.instance[0].ring);
+ amdgpu_fence_process(&adev->sdma.instance[0].ring, false);
break;
case 1:
/* XXX compute */
@@ -1129,7 +1129,7 @@ static int sdma_v2_4_process_trap_irq(struct amdgpu_device *adev,
case 1:
switch (queue_id) {
case 0:
- amdgpu_fence_process(&adev->sdma.instance[1].ring);
+ amdgpu_fence_process(&adev->sdma.instance[1].ring, false);
break;
case 1:
/* XXX compute */
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index 2677d6a..9dd2cba 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -1452,7 +1452,7 @@ static int sdma_v3_0_process_trap_irq(struct amdgpu_device *adev,
case 0:
switch (queue_id) {
case 0:
- amdgpu_fence_process(&adev->sdma.instance[0].ring);
+ amdgpu_fence_process(&adev->sdma.instance[0].ring, false);
break;
case 1:
/* XXX compute */
@@ -1465,7 +1465,7 @@ static int sdma_v3_0_process_trap_irq(struct amdgpu_device *adev,
case 1:
switch (queue_id) {
case 0:
- amdgpu_fence_process(&adev->sdma.instance[1].ring);
+ amdgpu_fence_process(&adev->sdma.instance[1].ring, false);
break;
case 1:
/* XXX compute */
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index 9da4a1b..85dc58b 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -1465,7 +1465,7 @@ static int sdma_v4_0_process_trap_irq(struct amdgpu_device *adev,
case SOC15_IH_CLIENTID_SDMA0:
switch (entry->ring_id) {
case 0:
- amdgpu_fence_process(&adev->sdma.instance[0].ring);
+ amdgpu_fence_process(&adev->sdma.instance[0].ring, false);
break;
case 1:
/* XXX compute */
@@ -1481,7 +1481,7 @@ static int sdma_v4_0_process_trap_irq(struct amdgpu_device *adev,
case SOC15_IH_CLIENTID_SDMA1:
switch (entry->ring_id) {
case 0:
- amdgpu_fence_process(&adev->sdma.instance[1].ring);
+ amdgpu_fence_process(&adev->sdma.instance[1].ring, false);
break;
case 1:
/* XXX compute */
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
index 8a926d1..2223265 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
@@ -681,7 +681,7 @@ static int uvd_v4_2_process_interrupt(struct amdgpu_device *adev,
struct amdgpu_iv_entry *entry)
{
DRM_DEBUG("IH: UVD TRAP\n");
- amdgpu_fence_process(&adev->uvd.inst->ring);
+ amdgpu_fence_process(&adev->uvd.inst->ring, false);
return 0;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 5024805..1fc587c 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
@@ -604,7 +604,7 @@ static int uvd_v5_0_process_interrupt(struct amdgpu_device *adev,
struct amdgpu_iv_entry *entry)
{
DRM_DEBUG("IH: UVD TRAP\n");
- amdgpu_fence_process(&adev->uvd.inst->ring);
+ amdgpu_fence_process(&adev->uvd.inst->ring, false);
return 0;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 6ae82cc..ca0f977 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -1234,17 +1234,17 @@ static int uvd_v6_0_process_interrupt(struct amdgpu_device *adev,
switch (entry->src_id) {
case 124:
- amdgpu_fence_process(&adev->uvd.inst->ring);
+ amdgpu_fence_process(&adev->uvd.inst->ring, false);
break;
case 119:
if (likely(uvd_v6_0_enc_support(adev)))
- amdgpu_fence_process(&adev->uvd.inst->ring_enc[0]);
+ amdgpu_fence_process(&adev->uvd.inst->ring_enc[0], false);
else
int_handled = false;
break;
case 120:
if (likely(uvd_v6_0_enc_support(adev)))
- amdgpu_fence_process(&adev->uvd.inst->ring_enc[1]);
+ amdgpu_fence_process(&adev->uvd.inst->ring_enc[1], false);
else
int_handled = false;
break;
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
index a289f6a..e57755b 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
@@ -1569,14 +1569,14 @@ static int uvd_v7_0_process_interrupt(struct amdgpu_device *adev,
switch (entry->src_id) {
case 124:
- amdgpu_fence_process(&adev->uvd.inst[ip_instance].ring);
+ amdgpu_fence_process(&adev->uvd.inst[ip_instance].ring, false);
break;
case 119:
- amdgpu_fence_process(&adev->uvd.inst[ip_instance].ring_enc[0]);
+ amdgpu_fence_process(&adev->uvd.inst[ip_instance].ring_enc[0], false);
break;
case 120:
if (!amdgpu_sriov_vf(adev))
- amdgpu_fence_process(&adev->uvd.inst[ip_instance].ring_enc[1]);
+ amdgpu_fence_process(&adev->uvd.inst[ip_instance].ring_enc[1], false);
break;
default:
DRM_ERROR("Unhandled interrupt: %d %d\n",
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
index 7eaa54b..a25cced 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
@@ -540,7 +540,7 @@ static int vce_v2_0_process_interrupt(struct amdgpu_device *adev,
switch (entry->src_data[0]) {
case 0:
case 1:
- amdgpu_fence_process(&adev->vce.ring[entry->src_data[0]]);
+ amdgpu_fence_process(&adev->vce.ring[entry->src_data[0]], false);
break;
default:
DRM_ERROR("Unhandled interrupt: %d %d\n",
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
index c8390f9a..deb8765 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
@@ -730,7 +730,7 @@ static int vce_v3_0_process_interrupt(struct amdgpu_device *adev,
case 0:
case 1:
case 2:
- amdgpu_fence_process(&adev->vce.ring[entry->src_data[0]]);
+ amdgpu_fence_process(&adev->vce.ring[entry->src_data[0]], false);
break;
default:
DRM_ERROR("Unhandled interrupt: %d %d\n",
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
index 1c94718..0c1549b 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
@@ -1034,7 +1034,7 @@ static int vce_v4_0_process_interrupt(struct amdgpu_device *adev,
case 0:
case 1:
case 2:
- amdgpu_fence_process(&adev->vce.ring[entry->src_data[0]]);
+ amdgpu_fence_process(&adev->vce.ring[entry->src_data[0]], false);
break;
default:
DRM_ERROR("Unhandled interrupt: %d %d\n",
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
index 2cde0b4..42ac02b 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
@@ -1590,16 +1590,16 @@ static int vcn_v1_0_process_interrupt(struct amdgpu_device *adev,
switch (entry->src_id) {
case 124:
- amdgpu_fence_process(&adev->vcn.ring_dec);
+ amdgpu_fence_process(&adev->vcn.ring_dec, false);
break;
case 119:
- amdgpu_fence_process(&adev->vcn.ring_enc[0]);
+ amdgpu_fence_process(&adev->vcn.ring_enc[0], false);
break;
case 120:
- amdgpu_fence_process(&adev->vcn.ring_enc[1]);
+ amdgpu_fence_process(&adev->vcn.ring_enc[1], false);
break;
case 126:
- amdgpu_fence_process(&adev->vcn.ring_jpeg);
+ amdgpu_fence_process(&adev->vcn.ring_jpeg, false);
break;
default:
DRM_ERROR("Unhandled interrupt: %d %d\n",