Skip to contentSkip to conversation

drm/amdgpu: skipping SDMA hw_init and hw_fini for S0ix.

PATCH In review Rajib Mahapatra 4 participants 8 messages Feb 10, 2022 – Feb 11, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: skipping SDMA hw_init and hw_fini for S0ix.

[Why]
SDMA ring buffer test failed if suspend is aborted during S0i3 resume.

[How]
If suspend is aborted for some reason during S0i3 resume cycle, it follows SDMA ring test failing and errors in amdgpu resume. For RN/CZN/Picasso, SMU saves and restores SDMA registers during S0ix cycle. So, skipping SDMA suspend and resume from driver solves the issue. This time, the system is able to resume gracefully even the suspend is aborted.

v2: add changes on sdma_v4, skipping SDMA hw_init and hw_fini.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +8 -0
index 06a7ceda4c87..02115d63b071 100644
@@ -2058,6 +2058,10 @@ static int sdma_v4_0_suspend(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	/* SMU saves SDMA state for us */
+	if (adev->in_s0ix)
+		return 0;
+
 	return sdma_v4_0_hw_fini(adev);
 }
 
@@ -2065,6 +2069,10 @@ static int sdma_v4_0_resume(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	/* SMU restores SDMA state for us */
+	if (adev->in_s0ix)
+		return 0;
+
 	return sdma_v4_0_hw_init(adev);
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw

[Public]

Quoted 22 lines

-----Original Message-----
From: Mahapatra, Rajib <[email protected]>
Sent: Thursday, February 10, 2022 07:35
To: Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>; Deucher, Alexander <[email protected]>
Cc: [email protected]; S, Shirish <[email protected]>; Mahapatra, Rajib <[email protected]>
Subject: [PATCH v2] drm/amdgpu: skipping SDMA hw_init and hw_fini for S0ix.

[Why]
SDMA ring buffer test failed if suspend is aborted during S0i3 resume.

[How]
If suspend is aborted for some reason during S0i3 resume cycle, it follows SDMA ring test failing and errors in amdgpu resume. For RN/CZN/Picasso, SMU saves and restores SDMA registers during S0ix cycle. So, skipping SDMA suspend and resume from driver solves the issue. This time, the system is able to resume gracefully even the suspend is aborted.

Quoted 1 line

v2: add changes on sdma_v4, skipping SDMA hw_init and hw_fini.

This line in the commit message should be "below" the ---

Besides that the code is better.

Quoted 34 lines
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +8 -1
index 06a7ceda4c87..02115d63b071 100644
@@ -2058,6 +2058,10 @@ static int sdma_v4_0_suspend(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	/* SMU saves SDMA state for us */
+	if (adev->in_s0ix)
+		return 0;
+
 	return sdma_v4_0_hw_fini(adev);
 }
 
@@ -2065,6 +2069,10 @@ static int sdma_v4_0_resume(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	/* SMU restores SDMA state for us */
+	if (adev->in_s0ix)
+		return 0;
+
 	return sdma_v4_0_hw_init(adev);
 }
 
--

2.25.1

Reviewed-by
#2 lore raw
Quoted 27 lines · Mario

[Public]

Quoted 22 lines

-----Original Message-----
From: Mahapatra, Rajib <[email protected]>
Sent: Thursday, February 10, 2022 07:35
To: Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>; Deucher, Alexander <[email protected]>
Cc: [email protected]; S, Shirish <[email protected]>; Mahapatra, Rajib <[email protected]>
Subject: [PATCH v2] drm/amdgpu: skipping SDMA hw_init and hw_fini for S0ix.

[Why]
SDMA ring buffer test failed if suspend is aborted during S0i3 resume.

[How]
If suspend is aborted for some reason during S0i3 resume cycle, it follows SDMA ring test failing and errors in amdgpu resume. For RN/CZN/Picasso, SMU saves and restores SDMA registers during S0ix cycle. So, skipping SDMA suspend and resume from driver solves the issue. This time, the system is able to resume gracefully even the suspend is aborted.

Quoted 7 lines
Quoted 1 line

v2: add changes on sdma_v4, skipping SDMA hw_init and hw_fini.

This line in the commit message should be "below" the ---

Besides that the code is better.

I presume sdma_v5.2.c needs a similar fix?

Alex

Quoted 35 lines
Quoted 35 lines
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +8 -1
index 06a7ceda4c87..02115d63b071 100644
@@ -2058,6 +2058,10 @@ static int sdma_v4_0_suspend(void *handle)
 {
      struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+     /* SMU saves SDMA state for us */
+     if (adev->in_s0ix)
+             return 0;
+
      return sdma_v4_0_hw_fini(adev);
 }
 
@@ -2065,6 +2069,10 @@ static int sdma_v4_0_resume(void *handle)
 {
      struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+     /* SMU restores SDMA state for us */
+     if (adev->in_s0ix)
+             return 0;
+
      return sdma_v4_0_hw_init(adev);
 }
 
--

2.25.1

#3 lore raw

[Public]

Quoted 44 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, February 10, 2022 09:28
To: Limonciello, Mario <[email protected]>
Cc: Mahapatra, Rajib <[email protected]>; Liang, Prike <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]; S, Shirish <[email protected]>
Subject: Re: [PATCH v2] drm/amdgpu: skipping SDMA hw_init and hw_fini for S0ix.

