public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mohammed Thasleem <mohammed.thasleem@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH RFC i-g-t] [RFC] tests/i915/i915_pm_dc: Add DC6 test for mtl
Date: Tue, 17 Jan 2023 14:20:55 +0530	[thread overview]
Message-ID: <20230117085055.128552-1-mohammed.thasleem@intel.com> (raw)

The flow for DC6 validation has changed for MTL.
DC6 state achieved based on PKGC10 entry.
This test validates PKGC10 entry and confirm DC6 achieved.

Signed-off-by: Mohammed Thasleem <mohammed.thasleem@intel.com>
---
 tests/i915/i915_pm_dc.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index ba49d014..c30269a6 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -45,6 +45,7 @@
 #define PWR_DOMAIN_INFO "i915_power_domain_info"
 #define RPM_STATUS "i915_runtime_pm_status"
 #define KMS_HELPER "/sys/module/drm_kms_helper/parameters/"
+#define PACKAGE_STATE_PATH "/sys/kernel/debug/pmc_core/"
 #define KMS_POLL_DISABLE 0
 #define DC9_RESETS_DC_COUNTERS(devid) (!(IS_DG1(devid) || IS_DG2(devid)))
 
@@ -60,6 +61,8 @@ typedef struct {
 	int drm_fd;
 	int msr_fd;
 	int debugfs_fd;
+	int pmc_fd;
+	uint32_t ver;
 	uint32_t devid;
 	char *debugfs_dump;
 	igt_display_t display;
@@ -485,6 +488,36 @@ static void test_dc9_dpms(data_t *data)
 	setup_dc9_dpms(data, dc_target);
 }
 
+static unsigned int read_pk10_value(int pmc_fd)
+{
+	char buf[4096];
+	char *str;
+
+	igt_require((pmc_fd = open(PACKAGE_STATE_PATH, O_RDONLY)) >= 0);
+
+	igt_debugfs_simple_read(pmc_fd, "package_cstate_show",
+				buf, sizeof(buf));
+	igt_skip_on_f(!strstr(buf, "Package C10"),
+		      "PK10 will be not supported.\n");
+	str = strstr(buf, "Package C10");
+	igt_assert_f(str, "PK10 value not available\n");
+
+	return get_dc_counter(str);
+}
+
+static void test_pk10_dpms(data_t *data)
+{
+	unsigned int timeout_sec = 30;
+	unsigned int prev_value = 0, cur_value = 0;
+
+	prev_value = read_pk10_value(data->pmc_fd);
+	dpms_off(data);
+	igt_wait((cur_value = read_pk10_value(data->pmc_fd)),
+		  timeout_sec * 1000, 100);
+	igt_assert_f(cur_value > prev_value, "PK10 is not achieived.\n");
+	dpms_on(data);
+}
+
 static void kms_poll_state_restore(int sig)
 {
 	int sysfs_fd;
@@ -506,6 +539,7 @@ igt_main
 		igt_require(data.debugfs_fd != -1);
 		kmstest_set_vt_graphics_mode();
 		data.devid = intel_get_drm_devid(data.drm_fd);
+		data.ver = intel_display_ver(data.devid);
 		igt_pm_enable_sata_link_power_management();
 		igt_require(igt_setup_runtime_pm(data.drm_fd));
 		igt_require(igt_pm_dmc_loaded(data.debugfs_fd));
@@ -557,7 +591,10 @@ igt_main
 	igt_subtest("dc6-dpms") {
 		igt_require_f(igt_pm_pc8_plus_residencies_enabled(data.msr_fd),
 			      "PC8+ residencies not supported\n");
-		test_dc_state_dpms(&data, CHECK_DC6);
+		if (data.ver == 14)
+			test_pk10_dpms(&data);
+		else
+			test_dc_state_dpms(&data, CHECK_DC6);
 	}
 
 	igt_describe("This test validates display engine entry to DC9 state");
-- 
2.25.1

             reply	other threads:[~2023-01-17  8:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17  8:50 Mohammed Thasleem [this message]
2023-01-17 14:06 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/i915/i915_pm_dc: Add DC6 test for mtl Patchwork
2023-01-17 18:27 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-01-19 12:08 ` [igt-dev] [PATCH RFC i-g-t] [RFC] " Govindapillai, Vinod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230117085055.128552-1-mohammed.thasleem@intel.com \
    --to=mohammed.thasleem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox