From patchwork Tue Jun 20 18:25:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Thierry X-Patchwork-Id: 9800073 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 B7688601BC for ; Tue, 20 Jun 2017 18:25:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B58E228294 for ; Tue, 20 Jun 2017 18:25:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7761283A6; Tue, 20 Jun 2017 18:25:09 +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.2 required=2.0 tests=BAYES_00, 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 3550E28294 for ; Tue, 20 Jun 2017 18:25:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D027E6E33E; Tue, 20 Jun 2017 18:25:08 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 931D36E33E for ; Tue, 20 Jun 2017 18:25:07 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2017 11:25:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.39,364,1493708400"; d="scan'208"; a="1162710097" Received: from relo-linux-11.sc.intel.com ([10.3.160.214]) by fmsmga001.fm.intel.com with ESMTP; 20 Jun 2017 11:25:02 -0700 From: Michel Thierry To: intel-gfx@lists.freedesktop.org Date: Tue, 20 Jun 2017 11:25:01 -0700 Message-Id: <20170620182502.28553-2-michel.thierry@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170620182502.28553-1-michel.thierry@intel.com> References: <20170620182502.28553-1-michel.thierry@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/3] lib: Add reset-type helper in ioctl_wrappers 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 Soon we will have tests that are only for platforms with reset-engine (GEN8+), so add a helper to query the has_gpu_reset via the getparam ioctl. Signed-off-by: Michel Thierry --- lib/ioctl_wrappers.c | 22 ++++++++++++++++++++++ lib/ioctl_wrappers.h | 1 + 2 files changed, 23 insertions(+) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 0816a7b6..958b7d03 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1199,6 +1199,28 @@ bool gem_uses_full_ppgtt(int fd) } /** + * gem_gpu_reset_type: + * @fd: open i915 drm file descriptor + * + * Query whether reset-engine (2), global-reset (1) or reset-disable (0) + * is available. + * + * Returns: GPU reset type available + */ +int gem_gpu_reset_type(int fd) +{ + struct drm_i915_getparam gp; + int gpu_reset_type = -1; + + memset(&gp, 0, sizeof(gp)); + gp.param = I915_PARAM_HAS_GPU_RESET; + gp.value = &gpu_reset_type; + drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); + + return gpu_reset_type; +} + +/** * gem_available_fences: * @fd: open i915 drm file descriptor * diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index e1279d94..0fd4e8e4 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -164,6 +164,7 @@ bool gem_has_blt(int fd); bool gem_has_vebox(int fd); bool gem_has_bsd2(int fd); int gem_gtt_type(int fd); +int gem_gpu_reset_type(int fd); bool gem_uses_ppgtt(int fd); bool gem_uses_full_ppgtt(int fd); int gem_available_fences(int fd);