All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate
@ 2021-05-19 16:22 James Zhu
  2021-05-19 16:22 ` [PATCH 2/7] drm/amdgpu/vcn2.0: " James Zhu
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: James Zhu @ 2021-05-19 16:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: jamesz

Add cancel_delayed_work_sync before set power gating state
to avoid race condition issue when power gating.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
index 0c1beef..27b1ced 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
@@ -231,9 +231,13 @@ static int vcn_v1_0_hw_fini(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
+
 	if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
-		RREG32_SOC15(VCN, 0, mmUVD_STATUS))
+		(adev->vcn.cur_state != AMD_PG_STATE_GATE &&
+		 RREG32_SOC15(VCN, 0, mmUVD_STATUS))) {
 		vcn_v1_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
+	}
 
 	return 0;
 }
-- 
2.7.4

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

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

* [PATCH 2/7] drm/amdgpu/vcn2.0: add cancel_delayed_work_sync before power gate
  2021-05-19 16:22 [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate James Zhu
@ 2021-05-19 16:22 ` James Zhu
  2021-05-19 16:22 ` [PATCH 3/7] drm/amdgpu/vcn2.5: " James Zhu
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: James Zhu @ 2021-05-19 16:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: jamesz

Add cancel_delayed_work_sync before set power gating state
to avoid race condition issue when power gating.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index 116b964..8af567c 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -262,6 +262,8 @@ static int vcn_v2_0_hw_fini(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
+
 	if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
 	    (adev->vcn.cur_state != AMD_PG_STATE_GATE &&
 	      RREG32_SOC15(VCN, 0, mmUVD_STATUS)))
-- 
2.7.4

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

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

* [PATCH 3/7] drm/amdgpu/vcn2.5: add cancel_delayed_work_sync before power gate
  2021-05-19 16:22 [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate James Zhu
  2021-05-19 16:22 ` [PATCH 2/7] drm/amdgpu/vcn2.0: " James Zhu
@ 2021-05-19 16:22 ` James Zhu
  2021-05-19 16:22 ` [PATCH 4/7] drm/amdgpu/vcn3: " James Zhu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: James Zhu @ 2021-05-19 16:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: jamesz