Quoted 14 lines · Mario

[Public]

Quoted 9 lines

-----Original Message-----
From: Mahapatra, Rajib <[email protected]>
Sent: Thursday, February 10, 2022 07:35
To: Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>; Deucher, Alexander <[email protected]>
Cc: [email protected]; S, Shirish <[email protected]>; Mahapatra, Rajib <[email protected]>
Subject: [PATCH v2] drm/amdgpu: skipping SDMA hw_init and hw_fini for

S0ix.

Quoted 17 lines
Quoted 13 lines

[Why]
SDMA ring buffer test failed if suspend is aborted during S0i3 resume.

[How]
If suspend is aborted for some reason during S0i3 resume cycle, it follows SDMA ring test failing and errors in amdgpu resume. For RN/CZN/Picasso, SMU saves and restores SDMA registers during S0ix cycle. So, skipping SDMA suspend and resume from driver solves the issue. This time, the system is able to resume gracefully even the suspend is aborted.

Quoted 1 line

v2: add changes on sdma_v4, skipping SDMA hw_init and hw_fini.

This line in the commit message should be "below" the ---

Quoted 7 lines
Quoted 3 lines

Besides that the code is better.

I presume sdma_v5.2.c needs a similar fix?

VG doesn't do s0i3 right?
No, YC should not take a similar fix. YC had an architectural change and to
avoid a "similar" problem takes 26db706a6d77b9e184feb11725e97e53b7a89519.

Quoted 39 lines

Alex

Quoted 35 lines
Quoted 35 lines
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +8 -1
index 06a7ceda4c87..02115d63b071 100644
@@ -2058,6 +2058,10 @@ static int sdma_v4_0_suspend(void *handle)
 {
      struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+     /* SMU saves SDMA state for us */
+     if (adev->in_s0ix)
+             return 0;
+
      return sdma_v4_0_hw_fini(adev);
 }
 
@@ -2065,6 +2069,10 @@ static int sdma_v4_0_resume(void *handle)
 {
      struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+     /* SMU restores SDMA state for us */
+     if (adev->in_s0ix)
+             return 0;
+
      return sdma_v4_0_hw_init(adev);
 }
 
--

2.25.1

#4 lore raw
Quoted 51 lines · Mario

[Public]

Quoted 46 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, February 10, 2022 09:28
To: Limonciello, Mario <[email protected]>
Cc: Mahapatra, Rajib <[email protected]>; Liang, Prike <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]; S, Shirish <[email protected]>
Subject: Re: [PATCH v2] drm/amdgpu: skipping SDMA hw_init and hw_fini for S0ix.

Quoted 14 lines · Mario

[Public]

Quoted 9 lines

-----Original Message-----
From: Mahapatra, Rajib <[email protected]>
Sent: Thursday, February 10, 2022 07:35
To: Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>; Deucher, Alexander <[email protected]>
Cc: [email protected]; S, Shirish <[email protected]>; Mahapatra, Rajib <[email protected]>
Subject: [PATCH v2] drm/amdgpu: skipping SDMA hw_init and hw_fini for

