<div dir="ltr">Hi<div><br></div><div>This patch is causing me issues on my Skylake/Tonga PRIME laptop, reverting sorts it</div><div><br></div><div>More details here: <a href="https://gitlab.freedesktop.org/drm/amd/-/issues/1668">https://gitlab.freedesktop.org/drm/amd/-/issues/1668</a><br></div><div><br></div><div>Cheers</div><div><br></div><div>Mike</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 28 Jul 2021 at 05:07, Likun Gao <<a href="mailto:likun.gao@amd.com">likun.gao@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Likun Gao <<a href="mailto:Likun.Gao@amd.com" target="_blank">Likun.Gao@amd.com</a>><br>
<br>
Fence driver was enabled per ring when sw init on per IP block before.<br>
Change to enable all the fence driver at the same time after<br>
amdgpu_device_ip_init finished.<br>
Rename some function related to fence to make it reasonable for read.<br>
<br>
Signed-off-by: Likun Gao <<a href="mailto:Likun.Gao@amd.com" target="_blank">Likun.Gao@amd.com</a>><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  6 ++++--<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c  | 15 ++++++---------<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h   |  4 ++--<br>
 3 files changed, 12 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index d3a4299b1f30..77195a4e5c59 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -3675,6 +3675,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,<br>
                goto release_ras_con;<br>
        }<br>
<br>
+       amdgpu_fence_driver_hw_init(adev);<br>
+<br>
        dev_info(adev->dev,<br>
                "SE %d, SH per SE %d, CU per SH %d, active_cu_number %d\n",<br>
                        adev->gfx.config.max_shader_engines,<br>
@@ -3939,7 +3941,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)<br>
        /* evict vram memory */<br>
        amdgpu_bo_evict_vram(adev);<br>
<br>
-       amdgpu_fence_driver_suspend(adev);<br>
+       amdgpu_fence_driver_hw_fini(adev);<br>
<br>
        amdgpu_device_ip_suspend_phase2(adev);<br>
        /* evict remaining vram memory<br>
@@ -3984,7 +3986,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)<br>
                dev_err(adev->dev, "amdgpu_device_ip_resume failed (%d).\n", r);<br>
                return r;<br>
        }<br>
-       amdgpu_fence_driver_resume(adev);<br>
+       amdgpu_fence_driver_hw_init(adev);<br>
<br>
<br>
        r = amdgpu_device_ip_late_init(adev);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c<br>
index 72d9b92b1754..e2f606bca779 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c<br>
@@ -417,9 +417,6 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,<br>
        }<br>
        amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq));<br>
<br>
-       if (irq_src)<br>
-               amdgpu_irq_get(adev, irq_src, irq_type);<br>
-<br>
        ring->fence_drv.irq_src = irq_src;<br>
        ring->fence_drv.irq_type = irq_type;<br>
        ring->fence_drv.initialized = true;<br>
@@ -572,14 +569,14 @@ void amdgpu_fence_driver_fini_sw(struct amdgpu_device *adev)<br>
 }<br>
<br>
 /**<br>
- * amdgpu_fence_driver_suspend - suspend the fence driver<br>
+ * amdgpu_fence_driver_hw_fini - disable the fence driver<br>
  * for all possible rings.<br>
  *<br>
  * @adev: amdgpu device pointer<br>
  *<br>
- * Suspend the fence driver for all possible rings (all asics).<br>
+ * Disable the fence driver for all possible rings (all asics).<br>
  */<br>
-void amdgpu_fence_driver_suspend(struct amdgpu_device *adev)<br>
+void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)<br>
 {<br>
        int i, r;<br>
<br>
@@ -603,18 +600,18 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev)<br>
 }<br>
<br>
 /**<br>
- * amdgpu_fence_driver_resume - resume the fence driver<br>
+ * amdgpu_fence_driver_hw_init - enable the fence driver<br>
  * for all possible rings.<br>
  *<br>
  * @adev: amdgpu device pointer<br>
  *<br>
- * Resume the fence driver for all possible rings (all asics).<br>
+ * Enable the fence driver for all possible rings (all asics).<br>
  * Not all asics have all rings, so each asic will only<br>
  * start the fence driver on the rings it has using<br>
  * amdgpu_fence_driver_start_ring().<br>
  * Returns 0 for success.<br>
  */<br>
-void amdgpu_fence_driver_resume(struct amdgpu_device *adev)<br>
+void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev)<br>
 {<br>
        int i;<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h<br>
index e7d3d0dbdd96..64471018f5e6 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h<br>
@@ -117,8 +117,8 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,<br>
 int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,<br>
                                   struct amdgpu_irq_src *irq_src,<br>
                                   unsigned irq_type);<br>
-void amdgpu_fence_driver_suspend(struct amdgpu_device *adev);<br>
-void amdgpu_fence_driver_resume(struct amdgpu_device *adev);<br>
+void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev);<br>
+void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev);<br>
 int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **fence,<br>
                      unsigned flags);<br>
 int amdgpu_fence_emit_polling(struct amdgpu_ring *ring, uint32_t *s,<br>
-- <br>
2.25.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</blockquote></div>