From patchwork Sat Nov 21 00:46:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 7672971 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 72C139F750 for ; Sat, 21 Nov 2015 00:46:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8956A20584 for ; Sat, 21 Nov 2015 00:46:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A279120553 for ; Sat, 21 Nov 2015 00:46:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 352EA6EB7A; Fri, 20 Nov 2015 16:45:54 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id DA5F66EB6E; Fri, 20 Nov 2015 16:45:50 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 20 Nov 2015 16:45:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,325,1444719600"; d="scan'208";a="825676450" Received: from rdvivi-hillsboro.jf.intel.com ([10.7.196.156]) by orsmga001.jf.intel.com with ESMTP; 20 Nov 2015 16:45:49 -0800 From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Subject: [PATCH 6/8] drm/i915: Remove remaining retries from intel_dp_aux_ch. Date: Fri, 20 Nov 2015 16:46:28 -0800 Message-Id: <1448066790-19591-7-git-send-email-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1448066790-19591-1-git-send-email-rodrigo.vivi@intel.com> References: <1448066790-19591-1-git-send-email-rodrigo.vivi@intel.com> Cc: dri-devel@lists.freedesktop.org, Rodrigo Vivi X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP drm level already takes care of the needed retries so instead of duplicate the effort here. If the retry is possible immediately we return EAGAIN. Otherwise, if we have no idea what caused the error let's assume something was busy and let drm level handle the wait and retries. Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/i915/intel_dp.c | 64 ++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a8ba243..35048d6 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -795,7 +795,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, uint32_t aux_clock_divider; int i, ret, recv_bytes; uint32_t status; - int try, clock = 0; + int clock = 0; bool has_aux_irq = HAS_AUX_IRQ(dev); bool vdd; @@ -835,41 +835,47 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, send_bytes, aux_clock_divider); - /* Must try at least 3 times according to DP spec */ - for (try = 0; try < 5; try++) { - /* Load the send data into the aux channel data registers */ - for (i = 0; i < send_bytes; i += 4) - I915_WRITE(intel_dp->aux_ch_data_reg[i >> 2], - intel_dp_pack_aux(send + i, - send_bytes - i)); + /* Load the send data into the aux channel data registers */ + for (i = 0; i < send_bytes; i += 4) + I915_WRITE(intel_dp->aux_ch_data_reg[i >> 2], + intel_dp_pack_aux(send + i, + send_bytes - i)); - /* Send the command and wait for it to complete */ - I915_WRITE(ch_ctl, send_ctl); + /* Send the command and wait for it to complete */ + I915_WRITE(ch_ctl, send_ctl); - status = intel_dp_aux_wait_done(intel_dp, has_aux_irq); + status = intel_dp_aux_wait_done(intel_dp, has_aux_irq); - /* Clear done status and any errors */ - I915_WRITE(ch_ctl, - status | - DP_AUX_CH_CTL_DONE | - DP_AUX_CH_CTL_TIME_OUT_ERROR | - DP_AUX_CH_CTL_RECEIVE_ERROR); + /* Clear done status and any errors */ + I915_WRITE(ch_ctl, + status | + DP_AUX_CH_CTL_DONE | + DP_AUX_CH_CTL_TIME_OUT_ERROR | + DP_AUX_CH_CTL_RECEIVE_ERROR); - if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) - continue; + if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) { + /* + * DP CTS 1.2 Core Rev 1.1, 4.2.1.1 & 4.2.1.2 + * 400us delay required for errors and timeouts + * Timeout errors from the HW already meet this + * requirement so skip to next iteration + */ + ret = -EAGAIN; + goto out; + } - /* DP CTS 1.2 Core Rev 1.1, 4.2.1.1 & 4.2.1.2 - * 400us delay required for errors and timeouts - * Timeout errors from the HW already meet this - * requirement so skip to next iteration + if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) { + /* + * We don't know what caused the error, so let's + * return -EBUSY so drm level takes care of + * the necessary wait for recover and retries */ - if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) { - usleep_range(400, 500); - continue; - } - if (status & DP_AUX_CH_CTL_DONE) - goto done; + ret = -EBUSY; + goto out; } + + if (status & DP_AUX_CH_CTL_DONE) + goto done; } if ((status & DP_AUX_CH_CTL_DONE) == 0) {