From patchwork Thu Sep 29 15:35:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9356591 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 AF0E0600C8 for ; Thu, 29 Sep 2016 15:36:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A087D29B5C for ; Thu, 29 Sep 2016 15:36:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 955ED29B7A; Thu, 29 Sep 2016 15:36:22 +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 3777229B5C for ; Thu, 29 Sep 2016 15:36:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2EE886E880; Thu, 29 Sep 2016 15:36:21 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id B24976E881 for ; Thu, 29 Sep 2016 15:36:16 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id w72so2683719wmf.1 for ; Thu, 29 Sep 2016 08:36:16 -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=Fqt67/42LHaeVSu6aq0kSSJwpFhTOtGF6lE6QQdoXgA=; b=e2pn3DXdkGxnTDj+tQ6d+n7uxYJ9yIuUYNc6ZRv/DQwWR8km8ZrpKFRT8Hwxl8Larw 0MiHgHqB03Bunv1L9werMiuHbam/D5yHrQpMVqbwa6jKrluJZ3AgSbsR1HBOaLSQu4yC n+kU6w0dKgWVkoKFQEButX4c7L3u/6hv9IilX/Z8vjm95l4VkTwdjjvF8MU0Wz0yLZtS cPztFHzsiuEQtG82ttGZlDttMa33w/DAuQkaoKhidNh0XZPoWaC+Vv5NB+mjhuJuDbLe b5G7ZGvW+IAVTmITtJUWgCDRiWCKXyVTCLit++9MBO7JOdr0irXhnB/sNUcnDhxpbLy/ odig== 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=Fqt67/42LHaeVSu6aq0kSSJwpFhTOtGF6lE6QQdoXgA=; b=EJO3Pbt8vUA1R1ZNwm9DnfiNXjdVi4oEXrykiewAQcNfvAMVIcyKPAYlkxhRYhJVXV KVQrIUzl8DE6AcjGN/T7B6QO+uTX3Am5CupdtitpcVVPrpAx3wAGGDkL9xMxCX3omZcy M7mUHLfgZx20vhAHezaBqeRV8i0iAGPplfSrj7A2YKMDfYjrbJnKiY7rXxJQonh00B+j IRHdApbn5kyyCWeLdvrYwL5/wBt8GjB7vrWFFspFNYYeMBHIhY3KiqemdxYAaU58h1Cj Gp+jpeDbNFv2FSWhdu/rnTWvQMs2B2cyXR+N4k3//LfjRG9PfZg0+0AinfActfciEbQQ OHPw== X-Gm-Message-State: AA6/9Rl51KWpSQ0gKIw7TLcs5mDlqDmI//v0DeUJ2qOSeNjilxcUNkpAvir8FeeTD0EY0Q== X-Received: by 10.194.133.4 with SMTP id oy4mr2114699wjb.188.1475163375273; Thu, 29 Sep 2016 08:36:15 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Sep 2016 08:36:14 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Thu, 29 Sep 2016 16:35:53 +0100 Message-Id: <1475163356-3463-11-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 10/13] drm/i915: Remove identical mmio read functions 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 It is now obvious VLV, CHV and Gen9 mmio read fcuntions are completely identical so we can remove the three copies and just keep the newly named generic implementation. Signed-off-by: Tvrtko Ursulin Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/intel_uncore.c | 54 +++++++------------------------------ 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index a4ce3576f8d4..4f9f57774e2a 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -905,9 +905,9 @@ gen6_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \ GEN6_READ_FOOTER; \ } -#define __vlv_read(x) \ +#define __fwtbl_read(x) \ static u##x \ -vlv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \ +fwtbl_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \ enum forcewake_domains fw_engine; \ GEN6_READ_HEADER(x); \ fw_engine = __fwtable_reg_read_fw_domains(offset); \ @@ -917,50 +917,16 @@ vlv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \ GEN6_READ_FOOTER; \ } -#define __chv_read(x) \ -static u##x \ -chv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \ - enum forcewake_domains fw_engine; \ - GEN6_READ_HEADER(x); \ - fw_engine = __fwtable_reg_read_fw_domains(offset); \ - if (fw_engine) \ - __force_wake_auto(dev_priv, fw_engine); \ - val = __raw_i915_read##x(dev_priv, reg); \ - GEN6_READ_FOOTER; \ -} - -#define __gen9_read(x) \ -static u##x \ -gen9_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \ - enum forcewake_domains fw_engine; \ - GEN6_READ_HEADER(x); \ - fw_engine = __fwtable_reg_read_fw_domains(offset); \ - if (fw_engine) \ - __force_wake_auto(dev_priv, fw_engine); \ - val = __raw_i915_read##x(dev_priv, reg); \ - GEN6_READ_FOOTER; \ -} - -__gen9_read(8) -__gen9_read(16) -__gen9_read(32) -__gen9_read(64) -__chv_read(8) -__chv_read(16) -__chv_read(32) -__chv_read(64) -__vlv_read(8) -__vlv_read(16) -__vlv_read(32) -__vlv_read(64) +__fwtbl_read(8) +__fwtbl_read(16) +__fwtbl_read(32) +__fwtbl_read(64) __gen6_read(8) __gen6_read(16) __gen6_read(32) __gen6_read(64) -#undef __gen9_read -#undef __chv_read -#undef __vlv_read +#undef __fwtbl_read #undef __gen6_read #undef GEN6_READ_FOOTER #undef GEN6_READ_HEADER @@ -1319,13 +1285,13 @@ void intel_uncore_init(struct drm_i915_private *dev_priv) case 9: ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges); ASSIGN_WRITE_MMIO_VFUNCS(gen9); - ASSIGN_READ_MMIO_VFUNCS(gen9); + ASSIGN_READ_MMIO_VFUNCS(fwtbl); break; case 8: if (IS_CHERRYVIEW(dev_priv)) { ASSIGN_FW_DOMAINS_TABLE(__chv_fw_ranges); ASSIGN_WRITE_MMIO_VFUNCS(chv); - ASSIGN_READ_MMIO_VFUNCS(chv); + ASSIGN_READ_MMIO_VFUNCS(fwtbl); } else { ASSIGN_WRITE_MMIO_VFUNCS(gen8); @@ -1338,7 +1304,7 @@ void intel_uncore_init(struct drm_i915_private *dev_priv) if (IS_VALLEYVIEW(dev_priv)) { ASSIGN_FW_DOMAINS_TABLE(__vlv_fw_ranges); - ASSIGN_READ_MMIO_VFUNCS(vlv); + ASSIGN_READ_MMIO_VFUNCS(fwtbl); } else { ASSIGN_READ_MMIO_VFUNCS(gen6); }