Skip to contentSkip to conversation

drm/amd: Allow s0ix without BIOS support

PATCH In review Mario Limonciello 3 participants 7 messages Jan 25, 2023 – Feb 2, 2023

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

PATCH 1/1 drm/amd: Allow s0ix without BIOS support

We guard the suspend entry code from running unless we have proper BIOS support for either S3 mode or s0ix mode.

If a user's system doesn't support either of these modes the kernel still does offer s2idle in /sys/power/mem_sleep so there is an expectation from users that it works even if the power consumption remains very high.

Rafael Ávila de Espíndola reports that a system of his has a non-functional graphics stack after resuming. That system doesn't support S3 and the FADT doesn't indicate support for low power idle.

Through some experimentation it was concluded that even without the hardware s0i3 support provided by the amd_pmc driver the power consumption over suspend is decreased by running amdgpu's s0ix suspend routine.

The numbers over suspend showed:
* No patch: 9.2W
* Skip amdgpu suspend entirely: 10.5W
* Run amdgpu s0ix routine: 7.7W

As this does improve the power, remove some of the guard rails in amdgpu_acpi.c for only running s0ix suspend routines in the right circumstances.

However if this turns out to cause regressions for anyone, we should revert this change and instead opt for skipping suspend/resume routines entirely or try to fix the underlying behavior that makes graphics fail after resume without underlying platform support.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -6
index 57b5e11446c65..fa7375b97fd47 100644
@@ -1079,20 +1079,16 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
 	 * S0ix even though the system is suspending to idle, so return false
 	 * in that case.
 	 */
-	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
 		dev_warn_once(adev->dev,
 			      "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
 			      "To use suspend-to-idle change the sleep mode in BIOS setup.\n");
-		return false;
-	}
 
 #if !IS_ENABLED(CONFIG_AMD_PMC)
 	dev_warn_once(adev->dev,
 		      "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
-	return false;
-#else
-	return true;
 #endif /* CONFIG_AMD_PMC */
+	return true;
 }
 
 #endif /* CONFIG_SUSPEND */
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 27 lines · Mario Limonciello

We guard the suspend entry code from running unless we have proper BIOS support for either S3 mode or s0ix mode.

If a user's system doesn't support either of these modes the kernel still does offer s2idle in /sys/power/mem_sleep so there is an expectation from users that it works even if the power consumption remains very high.

Rafael Ávila de Espíndola reports that a system of his has a non-functional graphics stack after resuming. That system doesn't support S3 and the FADT doesn't indicate support for low power idle.

Through some experimentation it was concluded that even without the hardware s0i3 support provided by the amd_pmc driver the power consumption over suspend is decreased by running amdgpu's s0ix suspend routine.

The numbers over suspend showed:
* No patch: 9.2W
* Skip amdgpu suspend entirely: 10.5W
* Run amdgpu s0ix routine: 7.7W

As this does improve the power, remove some of the guard rails in amdgpu_acpi.c for only running s0ix suspend routines in the right circumstances.

Quoted 8 lines

However if this turns out to cause regressions for anyone, we should revert this change and instead opt for skipping suspend/resume routines entirely or try to fix the underlying behavior that makes graphics fail after resume without underlying platform support.

Quoted 34 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -7
index 57b5e11446c65..fa7375b97fd47 100644
@@ -1079,20 +1079,16 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
         * S0ix even though the system is suspending to idle, so return false
         * in that case.
         */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
                dev_warn_once(adev->dev,
                              "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
                              "To use suspend-to-idle change the sleep mode in BIOS setup.\n");
