All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage
@ 2021-09-18  6:09 Guchun Chen
  2021-09-21 13:11 ` Chen, Guchun
  0 siblings, 1 reply; 3+ messages in thread
From: Guchun Chen @ 2021-09-18  6:09 UTC (permalink / raw)
  To: amd-gfx, christian.koenig, xinhui.pan, alexander.deucher,
	andrey.grodzovsky, monk.liu
  Cc: Guchun Chen, Leslie Shi

adev->rmmio is set to be NULL in amdgpu_device_unmap_mmio to prevent
access after pci_remove, however, in SRIOV case, amdgpu_virt_release_full_gpu
will still use adev->rmmio for access after amdgpu_device_unmap_mmio.
The patch is to move such SRIOV calling earlier to fini_early stage.

Fixes: 07775fc13878("drm/amdgpu: Unmap all MMIO mappings")
Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Leslie Shi <Yuliang.Shi@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index f3da97086f7d..2a75c09c4884 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2810,6 +2810,11 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
 		adev->ip_blocks[i].status.hw = false;
 	}
 
+	if (amdgpu_sriov_vf(adev)) {
+		if (amdgpu_virt_release_full_gpu(adev, false))
+			DRM_ERROR("failed to release exclusive mode on fini\n");
+	}
+
 	return 0;
 }
 
@@ -2870,10 +2875,6 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
 
 	amdgpu_ras_fini(adev);
 
-	if (amdgpu_sriov_vf(adev))
-		if (amdgpu_virt_release_full_gpu(adev, false))
-			DRM_ERROR("failed to release exclusive mode on fini\n");
-
 	return 0;
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage
  2021-09-18  6:09 [PATCH] drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage Guchun Chen
@ 2021-09-21 13:11 ` Chen, Guchun
  2021-09-21 14:12   ` Andrey Grodzovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Chen, Guchun @ 2021-09-21 13:11 UTC (permalink / raw)
  To: amd-gfx, Koenig,  Christian, Pan, Xinhui, Deucher, Alexander,
	Grodzovsky, Andrey, Liu, Monk
  Cc: Shi, Leslie

[Public]

Ping...

Regards,
Guchun

-----Original Message-----
From: Chen, Guchun <Guchun.Chen@amd.com> 
Sent: Saturday, September 18, 2021 2:09 PM
To: amd-gfx@lists.freedesktop.org; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Grodzovsky, Andrey <Andrey.Grodzovsky@amd.com>; Liu, Monk <Monk.Liu@amd.com>
Cc: Chen, Guchun <Guchun.Chen@amd.com>; Shi, Leslie <Yuliang.Shi@amd.com>
Subject: [PATCH] drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage

adev->rmmio is set to be NULL in amdgpu_device_unmap_mmio to prevent
access after pci_remove, however, in SRIOV case, amdgpu_virt_release_full_gpu will still use adev->rmmio for access after amdgpu_device_unmap_mmio.
The patch is to move such SRIOV calling earlier to fini_early stage.

Fixes: 07775fc13878("drm/amdgpu: Unmap all MMIO mappings")
Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Leslie Shi <Yuliang.Shi@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index f3da97086f7d..2a75c09c4884 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2810,6 +2810,11 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
 		adev->ip_blocks[i].status.hw = false;
 	}
 
+	if (amdgpu_sriov_vf(adev)) {
+		if (amdgpu_virt_release_full_gpu(adev, false))
+			DRM_ERROR("failed to release exclusive mode on fini\n");
+	}
+
 	return 0;
 }
 
@@ -2870,10 +2875,6 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
 
 	amdgpu_ras_fini(adev);
 
-	if (amdgpu_sriov_vf(adev))
-		if (amdgpu_virt_release_full_gpu(adev, false))
-			DRM_ERROR("failed to release exclusive mode on fini\n");
-
 	return 0;
 }
 
--
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage
  2021-09-21 13:11 ` Chen, Guchun
@ 2021-09-21 14:12   ` Andrey Grodzovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Andrey Grodzovsky @ 2021-09-21 14:12 UTC (permalink / raw)
  To: Chen, Guchun, amd-gfx, Koenig, Christian, Pan, Xinhui, Deucher,
	Alexander, Liu, Monk
  Cc: Shi, Leslie

Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>

Andrey

On 2021-09-21 9:11 a.m., Chen, Guchun wrote:
> [Public]
>
> Ping...
>
> Regards,
> Guchun
>
> -----Original Message-----
> From: Chen, Guchun <Guchun.Chen@amd.com>
> Sent: Saturday, September 18, 2021 2:09 PM
> To: amd-gfx@lists.freedesktop.org; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Grodzovsky, Andrey <Andrey.Grodzovsky@amd.com>; Liu, Monk <Monk.Liu@amd.com>
> Cc: Chen, Guchun <Guchun.Chen@amd.com>; Shi, Leslie <Yuliang.Shi@amd.com>
> Subject: [PATCH] drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage
>
> adev->rmmio is set to be NULL in amdgpu_device_unmap_mmio to prevent
> access after pci_remove, however, in SRIOV case, amdgpu_virt_release_full_gpu will still use adev->rmmio for access after amdgpu_device_unmap_mmio.
> The patch is to move such SRIOV calling earlier to fini_early stage.
>
> Fixes: 07775fc13878("drm/amdgpu: Unmap all MMIO mappings")
> Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> Signed-off-by: Leslie Shi <Yuliang.Shi@amd.com>
> Signed-off-by: Guchun Chen <guchun.chen@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index f3da97086f7d..2a75c09c4884 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2810,6 +2810,11 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
>   		adev->ip_blocks[i].status.hw = false;
>   	}
>   
> +	if (amdgpu_sriov_vf(adev)) {
> +		if (amdgpu_virt_release_full_gpu(adev, false))
> +			DRM_ERROR("failed to release exclusive mode on fini\n");
> +	}
> +
>   	return 0;
>   }
>   
> @@ -2870,10 +2875,6 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
>   
>   	amdgpu_ras_fini(adev);
>   
> -	if (amdgpu_sriov_vf(adev))
> -		if (amdgpu_virt_release_full_gpu(adev, false))
> -			DRM_ERROR("failed to release exclusive mode on fini\n");
> -
>   	return 0;
>   }
>   
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-21 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18  6:09 [PATCH] drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage Guchun Chen
2021-09-21 13:11 ` Chen, Guchun
2021-09-21 14:12   ` Andrey Grodzovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.