summaryrefslogtreecommitdiff
path: root/tests/i915/i915_pm_rpm.c
diff options
context:
space:
mode:
authorJyoti Yadav <jyoti.r.yadav@intel.com>2019-09-19 23:00:28 +0530
committerPetri Latvala <petri.latvala@intel.com>2019-09-20 13:51:55 +0300
commitdf7814112a8b078cdc4d61f01fa15daa51f7f22d (patch)
treeaabe76105f51406bc06033be16711d2e8c0aaac3 /tests/i915/i915_pm_rpm.c
parent924e5c59dbb82938e743efd6b0812eeb5760b70d (diff)
lib/igt_pm: igt lib helper routines to support DC5/6 tests
This patch does the following changes to lib/igt_pm.c -dmc_loaded() will be used by new test i915_pm_dc.c which will validate Display C States. So moving the same to igt_pm library. -Introduced igt_disable_runtime_pm() in order to disable runtime suspend for the function which support dc9. -Changed the igt_pm_enable_sata_link_power_management() and igt_pm_restore_sata_link_power_management() in order to save and restore the sata link power policy by an exit handler. v2: Simplify the comment section. v3: Remove . from the subject line. v4: Rebased, resolve conflicts in pm_rpm.c Included patch set version change log. v5: Listing actual change in patch set changelog to make review easier. v6: igt's lib added support for disabling runtime suspend, change in commit log. rebased due to test name pm_rpm changed to i915_pm_rpm. v7: Addressed review comment by saving POWER_DIR values in igt_disable_runtime_pm(). [Imre] v8: Addressed the review comment, igt_pm_enable_sata_link_power_management function to restore the original SATA link power policy if things fail by using an exit handler. [Imre] v9: IGT failure fixture in i915_pm_backlight and i915_pm_rpm. v10:Review comment fixup in sata_link_power_management lib functions. [Imre] v11:Add igt_assert_fd(pm_status_fd) in igt_disable_runtime_pm(). [Imre & Petri] v12: Refactor igt_pm_pc8_plus_residencies_enabled() from supports_pc8_plus_residencies(). Changed igt_disable_runtime_pm() return type. [Imre] Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
Diffstat (limited to 'tests/i915/i915_pm_rpm.c')
-rw-r--r--tests/i915/i915_pm_rpm.c39
1 files changed, 4 insertions, 35 deletions
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index f6749275..a2bdabee 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -52,11 +52,6 @@
#include "igt_device.h"
#include "igt_edid.h"
-#define MSR_PKG_CST_CONFIG_CONTROL 0xE2
-/* HSW/BDW: */
-#define PKG_CST_LIMIT_MASK 0xF
-#define PKG_CST_LIMIT_C8 0x6
-
#define MSR_PC8_RES 0x630
#define MSR_PC9_RES 0x631
#define MSR_PC10_RES 0x632
@@ -123,8 +118,6 @@ struct modeset_params lpsp_mode_params;
struct modeset_params non_lpsp_mode_params;
struct modeset_params *default_mode_params;
-static int8_t *pm_data = NULL;
-
static int modprobe(const char *driver)
{
return igt_kmod_load(driver, NULL);
@@ -146,15 +139,7 @@ static bool supports_pc8_plus_residencies(void)
if (rc != sizeof(val))
return false;
- rc = pread(msr_fd, &val, sizeof(uint64_t), MSR_PKG_CST_CONFIG_CONTROL);
- if (rc != sizeof(val))
- return false;
- if ((val & PKG_CST_LIMIT_MASK) < PKG_CST_LIMIT_C8) {
- igt_info("PKG C-states limited below PC8 by the BIOS\n");
- return false;
- }
-
- return true;
+ return igt_pm_pc8_plus_residencies_enabled(msr_fd);
}
static uint64_t get_residency(uint32_t type)
@@ -755,21 +740,6 @@ static void setup_pc8(void)
has_pc8 = true;
}
-static bool dmc_loaded(void)
-{
- char buf[15];
- int len;
-
- len = igt_sysfs_read(debugfs, "i915_dmc_info", buf, sizeof(buf) - 1);
- if (len < 0)
- return true; /* no CSR support, no DMC requirement */
-
- buf[len] = '\0';
-
- igt_info("DMC: %s\n", buf);
- return strstr(buf, "fw loaded: yes");
-}
-
static void dump_file(int dir, const char *filename)
{
char *contents;
@@ -796,7 +766,7 @@ static bool setup_environment(void)
init_mode_set_data(&ms_data);
- pm_data = igt_pm_enable_sata_link_power_management();
+ igt_pm_enable_sata_link_power_management();
has_runtime_pm = igt_setup_runtime_pm();
setup_pc8();
@@ -804,7 +774,7 @@ static bool setup_environment(void)
igt_info("Runtime PM support: %d\n", has_runtime_pm);
igt_info("PC8 residency support: %d\n", has_pc8);
igt_require(has_runtime_pm);
- igt_require(dmc_loaded());
+ igt_require(igt_pm_dmc_loaded(debugfs));
out:
disable_all_screens(&ms_data);
@@ -821,8 +791,7 @@ static void teardown_environment(void)
igt_restore_runtime_pm();
- igt_pm_restore_sata_link_power_management(pm_data);
- free(pm_data);
+ igt_pm_restore_sata_link_power_management();
fini_mode_set_data(&ms_data);