From patchwork Sat Nov 21 00:46:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 7672891 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 B44229F1C2 for ; Sat, 21 Nov 2015 00:45:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3B9820553 for ; Sat, 21 Nov 2015 00:45:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 320A520575 for ; Sat, 21 Nov 2015 00:45:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 677F86EB73; Fri, 20 Nov 2015 16:45:51 -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 393226E47C; 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="825676433" 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 1/8] drm: Introduce EAGAIN handling for immediatelly aux retries Date: Fri, 20 Nov 2015 16:46:23 -0800 Message-Id: <1448066790-19591-2-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: Dave Airlie , 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 The goal here is to offload aux retries handling from the drivers to drm. However there are 2 differents cases for retry: 1. Immediately retry - Hardware already took care of needed timeouts before answering that a retry is possible. 2. Busy - Wait some time and retry. This driver introduce the support for EAGAIN that can handle the first case and a following patch will introduce EBUSY waits, after all drivers counting on immediately retries are changed. Cc: Dave Airlie Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/drm_dp_helper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 9535c5b..ee7c955 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -198,6 +198,11 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, err = aux->transfer(aux, &msg); mutex_unlock(&aux->hw_mutex); if (err < 0) { + /* Immediately retry */ + if (err == -EAGAIN) + continue; + + /* FIXME: On BUSY we could wait before retrying */ if (err == -EBUSY) continue;