From patchwork Tue Jul 25 15:26:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Musial, Ewelina" X-Patchwork-Id: 9862295 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 33EDA602B1 for ; Tue, 25 Jul 2017 15:28:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F9D81FF60 for ; Tue, 25 Jul 2017 15:28:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20E562040D; Tue, 25 Jul 2017 15:28:59 +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 A8B1F1FF60 for ; Tue, 25 Jul 2017 15:28:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B9CF6E555; Tue, 25 Jul 2017 15:28:21 +0000 (UTC) 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 ESMTPS id 28DC96E13A for ; Tue, 25 Jul 2017 15:28:20 +0000 (UTC) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2017 08:28:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,411,1496127600"; d="scan'208";a="129291096" Received: from emusial-desk.igk.intel.com ([172.28.171.24]) by orsmga005.jf.intel.com with ESMTP; 25 Jul 2017 08:28:02 -0700 From: Ewelina Musial To: intel-gfx@lists.freedesktop.org Date: Tue, 25 Jul 2017 17:26:09 +0200 Message-Id: <20170725152609.16264-2-ewelina.musial@intel.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170725152609.16264-1-ewelina.musial@intel.com> References: <20170725152609.16264-1-ewelina.musial@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/2] tests/drv_suspend: Add subtests to check that forcewake is kept after resume 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 In some cases we observed that forcewake isn't kept after resume and checking RC6 residency is a simple way to verify that. If forcewake is kept after resume residency should be constant. Cc: Lukasz Fiedorowicz Cc: Radoslaw Szwichtenberg Cc: Michal Winiarski Signed-off-by: Ewelina Musial --- tests/drv_suspend.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c index 2e39f20a..0c576055 100644 --- a/tests/drv_suspend.c +++ b/tests/drv_suspend.c @@ -36,6 +36,9 @@ #include #include #include +#include "igt_sysfs.h" +#include "igt_aux.h" +#include #include @@ -160,8 +163,9 @@ test_sysfs_reader(bool hibernate) igt_stop_helper(&reader); } +#define SLEEP_DURATION 3 static void -test_forcewake(int fd, bool hibernate) +test_forcewake(int fd, bool hibernate, bool residency) { int fw_fd; @@ -174,8 +178,26 @@ test_forcewake(int fd, bool hibernate) else igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); + if (residency) + { + int sysfs; + uint32_t residency_pre, residency_post; - close (fw_fd); + sysfs = igt_sysfs_open(fd, NULL); + igt_assert_lte(0, sysfs); + sleep(1); // time to fully resume + + // forcewake should keep residency constant after resume + residency_pre = read_residency(sysfs, "rc6"); + sleep(SLEEP_DURATION); + residency_post = read_residency(sysfs, "rc6"); + + igt_assert_eq(residency_pre, residency_post); + + close(sysfs); + } + + close (fw_fd); } int fd; @@ -200,7 +222,10 @@ igt_main test_sysfs_reader(false); igt_subtest("forcewake") - test_forcewake(fd, false); + test_forcewake(fd, false, false); + + igt_subtest("rc6-forcewake") + test_forcewake(fd, false, true); igt_subtest("fence-restore-tiled2untiled-hibernate") test_fence_restore(fd, true, true); @@ -215,7 +240,10 @@ igt_main test_sysfs_reader(true); igt_subtest("forcewake-hibernate") - test_forcewake(fd, true); + test_forcewake(fd, true, false); + + igt_subtest("rc6-forcewake-hibernate") + test_forcewake(fd, true, true); igt_fixture close(fd);