RE: [PATCH 6/6] drm/amdgpu: check if we need to reset at init time (v2)

2019-01-08 Thread Quan, Evan
Series is Reviewed-by: Evan Quan 

> -Original Message-
> From: amd-gfx  On Behalf Of Alex
> Deucher
> Sent: 2019年1月9日 6:12
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander 
> Subject: [PATCH 6/6] drm/amdgpu: check if we need to reset at init time (v2)
> 
> To deal with situations like kexec or GPU VM passthrough where the device
> may have been used previously without a proper GPU reset between.
> 
> v2: rebase
> 
> bug: https://bugs.freedesktop.org/show_bug.cgi?id=108585
> bug: https://bugs.freedesktop.org/show_bug.cgi?id=108754
> Signed-off-by: Alex Deucher 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 1a558dc41ba6..8a61764e64cf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2550,6 +2550,17 @@ int amdgpu_device_init(struct amdgpu_device
> *adev,
>   /* detect if we are with an SRIOV vbios */
>   amdgpu_device_detect_sriov_bios(adev);
> 
> + /* check if we need to reset the asic
> +  *  E.g., driver was not cleanly unloaded previously, etc.
> +  */
> + if (amdgpu_asic_need_reset_on_init(adev)) {
> + r = amdgpu_asic_reset(adev);
> + if (r) {
> + dev_err(adev->dev, "asic reset on init failed\n");
> + goto failed;
> + }
> + }
> +
>   /* Post card if necessary */
>   if (amdgpu_device_need_post(adev)) {
>   if (!adev->bios) {
> --
> 2.20.1
> 
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 6/6] drm/amdgpu: check if we need to reset at init time (v2)

2019-01-08 Thread Alex Deucher
To deal with situations like kexec or GPU VM passthrough
where the device may have been used previously without a
proper GPU reset between.

v2: rebase

bug: https://bugs.freedesktop.org/show_bug.cgi?id=108585
bug: https://bugs.freedesktop.org/show_bug.cgi?id=108754
Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1a558dc41ba6..8a61764e64cf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2550,6 +2550,17 @@ int amdgpu_device_init(struct amdgpu_device *adev,
/* detect if we are with an SRIOV vbios */
amdgpu_device_detect_sriov_bios(adev);
 
+   /* check if we need to reset the asic
+*  E.g., driver was not cleanly unloaded previously, etc.
+*/
+   if (amdgpu_asic_need_reset_on_init(adev)) {
+   r = amdgpu_asic_reset(adev);
+   if (r) {
+   dev_err(adev->dev, "asic reset on init failed\n");
+   goto failed;
+   }
+   }
+
/* Post card if necessary */
if (amdgpu_device_need_post(adev)) {
if (!adev->bios) {
-- 
2.20.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx