Commit bea4e4a4 authored by Michal Wajdeczko's avatar Michal Wajdeczko Committed by Chris Wilson

drm/i915/guc: Use wait_for_register_fw() while waiting for MMIO response

Waiting for the response status in scratch register can be done
using our generic function. Let's use it.

v2: rebased
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Suggested-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170407160145.181328-2-michal.wajdeczko@intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 1d1a9774
...@@ -359,19 +359,6 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv) ...@@ -359,19 +359,6 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
i915_ggtt_disable_guc(dev_priv); i915_ggtt_disable_guc(dev_priv);
} }
/*
* Read GuC command/status register (SOFT_SCRATCH_0)
* Return true if it contains a response rather than a command
*/
static bool guc_recv(struct intel_guc *guc, u32 *status)
{
struct drm_i915_private *dev_priv = guc_to_i915(guc);
u32 val = I915_READ(SOFT_SCRATCH(0));
*status = val;
return INTEL_GUC_RECV_IS_RESPONSE(val);
}
/* /*
* This function implements the MMIO based host to GuC interface. * This function implements the MMIO based host to GuC interface.
*/ */
...@@ -399,13 +386,14 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len) ...@@ -399,13 +386,14 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len)
I915_WRITE(GUC_SEND_INTERRUPT, GUC_SEND_TRIGGER); I915_WRITE(GUC_SEND_INTERRUPT, GUC_SEND_TRIGGER);
/* /*
* Fast commands should complete in less than 10us, so sample quickly * No GuC command should ever take longer than 10ms.
* up to that length of time, then switch to a slower sleep-wait loop. * Fast commands should still complete in 10us.
* No inte_guc_send command should ever take longer than 10ms.
*/ */
ret = wait_for_us(guc_recv(guc, &status), 10); ret = __intel_wait_for_register_fw(dev_priv,
if (ret) SOFT_SCRATCH(0),
ret = wait_for(guc_recv(guc, &status), 10); INTEL_GUC_RECV_MASK,
INTEL_GUC_RECV_MASK,
10, 10, &status);
if (status != INTEL_GUC_STATUS_SUCCESS) { if (status != INTEL_GUC_STATUS_SUCCESS) {
/* /*
* Either the GuC explicitly returned an error (which * Either the GuC explicitly returned an error (which
......
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