From patchwork Thu Jul 31 01:59:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: jeff.mcgee@intel.com X-Patchwork-Id: 4652811 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AC53BC0338 for ; Thu, 31 Jul 2014 01:50:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B97FB201B4 for ; Thu, 31 Jul 2014 01:50:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 89F5C200F4 for ; Thu, 31 Jul 2014 01:50:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB4756E444; Wed, 30 Jul 2014 18:50:43 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 0EE766E444 for ; Wed, 30 Jul 2014 18:50:40 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 30 Jul 2014 18:50:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,768,1400050800"; d="scan'208";a="569739282" Received: from jeffdesk.fso.intel.com ([10.5.53.1]) by fmsmga001.fm.intel.com with ESMTP; 30 Jul 2014 18:50:39 -0700 From: jeff.mcgee@intel.com To: intel-gfx@lists.freedesktop.org Date: Wed, 30 Jul 2014 20:59:46 -0500 Message-Id: <1406771987-1127-1-git-send-email-jeff.mcgee@intel.com> X-Mailer: git-send-email 2.0.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Slice/Subslice/EU info via GETPARAM X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff McGee Define a struct to capture information on the device's Slice/Subslice/EU (SSEU) configuration. Add this struct to the main device info struct. Define a packed bitfield form for the SSEU info and share it with userspace via a new GETPARAM option. Starting with Cherryview, devices may have a varying number of EU for a given ID due to creative fusing. The surest way to determine the configuration is by reading fuses which is best done in the kernel and communicated to userspace. The immediate need from userspace is to determine the number of threads of compute work that can be safely submitted. The definition of SSEU as a new drm/i915 component, with its own header file and soon-to-be source file, is in anticipation of lots of upcoming code for its management, particularly the power gating functionality. Signed-off-by: Jeff McGee --- drivers/gpu/drm/i915/i915_dma.c | 3 +++ drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/intel_sseu.h | 40 +++++++++++++++++++++++++++++++++++++++ include/uapi/drm/i915_drm.h | 18 ++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 drivers/gpu/drm/i915/intel_sseu.h diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 2e7f03a..f581848 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1025,6 +1025,9 @@ static int i915_getparam(struct drm_device *dev, void *data, case I915_PARAM_CMD_PARSER_VERSION: value = i915_cmd_parser_get_version(); break; + case I915_PARAM_SSEU_INFO: + value = INTEL_INFO(dev)->sseu.gp_sseu_info; + break; default: DRM_DEBUG("Unknown parameter %d\n", param->param); return -EINVAL; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 18c9ad8..01adafd 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -45,6 +45,7 @@ #include #include #include +#include "intel_sseu.h" /* General customization: */ @@ -562,6 +563,8 @@ struct intel_device_info { int trans_offsets[I915_MAX_TRANSCODERS]; int palette_offsets[I915_MAX_PIPES]; int cursor_offsets[I915_MAX_PIPES]; + /* Slice/Subslice/EU info */ + struct intel_sseu_info sseu; }; #undef DEFINE_FLAG diff --git a/drivers/gpu/drm/i915/intel_sseu.h b/drivers/gpu/drm/i915/intel_sseu.h new file mode 100644 index 0000000..7db7175 --- /dev/null +++ b/drivers/gpu/drm/i915/intel_sseu.h @@ -0,0 +1,40 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ +#ifndef _INTEL_SSEU_H_ +#define _INTEL_SSEU_H_ + +struct intel_sseu_info { + /* Total slice count */ + unsigned int slice_cnt; + /* Total subslice count */ + unsigned int subslice_cnt; + /* Total execution unit count */ + unsigned int eu_cnt; + /* Thread count per EU */ + unsigned int threads_per_eu; + /* Bit field representation for I915_PARAM_SSEU_INFO */ + u32 gp_sseu_info; +}; + +#endif diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index ff57f07..b99c1a2 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -171,6 +171,23 @@ typedef struct _drm_i915_sarea { #define I915_BOX_TEXTURE_LOAD 0x8 #define I915_BOX_LOST_CONTEXT 0x10 +/* + * Slice/Subslice/EU Info + * - Accessed via GETPARAM ioctl option I915_PARAM_SSEU_INFO + * - SLICE_CNT: total slice count + * - SUBSLICE_CNT: total subslice count + * - EU_CNT: total execution unit count + * - THREADS_PER_EU: thread count per EU +*/ +#define I915_SSEU_INFO_SLICE_CNT_MASK 0xf +#define I915_SSEU_INFO_SLICE_CNT_SHIFT 0 +#define I915_SSEU_INFO_SUBSLICE_CNT_MASK (0x3f<<4) +#define I915_SSEU_INFO_SUBSLICE_CNT_SHIFT 4 +#define I915_SSEU_INFO_EU_CNT_MASK (0xff<<10) +#define I915_SSEU_INFO_EU_CNT_SHIFT 10 +#define I915_SSEU_INFO_THREADS_PER_EU_MASK (0xf<<18) +#define I915_SSEU_INFO_THREADS_PER_EU_SHIFT 18 + /* I915 specific ioctls * The device specific ioctl range is 0x40 to 0x79. */ @@ -340,6 +357,7 @@ typedef struct drm_i915_irq_wait { #define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 #define I915_PARAM_HAS_WT 27 #define I915_PARAM_CMD_PARSER_VERSION 28 +#define I915_PARAM_SSEU_INFO 29 typedef struct drm_i915_getparam { int param;