[PATCH] drm/amdgpu: adjust fence driver enable sequence
Mike Lothian
mike at fireburn.co.uk
Sun Aug 1 11:56:59 UTC 2021
Hi
This patch is causing me issues on my Skylake/Tonga PRIME laptop, reverting
sorts it
More details here: https://gitlab.freedesktop.org/drm/amd/-/issues/1668
Cheers
Mike
On Wed, 28 Jul 2021 at 05:07, Likun Gao <likun.gao at amd.com> wrote:
> From: Likun Gao <Likun.Gao at amd.com>
>
> Fence driver was enabled per ring when sw init on per IP block before.
> Change to enable all the fence driver at the same time after
> amdgpu_device_ip_init finished.
> Rename some function related to fence to make it reasonable for read.
>
> Signed-off-by: Likun Gao <Likun.Gao at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 15 ++++++---------
> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 4 ++--
> 3 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index d3a4299b1f30..77195a4e5c59 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3675,6 +3675,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
> goto release_ras_con;
> }
>
> + amdgpu_fence_driver_hw_init(adev);
> +
> dev_info(adev->dev,
> "SE %d, SH per SE %d, CU per SH %d, active_cu_number %d\n",
> adev->gfx.config.max_shader_engines,
> @@ -3939,7 +3941,7 @@ int amdgpu_device_suspend(struct drm_device *dev,
> bool fbcon)
> /* evict vram memory */
> amdgpu_bo_evict_vram(adev);
>
> - amdgpu_fence_driver_suspend(adev);
> + amdgpu_fence_driver_hw_fini(adev);
>
> amdgpu_device_ip_suspend_phase2(adev);
> /* evict remaining vram memory
> @@ -3984,7 +3986,7 @@ int amdgpu_device_resume(struct drm_device *dev,
> bool fbcon)
> dev_err(adev->dev, "amdgpu_device_ip_resume failed
> (%d).\n", r);
> return r;
> }
> - amdgpu_fence_driver_resume(adev);
> + amdgpu_fence_driver_hw_init(adev);
>
>
> r = amdgpu_device_ip_late_init(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 72d9b92b1754..e2f606bca779 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -417,9 +417,6 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring
> *ring,
> }
> amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq));
>
> - if (irq_src)
> - amdgpu_irq_get(adev, irq_src, irq_type);
> -
> ring->fence_drv.irq_src = irq_src;
> ring->fence_drv.irq_type = irq_type;
> ring->fence_drv.initialized = true;
> @@ -572,14 +569,14 @@ void amdgpu_fence_driver_fini_sw(struct
> amdgpu_device *adev)
> }
>
> /**
> - * amdgpu_fence_driver_suspend - suspend the fence driver
> + * amdgpu_fence_driver_hw_fini - disable the fence driver
> * for all possible rings.
> *
> * @adev: amdgpu device pointer
> *
> - * Suspend the fence driver for all possible rings (all asics).
> + * Disable the fence driver for all possible rings (all asics).
> */
> -void amdgpu_fence_driver_suspend(struct amdgpu_device *adev)
> +void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)
> {
> int i, r;
>
> @@ -603,18 +600,18 @@ void amdgpu_fence_driver_suspend(struct
> amdgpu_device *adev)
> }
>
> /**
> - * amdgpu_fence_driver_resume - resume the fence driver
> + * amdgpu_fence_driver_hw_init - enable the fence driver
> * for all possible rings.
> *
> * @adev: amdgpu device pointer
> *
> - * Resume the fence driver for all possible rings (all asics).
> + * Enable the fence driver for all possible rings (all asics).
> * Not all asics have all rings, so each asic will only
> * start the fence driver on the rings it has using
> * amdgpu_fence_driver_start_ring().
> * Returns 0 for success.
> */
> -void amdgpu_fence_driver_resume(struct amdgpu_device *adev)
> +void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev)
> {
> int i;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> index e7d3d0dbdd96..64471018f5e6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> @@ -117,8 +117,8 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring
> *ring,
> int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
> struct amdgpu_irq_src *irq_src,
> unsigned irq_type);
> -void amdgpu_fence_driver_suspend(struct amdgpu_device *adev);
> -void amdgpu_fence_driver_resume(struct amdgpu_device *adev);
> +void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev);
> +void amdgpu_fence_driver_hw_init(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,
> --
> 2.25.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20210801/262b89e5/attachment.htm>
More information about the amd-gfx
mailing list