-               return false;
-       }
 
 #if !IS_ENABLED(CONFIG_AMD_PMC)
        dev_warn_once(adev->dev,
                      "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
-       return false;
-#else
-       return true;
 #endif /* CONFIG_AMD_PMC */
+       return true;
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.25.1

Acked-by on v1 1/1
#2 lore raw
In reply to Mario Limonciello
Quoted 26 lines · Mario Limonciello

We guard the suspend entry code from running unless we have proper BIOS support for either S3 mode or s0ix mode.

If a user's system doesn't support either of these modes the kernel still does offer s2idle in /sys/power/mem_sleep so there is an expectation from users that it works even if the power consumption remains very high.

Rafael Ávila de Espíndola reports that a system of his has a non-functional graphics stack after resuming. That system doesn't support S3 and the FADT doesn't indicate support for low power idle.

Through some experimentation it was concluded that even without the hardware s0i3 support provided by the amd_pmc driver the power consumption over suspend is decreased by running amdgpu's s0ix suspend routine.

The numbers over suspend showed:
* No patch: 9.2W
* Skip amdgpu suspend entirely: 10.5W
* Run amdgpu s0ix routine: 7.7W

As this does improve the power, remove some of the guard rails in amdgpu_acpi.c for only running s0ix suspend routines in the right circumstances.

Quoted 8 lines

However if this turns out to cause regressions for anyone, we should revert this change and instead opt for skipping suspend/resume routines entirely or try to fix the underlying behavior that makes graphics fail after resume without underlying platform support.

I have tested this patch on a Gigabyte B550I AORUS PRO AX with a 4350G and can confirm that the errors are gone and the power consumption during suspend is down to 7.7 W.

Thanks,
Rafael

Quoted 33 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -6
index 57b5e11446c65..fa7375b97fd47 100644
@@ -1079,20 +1079,16 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
 	 * S0ix even though the system is suspending to idle, so return false
 	 * in that case.
 	 */
-	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
 		dev_warn_once(adev->dev,
 			      "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
 			      "To use suspend-to-idle change the sleep mode in BIOS setup.\n");
-		return false;
-	}
 
 #if !IS_ENABLED(CONFIG_AMD_PMC)
 	dev_warn_once(adev->dev,
 		      "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
-	return false;
-#else
-	return true;
 #endif /* CONFIG_AMD_PMC */
+	return true;
 }
 
 #endif /* CONFIG_SUSPEND */
Signature · 1 line
2.25.1
#3 lore raw
In reply to Mario Limonciello

BTW, to which git repo this gets added first? I took a look at
git://anongit.freedesktop.org/drm-tip, but it is not there.

Thanks,
Rafael

Quoted 67 lines · Mario Limonciello

We guard the suspend entry code from running unless we have proper BIOS support for either S3 mode or s0ix mode.

If a user's system doesn't support either of these modes the kernel still does offer s2idle in /sys/power/mem_sleep so there is an expectation from users that it works even if the power consumption remains very high.

Rafael Ávila de Espíndola reports that a system of his has a non-functional graphics stack after resuming. That system doesn't support S3 and the FADT doesn't indicate support for low power idle.

Through some experimentation it was concluded that even without the hardware s0i3 support provided by the amd_pmc driver the power consumption over suspend is decreased by running amdgpu's s0ix suspend routine.

The numbers over suspend showed:
* No patch: 9.2W
* Skip amdgpu suspend entirely: 10.5W
* Run amdgpu s0ix routine: 7.7W

As this does improve the power, remove some of the guard rails in amdgpu_acpi.c for only running s0ix suspend routines in the right circumstances.

However if this turns out to cause regressions for anyone, we should revert this change and instead opt for skipping suspend/resume routines entirely or try to fix the underlying behavior that makes graphics fail after resume without underlying platform support.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -6
index 57b5e11446c65..fa7375b97fd47 100644
@@ -1079,20 +1079,16 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
 	 * S0ix even though the system is suspending to idle, so return false
 	 * in that case.
 	 */
-	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
 		dev_warn_once(adev->dev,
 			      "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
 			      "To use suspend-to-idle change the sleep mode in BIOS setup.\n");
