From patchwork Tue May 17 13:55:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 9112521 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 95D20BF29F for ; Tue, 17 May 2016 13:58:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B39A92025A for ; Tue, 17 May 2016 13:58:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B23E0201FE for ; Tue, 17 May 2016 13:58:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F20656E53C; Tue, 17 May 2016 13:58:31 +0000 (UTC) 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 E27CD6E537 for ; Tue, 17 May 2016 13:58:30 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 17 May 2016 06:58:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,324,1459839600"; d="scan'208";a="956365676" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga001.jf.intel.com with ESMTP; 17 May 2016 06:58:24 -0700 Received: from mwiniars-desk1.ger.corp.intel.com (172.28.173.39) by IRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP Server id 14.3.248.2; Tue, 17 May 2016 14:55:51 +0100 From: =?UTF-8?q?Micha=C5=82=20Winiarski?= To: Date: Tue, 17 May 2016 15:55:44 +0200 Message-ID: <1463493344-11464-1-git-send-email-michal.winiarski@intel.com> X-Mailer: git-send-email 2.8.0 MIME-Version: 1.0 X-Originating-IP: [172.28.173.39] Subject: [Intel-gfx] [PATCH i-g-t] tests/pm_rps: Add handling of idle frequency exposed via sysfs 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.6 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 Signed-off-by: Micha? Winiarski --- tests/pm_rps.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index c3d4417..a0e6655 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -45,6 +45,7 @@ static int drm_fd; static const char sysfs_base_path[] = "/sys/class/drm/card%d/gt_%s_freq_mhz"; enum { CUR, + IDL, MIN, MAX, RP0, @@ -60,7 +61,7 @@ struct junk { const char *mode; FILE *filp; } stuff[] = { - { "cur", "r", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { NULL, NULL, NULL } + { "cur", "r", NULL }, {"idl", "rb+", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { NULL, NULL, NULL } }; static int readval(FILE *filp) @@ -145,6 +146,7 @@ static int do_writeval(FILE *filp, int val, int lerrno, bool readback_check) static void checkit(const int *freqs) { igt_assert_lte(freqs[MIN], freqs[MAX]); + igt_assert_lte(freqs[IDL], freqs[MIN]); igt_assert_lte(freqs[CUR], freqs[MAX]); igt_assert_lte(freqs[RPn], freqs[CUR]); igt_assert_lte(freqs[RPn], freqs[MIN]); @@ -160,6 +162,7 @@ static void matchit(const int *freqs1, const int *freqs2) igt_assert_eq(freqs1[CUR], freqs2[CUR]); igt_assert_eq(freqs1[MIN], freqs2[MIN]); igt_assert_eq(freqs1[MAX], freqs2[MAX]); + igt_assert_eq(freqs1[IDL], freqs2[IDL]); igt_assert_eq(freqs1[RP0], freqs2[RP0]); igt_assert_eq(freqs1[RP1], freqs2[RP1]); igt_assert_eq(freqs1[RPn], freqs2[RPn]); @@ -379,19 +382,44 @@ static void min_max_config(void (*check)(void), bool load_gpu) do_load_gpu(); check(); - igt_debug("\nSet min=RPn and max=RP0...\n"); + igt_debug("\nSet idle=RPn, min=RPn and max=RP0...\n"); + writeval(stuff[IDL].filp, origfreqs[RPn]); writeval(stuff[MIN].filp, origfreqs[RPn]); writeval(stuff[MAX].filp, origfreqs[RP0]); if (load_gpu) do_load_gpu(); check(); + igt_debug("\nIncrease idle above min (invalid)...\n"); + writeval_inval(stuff[IDL].filp, origfreqs[RPn] + 100); + if (load_gpu) + do_load_gpu(); + check(); + igt_debug("\nIncrease min to midpoint...\n"); writeval(stuff[MIN].filp, fmid); if (load_gpu) do_load_gpu(); check(); + igt_debug("\nIncrease idle to midpoint...\n"); + writeval(stuff[IDL].filp, fmid); + if (load_gpu) + do_load_gpu(); + check(); + + igt_debug("\nDecrease min below idle (invalid)...\n"); + writeval_inval(stuff[MIN].filp, fmid - 100); + if (load_gpu) + do_load_gpu(); + check(); + + igt_debug("\nDecrease idle to RPn...\n"); + writeval(stuff[IDL].filp, origfreqs[RPn]); + if (load_gpu) + do_load_gpu(); + check(); + igt_debug("\nIncrease min to RP0...\n"); writeval(stuff[MIN].filp, origfreqs[RP0]); if (load_gpu) @@ -476,13 +504,13 @@ static void idle_check(void) read_freqs(freqs); dump(freqs); checkit(freqs); - if (freqs[CUR] == freqs[RPn]) + if (freqs[CUR] == freqs[IDL]) break; usleep(1000 * IDLE_WAIT_TIMESTEP_MSEC); wait += IDLE_WAIT_TIMESTEP_MSEC; } while (wait < IDLE_WAIT_TIMEOUT_MSEC); - igt_assert_eq(freqs[CUR], freqs[RPn]); + igt_assert_eq(freqs[CUR], freqs[IDL]); igt_debug("Required %d msec to reach cur=idle\n", wait); }