From patchwork Wed Sep 28 12:25: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: 9353787 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 9444060756 for ; Wed, 28 Sep 2016 12:26:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 862B72953B for ; Wed, 28 Sep 2016 12:26:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B2792953D; Wed, 28 Sep 2016 12:26:05 +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 8CE2C2953B for ; Wed, 28 Sep 2016 12:26:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E2EA6E77B; Wed, 28 Sep 2016 12:26:02 +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 0A9406E77B for ; Wed, 28 Sep 2016 12:26:00 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id b4so5734773wmb.2 for ; Wed, 28 Sep 2016 05:25:59 -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=frXn2iB5rfMsic8iDne7l//O2utx0HvwJHHZ7ZKmVL8=; b=mp3zDBSrWdWQSSjwzMngwQLHKOnA2kVcjtWYcPcWyUhzwoiF7VdPLSSIFQiiqWS6cX pYYU84rmJiYWsCmYViZC5Oyz0yZXzOuUbao7QqjjSq3ZD1gyYIsOPiekJfUPMx6fotiV qSclI81FdnhJM5U/wgViAumvrNjW9lNfYnploVL3y3j73ZWPuQfWvBPzEprowhO4hscG Z8a4TMvxnMJjru1Ay+aNg0/9nsdfUFfTuaHF8IHpyhX0s5ruPuzHhytB3qTdAdLCxCqT AlrCnDtSVOKfA8i3EjqI4c83FGZqXTX/2DGY8F4gU8ejKetqrQuOyYHG65fXfRuqgoo6 /0+w== 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=frXn2iB5rfMsic8iDne7l//O2utx0HvwJHHZ7ZKmVL8=; b=TY7DfuKaRO64SQhVyIFucylq2bCc82wQrc+WHxBrTuxA/FArD2jgTPrkhOv8iXCi24 JamvP6nxIrS+BodhWe8gNgO6rt/5wjrJNp7+Nat9Qnjykg00Ew9Y2f+mLFxeG9xQYFE7 XdaMB364WIpGuoNaWz60IOCSDCdEp8v7HFI4oMJLgQUxZjecGQGxutH7UT5IlR+2CtV7 Lh9YFpptDp2a0At9YTAvv62FRoj1h+pgPwlq8oAcEjXE/NayTkmJaUWvpFykSTdCF5W0 QXwfL0CAf+JO1S3ylpucMXAAQD22doZ9R94/XY3oJmNrYrqN9Ugu0dWcIkATLE5PQydN b2xw== X-Gm-Message-State: AA6/9Rm8rzJI1WooTRg76QnkNceG04v5UpCpO8QhS+yARtVGfobsSdW1nmqdL0YR6TfzPA== X-Received: by 10.194.202.133 with SMTP id ki5mr31541306wjc.45.1475065558653; Wed, 28 Sep 2016 05:25:58 -0700 (PDT) Received: from localhost.localdomain ([2a02:c7d:9b6d:e300:916a:6cab:ac67:71c2]) by smtp.gmail.com with ESMTPSA id a5sm8182653wjd.9.2016.09.28.05.25.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Sep 2016 05:25:58 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Wed, 28 Sep 2016 13:25:46 +0100 Message-Id: <1475065546-5481-4-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475065546-5481-1-git-send-email-tvrtko.ursulin@linux.intel.com> References: <1475065546-5481-1-git-send-email-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH 3/3] 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. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/intel_uncore.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 079102b46fd3..c887ab0947c6 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -862,11 +862,22 @@ __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 void ___force_wake_auto(struct drm_i915_private *dev_priv, + enum forcewake_domains fw_domains) { struct intel_uncore_forcewake_domain *domain; + /* 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; +} + +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 +885,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) \