From patchwork Thu Sep 29 15:35:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9356601 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 E29A36086A for ; Thu, 29 Sep 2016 15:36:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D399529B5C for ; Thu, 29 Sep 2016 15:36:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C89FE29B80; Thu, 29 Sep 2016 15:36:34 +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 61C2A29B7B for ; Thu, 29 Sep 2016 15:36:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B61576E888; Thu, 29 Sep 2016 15:36:33 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6237D6E87A for ; Thu, 29 Sep 2016 15:36:14 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id w84so11289639wmg.0 for ; Thu, 29 Sep 2016 08:36:14 -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=rIb3FSj7uqPIUc6feH71RPm4G7uqcHkzTyeVk6C0A+o=; b=SNDcEF8rufT4aMmJOWOmru+QHeUMBO8tiEQ+chOWLbjdIikbA/tQMQeFcpdRydkOK4 d9KalRR7jNjdTxhumXgJWIFQb7CcUZWEOzTzr+WmgiHrMYA7L/TbOfLCeI7gysdDixZu cPtFqVTVzIr1iOtOW4xEmvLxmrLBK55vKAD4QkWus4tAuL23Kr9T/INM0pSsq9DSvflu tcud4OUKK2CfJtahQ2tIdxnpmAlJr2rGS/+hpEmZI8xqJFsVS37DThAWHZKglG1O2Y9y nYJStcKmNMBlz0yLDxSX2HzDfZvGPD/Y//VENQQt2KXzwhSz5MkBUD7FZWT5mApnwBwQ uJbQ== 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=rIb3FSj7uqPIUc6feH71RPm4G7uqcHkzTyeVk6C0A+o=; b=N6Bn/WW5FNr8yoPlsgKsCLxjlpLwz+AZL93G54VacfHals6HfRmx2og3TGny0Et/7F h0Vv9r3SHo2dv9kEg+l90Vkn4NAJ3xO/TH2tPl4/INSWkPEKABLKwn1dmzW+yB5Z9Ox7 VynaNwC9e7u74SpofWDhe2GKKEG/05FESxxMQO2cc8YUzaAL9DmVbJ3BAQiX3sB2rKum MFCnrN+XP8Mvp9jXGrna5DRyljzkBdXVCxF4DHtnQieJmnN79nfPwg43AglvEuFejlks aQn//Cw+zKUDapX1emvEpoFYSQGsFuK+CS+2o5J0BxlQ4O3M/a+02ewA0OAAhSQWSyPD hDdQ== X-Gm-Message-State: AA6/9RnJf4XWibrpfohhmPrvEA9oIbCag6sX5surLjTik4eN7WQxsdZlI7vtr5SsfgsMKg== X-Received: by 10.28.92.82 with SMTP id q79mr3219962wmb.113.1475163372803; Thu, 29 Sep 2016 08:36:12 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Sep 2016 08:36:12 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Thu, 29 Sep 2016 16:35:50 +0100 Message-Id: <1475163356-3463-8-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 07/13] drm/i915: Eliminate Gen9 special case 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 If we insert blitter forcewake domain entries in the range table we can eliminate that special case and simplify the code in a few macros. This will enable more unification later. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/intel_uncore.c | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index ae5edaea16f7..a41a6a2019be 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -614,7 +614,7 @@ find_fw_domain(u32 offset, const struct intel_forcewake_range *ranges, num_ranges, sizeof(struct intel_forcewake_range), fw_range_cmp); - return entry ? entry->domains : -1; + return entry ? entry->domains : 0; } static void @@ -651,12 +651,9 @@ static const struct intel_forcewake_range __vlv_fw_ranges[] = { #define __vlv_reg_read_fw_domains(offset) \ ({ \ enum forcewake_domains __fwd = 0; \ - if (NEEDS_FORCE_WAKE((offset))) { \ + if (NEEDS_FORCE_WAKE((offset))) \ __fwd = find_fw_domain(offset, __vlv_fw_ranges, \ ARRAY_SIZE(__vlv_fw_ranges)); \ - if (__fwd == -1 ) \ - __fwd = 0; \ - } \ __fwd; \ }) @@ -713,57 +710,63 @@ static const struct intel_forcewake_range __chv_fw_ranges[] = { #define __chv_reg_read_fw_domains(offset) \ ({ \ enum forcewake_domains __fwd = 0; \ - if (NEEDS_FORCE_WAKE((offset))) { \ + if (NEEDS_FORCE_WAKE((offset))) \ __fwd = find_fw_domain(offset, __chv_fw_ranges, \ ARRAY_SIZE(__chv_fw_ranges)); \ - if (__fwd == -1 ) \ - __fwd = 0; \ - } \ __fwd; \ }) #define __chv_reg_write_fw_domains(offset) \ ({ \ enum forcewake_domains __fwd = 0; \ - if (NEEDS_FORCE_WAKE((offset)) && !is_gen8_shadowed(offset)) { \ + if (NEEDS_FORCE_WAKE((offset)) && !is_gen8_shadowed(offset)) \ __fwd = find_fw_domain(offset, __chv_fw_ranges, \ ARRAY_SIZE(__chv_fw_ranges)); \ - if (__fwd == -1 ) \ - __fwd = 0; \ - } \ __fwd; \ }) /* *Must* be sorted by offset ranges! */ static const struct intel_forcewake_range __gen9_fw_ranges[] = { + GEN_FW_RANGE(0x0, 0xaff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0xb00, 0x1fff, 0), /* uncore range */ GEN_FW_RANGE(0x2000, 0x26ff, FORCEWAKE_RENDER), + GEN_FW_RANGE(0x2700, 0x2fff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x3000, 0x3fff, FORCEWAKE_RENDER), + GEN_FW_RANGE(0x4000, 0x51ff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x5200, 0x7fff, FORCEWAKE_RENDER), + GEN_FW_RANGE(0x8000, 0x812f, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x8130, 0x813f, FORCEWAKE_MEDIA), GEN_FW_RANGE(0x8140, 0x815f, FORCEWAKE_RENDER), + GEN_FW_RANGE(0x8160, 0x82ff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x8300, 0x84ff, FORCEWAKE_RENDER), + GEN_FW_RANGE(0x8500, 0x87ff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x8800, 0x89ff, FORCEWAKE_MEDIA), + GEN_FW_RANGE(0x8a00, 0x8bff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x8c00, 0x8cff, FORCEWAKE_RENDER), + GEN_FW_RANGE(0x8d00, 0x93ff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x9400, 0x97ff, FORCEWAKE_RENDER | FORCEWAKE_MEDIA), + GEN_FW_RANGE(0x9800, 0xafff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0xb000, 0xb47f, FORCEWAKE_RENDER), + GEN_FW_RANGE(0xb480, 0xbfff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0xd000, 0xd7ff, FORCEWAKE_MEDIA), + GEN_FW_RANGE(0xd800, 0xdfff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0xe000, 0xe8ff, FORCEWAKE_RENDER), + GEN_FW_RANGE(0xe900, 0x11fff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x12000, 0x13fff, FORCEWAKE_MEDIA), + GEN_FW_RANGE(0x14000, 0x19fff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x1a000, 0x1e9ff, FORCEWAKE_MEDIA), + GEN_FW_RANGE(0x1ea00, 0x243ff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x24400, 0x247ff, FORCEWAKE_RENDER), + GEN_FW_RANGE(0x24800, 0x2ffff, FORCEWAKE_BLITTER), GEN_FW_RANGE(0x30000, 0x3ffff, FORCEWAKE_MEDIA), }; #define __gen9_reg_read_fw_domains(offset) \ ({ \ enum forcewake_domains __fwd = 0; \ - if (NEEDS_FORCE_WAKE((offset))) { \ + if (NEEDS_FORCE_WAKE((offset))) \ __fwd = find_fw_domain(offset, __gen9_fw_ranges, \ ARRAY_SIZE(__gen9_fw_ranges)); \ - if (__fwd == -1 ) \ - __fwd = FORCEWAKE_BLITTER; \ - } \ __fwd; \ }) @@ -790,12 +793,9 @@ static bool is_gen9_shadowed(u32 offset) #define __gen9_reg_write_fw_domains(offset) \ ({ \ enum forcewake_domains __fwd = 0; \ - if (NEEDS_FORCE_WAKE((offset)) && !is_gen9_shadowed(offset)) { \ + if (NEEDS_FORCE_WAKE((offset)) && !is_gen9_shadowed(offset)) \ __fwd = find_fw_domain(offset, __gen9_fw_ranges, \ ARRAY_SIZE(__gen9_fw_ranges)); \ - if (__fwd == -1 ) \ - __fwd = FORCEWAKE_BLITTER; \ - } \ __fwd; \ })