Skip to contentSkip to conversation

Runtime suspend for APUs

RFC PATCH In review Mario Limonciello (AMD) 3 participants 5 messages Dec 7, 2025 – Dec 8, 2025

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

cover Runtime suspend for APUs

Set up APUs to follow similar policies as dGPUs in that they can potentially runtime suspend. If an APU is runtime suspended then prepare it for the matching system state (s0ix or s3) so that steps can be skipped when runtime suspended.

The thought with this series is that if the compositor has turned off displays and no other work is running an APU's GPU can enter runtime PM. If the system later enters system suspend the GPU steps can be skipped because the GPU is already in the runtime PM state to match the intended system state.

It's important to note that default runtime PM policy will prevent entering runtime PM when displays are connected. This can be changed by setting amdgpu.runpm=-2.

This series isn't yet tested, I just share it for feedback on the approach. If anyone wants to test it as well, please feel free.

Cc Antheas Kapenekakis <[email protected]>

Mario Limonciello (AMD) (1):
drm/amd: Expand runtime suspend to APUs

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 17 +++++++++++++++--
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h    |  1 +
 3 files changed, 22 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

RFC PATCH 1/1 drm/amd: Expand runtime suspend to APUs

Set up APUs to follow similar policies as dGPUs in that they can potentially runtime suspend. If an APU is runtime suspended then prepare it for the matching system state (s0ix or s3) so that steps can be skipped when runtime suspended.

It's important to note that default runtime PM policy will prevent entering runtime PM when displays are connected. This can be changed by setting amdgpu.runpm=-2.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 17 +++++++++++++++--
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h    |  1 +
 3 files changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
index 6fffb47cb9b42..749fb29026ef5 100644
@@ -497,6 +497,12 @@ void amdgpu_device_detect_runtime_pm_mode(struct amdgpu_device *adev)
 			adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO;
 			dev_info(adev->dev, "Using BOCO for runtime pm\n");
 		} else {
+			/* APU runtime pm */
+			if (adev->flags & AMD_IS_APU) {
+				adev->pm.rpm_mode = AMDGPU_RUNPM_APU;
+				dev_info(adev->dev, "Using APU runtime pm\n");
+				break;
+			}
 			if (!bamaco_support)
 				goto no_runtime_pm;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15 -2
index 25b725bd38201..ebe544c544c10 100644
@@ -2471,7 +2471,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 		if (amdgpu_device_supports_px(adev))
 			dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
 		/* we want direct complete for BOCO */
-		if (amdgpu_device_supports_boco(adev))
+		if (amdgpu_device_supports_boco(adev) || adev->flags & AMD_IS_APU)
 			dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_SMART_PREPARE |
 						DPM_FLAG_SMART_SUSPEND |
 						DPM_FLAG_MAY_SKIP_RESUME);
@@ -2581,7 +2581,7 @@ static int amdgpu_pmops_prepare(struct device *dev)
 	/* Return a positive number here so
 	 * DPM_FLAG_SMART_SUSPEND works properly
 	 */
-	if (amdgpu_device_supports_boco(adev) && pm_runtime_suspended(dev))
+	if (pm_runtime_suspended(dev))
 		return 1;
 
 	/* if we will not support s3 or s2i for the device
@@ -2848,6 +2848,15 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
 	ret = amdgpu_device_prepare(drm_dev);
 	if (ret)
 		return ret;
+
+	/* for APUs - match the sleep state of the system */
+	if (adev->pm.rpm_mode == AMDGPU_RUNPM_APU) {
+		if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
+			adev->in_s0ix = true;
+		else
+			adev->in_s3 = true;
+	}
+
 	ret = amdgpu_device_suspend(drm_dev, false);
 	if (ret) {
 		adev->in_runpm = false;
@@ -2925,6 +2934,10 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
 	if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX)
 		drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
 	adev->in_runpm = false;
+	if (adev->pm.rpm_mode == AMDGPU_RUNPM_APU) {
+		adev->in_s0ix = false;
+		adev->in_s3 = false;
+	}
 	return 0;
 }
 
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +1 -0
index c7ea293856827..2972c874b5e6d 100644
@@ -51,6 +51,7 @@ enum amdgpu_runpm_mode {
 	AMDGPU_RUNPM_BOCO,
 	AMDGPU_RUNPM_BACO,
 	AMDGPU_RUNPM_BAMACO,
+	AMDGPU_RUNPM_APU,
 };
 
 #define BACO_SUPPORT (1<<0)