S0ix.

Quoted 19 lines
Quoted 13 lines

[Why]
SDMA ring buffer test failed if suspend is aborted during S0i3 resume.

[How]
If suspend is aborted for some reason during S0i3 resume cycle, it follows SDMA ring test failing and errors in amdgpu resume. For RN/CZN/Picasso, SMU saves and restores SDMA registers during S0ix cycle. So, skipping SDMA suspend and resume from driver solves the issue. This time, the system is able to resume gracefully even the suspend is aborted.

Quoted 1 line

v2: add changes on sdma_v4, skipping SDMA hw_init and hw_fini.

This line in the commit message should be "below" the ---

Besides that the code is better.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I presume sdma_v5.2.c needs a similar fix?

VG doesn't do s0i3 right?

Right.

Quoted 2 lines

No, YC should not take a similar fix. YC had an architectural change and to
avoid a "similar" problem takes 26db706a6d77b9e184feb11725e97e53b7a89519.

Isn't that likely just a workaround for the same issue? This seems cleaner.

Alex

Quoted 40 lines
Quoted 40 lines

Alex

Quoted 35 lines
Quoted 35 lines
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +8 -1
index 06a7ceda4c87..02115d63b071 100644
@@ -2058,6 +2058,10 @@ static int sdma_v4_0_suspend(void *handle)
 {
      struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+     /* SMU saves SDMA state for us */
+     if (adev->in_s0ix)
+             return 0;
+
      return sdma_v4_0_hw_fini(adev);
 }
 
@@ -2065,6 +2069,10 @@ static int sdma_v4_0_resume(void *handle)
 {
      struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+     /* SMU restores SDMA state for us */
+     if (adev->in_s0ix)
+             return 0;
+
      return sdma_v4_0_hw_init(adev);
 }
 
--

2.25.1

#5 lore raw

[Public]

Quoted 10 lines
Quoted 1 line

VG doesn't do s0i3 right?

Right.

Quoted 2 lines

No, YC should not take a similar fix. YC had an architectural change and to
avoid a "similar" problem takes

26db706a6d77b9e184feb11725e97e53b7a89519.

Isn't that likely just a workaround for the same issue? This seems cleaner.

The SMU doesn't handle the restore of the SDMA registers for YC though, this explicitly changed. So I don't believe we can do an identical fix there.

@Liang, Prike comments?

#6 lore raw
Quoted 11 lines · Mario

[Public]

Quoted 8 lines
Quoted 1 line

VG doesn't do s0i3 right?

Right.

Quoted 2 lines

No, YC should not take a similar fix. YC had an architectural change and to
avoid a "similar" problem takes

26db706a6d77b9e184feb11725e97e53b7a89519.

Quoted 7 lines
Quoted 2 lines

Isn't that likely just a workaround for the same issue? This seems cleaner.

The SMU doesn't handle the restore of the SDMA registers for YC though, this explicitly changed. So I don't believe we can do an identical fix there.

@Liang, Prike comments?

Ah, ok, in that case, it's probably correct as is. I assumed the smu would probably behave the same.

Alex

#7 lore raw
In reply to Limonciello, Mario
Quoted 24 lines

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Friday, February 11, 2022 12:09 AM
To: Alex Deucher <[email protected]>; Liang, Prike <[email protected]>
Cc: Mahapatra, Rajib <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]; S, Shirish <[email protected]>
Subject: RE: [PATCH v2] drm/amdgpu: skipping SDMA hw_init and hw_fini for S0ix.

[Public]

Quoted 5 lines
Quoted 1 line

VG doesn't do s0i3 right?

Right.

Quoted 1 line

No, YC should not take a similar fix. YC had an architectural change and

to

Quoted 3 lines
Quoted 1 line

avoid a "similar" problem takes

26db706a6d77b9e184feb11725e97e53b7a89519.

Quoted 7 lines
Quoted 2 lines

Isn't that likely just a workaround for the same issue? This seems cleaner.

The SMU doesn't handle the restore of the SDMA registers for YC though, this explicitly changed. So I don't believe we can do an identical fix there.

@Liang, Prike comments?

Yeah, in the gfx10 series looks the SMU doesn't handle SDMA save and restore in the PMFW anymore.