Add cancel_delayed_work_sync before set power gating state
to avoid race condition issue when power gating.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
index 948813d..888b17d 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
@@ -321,6 +321,8 @@ static int vcn_v2_5_hw_fini(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	int i;
 
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
+
 	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
 		if (adev->vcn.harvest_config & (1 << i))
 			continue;
-- 
2.7.4

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

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

* [PATCH 4/7] drm/amdgpu/vcn3: add cancel_delayed_work_sync before power gate
  2021-05-19 16:22 [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate James Zhu
  2021-05-19 16:22 ` [PATCH 2/7] drm/amdgpu/vcn2.0: " James Zhu
  2021-05-19 16:22 ` [PATCH 3/7] drm/amdgpu/vcn2.5: " James Zhu
@ 2021-05-19 16:22 ` James Zhu
  2021-05-19 16:22 ` [PATCH 5/7] drm/amdgpu/jpeg2.0: " James Zhu
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: James Zhu @ 2021-05-19 16:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: jamesz

Add cancel_delayed_work_sync before set power gating state
to avoid race condition issue when power gating.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
index 2d67cab..ce3c794 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
@@ -380,15 +380,14 @@ static int vcn_v3_0_hw_init(void *handle)
 static int vcn_v3_0_hw_fini(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	struct amdgpu_ring *ring;
-	int i, j;
+	int i;
+
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
 
 	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
 		if (adev->vcn.harvest_config & (1 << i))
 			continue;
 
-		ring = &adev->vcn.inst[i].ring_dec;
-
 		if (!amdgpu_sriov_vf(adev)) {
 			if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
 					(adev->vcn.cur_state != AMD_PG_STATE_GATE &&
-- 
2.7.4

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

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

* [PATCH 5/7] drm/amdgpu/jpeg2.0: add cancel_delayed_work_sync before power gate
  2021-05-19 16:22 [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate James Zhu
                   ` (2 preceding siblings ...)
  2021-05-19 16:22 ` [PATCH 4/7] drm/amdgpu/vcn3: " James Zhu
@ 2021-05-19 16:22 ` James Zhu
  2021-05-19 16:22 ` [PATCH 6/7] drm/amdgpu/jpeg2.5: " James Zhu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: James Zhu @ 2021-05-19 16:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: jamesz

Add cancel_delayed_work_sync before set power gating state
to avoid race condition issue when power gating.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
index de5abce..85967a5 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
@@ -172,6 +172,8 @@ static int jpeg_v2_0_hw_fini(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
+
 	if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
 	      RREG32_SOC15(JPEG, 0, mmUVD_JRBC_STATUS))
 		jpeg_v2_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
-- 
2.7.4

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

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

* [PATCH 6/7] drm/amdgpu/jpeg2.5: add cancel_delayed_work_sync before power gate
  2021-05-19 16:22 [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate James Zhu
                   ` (3 preceding siblings ...)
  2021-05-19 16:22 ` [PATCH 5/7] drm/amdgpu/jpeg2.0: " James Zhu
@ 2021-05-19 16:22 ` James Zhu
  2021-05-19 16:22 ` [PATCH 7/7] drm/amdgpu/jpeg3: " James Zhu
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: James Zhu @ 2021-05-19 16:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: jamesz

Add cancel_delayed_work_sync before set power gating state
to avoid race condition issue when power gating.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
index 938ef4c..46096ad 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
@@ -187,14 +187,14 @@ static int jpeg_v2_5_hw_init(void *handle)
 static int jpeg_v2_5_hw_fini(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	struct amdgpu_ring *ring;
 	int i;
 
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
+
 	for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) {
 		if (adev->jpeg.harvest_config & (1 << i))
 			continue;
 
-		ring = &adev->jpeg.inst[i].ring_dec;
 		if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
 		      RREG32_SOC15(JPEG, i, mmUVD_JRBC_STATUS))
 			jpeg_v2_5_set_powergating_state(adev, AMD_PG_STATE_GATE);
-- 
2.7.4

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

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

* [PATCH 7/7] drm/amdgpu/jpeg3: add cancel_delayed_work_sync before power gate
  2021-05-19 16:22 [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate James Zhu
                   ` (4 preceding siblings ...)
  2021-05-19 16:22 ` [PATCH 6/7] drm/amdgpu/jpeg2.5: " James Zhu
@ 2021-05-19 16:22 ` James Zhu
  2021-05-20 10:56 ` [PATCH 1/7] drm/amdgpu/vcn1: " Christian König
  2021-05-20 13:51 ` Leo Liu
  7 siblings, 0 replies; 9+ messages in thread
From: James Zhu @ 2021-05-19 16:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: jamesz

Add cancel_delayed_work_sync before set power gating state
to avoid race condition issue when power gating.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c
index 94be353..bd77794 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c
@@ -159,9 +159,9 @@ static int jpeg_v3_0_hw_init(void *handle)
 static int jpeg_v3_0_hw_fini(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	struct amdgpu_ring *ring;
 
-	ring = &adev->jpeg.inst->ring_dec;
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
+
 	if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
 	      RREG32_SOC15(JPEG, 0, mmUVD_JRBC_STATUS))
 		jpeg_v3_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
-- 
2.7.4

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

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

* Re: [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate
  2021-05-19 16:22 [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate James Zhu
                   ` (5 preceding siblings ...)
  2021-05-19 16:22 ` [PATCH 7/7] drm/amdgpu/jpeg3: " James Zhu
@ 2021-05-20 10:56 ` Christian König
  2021-05-20 13:51 ` Leo Liu
  7 siblings, 0 replies; 9+ messages in thread
From: Christian König @ 2021-05-20 10:56 UTC (permalink / raw)
  To: James Zhu, amd-gfx; +Cc: jamesz

Am 19.05.21 um 18:22 schrieb James Zhu:
> Add cancel_delayed_work_sync before set power gating state
> to avoid race condition issue when power gating.
>
> Signed-off-by: James Zhu <James.Zhu@amd.com>

Acked-by: Christian König <christian.koenig@amd.com> for the series.

> ---
>   drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> index 0c1beef..27b1ced 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> @@ -231,9 +231,13 @@ static int vcn_v1_0_hw_fini(void *handle)
>   {
>   	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>   
> +	cancel_delayed_work_sync(&adev->vcn.idle_work);
> +
>   	if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
> -		RREG32_SOC15(VCN, 0, mmUVD_STATUS))
> +		(adev->vcn.cur_state != AMD_PG_STATE_GATE &&
> +		 RREG32_SOC15(VCN, 0, mmUVD_STATUS))) {
>   		vcn_v1_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
> +	}
>   
>   	return 0;
>   }

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

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

* Re: [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate
  2021-05-19 16:22 [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate James Zhu
                   ` (6 preceding siblings ...)
  2021-05-20 10:56 ` [PATCH 1/7] drm/amdgpu/vcn1: " Christian König
@ 2021-05-20 13:51 ` Leo Liu
  7 siblings, 0 replies; 9+ messages in thread
From: Leo Liu @ 2021-05-20 13:51 UTC (permalink / raw)
  To: James Zhu, amd-gfx; +Cc: jamesz

The series are:

Reviewed-by: Leo Liu <leo.liu@amd.com>


On 2021-05-19 12:22 p.m., James Zhu wrote:
> Add cancel_delayed_work_sync before set power gating state
> to avoid race condition issue when power gating.
>
> Signed-off-by: James Zhu <James.Zhu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> index 0c1beef..27b1ced 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> @@ -231,9 +231,13 @@ static int vcn_v1_0_hw_fini(void *handle)
>   {
>   	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>   
> +	cancel_delayed_work_sync(&adev->vcn.idle_work);
> +
>   	if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
> -		RREG32_SOC15(VCN, 0, mmUVD_STATUS))
> +		(adev->vcn.cur_state != AMD_PG_STATE_GATE &&
> +		 RREG32_SOC15(VCN, 0, mmUVD_STATUS))) {
>   		vcn_v1_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
> +	}
>   
>   	return 0;
>   }
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2021-05-20 13:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 16:22 [PATCH 1/7] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate James Zhu
2021-05-19 16:22 ` [PATCH 2/7] drm/amdgpu/vcn2.0: " James Zhu
2021-05-19 16:22 ` [PATCH 3/7] drm/amdgpu/vcn2.5: " James Zhu
2021-05-19 16:22 ` [PATCH 4/7] drm/amdgpu/vcn3: " James Zhu
2021-05-19 16:22 ` [PATCH 5/7] drm/amdgpu/jpeg2.0: " James Zhu
2021-05-19 16:22 ` [PATCH 6/7] drm/amdgpu/jpeg2.5: " James Zhu
2021-05-19 16:22 ` [PATCH 7/7] drm/amdgpu/jpeg3: " James Zhu
2021-05-20 10:56 ` [PATCH 1/7] drm/amdgpu/vcn1: " Christian König
2021-05-20 13:51 ` Leo Liu

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.