Commit 3055f0cd authored by Chris Wilson's avatar Chris Wilson

drm/i915/guc: Track the rpm wakeref

Keep track of our acquired wakeref for interacting with the guc, so that
we can cancel it upon release and so clearly identify leaks.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190114142129.24398-9-chris@chris-wilson.co.uk
parent 00e27cbe
...@@ -436,6 +436,7 @@ static void guc_log_capture_logs(struct intel_guc_log *log) ...@@ -436,6 +436,7 @@ static void guc_log_capture_logs(struct intel_guc_log *log)
{ {
struct intel_guc *guc = log_to_guc(log); struct intel_guc *guc = log_to_guc(log);
struct drm_i915_private *dev_priv = guc_to_i915(guc); struct drm_i915_private *dev_priv = guc_to_i915(guc);
intel_wakeref_t wakeref;
guc_read_update_log_buffer(log); guc_read_update_log_buffer(log);
...@@ -443,9 +444,9 @@ static void guc_log_capture_logs(struct intel_guc_log *log) ...@@ -443,9 +444,9 @@ static void guc_log_capture_logs(struct intel_guc_log *log)
* Generally device is expected to be active only at this * Generally device is expected to be active only at this
* time, so get/put should be really quick. * time, so get/put should be really quick.
*/ */
intel_runtime_pm_get(dev_priv); wakeref = intel_runtime_pm_get(dev_priv);
guc_action_flush_log_complete(guc); guc_action_flush_log_complete(guc);
intel_runtime_pm_put_unchecked(dev_priv); intel_runtime_pm_put(dev_priv, wakeref);
} }
int intel_guc_log_create(struct intel_guc_log *log) int intel_guc_log_create(struct intel_guc_log *log)
...@@ -505,6 +506,7 @@ int intel_guc_log_set_level(struct intel_guc_log *log, u32 level) ...@@ -505,6 +506,7 @@ int intel_guc_log_set_level(struct intel_guc_log *log, u32 level)
{ {
struct intel_guc *guc = log_to_guc(log); struct intel_guc *guc = log_to_guc(log);
struct drm_i915_private *dev_priv = guc_to_i915(guc); struct drm_i915_private *dev_priv = guc_to_i915(guc);
intel_wakeref_t wakeref;
int ret; int ret;
BUILD_BUG_ON(GUC_LOG_VERBOSITY_MIN != 0); BUILD_BUG_ON(GUC_LOG_VERBOSITY_MIN != 0);
...@@ -524,11 +526,11 @@ int intel_guc_log_set_level(struct intel_guc_log *log, u32 level) ...@@ -524,11 +526,11 @@ int intel_guc_log_set_level(struct intel_guc_log *log, u32 level)
goto out_unlock; goto out_unlock;
} }
intel_runtime_pm_get(dev_priv); wakeref = intel_runtime_pm_get(dev_priv);
ret = guc_action_control_log(guc, GUC_LOG_LEVEL_IS_VERBOSE(level), ret = guc_action_control_log(guc, GUC_LOG_LEVEL_IS_VERBOSE(level),
GUC_LOG_LEVEL_IS_ENABLED(level), GUC_LOG_LEVEL_IS_ENABLED(level),
GUC_LOG_LEVEL_TO_VERBOSITY(level)); GUC_LOG_LEVEL_TO_VERBOSITY(level));
intel_runtime_pm_put_unchecked(dev_priv); intel_runtime_pm_put(dev_priv, wakeref);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("guc_log_control action failed %d\n", ret); DRM_DEBUG_DRIVER("guc_log_control action failed %d\n", ret);
goto out_unlock; goto out_unlock;
...@@ -601,6 +603,7 @@ void intel_guc_log_relay_flush(struct intel_guc_log *log) ...@@ -601,6 +603,7 @@ void intel_guc_log_relay_flush(struct intel_guc_log *log)
{ {
struct intel_guc *guc = log_to_guc(log); struct intel_guc *guc = log_to_guc(log);
struct drm_i915_private *i915 = guc_to_i915(guc); struct drm_i915_private *i915 = guc_to_i915(guc);
intel_wakeref_t wakeref;
/* /*
* Before initiating the forceful flush, wait for any pending/ongoing * Before initiating the forceful flush, wait for any pending/ongoing
...@@ -608,9 +611,9 @@ void intel_guc_log_relay_flush(struct intel_guc_log *log) ...@@ -608,9 +611,9 @@ void intel_guc_log_relay_flush(struct intel_guc_log *log)
*/ */
flush_work(&log->relay.flush_work); flush_work(&log->relay.flush_work);
intel_runtime_pm_get(i915); wakeref = intel_runtime_pm_get(i915);
guc_action_flush_log(guc); guc_action_flush_log(guc);
intel_runtime_pm_put_unchecked(i915); intel_runtime_pm_put(i915, wakeref);
/* GuC would have updated log buffer by now, so capture it */ /* GuC would have updated log buffer by now, so capture it */
guc_log_capture_logs(log); guc_log_capture_logs(log);
......
...@@ -115,14 +115,15 @@ int intel_huc_auth(struct intel_huc *huc) ...@@ -115,14 +115,15 @@ int intel_huc_auth(struct intel_huc *huc)
int intel_huc_check_status(struct intel_huc *huc) int intel_huc_check_status(struct intel_huc *huc)
{ {
struct drm_i915_private *dev_priv = huc_to_i915(huc); struct drm_i915_private *dev_priv = huc_to_i915(huc);
intel_wakeref_t wakeref;
bool status; bool status;
if (!HAS_HUC(dev_priv)) if (!HAS_HUC(dev_priv))
return -ENODEV; return -ENODEV;
intel_runtime_pm_get(dev_priv); wakeref = intel_runtime_pm_get(dev_priv);
status = I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED; status = I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED;
intel_runtime_pm_put_unchecked(dev_priv); intel_runtime_pm_put(dev_priv, wakeref);
return status; return status;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment