@@ -1205,55 +1205,3 @@ void i915_guc_submission_disable(struct drm_i915_private *dev_priv)
guc_client_free(guc->execbuf_client);
guc->execbuf_client = NULL;
}
-
-/**
- * intel_guc_suspend() - notify GuC entering suspend state
- * @dev_priv: i915 device private
- */
-int intel_guc_suspend(struct drm_i915_private *dev_priv)
-{
- struct intel_guc *guc = &dev_priv->guc;
- struct i915_gem_context *ctx;
- u32 data[3];
-
- if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
- return 0;
-
- gen9_disable_guc_interrupts(dev_priv);
-
- ctx = dev_priv->kernel_context;
-
- data[0] = INTEL_GUC_ACTION_ENTER_S_STATE;
- /* any value greater than GUC_POWER_D0 */
- data[1] = GUC_POWER_D1;
- /* first page is shared data with GuC */
- data[2] = guc_ggtt_offset(ctx->engine[RCS].state) + LRC_GUCSHR_PN * PAGE_SIZE;
-
- return intel_guc_send(guc, data, ARRAY_SIZE(data));
-}
-
-/**
- * intel_guc_resume() - notify GuC resuming from suspend state
- * @dev_priv: i915 device private
- */
-int intel_guc_resume(struct drm_i915_private *dev_priv)
-{
- struct intel_guc *guc = &dev_priv->guc;
- struct i915_gem_context *ctx;
- u32 data[3];
-
- if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
- return 0;
-
- if (i915.guc_log_level >= 0)
- gen9_enable_guc_interrupts(dev_priv);
-
- ctx = dev_priv->kernel_context;
-
- data[0] = INTEL_GUC_ACTION_EXIT_S_STATE;
- data[1] = GUC_POWER_D0;
- /* first page is shared data with GuC */
- data[2] = guc_ggtt_offset(ctx->engine[RCS].state) + LRC_GUCSHR_PN * PAGE_SIZE;
-
- return intel_guc_send(guc, data, ARRAY_SIZE(data));
-}
@@ -136,3 +136,55 @@ int intel_guc_sample_forcewake(struct intel_guc *guc)
return intel_guc_send(guc, action, ARRAY_SIZE(action));
}
+
+/**
+ * intel_guc_enter_sleep() - notify GuC entering sleep state
+ * @guc: guc structure
+ */
+int intel_guc_enter_sleep(struct intel_guc *guc)
+{
+ struct drm_i915_private *dev_priv = guc_to_i915(guc);
+ struct i915_gem_context *ctx;
+ u32 data[3];
+
+ if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
+ return 0;
+
+ gen9_disable_guc_interrupts(dev_priv);
+
+ ctx = dev_priv->kernel_context;
+
+ data[0] = INTEL_GUC_ACTION_ENTER_S_STATE;
+ /* any value greater than GUC_POWER_D0 */
+ data[1] = GUC_POWER_D1;
+ /* first page is shared data with GuC */
+ data[2] = guc_ggtt_offset(ctx->engine[RCS].state) + LRC_GUCSHR_PN * PAGE_SIZE;
+
+ return intel_guc_send(guc, data, ARRAY_SIZE(data));
+}
+
+/**
+ * intel_guc_exit_sleep() - notify GuC exit from sleep state
+ * @guc: guc structure
+ */
+int intel_guc_exit_sleep(struct intel_guc *guc)
+{
+ struct drm_i915_private *dev_priv = guc_to_i915(guc);
+ struct i915_gem_context *ctx;
+ u32 data[3];
+
+ if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
+ return 0;
+
+ if (i915.guc_log_level >= 0)
+ gen9_enable_guc_interrupts(dev_priv);
+
+ ctx = dev_priv->kernel_context;
+
+ data[0] = INTEL_GUC_ACTION_EXIT_S_STATE;
+ data[1] = GUC_POWER_D0;
+ /* first page is shared data with GuC */
+ data[2] = guc_ggtt_offset(ctx->engine[RCS].state) + LRC_GUCSHR_PN * PAGE_SIZE;
+
+ return intel_guc_send(guc, data, ARRAY_SIZE(data));
+}
@@ -131,6 +131,8 @@ struct intel_guc {
void intel_guc_init_send_regs(struct intel_guc *guc);
int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len);
int intel_guc_sample_forcewake(struct intel_guc *guc);
+int intel_guc_enter_sleep(struct intel_guc *guc);
+int intel_guc_exit_sleep(struct intel_guc *guc);
static inline int intel_guc_send(struct intel_guc *guc, const u32 *action, u32 len)
{
@@ -154,8 +156,6 @@ static inline void intel_guc_init_early(struct intel_guc *guc)
/* intel_guc_loader.c */
int intel_guc_select_fw(struct intel_guc *guc);
int intel_guc_init_hw(struct intel_guc *guc);
-int intel_guc_suspend(struct drm_i915_private *dev_priv);
-int intel_guc_resume(struct drm_i915_private *dev_priv);
u32 intel_guc_wopcm_size(struct intel_guc *guc);
/* i915_guc_submission.c */
@@ -425,17 +425,17 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
int intel_uc_runtime_suspend(struct drm_i915_private *dev_priv)
{
- return intel_guc_suspend(dev_priv);
+ return intel_guc_enter_sleep(&dev_priv->guc);
}
int intel_uc_runtime_resume(struct drm_i915_private *dev_priv)
{
- return intel_guc_resume(dev_priv);
+ return intel_guc_exit_sleep(&dev_priv->guc);
}
int intel_uc_suspend(struct drm_i915_private *dev_priv)
{
- return intel_guc_suspend(dev_priv);
+ return intel_guc_enter_sleep(&dev_priv->guc);
}
int intel_uc_resume(struct drm_i915_private *dev_priv)
Renamed intel_guc_suspend to intel_guc_enter_sleep and intel_guc_resume to intel_guc_exit_sleep to match GuC nomenclature compatibility. Also, We plan to use intel_guc_suspend and intel_guc_resume through intel_uc_suspend and intel_uc_resume in the path i915_drm_suspend and i915_drm_resume respectively for better naming. Also, with this patch we pass intel_guc struct as parameter to enter_sleep and exit_sleep functions. Moved the definition to intel_guc.c for better code structuring. If needed we can pull some of the functions from intel_guc.c to new file intel_guc_pm.c in future. Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: MichaĆ Winiarski <michal.winiarski@intel.com> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com> --- drivers/gpu/drm/i915/i915_guc_submission.c | 52 ------------------------------ drivers/gpu/drm/i915/intel_guc.c | 52 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_guc.h | 4 +-- drivers/gpu/drm/i915/intel_uc.c | 6 ++-- 4 files changed, 57 insertions(+), 57 deletions(-)