Message ID | 20250401153225.96379-11-anshuman.gupta@intel.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
Series | VRAM Self Refresh | expand |
On 01-04-2025 21:02, Anshuman Gupta wrote: > Trade-off D3Cold target state based upon current vram usage. > If vram usage is greater than vram_d3cold_threshold and GPU > is VRSR capable target D3Cold state is D3Cold-VRSR > otherwise target state is D3Cold-Off. > > Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> > --- > drivers/gpu/drm/xe/xe_pm.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c > index d4149a2eace7..5db9313ae269 100644 > --- a/drivers/gpu/drm/xe/xe_pm.c > +++ b/drivers/gpu/drm/xe/xe_pm.c > @@ -148,6 +148,14 @@ static void xe_rpm_lockmap_release(const struct xe_device *xe) > &xe_pm_runtime_d3cold_map); > } > > +static void xe_pm_suspend_prepare(struct xe_device *xe) > +{ > + if (pm_suspend_target_state == PM_SUSPEND_TO_IDLE) > + xe_pm_d3cold_allowed_toggle(xe); > + else > + xe->d3cold.target_state = XE_D3COLD_OFF; > +} > + > /** > * xe_pm_suspend - Helper for System suspend, i.e. S0->S3 / S0->S2idle > * @xe: xe device instance > @@ -163,6 +171,8 @@ int xe_pm_suspend(struct xe_device *xe) > drm_dbg(&xe->drm, "Suspending device\n"); > trace_xe_pm_suspend(xe, __builtin_return_address(0)); > > + xe_pm_suspend_prepare(xe); > + > err = xe_pxp_pm_suspend(xe->pxp); > if (err) > goto err; > @@ -927,10 +937,14 @@ void xe_pm_d3cold_target_state_toggle(struct xe_device *xe) > > if (total_vram_used_mb < xe->d3cold.vram_threshold) > xe->d3cold.target_state = XE_D3COLD_OFF; > + else if (xe->d3cold.vrsr_capable) > + xe->d3cold.target_state = XE_D3COLD_VRSR; > else > xe->d3cold.target_state = XE_D3HOT; > > mutex_unlock(&xe->d3cold.lock); > + > + drm_dbg(&xe->drm, "Xe d3cold target state %d\n", xe->d3cold.allowed); the variable should be xe->d3cold.target_state > } > > /**
diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c index d4149a2eace7..5db9313ae269 100644 --- a/drivers/gpu/drm/xe/xe_pm.c +++ b/drivers/gpu/drm/xe/xe_pm.c @@ -148,6 +148,14 @@ static void xe_rpm_lockmap_release(const struct xe_device *xe) &xe_pm_runtime_d3cold_map); } +static void xe_pm_suspend_prepare(struct xe_device *xe) +{ + if (pm_suspend_target_state == PM_SUSPEND_TO_IDLE) + xe_pm_d3cold_allowed_toggle(xe); + else + xe->d3cold.target_state = XE_D3COLD_OFF; +} + /** * xe_pm_suspend - Helper for System suspend, i.e. S0->S3 / S0->S2idle * @xe: xe device instance @@ -163,6 +171,8 @@ int xe_pm_suspend(struct xe_device *xe) drm_dbg(&xe->drm, "Suspending device\n"); trace_xe_pm_suspend(xe, __builtin_return_address(0)); + xe_pm_suspend_prepare(xe); + err = xe_pxp_pm_suspend(xe->pxp); if (err) goto err; @@ -927,10 +937,14 @@ void xe_pm_d3cold_target_state_toggle(struct xe_device *xe) if (total_vram_used_mb < xe->d3cold.vram_threshold) xe->d3cold.target_state = XE_D3COLD_OFF; + else if (xe->d3cold.vrsr_capable) + xe->d3cold.target_state = XE_D3COLD_VRSR; else xe->d3cold.target_state = XE_D3HOT; mutex_unlock(&xe->d3cold.lock); + + drm_dbg(&xe->drm, "Xe d3cold target state %d\n", xe->d3cold.allowed); } /**
Trade-off D3Cold target state based upon current vram usage. If vram usage is greater than vram_d3cold_threshold and GPU is VRSR capable target D3Cold state is D3Cold-VRSR otherwise target state is D3Cold-Off. Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> --- drivers/gpu/drm/xe/xe_pm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)