-		return false;
-	}
 
 #if !IS_ENABLED(CONFIG_AMD_PMC)
 	dev_warn_once(adev->dev,
 		      "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
-	return false;
-#else
-	return true;
 #endif /* CONFIG_AMD_PMC */
+	return true;
 }
 
 #endif /* CONFIG_SUSPEND */
Signature · 1 line
2.25.1
#4 lore raw

[Public]

Quoted 8 lines

-----Original Message-----
From: Rafael Ávila de Espíndola <[email protected]>
Sent: Monday, January 30, 2023 08:08
To: Limonciello, Mario <[email protected]>; amd- [email protected]
Cc: Limonciello, Mario <[email protected]>
Subject: Re: [PATCH] drm/amd: Allow s0ix without BIOS support

Quoted 5 lines

BTW, to which git repo this gets added first? I took a look at
git://anongit.freedesktop.org/drm-tip, but it is not there.

Thanks,
Rafael

Hi,

It will first show up in amd-staging-drm-next here:

https://gitlab.freedesktop.org/agd5f/linux/-/commits/amd-staging-drm-next

It hasn't been refreshed for things accepted this last week yet, but it should show up this week some time.

Thanks,

Quoted 75 lines
Quoted 31 lines · Mario Limonciello

We guard the suspend entry code from running unless we have proper BIOS support for either S3 mode or s0ix mode.

If a user's system doesn't support either of these modes the kernel still does offer s2idle in /sys/power/mem_sleep so there is an expectation from users that it works even if the power consumption remains very high.

Rafael Ávila de Espíndola reports that a system of his has a non-functional graphics stack after resuming. That system doesn't support S3 and the FADT doesn't indicate support for low power idle.

Through some experimentation it was concluded that even without the hardware s0i3 support provided by the amd_pmc driver the power consumption over suspend is decreased by running amdgpu's s0ix suspend routine.

The numbers over suspend showed:
* No patch: 9.2W
* Skip amdgpu suspend entirely: 10.5W
* Run amdgpu s0ix routine: 7.7W

As this does improve the power, remove some of the guard rails in amdgpu_acpi.c for only running s0ix suspend routines in the right circumstances.

However if this turns out to cause regressions for anyone, we should revert this change and instead opt for skipping suspend/resume routines entirely or try to fix the underlying behavior that makes graphics fail after resume without underlying platform support.

Review

Quoted 8 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct

Quoted 4 lines

index 57b5e11446c65..fa7375b97fd47 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
@@ -1079,20 +1079,16 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
 	 * S0ix even though the system is suspending to idle, so return false
 	 * in that case.
 	 */
-	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
 		dev_warn_once(adev->dev,
 			      "Power consumption will be higher as BIOS has

not been configured for suspend-to-idle.\n"

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct · line 1085

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
 			      "To use suspend-to-idle change the sleep mode in

BIOS setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -2
-		return false;
-	}
 
 #if !IS_ENABLED(CONFIG_AMD_PMC)
 	dev_warn_once(adev->dev,
 		      "Power consumption will be higher as the kernel has not

been compiled with CONFIG_AMD_PMC.\n");

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -4
-	return false;
-#else
-	return true;
 #endif /* CONFIG_AMD_PMC */
+	return true;
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.25.1

#5 lore raw
In reply to Mario Limonciello
Quoted 44 lines · Mario Limonciello

We guard the suspend entry code from running unless we have proper BIOS support for either S3 mode or s0ix mode.

If a user's system doesn't support either of these modes the kernel still does offer s2idle in /sys/power/mem_sleep so there is an expectation from users that it works even if the power consumption remains very high.

Rafael Ávila de Espíndola reports that a system of his has a non-functional graphics stack after resuming. That system doesn't support S3 and the FADT doesn't indicate support for low power idle.

Through some experimentation it was concluded that even without the hardware s0i3 support provided by the amd_pmc driver the power consumption over suspend is decreased by running amdgpu's s0ix suspend routine.

The numbers over suspend showed:
* No patch: 9.2W
* Skip amdgpu suspend entirely: 10.5W
* Run amdgpu s0ix routine: 7.7W

As this does improve the power, remove some of the guard rails in amdgpu_acpi.c for only running s0ix suspend routines in the right circumstances.

However if this turns out to cause regressions for anyone, we should revert this change and instead opt for skipping suspend/resume routines entirely or try to fix the underlying behavior that makes graphics fail after resume without underlying platform support.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
index 57b5e11446c65..fa7375b97fd47 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) · line 1086

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -2
@@ -1079,20 +1079,16 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
         * S0ix even though the system is suspending to idle, so return false
         * in that case.
         */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
                dev_warn_once(adev->dev,
                              "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
                              "To use suspend-to-idle change the sleep mode in BIOS setup.\n");