Signature · 1 line
2.43.0
#2 lore raw
In reply to Mario Limonciello (AMD)
Quoted 11 lines · Mario Limonciello (AMD)

Set up APUs to follow similar policies as dGPUs in that they can potentially runtime suspend. If an APU is runtime suspended then prepare it for the matching system state (s0ix or s3) so that steps can be skipped when runtime suspended.

The thought with this series is that if the compositor has turned off displays and no other work is running an APU's GPU can enter runtime PM. If the system later enters system suspend the GPU steps can be skipped because the GPU is already in the runtime PM state to match the intended system state.

The compositor or a game probably has assets on the GPU. If they are frozen, would the amdgpu driver be able to suspend?

Quoted 21 lines

It's important to note that default runtime PM policy will prevent entering runtime PM when displays are connected. This can be changed by setting amdgpu.runpm=-2.

This series isn't yet tested, I just share it for feedback on the approach. If anyone wants to test it as well, please feel free.

Cc Antheas Kapenekakis <[email protected]>

Mario Limonciello (AMD) (1):
drm/amd: Expand runtime suspend to APUs

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 17 +++++++++++++++--
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h    |  1 +
 3 files changed, 22 insertions(+), 2 deletions(-)

--
2.43.0

#3 lore raw
Quoted 7 lines · Antheas Kapenekakis
Quoted 6 lines · Mario Limonciello (AMD)

Set up APUs to follow similar policies as dGPUs in that they can potentially runtime suspend. If an APU is runtime suspended then prepare it for the matching system state (s0ix or s3) so that steps can be skipped when runtime suspended.

Quoted 8 lines
Quoted 5 lines

The thought with this series is that if the compositor has turned off displays and no other work is running an APU's GPU can enter runtime PM. If the system later enters system suspend the GPU steps can be skipped because the GPU is already in the runtime PM state to match the intended system state.

The compositor or a game probably has assets on the GPU. If they are frozen, would the amdgpu driver be able to suspend?

I'd expect so at least for some workloads. This is why we're able to enter GFXOFF at runtime, the various rings are idle.

And if they're working like I'd expect any sort of GFX work, display work, or reading a sensor will wake it back up.

But by all means try the patch and see what happens.

Quoted 23 lines
Quoted 22 lines

It's important to note that default runtime PM policy will prevent entering runtime PM when displays are connected. This can be changed by setting amdgpu.runpm=-2.

This series isn't yet tested, I just share it for feedback on the approach. If anyone wants to test it as well, please feel free.

Cc Antheas Kapenekakis <[email protected]>

Mario Limonciello (AMD) (1):
drm/amd: Expand runtime suspend to APUs

  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 17 +++++++++++++++--
  drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h    |  1 +
  3 files changed, 22 insertions(+), 2 deletions(-)

--
2.43.0

#4 lore raw
In reply to Antheas Kapenekakis
Quoted 8 lines · Antheas Kapenekakis
Quoted 6 lines · Mario Limonciello (AMD)

Set up APUs to follow similar policies as dGPUs in that they can potentially runtime suspend. If an APU is runtime suspended then prepare it for the matching system state (s0ix or s3) so that steps can be skipped when runtime suspended.

Quoted 8 lines
Quoted 5 lines

The thought with this series is that if the compositor has turned off displays and no other work is running an APU's GPU can enter runtime PM. If the system later enters system suspend the GPU steps can be skipped because the GPU is already in the runtime PM state to match the intended system state.

The compositor or a game probably has assets on the GPU. If they are frozen, would the amdgpu driver be able to suspend?

Yes. APUs don't have dedicated VRAM so all assets are in system memory. For dGPUs, the assets need to be migrated to system memory if the low power state results in VRAM getting powered down. That said, the assets will be swapped back into VRAM on resume as needed.

Alex

Quoted 23 lines
Quoted 22 lines

It's important to note that default runtime PM policy will prevent entering runtime PM when displays are connected. This can be changed by setting amdgpu.runpm=-2.

This series isn't yet tested, I just share it for feedback on the approach. If anyone wants to test it as well, please feel free.

Cc Antheas Kapenekakis <[email protected]>

Mario Limonciello (AMD) (1):
drm/amd: Expand runtime suspend to APUs

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 17 +++++++++++++++--
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h    |  1 +
 3 files changed, 22 insertions(+), 2 deletions(-)

--
2.43.0