From patchwork Fri Jan 31 16:13:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jeff.mcgee@intel.com X-Patchwork-Id: 3563561 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3F9549F381 for ; Fri, 31 Jan 2014 20:11:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77CAF20253 for ; Fri, 31 Jan 2014 20:11:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8F29620251 for ; Fri, 31 Jan 2014 20:11:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7F90107318; Fri, 31 Jan 2014 12:11:02 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id B46AEF9EBF for ; Fri, 31 Jan 2014 08:06:39 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 31 Jan 2014 08:06:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,758,1384329600"; d="scan'208";a="473914369" Received: from jeffdesk.fso.intel.com ([10.5.53.1]) by fmsmga002.fm.intel.com with ESMTP; 31 Jan 2014 08:06:33 -0800 From: jeff.mcgee@intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 31 Jan 2014 10:13:50 -0600 Message-Id: <1391184833-10973-2-git-send-email-jeff.mcgee@intel.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1391184833-10973-1-git-send-email-jeff.mcgee@intel.com> References: <1391184833-10973-1-git-send-email-jeff.mcgee@intel.com> Subject: [Intel-gfx] [PATCH 1/4] pm_rps: Add stop rings injection utility X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.8 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 Signed-off-by: Jeff McGee --- tests/pm_rps.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 709e341..a6807d2 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -32,10 +32,12 @@ #include #include #include +#include #include "drmtest.h" #include "intel_gpu_tools.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" +#include "igt_debugfs.h" static bool verbose = false; @@ -62,6 +64,8 @@ struct junk { { "cur", "r", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { NULL, NULL, NULL } }; +static igt_debugfs_t dfs; + static int readval(FILE *filp) { int val; @@ -267,6 +271,37 @@ static void load_helper_deinit(void) drm_intel_bufmgr_destroy(lh.bufmgr); } +static void stop_rings(void) +{ + int fd; + static const char data[] = "0xf"; + + fd = igt_debugfs_open(&dfs, "i915_ring_stop", O_WRONLY); + igt_assert(fd >= 0); + + log("injecting ring stop\n"); + igt_assert(write(fd, data, sizeof(data)) == sizeof(data)); + + close(fd); +} + +static bool rings_stopped(void) +{ + int fd; + static char buf[128]; + unsigned long long val; + + fd = igt_debugfs_open(&dfs, "i915_ring_stop", O_RDONLY); + igt_assert(fd >= 0); + + igt_assert(read(fd, buf, sizeof(buf)) > 0); + close(fd); + + sscanf(buf, "%llx", &val); + + return (bool)val; +} + static void min_max_config(void (*check)(void)) { int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2; @@ -471,6 +506,8 @@ int main(int argc, char **argv) igt_install_exit_handler(pm_rps_exit_handler); load_helper_init(); + + igt_debugfs_init(&dfs); } igt_subtest("basic-api")