-               return false;

Thinking about this more, I think we may need to check the asic type here. Pre-Raven APUs didn't support S0ix at all so this may break them if they have any checks that use amdgpu_acpi_is_s0ix_active() in their code paths.

Alex

Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -5
-       }
 
 #if !IS_ENABLED(CONFIG_AMD_PMC)
        dev_warn_once(adev->dev,
                      "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
-       return false;
-#else
-       return true;
 #endif /* CONFIG_AMD_PMC */
+       return true;
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.25.1

#6 lore raw

[AMD Official Use Only - General]

Quoted 64 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, February 1, 2023 21:49
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH] drm/amd: Allow s0ix without BIOS support

Quoted 32 lines · Mario Limonciello

We guard the suspend entry code from running unless we have proper BIOS support for either S3 mode or s0ix mode.

If a user's system doesn't support either of these modes the kernel still does offer s2idle in /sys/power/mem_sleep so there is an expectation from users that it works even if the power consumption remains very high.

Rafael Ávila de Espíndola reports that a system of his has a non-functional graphics stack after resuming. That system doesn't support S3 and the FADT doesn't indicate support for low power idle.

Through some experimentation it was concluded that even without the hardware s0i3 support provided by the amd_pmc driver the power consumption over suspend is decreased by running amdgpu's s0ix suspend routine.

The numbers over suspend showed:
* No patch: 9.2W
* Skip amdgpu suspend entirely: 10.5W
* Run amdgpu s0ix routine: 7.7W

As this does improve the power, remove some of the guard rails in amdgpu_acpi.c for only running s0ix suspend routines in the right circumstances.

However if this turns out to cause regressions for anyone, we should revert this change and instead opt for skipping suspend/resume routines entirely or try to fix the underlying behavior that makes graphics fail after resume without underlying platform support.

Review

Quoted 8 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct

Quoted 4 lines

index 57b5e11446c65..fa7375b97fd47 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
@@ -1079,20 +1079,16 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
         * S0ix even though the system is suspending to idle, so return false
         * in that case.
         */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
                dev_warn_once(adev->dev,
                              "Power consumption will be higher as BIOS has not been

configured for suspend-to-idle.\n"

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct · line 1085

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
                              "To use suspend-to-idle change the sleep mode in BIOS

setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct · line 1086

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -1
-               return false;

Thinking about this more, I think we may need to check the asic type here. Pre-Raven APUs didn't support S0ix at all so this may break them if they have any checks that use amdgpu_acpi_is_s0ix_active() in their code paths.

For them what should we be doing when they try to do s2idle though? S3 path? Or nothing?

Quoted 21 lines

Alex

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -1
-       }
 
 #if !IS_ENABLED(CONFIG_AMD_PMC)
        dev_warn_once(adev->dev,
                      "Power consumption will be higher as the kernel has not been

compiled with CONFIG_AMD_PMC.\n");

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -4
-       return false;
-#else
-       return true;
 #endif /* CONFIG_AMD_PMC */
+       return true;
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.25.1