From patchwork Fri Apr 7 13:55:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rogozhkin, Dmitry V" X-Patchwork-Id: 9670507 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 85C83602B3 for ; Fri, 7 Apr 2017 21:57:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75A161FF8F for ; Fri, 7 Apr 2017 21:57:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A18B20499; Fri, 7 Apr 2017 21:57:10 +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=-2.5 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, 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 D6D441FF8F for ; Fri, 7 Apr 2017 21:57:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 73D446ED96; Fri, 7 Apr 2017 21:57:09 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id D19766ED96 for ; Fri, 7 Apr 2017 21:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491602228; x=1523138228; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Il1KxDGmC6AAgbjTE2E9mQWI/7W2SybM5elXwgm2110=; b=eF8gVr7Iu9tACKA0Hd6ZBpuq85G+ChPcarWhu+Oc8THevC/+xI/mHdoh b9wmT+93+ktukasEKl8EIFNorhsCkQ==; Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Apr 2017 14:57:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,168,1488873600"; d="scan'208";a="71237597" Received: from dvrscl.jf.intel.com ([10.54.70.8]) by orsmga002.jf.intel.com with ESMTP; 07 Apr 2017 14:57:08 -0700 From: Dmitry Rogozhkin To: intel-gfx@lists.freedesktop.org Date: Fri, 7 Apr 2017 06:55:28 -0700 Message-Id: <1491573329-7066-2-git-send-email-dmitry.v.rogozhkin@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1491573329-7066-1-git-send-email-dmitry.v.rogozhkin@intel.com> References: <1491573329-7066-1-git-send-email-dmitry.v.rogozhkin@intel.com> Subject: [Intel-gfx] [RFC 1/2] drm/i915/skl: add slice shutdown debugfs interface 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 Slice shutdown override interface (i915_slice_enabled) permits to power on/off GPGPU slices in Gen8 and Gen9. This is helpful in performance investigations amd checking scalability across hw platforms. Changes to slice number done via this interface will effect any lrc created after the write and will not affect older ones. v1: Restrict effect of the patch to SKL. Comment code. Change-Id: I4f2fe5fefb8d1df4519fd0eb58237759c7d1a930 Signed-off-by: Dmitry Rogozhkin CC: Tvrtko Ursulin CC: Zhipeng Gong CC: Joonas Lahtinen CC: Chris Wilson --- drivers/gpu/drm/i915/i915_debugfs.c | 38 +++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_device_info.c | 1 + drivers/gpu/drm/i915/intel_lrc.c | 2 +- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index d689e51..4d7dac5 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -4812,6 +4812,41 @@ static int i915_hpd_storm_ctl_open(struct inode *inode, struct file *file) {"i915_drrs_status", i915_drrs_status, 0}, {"i915_rps_boost_info", i915_rps_boost_info, 0}, }; + +static int +i915_slice_enabled_get(void *data, u64 *val) +{ + struct drm_i915_private *dev_priv = data; + + *val = INTEL_INFO(dev_priv)->sseu.slice_enabled; + return 0; +} + +/* Changes to slice number done via this interface will effect + * any lrc created after the write and will not affect + * older ones. + */ +static int +i915_slice_enabled_set(void *data, u64 val) +{ + struct drm_i915_private *dev_priv = data; + struct intel_device_info *info; + + info = mkwrite_device_info(dev_priv); + if (!IS_SKYLAKE(dev_priv) || !info->sseu.has_slice_pg) + return -EINVAL; + + if (val > hweight8(info->sseu.slice_mask)) + return -EINVAL; + + info->sseu.slice_enabled = val; + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(i915_slice_enabled_fops, + i915_slice_enabled_get, i915_slice_enabled_set, + "%llu\n"); + #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) static const struct i915_debugfs_files { @@ -4839,7 +4874,8 @@ static int i915_hpd_storm_ctl_open(struct inode *inode, struct file *file) {"i915_dp_test_type", &i915_displayport_test_type_fops}, {"i915_dp_test_active", &i915_displayport_test_active_fops}, {"i915_guc_log_control", &i915_guc_log_control_fops}, - {"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops} + {"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops}, + {"i915_slice_enabled", &i915_slice_enabled_fops} }; int i915_debugfs_register(struct drm_i915_private *dev_priv) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index bb6fc1e..7455d43 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -852,6 +852,7 @@ struct sseu_dev_info { u8 has_slice_pg:1; u8 has_subslice_pg:1; u8 has_eu_pg:1; + u8 slice_enabled; }; static inline unsigned int sseu_subslice_total(const struct sseu_dev_info *sseu) diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c index 7d01dfe..2eee76b 100644 --- a/drivers/gpu/drm/i915/intel_device_info.c +++ b/drivers/gpu/drm/i915/intel_device_info.c @@ -412,6 +412,7 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv) gen9_sseu_info_init(dev_priv); info->has_snoop = !info->has_llc; + info->sseu.slice_enabled = hweight8(info->sseu.slice_mask); DRM_DEBUG_DRIVER("slice mask: %04x\n", info->sseu.slice_mask); DRM_DEBUG_DRIVER("slice total: %u\n", hweight8(info->sseu.slice_mask)); diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 0dc1cc4..2a1b641 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -1743,7 +1743,7 @@ int logical_xcs_ring_init(struct intel_engine_cs *engine) */ if (INTEL_INFO(dev_priv)->sseu.has_slice_pg) { rpcs |= GEN8_RPCS_S_CNT_ENABLE; - rpcs |= hweight8(INTEL_INFO(dev_priv)->sseu.slice_mask) << + rpcs |= INTEL_INFO(dev_priv)->sseu.slice_enabled << GEN8_RPCS_S_CNT_SHIFT; rpcs |= GEN8_RPCS_ENABLE; }