drm/xe: make xe_gt_idle_disable_c6() handle the forcewake internally
PATCH 1/2 drm/xe: make xe_gt_idle_disable_c6() handle the forcewake internally
[ Upstream commit 1313351e71181a4818afeb8dfe202e4162091ef6 ]
Move forcewake_get() into xe_gt_idle_enable_c6() to streamline the code and make it easier to use.
Suggested-by Rodrigo Vivi <[email protected]>
Signed-off-by Xin Wang <[email protected]>
Reviewed-by Rodrigo Vivi <[email protected]>
Signed-off-by Rodrigo Vivi <[email protected]>
--- drivers/gpu/drm/xe/xe_gt_idle.c | 20 +++++++++++++------- drivers/gpu/drm/xe/xe_gt_idle.h | 2 +- drivers/gpu/drm/xe/xe_guc_pc.c | 10 +--------- 3 files changed, 15 insertions(+), 17 deletions(-)
drivers/gpu/drm/xe/xe_gt_idle.c +13 -7
@@ -204,11 +204,8 @@ static void gt_idle_fini(void *arg)xe_gt_idle_disable_pg (gt); -if (gt_to_xe (gt)->info.skip_guc_pc) { -XE_WARN_ON (xe_force_wake_get (gt_to_fw (gt),XE_FW_GT )); +if (gt_to_xe (gt)->info.skip_guc_pc)xe_gt_idle_disable_c6 (gt); -xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); - }sysfs_remove_files (kobj, gt_idle_attrs);kobject_put (kobj);
@@ -266,14 +263,23 @@ void xe_gt_idle_enable_c6(struct xe_gt *gt) RC_CTL_HW_ENABLE | RC_CTL_TO_MODE | RC_CTL_RC6_ENABLE); } -void xe_gt_idle_disable_c6 (struct xe_gt *gt) +int xe_gt_idle_disable_c6 (struct xe_gt *gt) { +unsigned int fw_ref; +xe_device_assert_mem_access (gt_to_xe (gt)); -xe_force_wake_assert_held (gt_to_fw (gt),XE_FW_GT );if (IS_SRIOV_VF (gt_to_xe (gt))) -return ; +return 0 ; + + fw_ref =xe_force_wake_get (gt_to_fw (gt),XE_FW_GT ); +if (!fw_ref) +return -ETIMEDOUT ;xe_mmio_write32 (gt,RC_CONTROL ,0 );xe_mmio_write32 (gt,RC_STATE ,0 ); + +xe_force_wake_put (gt_to_fw (gt), fw_ref); + +return 0 ; }
drivers/gpu/drm/xe/xe_gt_idle.h +1 -1
@@ -12,7 +12,7 @@ struct xe_gt;int xe_gt_idle_init (struct xe_gt_idle *gtidle);void xe_gt_idle_enable_c6 (struct xe_gt *gt); -void xe_gt_idle_disable_c6 (struct xe_gt *gt); +int xe_gt_idle_disable_c6 (struct xe_gt *gt);void xe_gt_idle_enable_pg (struct xe_gt *gt);void xe_gt_idle_disable_pg (struct xe_gt *gt);
drivers/gpu/drm/xe/xe_guc_pc.c +1 -9
@@ -1008,15 +1008,7 @@ int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc)if (ret)return ret; - ret =xe_force_wake_get (gt_to_fw (gt),XE_FORCEWAKE_ALL ); -if (ret) -return ret; - -xe_gt_idle_disable_c6 (gt); - -XE_WARN_ON (xe_force_wake_put (gt_to_fw (gt),XE_FORCEWAKE_ALL )); - -return 0 ; +return xe_gt_idle_disable_c6 (gt); }/**
Signature · 1 line
2.43.0
PATCH 2/2 drm/xe: Ensure GT is in C0 during resumes
[ Upstream commit 95d0883ac8105717f59c2dcdc0d8b9150f13aa12 ]
This patch ensures the gt will be awake for the entire duration of the resume sequences until GuCRC takes over and GT-C6 gets re-enabled.
Before suspending GT-C6 is kept enabled, but upon resume, GuCRC is not yet alive to properly control the exits and some cases of instability and corruption related to GT-C6 can be observed.
Suggested-by Rodrigo Vivi <[email protected]>
Signed-off-by Xin Wang <[email protected]>
Reviewed-by Rodrigo Vivi <[email protected]>
Signed-off-by Rodrigo Vivi <[email protected]>
--- drivers/gpu/drm/xe/xe_pm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_pm.c +7 -1
@@ -17,7 +17,7 @@#include "xe_device_sysfs.h" #include "xe_ggtt.h" #include "xe_gt.h" -#include "xe_guc.h" +#include "xe_gt_idle.h" #include "xe_irq.h" #include "xe_pcode.h" #include "xe_trace.h"
@@ -165,6 +165,9 @@ int xe_pm_resume(struct xe_device *xe)drm_dbg (&xe->drm,"Resuming device\n" );trace_xe_pm_resume (xe,__builtin_return_address (0 )); +for_each_gt (gt, xe, id) +xe_gt_idle_disable_c6 (gt); +for_each_tile (tile, xe, id)xe_wa_apply_tile_workarounds (tile);
@@ -451,6 +454,9 @@ int xe_pm_runtime_resume(struct xe_device *xe)xe_rpm_lockmap_acquire (xe); +for_each_gt (gt, xe, id) +xe_gt_idle_disable_c6 (gt); +if (xe->d3cold.allowed) { err =xe_pcode_ready (xe, true);if (err)
Signature · 1 line
2.43.0