From patchwork Thu Sep 29 15:35:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9356579 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 90ACA600C8 for ; Thu, 29 Sep 2016 15:36:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8243D29B7A for ; Thu, 29 Sep 2016 15:36:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 770FF29B80; Thu, 29 Sep 2016 15:36:15 +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 6BF7429B7A for ; Thu, 29 Sep 2016 15:36:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1F046E879; Thu, 29 Sep 2016 15:36:13 +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 3B0196E879 for ; Thu, 29 Sep 2016 15:36:11 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id w72so2683295wmf.1 for ; Thu, 29 Sep 2016 08:36:11 -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=qa5dyWaYO6Pa7egx0g8L6L9YOUj6zO5BCRbrmlBwhjxjFm6dXLFZu1nypn9nqUO734 BGayPidxvO+nKpTu950pBkxM7ho4R2RoBlBx8TDZ6rt4DiZAaNHzXUi7cJ/OtyOxiTjd 6LN6u+62Be+D+D9PMBMXGkwwUAnxZDwJdajZAFx58/P5+eRNnNzc8KITdxa9QefRCSR+ PsDZyjb0QUPBWFjeNWhZ57SQ1nJxxFr3nxOcrac2Rrzvse+6fNPZzZ84bSS2dQdey2ue cOdtAfbXZ7pVmnDjY1yYCJcdmwrUDUe7QvBvAeKMF+wV/9DLMrXFw1/t2k0/lSbmFWvk oyQw== 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=GvGr133NMMk2gPEYzkttXe+sP0yEXJAUGnHeKjGJcsv3SJ1nAG/syten7Jzm/uuAml d3geisZlzDSk5iUoy3CH80ZcxlzCUdWTItcBghyK2Vo78CTXbkGR16kEYmebzPAujtql wjsLQyjEEMWBkgoQp2k8JkNoZdqdho1ZpC0H+An8jAYGBhRjxAlwAunV7u+ip6HD9vnx kaIphfhYKpRtvAfs3CoZjW5Kl82IJ2HPkyH1nokMz2crZpxXJoYcoWnKw1NSUk56LOJU XsneOzBPA9yZbnLkckYCq2y0RW4zfXpFgNP9AOqJ+n73bNfEpDfDuGVqgBCT+4Kw3Tpa 6AOQ== X-Gm-Message-State: AA6/9RlsZvIbhow2/cmZePN4Zv6P2IJu4d2Fmjq2ADcO4ynhFn44CLQnHYyhc23r1S8VDw== X-Received: by 10.28.27.138 with SMTP id b132mr3194265wmb.81.1475163369608; Thu, 29 Sep 2016 08:36:09 -0700 (PDT) Received: from localhost.localdomain ([2a02:c7d:9b6d:e300:916a:6cab:ac67:71c2]) by smtp.gmail.com with ESMTPSA id s7sm14781924wjc.34.2016.09.29.08.36.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Sep 2016 08:36:09 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Thu, 29 Sep 2016 16:35:46 +0100 Message-Id: <1475163356-3463-4-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475163356-3463-1-git-send-email-tvrtko.ursulin@linux.intel.com> References: <1475163356-3463-1-git-send-email-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH 03/13] 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) \