From patchwork Mon Apr 24 12:55:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Musial, Ewelina" X-Patchwork-Id: 9696103 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 29F80601E9 for ; Mon, 24 Apr 2017 12:55:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18860267EC for ; Mon, 24 Apr 2017 12:55:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B1B62582C; Mon, 24 Apr 2017 12:55:12 +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 995AB2582C for ; Mon, 24 Apr 2017 12:55:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B44CD6E214; Mon, 24 Apr 2017 12:55:10 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59C446E215 for ; Mon, 24 Apr 2017 12:55:09 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2017 05:55:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,244,1488873600"; d="scan'208";a="252761574" Received: from emusial-desk.igk.intel.com ([172.28.171.24]) by fmsmga004.fm.intel.com with ESMTP; 24 Apr 2017 05:55:07 -0700 From: Ewelina Musial To: intel-gfx@lists.freedesktop.org Date: Mon, 24 Apr 2017 14:55:23 +0200 Message-Id: <20170424125523.3654-1-ewelina.musial@intel.com> X-Mailer: git-send-email 2.9.3 Subject: [Intel-gfx] [PATCH i-g-t] tests/pm_rc6_residency: Add subtest to check RC6 suspend handling 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 then RC6 residency is not constant. References: HSD#1804921797 Cc: Arkadiusz Hiler Cc: Michal Winiarski Cc: Lukasz Fiedorowicz Signed-off-by: Ewelina Musial Reviewed-by: Radoslaw Szwichtenberg Reviewed-by: MichaƂ Winiarski --- tests/pm_rc6_residency.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c index bdb9747..4e61326 100644 --- a/tests/pm_rc6_residency.c +++ b/tests/pm_rc6_residency.c @@ -165,6 +165,44 @@ static void measure_residencies(int devid, unsigned int rc6_mask, res->rc6 += res->rc6p; } +enum sleep_state { NOSLEEP, SUSPEND, HIBERNATE }; +static void test_rc6_forcewake(enum sleep_state sleep_state) +{ + int fd, fw_fd; + unsigned long residency_pre, residency_post; + + fd = drm_open_driver(DRIVER_INTEL); + igt_assert_lte(0, fd); + + fw_fd = igt_open_forcewake_handle(fd); + igt_assert_lte(0, fw_fd); + + switch (sleep_state) { + case NOSLEEP: + break; + case SUSPEND: + igt_system_suspend_autoresume(SUSPEND_STATE_MEM, + SUSPEND_TEST_NONE); + break; + case HIBERNATE: + igt_system_suspend_autoresume(SUSPEND_STATE_DISK, + SUSPEND_TEST_NONE); + break; + } + + sleep(1); // time to fully resume + + // forcewake should keep residency constant after resume + residency_pre = read_rc6_residency("rc6"); + sleep(SLEEP_DURATION); + residency_post = read_rc6_residency("rc6"); + + igt_assert_eq(residency_pre, residency_post); + + close(fw_fd); + close(fd); +} + igt_main { unsigned int rc6_mask; @@ -209,4 +247,19 @@ igt_main residency_accuracy(res.rc6pp, res.duration, "rc6pp"); } + igt_subtest("rc6-forcewake") { + igt_skip_on(!(rc6_mask & RC6_ENABLED)); + + test_rc6_forcewake(NOSLEEP); + } + igt_subtest("rc6-forcewake-suspend") { + igt_skip_on(!(rc6_mask & RC6_ENABLED)); + + test_rc6_forcewake(SUSPEND); + } + igt_subtest("rc6-forcewake-hibernate") { + igt_skip_on(!(rc6_mask & RC6_ENABLED)); + + test_rc6_forcewake(HIBERNATE); + } }