From patchwork Fri May 12 13:53:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9724215 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 2AD5B601E7 for ; Fri, 12 May 2017 13:54:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BA8528821 for ; Fri, 12 May 2017 13:54:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 207A228824; Fri, 12 May 2017 13:54:00 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 C53C128821 for ; Fri, 12 May 2017 13:53:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5BF06E6E6; Fri, 12 May 2017 13:53:58 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 93D5C6E6E8 for ; Fri, 12 May 2017 13:53:56 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 6780739-1500050 for multiple; Fri, 12 May 2017 14:53:35 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Fri, 12 May 2017 14:53:36 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 12 May 2017 14:53:34 +0100 Message-Id: <20170512135335.20099-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Cc: Mika Kuoppala Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Compute the fw_domain id from the mask 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 Storing both the mask and the id is redundant as we can trivially compute one from the other. As the mask is more frequently used, remove the id. Signed-off-by: Chris Wilson Cc: Mika Kuoppala Cc: Tvrtko Ursulin --- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- drivers/gpu/drm/i915/intel_uncore.c | 12 ++++++------ drivers/gpu/drm/i915/intel_uncore.h | 6 ++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index bd9abef40c66..a2c9c3e792e1 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1468,7 +1468,7 @@ static int i915_forcewake_domains(struct seq_file *m, void *data) for_each_fw_domain(fw_domain, i915, tmp) seq_printf(m, "%s.wake_count = %u\n", - intel_uncore_forcewake_domain_to_str(fw_domain->id), + intel_uncore_forcewake_domain_to_str(fw_domain), READ_ONCE(fw_domain->wake_count)); return 0; diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 08d7d08438c0..7eaa592aed26 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -40,8 +40,10 @@ static const char * const forcewake_domain_names[] = { }; const char * -intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id) +intel_uncore_forcewake_domain_to_str(const struct intel_uncore_forcewake_domain *d) { + unsigned int id = ilog2(d->mask); + BUILD_BUG_ON(ARRAY_SIZE(forcewake_domain_names) != FW_DOMAIN_ID_COUNT); if (id >= 0 && id < FW_DOMAIN_ID_COUNT) @@ -77,7 +79,7 @@ fw_domain_wait_ack_clear(const struct drm_i915_private *i915, FORCEWAKE_KERNEL) == 0, FORCEWAKE_ACK_TIMEOUT_MS)) DRM_ERROR("%s: timed out waiting for forcewake ack to clear.\n", - intel_uncore_forcewake_domain_to_str(d->id)); + intel_uncore_forcewake_domain_to_str(d)); } static inline void @@ -95,7 +97,7 @@ fw_domain_wait_ack(const struct drm_i915_private *i915, FORCEWAKE_KERNEL), FORCEWAKE_ACK_TIMEOUT_MS)) DRM_ERROR("%s: timed out waiting for forcewake ack request.\n", - intel_uncore_forcewake_domain_to_str(d->id)); + intel_uncore_forcewake_domain_to_str(d)); } static inline void @@ -209,7 +211,7 @@ intel_uncore_fw_release_timer(struct hrtimer *timer) struct intel_uncore_forcewake_domain *domain = container_of(timer, struct intel_uncore_forcewake_domain, timer); struct drm_i915_private *dev_priv = - container_of(domain, struct drm_i915_private, uncore.fw_domain[domain->id]); + container_of(domain, struct drm_i915_private, uncore.fw_domain[ilog2(domain->mask)]); unsigned long irqflags; assert_rpm_device_not_suspended(dev_priv); @@ -1149,8 +1151,6 @@ static void fw_domain_init(struct drm_i915_private *dev_priv, d->reg_set = reg_set; d->reg_ack = reg_ack; - d->id = domain_id; - BUILD_BUG_ON(FORCEWAKE_RENDER != (1 << FW_DOMAIN_ID_RENDER)); BUILD_BUG_ON(FORCEWAKE_BLITTER != (1 << FW_DOMAIN_ID_BLITTER)); BUILD_BUG_ON(FORCEWAKE_MEDIA != (1 << FW_DOMAIN_ID_MEDIA)); diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h index ff6fe2bb0ccf..5fec5fd4346c 100644 --- a/drivers/gpu/drm/i915/intel_uncore.h +++ b/drivers/gpu/drm/i915/intel_uncore.h @@ -93,8 +93,7 @@ struct intel_uncore { u32 fw_reset; struct intel_uncore_forcewake_domain { - enum forcewake_domain_id id; - enum forcewake_domains mask; + unsigned int mask; unsigned int wake_count; struct hrtimer timer; i915_reg_t reg_set; @@ -123,8 +122,7 @@ void intel_uncore_resume_early(struct drm_i915_private *dev_priv); u64 intel_uncore_edram_size(struct drm_i915_private *dev_priv); void assert_forcewakes_inactive(struct drm_i915_private *dev_priv); -const char *intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id); - +const char *intel_uncore_forcewake_domain_to_str(const struct intel_uncore_forcewake_domain *domain); enum forcewake_domains intel_uncore_forcewake_for_reg(struct drm_i915_private *dev_priv, i915_reg_t reg, unsigned int op);