From patchwork Fri May 18 17:14:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 10411661 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 57EFB602CB for ; Fri, 18 May 2018 17:14:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 456F5288F8 for ; Fri, 18 May 2018 17:14:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3876428963; Fri, 18 May 2018 17:14:53 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 C1E512894C for ; Fri, 18 May 2018 17:14:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D10686EE38; Fri, 18 May 2018 17:14:51 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E0B96EE38 for ; Fri, 18 May 2018 17:14:50 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 May 2018 10:14:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,415,1520924400"; d="scan'208";a="225390773" Received: from delly.ld.intel.com ([10.103.238.202]) by orsmga005.jf.intel.com with ESMTP; 18 May 2018 10:14:48 -0700 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Fri, 18 May 2018 18:14:52 +0100 Message-Id: <20180518171452.4813-1-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.17.0 Subject: [Intel-gfx] [PATCH v2] drm/i915/cmdparser: Whitelist INSTPM instruction parsing disable bits X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 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 On Gen8+ this register is not priviledged and we want to use it in Mesa to implement a feature required by GPA called Null Hardware. The idea is to have the command parser turn 3DPRIMITIVE/GPGPU_WALKER into NOOPs. This patch just whitelists the bits that we need and that are currently not used by the kernel. v2: Bump the command parser revision (Chris) Signed-off-by: Lionel Landwerlin --- drivers/gpu/drm/i915/i915_cmd_parser.c | 11 ++++++++++- drivers/gpu/drm/i915/i915_reg.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c index 95478db9998b..bb51d2c6c4c8 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c @@ -534,6 +534,14 @@ struct drm_i915_reg_descriptor { { .addr = _reg ## _UDW(idx) } static const struct drm_i915_reg_descriptor gen7_render_regs[] = { + REG32(INSTPM, + .mask = ~((INSTPM_3D_STATE_INSTRUCTION_DISABLE | + INSTPM_3D_RENDERING_INSTRUCTION_DISABLE | + INSTPM_3D_MEDIA_INSTRUCTION_DISABLE) << 16 | + (INSTPM_3D_STATE_INSTRUCTION_DISABLE | + INSTPM_3D_RENDERING_INSTRUCTION_DISABLE | + INSTPM_3D_MEDIA_INSTRUCTION_DISABLE)), + .value = 0), REG64(GPGPU_THREADS_DISPATCHED), REG64(HS_INVOCATION_COUNT), REG64(DS_INVOCATION_COUNT), @@ -1382,6 +1390,7 @@ int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv) * the parser enabled. * 9. Don't whitelist or handle oacontrol specially, as ownership * for oacontrol state is moving to i915-perf. + * 10. Whitelist INSTPM on Ivybridge & Haswell. */ - return 9; + return 10; } diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 196a0eb79272..86ab1303724a 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2531,6 +2531,9 @@ enum i915_power_well_id { #define INSTPM_FORCE_ORDERING (1<<7) /* GEN6+ */ #define INSTPM_TLB_INVALIDATE (1<<9) #define INSTPM_SYNC_FLUSH (1<<5) +#define INSTPM_3D_MEDIA_INSTRUCTION_DISABLE (1 << 3) /* GEN6+ */ +#define INSTPM_3D_RENDERING_INSTRUCTION_DISABLE (1 << 2) /* GEN6+ */ +#define INSTPM_3D_STATE_INSTRUCTION_DISABLE (1 << 1) /* GEN6+ */ #define ACTHD _MMIO(0x20c8) #define MEM_MODE _MMIO(0x20cc) #define MEM_DISPLAY_B_TRICKLE_FEED_DISABLE (1<<3) /* 830 only */