From patchwork Wed Sep 28 15:23:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9354087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 98FE960756 for ; Wed, 28 Sep 2016 15:24:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A475296CE for ; Wed, 28 Sep 2016 15:24:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7ED74296D5; Wed, 28 Sep 2016 15:24:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E924C296CE for ; Wed, 28 Sep 2016 15:24:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F2626E7C5; Wed, 28 Sep 2016 15:24:05 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2640A6E7C5 for ; Wed, 28 Sep 2016 15:24:04 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id b4so6498562wmb.2 for ; Wed, 28 Sep 2016 08:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hk+Kx0mXt1vKisqFxDzAR5HoDr84m/rgCePB9za69So=; b=u8K59N5htUwtVrS0itIagPbQzrSbXzr4k4o3XafoTGY8K6oPv1owhFoalkUsIS6OdF xpVYQIffmEMH8zgB01DpnaEBLVyzo1ol/eHZZsPsYd1Fv9ksQreEvTXBTzqphFb7SIBb 3zZz/0gLJiCBAcf3Syj3nJam3Br898JtczDO6tUUKB59ee1hdU3dS7WG03NqdvqFRSI5 XQK5gdLEf/TDpD2vixtfh0dz4Wg8Bb2yzrkNKCjmCCYw86OMlY/OJTJbOwsJPhUCd3MR Nd99jptvGuFmdUAAzLnaJ/IcNlPPZipURn4z9EL+QoHg160dnUrOrTFbk85pu+xfx4ZB tBvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hk+Kx0mXt1vKisqFxDzAR5HoDr84m/rgCePB9za69So=; b=RKKk0/BquBNU/5mzn+qIWn2QcwJAzFfG+TGGJIirt7IuL/RwjMS9mWA8Z7zbQmw/SO 4r4sJnHkvtOkeKb0x4ZlfFbRaX+szPffXeIWz6Jxmi+oKzFJP+gcGUZaZSS0K3yHO9GW 3PnTv5Z2deMMnyKo1O79ZcRxI/iXHVZgfuVjoiU1tzMylAqVd7cFYFd5FIiMoenY+V17 vg8qzQjY1V3WzuXZz++QRAhOJ7NxIJgvmursCd71gSNN5eOoEG/Mp1ojbPZGOYPXtdsj b8IEItPO1Z3INj6zOBM7bRgHOAe3L/Z5IgxNz4E+YVDFlGKmy1ArTnMzJysUhcAt8Yx3 YQHA== X-Gm-Message-State: AA6/9RlWLWeuhA1bkj09WTP0FnMe/ISSSoBBY1SI7+sGaCwoTj/fpSs9b518NYocqvbmpw== X-Received: by 10.28.55.21 with SMTP id e21mr8248853wma.80.1475076242759; Wed, 28 Sep 2016 08:24:02 -0700 (PDT) Received: from localhost.localdomain ([2a02:c7d:9b6d:e300:916a:6cab:ac67:71c2]) by smtp.gmail.com with ESMTPSA id bl3sm8916209wjc.26.2016.09.28.08.24.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Sep 2016 08:24:02 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Wed, 28 Sep 2016 16:23:50 +0100 Message-Id: <1475076230-18023-1-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20160928123847.GZ28107@nuc-i3427.alporthouse.com> References: <20160928123847.GZ28107@nuc-i3427.alporthouse.com> Subject: [Intel-gfx] [PATCH v2] drm/i915: Do not inline forcewake taking in mmio accessors X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Once we know we need to take new forcewakes, that being a slow operation, it does not make sense to inline that code into every mmio accessor. Move it to a separate function and save some code. v2: Be explicit with noinline and remove stale comment. (Chris Wilson) Signed-off-by: Tvrtko Ursulin Reviewed-by: Chris Wilson --- drivers/gpu/drm/i915/intel_uncore.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 079102b46fd3..60137a164094 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -862,11 +862,21 @@ __gen2_read(64) trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \ return val -static inline void __force_wake_auto(struct drm_i915_private *dev_priv, - enum forcewake_domains fw_domains) +static noinline void ___force_wake_auto(struct drm_i915_private *dev_priv, + enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *domain; + for_each_fw_domain_masked(domain, fw_domains, dev_priv) + fw_domain_arm_timer(domain); + + dev_priv->uncore.funcs.force_wake_get(dev_priv, fw_domains); + dev_priv->uncore.fw_domains_active |= fw_domains; +} + +static inline void __force_wake_auto(struct drm_i915_private *dev_priv, + enum forcewake_domains fw_domains) +{ if (WARN_ON(!fw_domains)) return; @@ -874,14 +884,8 @@ static inline void __force_wake_auto(struct drm_i915_private *dev_priv, fw_domains &= dev_priv->uncore.fw_domains; fw_domains &= ~dev_priv->uncore.fw_domains_active; - if (fw_domains) { - /* Ideally GCC would be constant-fold and eliminate this loop */ - for_each_fw_domain_masked(domain, fw_domains, dev_priv) - fw_domain_arm_timer(domain); - - dev_priv->uncore.funcs.force_wake_get(dev_priv, fw_domains); - dev_priv->uncore.fw_domains_active |= fw_domains; - } + if (fw_domains) + ___force_wake_auto(dev_priv, fw_domains); } #define __gen6_read(x) \