drm/amd: Don't allow s0ix on APUs older than Raven
Subsystems (2)
PATCH v2 1/1 drm/amd: Don't allow s0ix on APUs older than Raven
APUs before Raven didn't support s0ix. As we just relieved some of the safety checks for s0ix to improve power consumption on APUs that support it but that are missing BIOS support a new blind spot was introduced that a user could "try" to run s0ix.
Plug this hole so that if users try to run s0ix on anything older than Raven it will just skip suspend of the GPU.
---v1->v2:
* Don't run any suspend code or resume code in this case
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
@@ -1073,6 +1073,9 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) (pm_suspend_target_state != PM_SUSPEND_TO_IDLE))return false; +if (adev->asic_type <CHIP_RAVEN ) +return false; +/* * If ACPI_FADT_LOW_POWER_S0 is not set in the FADT, it is generally * risky to do any special firmware-related preparations for entering
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6 -1
@@ -2414,8 +2414,10 @@ static int amdgpu_pmops_suspend(struct device *dev)if (amdgpu_acpi_is_s0ix_active (adev)) adev->in_s0ix = true; -else +else if (amdgpu_acpi_is_s3_active (adev)) adev->in_s3 = true; +if (!adev->in_s0ix && !adev->in_s3) +return 0 ;return amdgpu_device_suspend (drm_dev, true); }
@@ -2436,6 +2438,9 @@ static int amdgpu_pmops_resume(struct device *dev)struct amdgpu_device *adev =drm_to_adev (drm_dev);int r; +if (!adev->in_s0ix && !adev->in_s3) +return 0 ; +/* Avoids registers access if device is physically gone */ if (!pci_device_is_present (adev->pdev)) adev->no_hw_access = true;
Signature · 1 line
2.25.1
[Public]
Quoted 16 lines
-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Monday, February 13, 2023 15:11
To: [email protected]
Cc: Limonciello, Mario <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH v2] drm/amd: Don't allow s0ix on APUs older than RavenAPUs before Raven didn't support s0ix. As we just relieved some of the safety checks for s0ix to improve power consumption on APUs that support it but that are missing BIOS support a new blind spot was introduced that a user could "try" to run s0ix.
Plug this hole so that if users try to run s0ix on anything older than Raven it will just skip suspend of the GPU.
Quoted 6 lines
Fixes cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support")Suggested-by Alexander Deucher <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Don't run any suspend code or resume code in this case
Any feedback for this patch?
Quoted 53 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3
-0@@ -1073,6 +1073,9 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) (pm_suspend_target_state != PM_SUSPEND_TO_IDLE)) return false; +if (adev->asic_type <CHIP_RAVEN ) +return false; +/* * If ACPI_FADT_LOW_POWER_S0 is not set in the FADT, it is generally
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0
-0* risky to do any special firmware-related preparations for entering drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6
-1@@ -2414,8 +2414,10 @@ static int amdgpu_pmops_suspend(struct device *dev)if (amdgpu_acpi_is_s0ix_active (adev)) adev->in_s0ix = true; -else +else if (amdgpu_acpi_is_s3_active (adev)) adev->in_s3 = true; +if (!adev->in_s0ix && !adev->in_s3) +return 0 ;return amdgpu_device_suspend (drm_dev, true); }@@ -2436,6 +2438,9 @@ static int amdgpu_pmops_resume(struct device *dev)struct amdgpu_device *adev =drm_to_adev (drm_dev);int r; +if (!adev->in_s0ix && !adev->in_s3) +return 0 ; +/* Avoids registers access if device is physically gone */ if (!pci_device_is_present (adev->pdev))
adev->no_hw_access= true;
--
2.25.1
Alex Deucher
Reviewed-byQuoted 21 lines · Mario
[Public]
Quoted 16 lines
-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Monday, February 13, 2023 15:11
To: [email protected]
Cc: Limonciello, Mario <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH v2] drm/amd: Don't allow s0ix on APUs older than RavenAPUs before Raven didn't support s0ix. As we just relieved some of the safety checks for s0ix to improve power consumption on APUs that support it but that are missing BIOS support a new blind spot was introduced that a user could "try" to run s0ix.
Plug this hole so that if users try to run s0ix on anything older than Raven it will just skip suspend of the GPU.
Quoted 8 lines
Quoted 6 lines
Fixes cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support")Suggested-by Alexander Deucher <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Don't run any suspend code or resume code in this caseAny feedback for this patch?
I think for S0ix and dGPUs, we probably need some additional work as well. If the user tries s2idle and the platform doesn't actually support s0ix (i.e., doesn't actually turn off the power rails), we should be using the runtime suspend routines for BACO/BOCO rather than the S3 suspend routines.
Alex
Quoted 54 lines
Quoted 54 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3
-0@@ -1073,6 +1073,9 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) (pm_suspend_target_state != PM_SUSPEND_TO_IDLE)) return false; +if (adev->asic_type <CHIP_RAVEN ) +return false; +/* * If ACPI_FADT_LOW_POWER_S0 is not set in the FADT, it is generally
* risky to do any special firmware-related preparations for enteringdrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6
-1@@ -2414,8 +2414,10 @@ static int amdgpu_pmops_suspend(struct device *dev)if (amdgpu_acpi_is_s0ix_active (adev)) adev->in_s0ix = true; -else +else if (amdgpu_acpi_is_s3_active (adev)) adev->in_s3 = true; +if (!adev->in_s0ix && !adev->in_s3) +return 0 ;return amdgpu_device_suspend (drm_dev, true); }@@ -2436,6 +2438,9 @@ static int amdgpu_pmops_resume(struct device *dev)struct amdgpu_device *adev =drm_to_adev (drm_dev);int r; +if (!adev->in_s0ix && !adev->in_s3) +return 0 ; +/* Avoids registers access if device is physically gone */ if (!pci_device_is_present (adev->pdev))adev->no_hw_access = true;--
2.25.1
[AMD Official Use Only - General]
Quoted 39 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Monday, February 20, 2023 11:10
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2] drm/amd: Don't allow s0ix on APUs older than RavenQuoted 10 lines · Mario
[Public]
Quoted 5 lines
-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Monday, February 13, 2023 15:11
To: [email protected]
Cc: Limonciello, Mario <[email protected]>; Deucher,Alexander
Quoted 18 lines
Quoted 17 lines
<[email protected]>
Subject: [PATCH v2] drm/amd: Don't allow s0ix on APUs older than RavenAPUs before Raven didn't support s0ix. As we just relieved some of the safety checks for s0ix to improve power consumption on APUs that support it but that are missing BIOS support a new blind spot was introduced that a user could "try" to run s0ix.
Plug this hole so that if users try to run s0ix on anything older than Raven it will just skip suspend of the GPU.
Fixes cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support")Suggested-by Alexander Deucher <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Don't run any suspend code or resume code in this case
Quoted 4 lines
Quoted 1 line
Any feedback for this patch?
Reviewed-by Alex Deucher <[email protected]>
Thanks.
Quoted 5 lines
I think for S0ix and dGPUs, we probably need some additional work as well. If the user tries s2idle and the platform doesn't actually support s0ix (i.e., doesn't actually turn off the power rails), we should be using the runtime suspend routines for BACO/BOCO rather than the S3 suspend routines.
OK - I'll review the framework code for that case and see what makes sense.
Quoted 59 lines
Alex
Quoted 16 lines
Quoted 16 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0
-0@@ -1073,6 +1073,9 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) (pm_suspend_target_state != PM_SUSPEND_TO_IDLE)) return false;Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend(struct
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3
-0+if (adev->asic_type <CHIP_RAVEN ) +return false; +/* * If ACPI_FADT_LOW_POWER_S0 is not set in the FADT, it is generally
* risky to do any special firmware-related preparations for enteringdrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2414,8 +2414,10 @@ static int amdgpu_pmops_suspend(structdevice
Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6
-1*dev)if (amdgpu_acpi_is_s0ix_active (adev)) adev->in_s0ix = true; -else +else if (amdgpu_acpi_is_s3_active (adev)) adev->in_s3 = true; +if (!adev->in_s0ix && !adev->in_s3) +return 0 ;return amdgpu_device_suspend (drm_dev, true); }@@ -2436,6 +2438,9 @@ static int amdgpu_pmops_resume(struct device *dev)struct amdgpu_device *adev =drm_to_adev (drm_dev);int r; +if (!adev->in_s0ix && !adev->in_s3) +return 0 ; +/* Avoids registers access if device is physically gone */ if (!pci_device_is_present (adev->pdev))adev->no_hw_access = true;--
2.25.1