drm/xe: remove gucrc disable from suspend path
authorRiana Tauro <riana.tauro@intel.com>
Mon, 17 Jul 2023 09:59:00 +0000 (15:29 +0530)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:37:31 +0000 (11:37 -0500)
Currently GuCRC is disabled in suspend path for xe.
Rc6 is a prerequiste to enable s0ix and
should not be disabled for s2idle. There is no requirement
to disable GuCRC for S3+.

Remove it from xe_guc_pc_stop, thus removing from suspend path.
Retain the call in other places where xe_guc_pc_stop is
called.

v2: add description and return statement to kernel-doc (Rodrigo)
v3: update commit message (Rodrigo)
v4: add mem_access_get to the gucrc disable function

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_gt.c
drivers/gpu/drm/xe/xe_guc_pc.c
drivers/gpu/drm/xe/xe_guc_pc.h
drivers/gpu/drm/xe/xe_uc.c
drivers/gpu/drm/xe/xe_uc.h

index a21d44bfe9e876358777ff0c20df14f8e186ea59..b31ef2a8ff17d715db322e831af428252dc8e7e5 100644 (file)
@@ -517,6 +517,7 @@ static int gt_reset(struct xe_gt *gt)
        if (err)
                goto err_msg;
 
+       xe_uc_gucrc_disable(&gt->uc);
        xe_uc_stop_prepare(&gt->uc);
        xe_gt_pagefault_reset(gt);
 
index 3093cfeff0c2c3b197266df8d432ae3348dd955e..03dfbde29fe51c21803ffae2a90569b465bee757 100644 (file)
@@ -730,12 +730,20 @@ static int pc_adjust_requested_freq(struct xe_guc_pc *pc)
        return ret;
 }
 
-static int pc_gucrc_disable(struct xe_guc_pc *pc)
+/**
+ * xe_guc_pc_gucrc_disable - Disable GuC RC
+ * @pc: Xe_GuC_PC instance
+ *
+ * Disables GuC RC by taking control of RC6 back from GuC.
+ *
+ * Return: 0 on success, negative error code on error.
+ */
+int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc)
 {
        struct xe_gt *gt = pc_to_gt(pc);
        int ret;
 
-       xe_device_assert_mem_access(pc_to_xe(pc));
+       xe_device_mem_access_get(pc_to_xe(pc));
 
        ret = pc_action_setup_gucrc(pc, XE_GUCRC_HOST_CONTROL);
        if (ret)
@@ -750,6 +758,7 @@ static int pc_gucrc_disable(struct xe_guc_pc *pc)
        xe_mmio_write32(gt, RC_STATE, 0);
 
        XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
+       xe_device_mem_access_put(pc_to_xe(pc));
        return 0;
 }
 
@@ -827,7 +836,7 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
                goto out;
 
        if (xe->info.platform == XE_PVC) {
-               pc_gucrc_disable(pc);
+               xe_guc_pc_gucrc_disable(pc);
                ret = 0;
                goto out;
        }
@@ -850,10 +859,6 @@ int xe_guc_pc_stop(struct xe_guc_pc *pc)
 
        xe_device_mem_access_get(pc_to_xe(pc));
 
-       ret = pc_gucrc_disable(pc);
-       if (ret)
-               goto out;
-
        mutex_lock(&pc->freq_lock);
        pc->freq_ready = false;
        mutex_unlock(&pc->freq_lock);
@@ -876,6 +881,7 @@ static void pc_fini(struct drm_device *drm, void *arg)
 {
        struct xe_guc_pc *pc = arg;
 
+       XE_WARN_ON(xe_guc_pc_gucrc_disable(pc));
        XE_WARN_ON(xe_guc_pc_stop(pc));
        sysfs_remove_files(pc_to_gt(pc)->sysfs, pc_attrs);
        xe_bo_unpin_map_no_vm(pc->bo);
index 370353a40a17595ec51a589d9d190e837f261ebc..81833a53b3c9257c90682405abc56557373db1bd 100644 (file)
@@ -11,6 +11,7 @@
 int xe_guc_pc_init(struct xe_guc_pc *pc);
 int xe_guc_pc_start(struct xe_guc_pc *pc);
 int xe_guc_pc_stop(struct xe_guc_pc *pc);
+int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc);
 
 enum xe_gt_idle_state xe_guc_pc_c_status(struct xe_guc_pc *pc);
 u64 xe_guc_pc_rc6_residency(struct xe_guc_pc *pc);
index e244d27b55d5c36c6e33303325ade21c4257942c..addd6f2681b942404638d12b548b91674e57505d 100644 (file)
@@ -176,6 +176,11 @@ int xe_uc_reset_prepare(struct xe_uc *uc)
        return xe_guc_reset_prepare(&uc->guc);
 }
 
+void xe_uc_gucrc_disable(struct xe_uc *uc)
+{
+       XE_WARN_ON(xe_guc_pc_gucrc_disable(&uc->guc.pc));
+}
+
 void xe_uc_stop_prepare(struct xe_uc *uc)
 {
        xe_guc_stop_prepare(&uc->guc);
index d6efc9ef00d3d71077e0c236b2f3ab126ef4500c..42219b361df55a76e808e6d46a715824ce5ee208 100644 (file)
@@ -12,6 +12,7 @@ int xe_uc_init(struct xe_uc *uc);
 int xe_uc_init_hwconfig(struct xe_uc *uc);
 int xe_uc_init_post_hwconfig(struct xe_uc *uc);
 int xe_uc_init_hw(struct xe_uc *uc);
+void xe_uc_gucrc_disable(struct xe_uc *uc);
 int xe_uc_reset_prepare(struct xe_uc *uc);
 void xe_uc_stop_prepare(struct xe_uc *uc);
 int xe_uc_stop(struct xe_uc *uc);