From patchwork Fri Sep 30 17:48:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9358673 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 1975F600C8 for ; Fri, 30 Sep 2016 17:49:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 117182A12A for ; Fri, 30 Sep 2016 17:49:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 060C92A131; Fri, 30 Sep 2016 17:49:04 +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 8A9A32A12F for ; Fri, 30 Sep 2016 17:49:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 270856E1B6; Fri, 30 Sep 2016 17:49:03 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id B11106E1B4 for ; Fri, 30 Sep 2016 17:49:01 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id p197so2988603wmg.1 for ; Fri, 30 Sep 2016 10:49:01 -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=Q5vfsJlKvljT6x0LBPkIA9cCLCq9zWTNWV515rm5iBQ=; b=iC13izXU44+zwmQyqvPI7LbTF8TbgaGk+WLf5H9SiKOd0kot0ZzZgBWaaLCNtDViNX A3wFjABKuxfGup6+rE5BoRcyvj5P92AxvbUJV/gyG4WQ625aUFsLQAfATeYiBXZYMw4G cs7JDStP5WNw5+uynCS9esNCxBgfEsob40DpIw9VN9fnSehievsl96s9vppTz2AbYxwM ONOcEibazhUeemEYO1e7/U8g/rGHHDph+SZCbTRr8lSKboRuotqkID9dimEvsQfX44tP +clzL+6hFiyrvCwhsKTI9jfP2HWFq207QCu6pZYOe/IdbG29DXk+Hz6Z4KgVnOPWnpum +Tbw== 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=Q5vfsJlKvljT6x0LBPkIA9cCLCq9zWTNWV515rm5iBQ=; b=bBP18kKhK+8cgG6ROP390ZPcsYpS+2oRLMYswzRVwoE6WcJ+GItaadoae01XbyYA7s /+/ZkU9Qk2a0+Ko08o8yx7V0yw1PcAAh+C3/s10+YNxcudhNGju0erITI0okWXKe/Vab dKNBJmM43dmehQNSzTJEtNIh0W2X7aoOwXcHnKssN+8zlXZGZYmK9VibTwZYODGCtGHo tu8lyBmpQFleN8zHjO663F14NhVuRwdwBXHhWq69/EFlrWHFjX/3ih5CeNDqyfFT4dXg R1EYNuDhxJVKZPDpUfqI6S9H8iFaewtq+Ss+3fQknzPK9MAc2X7joKSLLUGis+yc8Mce 8dNg== X-Gm-Message-State: AA6/9RmeRhch1c2ZFBoZ5J7B19aEGuDElVLnsG83a0mPGnkxxuAtBa4J9MYE8jfg6J1V6Q== X-Received: by 10.194.178.165 with SMTP id cz5mr8564491wjc.202.1475257740110; Fri, 30 Sep 2016 10:49:00 -0700 (PDT) Received: from e31.Home ([2a02:c7d:9b6d:e300:916a:6cab:ac67:71c2]) by smtp.gmail.com with ESMTPSA id a1sm246125wjl.28.2016.09.30.10.48.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Sep 2016 10:48:59 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Fri, 30 Sep 2016 18:48:38 +0100 Message-Id: <1475257729-11283-4-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475257729-11283-1-git-send-email-tvrtko.ursulin@linux.intel.com> References: <1475257729-11283-1-git-send-email-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH 03/14] 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) \