After we assert the reset request (and wait for 20us), when the device has been fully reset it asserts the reset-status bit. Before we stop requesting the reset and allow the device to return to normal, we should wait for the reset to be completed. (Similar to how we wait for the device to return to normal after deasserting the reset request.) Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/intel_uncore.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 0fd59dd6bbb5..c46848590873 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -1550,24 +1550,40 @@ static void i915_stop_engines(struct drm_i915_private *dev_priv, gen3_stop_engine(engine); } -static bool i915_reset_complete(struct pci_dev *pdev) +static bool i915_reset_asserted(struct pci_dev *pdev) { u8 gdrst; pci_read_config_byte(pdev, I915_GDRST, &gdrst); - return (gdrst & GRDOM_RESET_STATUS) == 0; + return gdrst & GRDOM_RESET_STATUS; } static int i915_do_reset(struct drm_i915_private *dev_priv, unsigned engine_mask) { struct pci_dev *pdev = dev_priv->drm.pdev; + ktime_t now; + int err; /* assert reset for at least 20 usec */ pci_write_config_byte(pdev, I915_GDRST, GRDOM_RESET_ENABLE); usleep_range(50, 200); + + now = ktime_get_raw(); + err = wait_for(i915_reset_asserted(pdev), 500); + pr_err("wait-for-asserted took %lldns\n", + ktime_to_ns(ktime_sub(ktime_get_raw(), now))); + pci_write_config_byte(pdev, I915_GDRST, 0); + usleep_range(50, 200); - return wait_for(i915_reset_complete(pdev), 500); + if (!err) { + now = ktime_get_raw(); + err = wait_for(!i915_reset_asserted(pdev), 500); + pr_err("wait-for-unasserted took %lldns\n", + ktime_to_ns(ktime_sub(ktime_get_raw(), now))); + } + + return err; } static bool g4x_reset_complete(struct pci_dev *pdev) -- 2.16.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx