* [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series
@ 2019-09-06 14:05 Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests Anshuman Gupta
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: Anshuman Gupta @ 2019-09-06 14:05 UTC (permalink / raw)
To: igt-dev; +Cc: jyoti.r.yadav
Sending v14 serires again after adding IGT_DESCRIPTION and
igt_describe() as suggeested by Hiler, Arkadiusz.
There is no functional change.
Anshuman Gupta (1):
tests/i915/i915_pm_dc:Skip the DC6 test if BIOS has disabled PC8+
Jyoti Yadav (5):
lib/igt_pm: igt lib helper routines to support DC5/6 tests
tests/i915/i915_pm_dc: Added new test to verify Display C States
tests/i915/i915_pm_dc: Added test for DC6 during PSR
tests/i915/i915_pm_dc: Added test for DC5 during DPMS
tests/i915/i915_pm_dc: Added test for DC6 during DPMS
lib/igt_pm.c | 215 ++++++++++++++++++-----
lib/igt_pm.h | 7 +-
tests/Makefile.sources | 3 +
tests/i915/i915_pm_backlight.c | 6 +-
tests/i915/i915_pm_dc.c | 306 +++++++++++++++++++++++++++++++++
tests/i915/i915_pm_rpm.c | 39 +----
tests/meson.build | 1 +
7 files changed, 489 insertions(+), 88 deletions(-)
create mode 100644 tests/i915/i915_pm_dc.c
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests
2019-09-06 14:05 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
@ 2019-09-06 14:05 ` Anshuman Gupta
2019-09-17 16:55 ` Imre Deak
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 3/6] tests/i915/i915_pm_dc: Added test for DC6 during PSR Anshuman Gupta
` (5 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Anshuman Gupta @ 2019-09-06 14:05 UTC (permalink / raw)
To: igt-dev; +Cc: jyoti.r.yadav
From: Jyoti Yadav <jyoti.r.yadav@intel.com>
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 is_bios_limits_pc8_plus_residencies() 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>
---
lib/igt_pm.c | 215 ++++++++++++++++++++++++++-------
lib/igt_pm.h | 7 +-
tests/i915/i915_pm_backlight.c | 6 +-
tests/i915/i915_pm_rpm.c | 39 +-----
4 files changed, 179 insertions(+), 88 deletions(-)
diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index fd22273a..540a9f92 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -38,6 +38,7 @@
#include "drmtest.h"
#include "igt_pm.h"
#include "igt_aux.h"
+#include "igt_sysfs.h"
/**
* SECTION:igt_pm
@@ -58,16 +59,30 @@ enum {
POLICY_MIN_POWER = 2
};
+#define MSR_PKG_CST_CONFIG_CONTROL 0xE2
+/*
+ * Below PKG CST limit mask and PC8 bits are meant for
+ * HSW,BDW SKL,ICL and Goldmont Microarch and future platforms.
+ * Refer IA S/W developers manual vol3c part3 chapter:35
+ */
+#define PKG_CST_LIMIT_MASK 0xF
+#define PKG_CST_LIMIT_C8 0x6
+
#define MAX_PERFORMANCE_STR "max_performance\n"
#define MEDIUM_POWER_STR "medium_power\n"
#define MIN_POWER_STR "min_power\n"
/* Remember to fix this if adding longer strings */
#define MAX_POLICY_STRLEN strlen(MAX_PERFORMANCE_STR)
+int8_t *__sata_pm_policies;
+int __scsi_host_cnt;
static char __igt_pm_audio_runtime_power_save[64];
static char * __igt_pm_audio_runtime_control_path;
static char __igt_pm_audio_runtime_control[64];
+static void __igt_pm_sata_link_pm_exit_handler(int sig);
+static void __igt_pm_restore_sata_link_power_management(void);
+
static int __igt_pm_audio_restore_runtime_pm(void)
{
int fd;
@@ -280,39 +295,26 @@ void igt_pm_enable_audio_runtime_pm(void)
igt_debug("Failed to enable audio runtime PM! (%d)\n", -err);
}
-/**
- * igt_pm_enable_sata_link_power_management:
- *
- * Enable the min_power policy for SATA link power management.
- * Without this we cannot reach deep runtime power states.
- *
- * We don't have any assertions on open since the system might not have
- * a SATA host.
- *
- * Returns:
- * An opaque pointer to the data needed to restore the default values
- * after the test has terminated, or NULL if SATA link power management
- * is not supported. This pointer should be freed when no longer used
- * (typically after having called restore_sata_link_power_management()).
- */
-int8_t *igt_pm_enable_sata_link_power_management(void)
+static void __igt_pm_enable_sata_link_power_management(void)
{
int fd, i;
ssize_t len;
char *buf;
char *file_name;
- int8_t *link_pm_policies = NULL;
+ int8_t policy;
file_name = malloc(PATH_MAX);
buf = malloc(MAX_POLICY_STRLEN + 1);
- for (i = 0; ; i++) {
- int8_t policy;
-
+ for (__scsi_host_cnt = 0; ; __scsi_host_cnt++) {
snprintf(file_name, PATH_MAX,
"/sys/class/scsi_host/host%d/link_power_management_policy",
- i);
+ __scsi_host_cnt);
+ /*
+ * We don't have any assertions on open since the system
+ * might not have a SATA host.
+ */
fd = open(file_name, O_RDWR);
if (fd < 0)
break;
@@ -332,12 +334,26 @@ int8_t *igt_pm_enable_sata_link_power_management(void)
else
policy = POLICY_UNKNOWN;
- if (!(i % 256))
- link_pm_policies = realloc(link_pm_policies,
- (i / 256 + 1) * 256 + 1);
+ if (!(__scsi_host_cnt % 256))
+ __sata_pm_policies = realloc(__sata_pm_policies,
+ (__scsi_host_cnt / 256 + 1)
+ * 256 + 1);
+
+ __sata_pm_policies[__scsi_host_cnt] = policy;
+ close(fd);
+ }
+
+ igt_install_exit_handler(__igt_pm_sata_link_pm_exit_handler);
+
+ for (i = 0; i < __scsi_host_cnt; i++) {
+ snprintf(file_name, PATH_MAX,
+ "/sys/class/scsi_host/host%d/link_power_management_policy",
+ i);
+ fd = open(file_name, O_RDWR);
+ if (fd < 0)
+ break;
- link_pm_policies[i] = policy;
- link_pm_policies[i + 1] = 0;
+ policy = __sata_pm_policies[i];
/* If the policy is something we don't know about,
* don't touch it, since we might potentially break things.
@@ -355,39 +371,25 @@ int8_t *igt_pm_enable_sata_link_power_management(void)
}
free(buf);
free(file_name);
-
- return link_pm_policies;
}
-/**
- * igt_pm_restore_sata_link_power_management:
- * @pm_data: An opaque pointer with saved link PM policies;
- * If NULL is passed we force enable the "max_performance" policy.
- *
- * Restore the link power management policies to the values
- * prior to enabling min_power.
- *
- * Caveat: If the system supports hotplugging and hotplugging takes
- * place during our testing so that the hosts change numbers
- * we might restore the settings to the wrong hosts.
- */
-void igt_pm_restore_sata_link_power_management(int8_t *pm_data)
-
+static void __igt_pm_restore_sata_link_power_management(void)
{
int fd, i;
char *file_name;
+ if (!__sata_pm_policies)
+ return;
+
/* Disk runtime PM policies. */
file_name = malloc(PATH_MAX);
- for (i = 0; ; i++) {
+ for (i = 0; i < __scsi_host_cnt; i++) {
int8_t policy;
- if (!pm_data)
- policy = POLICY_MAX_PERFORMANCE;
- else if (pm_data[i] == POLICY_UNKNOWN)
+ if (__sata_pm_policies[i] == POLICY_UNKNOWN)
continue;
else
- policy = pm_data[i];
+ policy = __sata_pm_policies[i];
snprintf(file_name, PATH_MAX,
"/sys/class/scsi_host/host%d/link_power_management_policy",
@@ -421,7 +423,48 @@ void igt_pm_restore_sata_link_power_management(int8_t *pm_data)
close(fd);
}
free(file_name);
+ free(__sata_pm_policies);
+ __sata_pm_policies = NULL;
}
+
+/**
+ * igt_pm_enable_sata_link_power_management:
+ *
+ * Enable the min_power policy for SATA link power management.
+ * Without this we cannot reach deep runtime power states.
+ */
+void igt_pm_enable_sata_link_power_management(void)
+{
+ /* Check if has been already saved. */
+ if (__sata_pm_policies)
+ return;
+
+ __igt_pm_enable_sata_link_power_management();
+}
+
+/**
+ * igt_pm_restore_sata_link_power_management:
+ *
+ * Restore the link power management policies to the values
+ * prior to enabling min_power.
+ *
+ * Caveat: If the system supports hotplugging and hotplugging takes
+ * place during our testing so that the hosts change numbers
+ * we might restore the settings to the wrong hosts.
+ */
+void igt_pm_restore_sata_link_power_management(void)
+{
+ if (!__sata_pm_policies)
+ return;
+
+ __igt_pm_restore_sata_link_power_management();
+}
+
+static void __igt_pm_sata_link_pm_exit_handler(int sig)
+{
+ __igt_pm_restore_sata_link_power_management();
+}
+
#define POWER_DIR "/sys/devices/pci0000:00/0000:00:02.0/power"
/* We just leak this on exit ... */
int pm_status_fd = -1;
@@ -585,6 +628,34 @@ bool igt_setup_runtime_pm(void)
return true;
}
+/**
+ * igt_disable_runtime_pm:
+ *
+ * Disable the runtime pm for i915 device.
+ * igt_disable_runtime_pm assumes that igt_setup_runtime_pm has already
+ * called to save runtime autosuspend and control attributes.
+ */
+void igt_disable_runtime_pm(void)
+{
+ int fd;
+ ssize_t size;
+ char buf[6];
+
+ igt_assert_fd(pm_status_fd);
+
+ /* We know we support runtime PM, let's try to disable it now. */
+ fd = open(POWER_DIR "/control", O_RDWR);
+ igt_assert_f(fd >= 0, "Can't open " POWER_DIR "/control\n");
+
+ size = write(fd, "on\n", 3);
+ igt_assert(size == 3);
+ lseek(fd, 0, SEEK_SET);
+ size = read(fd, buf, ARRAY_SIZE(buf));
+ igt_assert(size == 3);
+ igt_assert(strncmp(buf, "on\n", 3) == 0);
+ close(fd);
+}
+
/**
* igt_get_runtime_pm_status:
*
@@ -628,3 +699,53 @@ bool igt_wait_for_pm_status(enum igt_runtime_pm_status status)
{
return igt_wait(igt_get_runtime_pm_status() == status, 10000, 100);
}
+
+/**
+ * dmc_loaded:
+ * @debugfs: fd to the debugfs dir.
+
+ * Check whether DMC FW is loaded or not. DMC FW is require for few Display C
+ * states like DC5 and DC6. FW does the Context Save and Restore during Display
+ * C States entry and exit.
+ *
+ * Returns:
+ * True if DMC FW is loaded otherwise false.
+ */
+bool igt_pm_dmc_loaded(int debugfs)
+{
+ 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");
+}
+
+/**
+ * is_bios_limits_pc8_plus_residencies:
+
+ * Check whether BIOS has disabled the PC8 package deeper state.
+ *
+ * Returns:
+ * True if PC8+ package deeper state enabled on machine otherwise false.
+ */
+bool is_bios_limits_pc8_plus_residencies(int msr_fd)
+{
+ int rc;
+ uint64_t val;
+
+ 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;
+}
diff --git a/lib/igt_pm.h b/lib/igt_pm.h
index 10cc6794..f4d6c496 100644
--- a/lib/igt_pm.h
+++ b/lib/igt_pm.h
@@ -25,8 +25,8 @@
#define IGT_PM_H
void igt_pm_enable_audio_runtime_pm(void);
-int8_t *igt_pm_enable_sata_link_power_management(void);
-void igt_pm_restore_sata_link_power_management(int8_t *pm_data);
+void igt_pm_enable_sata_link_power_management(void);
+void igt_pm_restore_sata_link_power_management(void);
/**
* igt_runtime_pm_status:
@@ -47,8 +47,11 @@ enum igt_runtime_pm_status {
};
bool igt_setup_runtime_pm(void);
+void igt_disable_runtime_pm(void);
void igt_restore_runtime_pm(void);
enum igt_runtime_pm_status igt_get_runtime_pm_status(void);
bool igt_wait_for_pm_status(enum igt_runtime_pm_status status);
+bool igt_pm_dmc_loaded(int debugfs);
+bool is_bios_limits_pc8_plus_residencies(int msr_fd);
#endif /* IGT_PM_H */
diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
index 4c1bff5b..9a5f4c37 100644
--- a/tests/i915/i915_pm_backlight.c
+++ b/tests/i915/i915_pm_backlight.c
@@ -47,7 +47,6 @@ struct context {
#define FADESPEED 100 /* milliseconds between steps */
IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
-static int8_t *pm_data = NULL;
static int backlight_read(int *result, const char *fname)
{
@@ -235,7 +234,7 @@ igt_main
igt_plane_set_fb(primary, &fb);
igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
- pm_data = igt_pm_enable_sata_link_power_management();
+ igt_pm_enable_sata_link_power_management();
}
igt_subtest("basic-brightness")
@@ -255,8 +254,7 @@ igt_main
igt_display_fini(&display);
igt_remove_fb(display.drm_fd, &fb);
- igt_pm_restore_sata_link_power_management(pm_data);
- free(pm_data);
+ igt_pm_restore_sata_link_power_management();
close(display.drm_fd);
}
}
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index 2168ff72..d0a0bc90 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 is_bios_limits_pc8_plus_residencies(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);
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v14 3/6] tests/i915/i915_pm_dc: Added test for DC6 during PSR
2019-09-06 14:05 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests Anshuman Gupta
@ 2019-09-06 14:05 ` Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 4/6] tests/i915/i915_pm_dc: Added test for DC5 during DPMS Anshuman Gupta
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Anshuman Gupta @ 2019-09-06 14:05 UTC (permalink / raw)
To: igt-dev; +Cc: jyoti.r.yadav
From: Jyoti Yadav <jyoti.r.yadav@intel.com>
This patch add subtest to check DC6 entry on PSR for the supported
platforms.
v2: Rename the subtest with more meaningful name.
v3: Rebased.
v4: Rebased, to fix compilation error in psr_enable().
Addressed review comment by fixing typo in comment description
of DC6 PSR subtest.
v5: Addressed the review comment by removing redundant read_dc_counter(),
clubbed cleanup() function in test_dc_state_psr() suggested by Imre.
Listing actual change in patch set changelog to make review easier.
v6: Rebased due to test name pm_dc changed to i915_pm_dc, aligning to
other PM tests.
Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
tests/i915/i915_pm_dc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index c0e41c32..5a2c7983 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -202,6 +202,15 @@ int main(int argc, char *argv[])
test_dc_state_psr(&data, CHECK_DC5);
}
+ igt_describe("DC6 igt test with PSR Sleep state");
+ igt_subtest("dc6-psr") {
+ data.op_psr_mode = PSR_MODE_1;
+ psr_enable(data.debugfs_fd, data.op_psr_mode);
+ igt_require_f(edp_psr_sink_support(&data),
+ "Sink does not support PSR\n");
+ test_dc_state_psr(&data, CHECK_DC6);
+ }
+
igt_fixture {
close(data.debugfs_fd);
display_fini(&data);
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v14 4/6] tests/i915/i915_pm_dc: Added test for DC5 during DPMS
2019-09-06 14:05 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 3/6] tests/i915/i915_pm_dc: Added test for DC6 during PSR Anshuman Gupta
@ 2019-09-06 14:05 ` Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 5/6] tests/i915/i915_pm_dc: Added test for DC6 " Anshuman Gupta
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Anshuman Gupta @ 2019-09-06 14:05 UTC (permalink / raw)
To: igt-dev; +Cc: jyoti.r.yadav
From: Jyoti Yadav <jyoti.r.yadav@intel.com>
Added new subtest for DC5 entry during DPMS on/off cycle.
During DPMS on/off cycle DC5 counter is incremented.
v2: Rename the subtest with meaningful name.
v3: Rebased.
v4: Addressed review comments by removing leftover code
cleanup().
v5: Addressed the review comment by removing redundant
read_dc_counter() suggested by Imre.
Listing actual change in patch set changelog to make review easier.
v6: Three way patch applied, no functional change.
v7: Disabling runtime suspend for the platform which support, DC9.
rebased due to test name pm_dc changed to i915_pm_dc, aligning to
other PM tests.
v8: Introduced setup_dc_dpms() in order to disable runtime pm, restoring
POWER_DIR values to its original and enabling runtime pm for other
followed sub-tests.
v9: Check DC5 counter value after DPMS off, broke the dpms_on_off
function to dpms_on and dpms_off. [Imre]
v10:Added AT_LEAST_Gen11 condition instead of IS_ICELAKE in order to
disable runtime suspend. [Imre]
v11:Added a cleanup_dc_dpms() function. [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>
---
tests/i915/i915_pm_dc.c | 67 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index 5a2c7983..cd9768cf 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -44,6 +44,7 @@ typedef struct {
enum psr_mode op_psr_mode;
drmModeModeInfo *mode;
igt_output_t *output;
+ bool runtime_suspend_disabled;
} data_t;
static bool dc_state_wait_entry(int drm_fd, int dc_flag, int prev_dc_count);
@@ -171,6 +172,67 @@ static void test_dc_state_psr(data_t *data, int dc_flag)
cleanup_dc_psr(data);
}
+static void cleanup_dc_dpms(data_t *data)
+{
+ /*
+ * if runtime PM is disabled for i915 restore it,
+ * so any other sub-test can use runtime-PM.
+ */
+ if (data->runtime_suspend_disabled) {
+ igt_restore_runtime_pm();
+ igt_setup_runtime_pm();
+ }
+}
+
+static void setup_dc_dpms(data_t *data)
+{
+ if (IS_BROXTON(data->devid) || IS_GEMINILAKE(data->devid) ||
+ AT_LEAST_GEN(data->devid, 11)) {
+ igt_disable_runtime_pm();
+ data->runtime_suspend_disabled = true;
+ } else {
+ data->runtime_suspend_disabled = false;
+ }
+}
+
+static void dpms_off(data_t *data)
+{
+ for (int i = 0; i < data->display.n_outputs; i++) {
+ kmstest_set_connector_dpms(data->drm_fd,
+ data->display.outputs[i].config.connector,
+ DRM_MODE_DPMS_OFF);
+ }
+
+ if (!data->runtime_suspend_disabled)
+ igt_assert(igt_wait_for_pm_status
+ (IGT_RUNTIME_PM_STATUS_SUSPENDED));
+}
+
+static void dpms_on(data_t *data)
+{
+ for (int i = 0; i < data->display.n_outputs; i++) {
+ kmstest_set_connector_dpms(data->drm_fd,
+ data->display.outputs[i].config.connector,
+ DRM_MODE_DPMS_ON);
+ }
+
+ if (!data->runtime_suspend_disabled)
+ igt_assert(igt_wait_for_pm_status
+ (IGT_RUNTIME_PM_STATUS_ACTIVE));
+}
+
+static void test_dc_state_dpms(data_t *data, int dc_flag)
+{
+ uint32_t dc_counter;
+
+ setup_dc_dpms(data);
+ dc_counter = read_dc_counter(data->drm_fd, dc_flag);
+ dpms_off(data);
+ check_dc_counter(data->drm_fd, dc_flag, dc_counter);
+ dpms_on(data);
+ cleanup_dc_dpms(data);
+}
+
IGT_TEST_DESCRIPTION("Display Power DC states IGT Test");
int main(int argc, char *argv[])
{
@@ -211,6 +273,11 @@ int main(int argc, char *argv[])
test_dc_state_psr(&data, CHECK_DC6);
}
+ igt_describe("DC5 igt test with all connectors DPMS OFF/ON");
+ igt_subtest("dc5-dpms") {
+ test_dc_state_dpms(&data, CHECK_DC5);
+ }
+
igt_fixture {
close(data.debugfs_fd);
display_fini(&data);
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v14 5/6] tests/i915/i915_pm_dc: Added test for DC6 during DPMS
2019-09-06 14:05 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
` (2 preceding siblings ...)
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 4/6] tests/i915/i915_pm_dc: Added test for DC5 during DPMS Anshuman Gupta
@ 2019-09-06 14:05 ` Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 6/6] tests/i915/i915_pm_dc:Skip the DC6 test if BIOS has disabled PC8+ Anshuman Gupta
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Anshuman Gupta @ 2019-09-06 14:05 UTC (permalink / raw)
To: igt-dev; +Cc: jyoti.r.yadav
From: Jyoti Yadav <jyoti.r.yadav@intel.com>
Added new subtest for DC6 entry during DPMS on/off cycle.
During DPMS on/off cycle DC6 counter is incremented.
v2: Renamed the subtest name.
v3: Rebased.
v4: Addressed review comment by replacing igt_display_init() to
igt_display_require(), changes got done in patch set 2.
v5: Addressed the review comment by removing redundant read_dc_counter()
suggested by Imre.
Listing actual change in patch set changelog to make review easier.
v6: Rebased due to test name pm_dc changed to i915_pm_dc, aligning to
other PM tests.
v7: Introduced setup_dc_dpms() inorder to disable i915 runtime PM for
the platform supports DC9.
Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
tests/i915/i915_pm_dc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index cd9768cf..b93466a7 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -278,6 +278,11 @@ int main(int argc, char *argv[])
test_dc_state_dpms(&data, CHECK_DC5);
}
+ igt_describe("DC6 igt test with all connectors DPMS OFF/ON");
+ igt_subtest("dc6-dpms") {
+ test_dc_state_dpms(&data, CHECK_DC6);
+ }
+
igt_fixture {
close(data.debugfs_fd);
display_fini(&data);
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v14 6/6] tests/i915/i915_pm_dc:Skip the DC6 test if BIOS has disabled PC8+
2019-09-06 14:05 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
` (3 preceding siblings ...)
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 5/6] tests/i915/i915_pm_dc: Added test for DC6 " Anshuman Gupta
@ 2019-09-06 14:05 ` Anshuman Gupta
2019-09-06 14:39 ` [igt-dev] ✓ Fi.CI.BAT: success for DC states igt tests patch series (rev20) Patchwork
2019-09-06 16:53 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
6 siblings, 0 replies; 11+ messages in thread
From: Anshuman Gupta @ 2019-09-06 14:05 UTC (permalink / raw)
To: igt-dev; +Cc: jyoti.r.yadav
As DC6 requires platform to enter PC8 package C state.
It make sense to skip the DC6 igt-test, if BIOS configuration
has disabled PC8+ package C states.
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
tests/i915/i915_pm_dc.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index b93466a7..86c12adf 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -23,10 +23,12 @@
*/
#include <errno.h>
+#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "igt.h"
+#include "igt_kmod.h"
#include "igt_psr.h"
#include "igt_sysfs.h"
#include "limits.h"
@@ -37,6 +39,7 @@
typedef struct {
int drm_fd;
+ int msr_fd;
int debugfs_fd;
uint32_t devid;
igt_display_t display;
@@ -253,6 +256,12 @@ int main(int argc, char *argv[])
igt_require(has_runtime_pm);
igt_require(igt_pm_dmc_loaded(data.debugfs_fd));
igt_display_require(&data.display, data.drm_fd);
+ /* Make sure our Kernel supports MSR and the module is loaded */
+ igt_require(igt_kmod_load("msr", NULL) == 0);
+
+ data.msr_fd = open("/dev/cpu/0/msr", O_RDONLY);
+ igt_assert_f(data.msr_fd >= 0,
+ "Can't open /dev/cpu/0/msr.\n");
}
igt_describe("DC5 igt test with PSR Sleep state");
@@ -270,6 +279,8 @@ int main(int argc, char *argv[])
psr_enable(data.debugfs_fd, data.op_psr_mode);
igt_require_f(edp_psr_sink_support(&data),
"Sink does not support PSR\n");
+ igt_require_f(is_bios_limits_pc8_plus_residencies(data.msr_fd),
+ "PC8+ residencies not supported\n");
test_dc_state_psr(&data, CHECK_DC6);
}
@@ -280,11 +291,14 @@ int main(int argc, char *argv[])
igt_describe("DC6 igt test with all connectors DPMS OFF/ON");
igt_subtest("dc6-dpms") {
+ igt_require_f(is_bios_limits_pc8_plus_residencies(data.msr_fd),
+ "PC8+ residencies not supported\n");
test_dc_state_dpms(&data, CHECK_DC6);
}
igt_fixture {
close(data.debugfs_fd);
+ close(data.msr_fd);
display_fini(&data);
}
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for DC states igt tests patch series (rev20)
2019-09-06 14:05 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
` (4 preceding siblings ...)
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 6/6] tests/i915/i915_pm_dc:Skip the DC6 test if BIOS has disabled PC8+ Anshuman Gupta
@ 2019-09-06 14:39 ` Patchwork
2019-09-06 16:53 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2019-09-06 14:39 UTC (permalink / raw)
To: Anshuman Gupta; +Cc: igt-dev
== Series Details ==
Series: DC states igt tests patch series (rev20)
URL : https://patchwork.freedesktop.org/series/56713/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6842 -> IGTPW_3424
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/56713/revisions/20/mbox/
Known issues
------------
Here are the changes found in IGTPW_3424 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [PASS][1] -> [FAIL][2] ([fdo#111407])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u3: [PASS][3] -> [FAIL][4] ([fdo#103167])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/fi-icl-u3/igt@kms_frontbuffer_tracking@basic.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/fi-icl-u3/igt@kms_frontbuffer_tracking@basic.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
Participating hosts (53 -> 47)
------------------------------
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_5171 -> IGTPW_3424
CI-20190529: 20190529
CI_DRM_6842: 8e261b91905f757c19188ad1d38c9b6bfc2837d1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3424: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/
IGT_5171: 1911564805fe454919e8a5846534a0c1ef376a33 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Testlist changes ==
+igt@i915_pm_dc@dc5-dpms
+igt@i915_pm_dc@dc5-psr
+igt@i915_pm_dc@dc6-dpms
+igt@i915_pm_dc@dc6-psr
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] ✓ Fi.CI.IGT: success for DC states igt tests patch series (rev20)
2019-09-06 14:05 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
` (5 preceding siblings ...)
2019-09-06 14:39 ` [igt-dev] ✓ Fi.CI.BAT: success for DC states igt tests patch series (rev20) Patchwork
@ 2019-09-06 16:53 ` Patchwork
6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2019-09-06 16:53 UTC (permalink / raw)
To: Anshuman Gupta; +Cc: igt-dev
== Series Details ==
Series: DC states igt tests patch series (rev20)
URL : https://patchwork.freedesktop.org/series/56713/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6842_full -> IGTPW_3424_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/56713/revisions/20/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_3424_full:
### IGT changes ###
#### Possible regressions ####
* {igt@i915_pm_dc@dc6-dpms} (NEW):
- shard-kbl: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-kbl6/igt@i915_pm_dc@dc6-dpms.html
- shard-hsw: NOTRUN -> [FAIL][2]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-hsw2/igt@i915_pm_dc@dc6-dpms.html
New tests
---------
New tests have been introduced between CI_DRM_6842_full and IGTPW_3424_full:
### New IGT tests (4) ###
* igt@i915_pm_dc@dc5-dpms:
- Statuses : 4 pass(s) 2 skip(s)
- Exec time: [0.0, 2.19] s
* igt@i915_pm_dc@dc5-psr:
- Statuses : 1 pass(s) 5 skip(s)
- Exec time: [0.0, 3.30] s
* igt@i915_pm_dc@dc6-dpms:
- Statuses : 2 fail(s) 3 skip(s)
- Exec time: [0.0, 3.57] s
* igt@i915_pm_dc@dc6-psr:
- Statuses : 1 pass(s) 5 skip(s)
- Exec time: [0.0, 3.31] s
Known issues
------------
Here are the changes found in IGTPW_3424_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_eio@in-flight-suspend:
- shard-snb: [PASS][3] -> [FAIL][4] ([fdo#103375]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-snb6/igt@gem_eio@in-flight-suspend.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-snb5/igt@gem_eio@in-flight-suspend.html
* igt@gem_exec_schedule@preempt-other-bsd1:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#109276]) +15 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb4/igt@gem_exec_schedule@preempt-other-bsd1.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb7/igt@gem_exec_schedule@preempt-other-bsd1.html
* igt@gem_exec_schedule@preemptive-hang-bsd:
- shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#111325]) +7 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb5/igt@gem_exec_schedule@preemptive-hang-bsd.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb4/igt@gem_exec_schedule@preemptive-hang-bsd.html
* igt@gem_exec_suspend@basic-s3:
- shard-hsw: [PASS][9] -> [FAIL][10] ([fdo#103375]) +1 similar issue
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-hsw6/igt@gem_exec_suspend@basic-s3.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-hsw2/igt@gem_exec_suspend@basic-s3.html
* igt@i915_pm_rc6_residency@rc6-accuracy:
- shard-snb: [PASS][11] -> [SKIP][12] ([fdo#109271])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-snb7/igt@i915_pm_rc6_residency@rc6-accuracy.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-snb5/igt@i915_pm_rc6_residency@rc6-accuracy.html
* igt@i915_pm_rpm@pm-tiling:
- shard-hsw: [PASS][13] -> [FAIL][14] ([fdo#111548]) +3 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-hsw1/igt@i915_pm_rpm@pm-tiling.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-hsw2/igt@i915_pm_rpm@pm-tiling.html
* igt@i915_suspend@fence-restore-untiled:
- shard-apl: [PASS][15] -> [DMESG-WARN][16] ([fdo#108566]) +4 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl1/igt@i915_suspend@fence-restore-untiled.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl6/igt@i915_suspend@fence-restore-untiled.html
* igt@kms_flip@dpms-vs-vblank-race:
- shard-apl: [PASS][17] -> [FAIL][18] ([fdo#103060])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl2/igt@kms_flip@dpms-vs-vblank-race.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl1/igt@kms_flip@dpms-vs-vblank-race.html
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-move:
- shard-iclb: [PASS][19] -> [FAIL][20] ([fdo#103167]) +4 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb8/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-move.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb6/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-move.html
* igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: [PASS][21] -> [FAIL][22] ([fdo#103166])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb1/igt@kms_plane_lowres@pipe-a-tiling-x.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb7/igt@kms_plane_lowres@pipe-a-tiling-x.html
* igt@kms_psr@psr2_primary_mmap_gtt:
- shard-iclb: [PASS][23] -> [SKIP][24] ([fdo#109441]) +2 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb2/igt@kms_psr@psr2_primary_mmap_gtt.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb6/igt@kms_psr@psr2_primary_mmap_gtt.html
* igt@perf_pmu@init-sema-bcs0:
- shard-apl: [PASS][25] -> [FAIL][26] ([fdo#111545]) +3 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl4/igt@perf_pmu@init-sema-bcs0.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl4/igt@perf_pmu@init-sema-bcs0.html
#### Possible fixes ####
* igt@gem_ctx_shared@exec-single-timeline-bsd:
- shard-iclb: [SKIP][27] ([fdo#110841]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb2/igt@gem_ctx_shared@exec-single-timeline-bsd.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb5/igt@gem_ctx_shared@exec-single-timeline-bsd.html
* igt@gem_exec_schedule@preempt-other-chain-bsd:
- shard-iclb: [SKIP][29] ([fdo#111325]) -> [PASS][30] +4 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb1/igt@gem_exec_schedule@preempt-other-chain-bsd.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb6/igt@gem_exec_schedule@preempt-other-chain-bsd.html
* igt@gem_exec_schedule@reorder-wide-bsd1:
- shard-iclb: [SKIP][31] ([fdo#109276]) -> [PASS][32] +18 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb5/igt@gem_exec_schedule@reorder-wide-bsd1.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb1/igt@gem_exec_schedule@reorder-wide-bsd1.html
* igt@gem_exec_suspend@basic-s3:
- shard-snb: [FAIL][33] ([fdo#103375]) -> [PASS][34] +1 similar issue
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-snb1/igt@gem_exec_suspend@basic-s3.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-snb2/igt@gem_exec_suspend@basic-s3.html
* igt@gem_exec_suspend@basic-s4-devices:
- shard-snb: [FAIL][35] ([fdo#111550]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-snb1/igt@gem_exec_suspend@basic-s4-devices.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-snb1/igt@gem_exec_suspend@basic-s4-devices.html
* igt@gem_mocs_settings@mocs-rc6-blt:
- shard-apl: [SKIP][37] ([fdo#109271]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl3/igt@gem_mocs_settings@mocs-rc6-blt.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl2/igt@gem_mocs_settings@mocs-rc6-blt.html
* igt@gem_workarounds@suspend-resume-context:
- shard-kbl: [INCOMPLETE][39] ([fdo#103665]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-kbl1/igt@gem_workarounds@suspend-resume-context.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-kbl2/igt@gem_workarounds@suspend-resume-context.html
* igt@gem_workarounds@suspend-resume-fd:
- shard-apl: [DMESG-WARN][41] ([fdo#108566]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl8/igt@gem_workarounds@suspend-resume-fd.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl5/igt@gem_workarounds@suspend-resume-fd.html
* igt@i915_pm_rc6_residency@rc6-accuracy:
- shard-kbl: [SKIP][43] ([fdo#109271]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-kbl2/igt@i915_pm_rc6_residency@rc6-accuracy.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-kbl7/igt@i915_pm_rc6_residency@rc6-accuracy.html
* igt@kms_flip@dpms-vs-vblank-race-interruptible:
- shard-glk: [FAIL][45] ([fdo#103060]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-glk6/igt@kms_flip@dpms-vs-vblank-race-interruptible.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-glk1/igt@kms_flip@dpms-vs-vblank-race-interruptible.html
* igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-blt:
- shard-iclb: [FAIL][47] ([fdo#103167]) -> [PASS][48] +3 similar issues
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb2/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-blt.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb1/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-blt.html
* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
- shard-apl: [FAIL][49] ([fdo#103375]) -> [PASS][50] +1 similar issue
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl3/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl1/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes.html
* igt@kms_psr@psr2_basic:
- shard-iclb: [SKIP][51] ([fdo#109441]) -> [PASS][52] +2 similar issues
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb4/igt@kms_psr@psr2_basic.html
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb2/igt@kms_psr@psr2_basic.html
* igt@kms_setmode@basic:
- shard-apl: [FAIL][53] ([fdo#99912]) -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl1/igt@kms_setmode@basic.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl5/igt@kms_setmode@basic.html
* igt@kms_vblank@pipe-a-ts-continuation-dpms-rpm:
- shard-apl: [INCOMPLETE][55] ([fdo#103927]) -> [PASS][56] +2 similar issues
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl8/igt@kms_vblank@pipe-a-ts-continuation-dpms-rpm.html
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl1/igt@kms_vblank@pipe-a-ts-continuation-dpms-rpm.html
* igt@perf_pmu@busy-double-start-vcs0:
- shard-apl: [FAIL][57] ([fdo#111545]) -> [PASS][58] +5 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl3/igt@perf_pmu@busy-double-start-vcs0.html
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl2/igt@perf_pmu@busy-double-start-vcs0.html
* igt@tools_test@tools_test:
- shard-snb: [SKIP][59] ([fdo#109271]) -> [PASS][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-snb4/igt@tools_test@tools_test.html
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-snb7/igt@tools_test@tools_test.html
#### Warnings ####
* igt@gem_ctx_isolation@vcs1-nonpriv:
- shard-iclb: [FAIL][61] ([fdo#111329]) -> [SKIP][62] ([fdo#109276])
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb2/igt@gem_ctx_isolation@vcs1-nonpriv.html
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb7/igt@gem_ctx_isolation@vcs1-nonpriv.html
* igt@gem_mocs_settings@mocs-rc6-bsd2:
- shard-iclb: [FAIL][63] ([fdo#111330]) -> [SKIP][64] ([fdo#109276])
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-iclb4/igt@gem_mocs_settings@mocs-rc6-bsd2.html
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-iclb7/igt@gem_mocs_settings@mocs-rc6-bsd2.html
* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-apl: [FAIL][65] ([fdo#103375]) -> [DMESG-WARN][66] ([fdo#108566]) +1 similar issue
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-apl3/igt@kms_frontbuffer_tracking@fbc-suspend.html
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-apl6/igt@kms_frontbuffer_tracking@fbc-suspend.html
* igt@perf_pmu@cpu-hotplug:
- shard-hsw: [INCOMPLETE][67] ([fdo#103540]) -> [TIMEOUT][68] ([fdo#111546])
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6842/shard-hsw6/igt@perf_pmu@cpu-hotplug.html
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/shard-hsw2/igt@perf_pmu@cpu-hotplug.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#110841]: https://bugs.freedesktop.org/show_bug.cgi?id=110841
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111329]: https://bugs.freedesktop.org/show_bug.cgi?id=111329
[fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330
[fdo#111545]: https://bugs.freedesktop.org/show_bug.cgi?id=111545
[fdo#111546]: https://bugs.freedesktop.org/show_bug.cgi?id=111546
[fdo#111548]: https://bugs.freedesktop.org/show_bug.cgi?id=111548
[fdo#111550]: https://bugs.freedesktop.org/show_bug.cgi?id=111550
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
Participating hosts (10 -> 6)
------------------------------
Missing (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_5171 -> IGTPW_3424
* Piglit: piglit_4509 -> None
CI-20190529: 20190529
CI_DRM_6842: 8e261b91905f757c19188ad1d38c9b6bfc2837d1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3424: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/
IGT_5171: 1911564805fe454919e8a5846534a0c1ef376a33 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3424/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests Anshuman Gupta
@ 2019-09-17 16:55 ` Imre Deak
0 siblings, 0 replies; 11+ messages in thread
From: Imre Deak @ 2019-09-17 16:55 UTC (permalink / raw)
To: Anshuman Gupta; +Cc: igt-dev, jyoti.r.yadav
On Fri, Sep 06, 2019 at 07:35:23PM +0530, Anshuman Gupta wrote:
> From: Jyoti Yadav <jyoti.r.yadav@intel.com>
>
> 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 is_bios_limits_pc8_plus_residencies() 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>
> ---
> lib/igt_pm.c | 215 ++++++++++++++++++++++++++-------
> lib/igt_pm.h | 7 +-
> tests/i915/i915_pm_backlight.c | 6 +-
> tests/i915/i915_pm_rpm.c | 39 +-----
> 4 files changed, 179 insertions(+), 88 deletions(-)
>
> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> index fd22273a..540a9f92 100644
> --- a/lib/igt_pm.c
> +++ b/lib/igt_pm.c
> @@ -38,6 +38,7 @@
> #include "drmtest.h"
> #include "igt_pm.h"
> #include "igt_aux.h"
> +#include "igt_sysfs.h"
>
> /**
> * SECTION:igt_pm
> @@ -58,16 +59,30 @@ enum {
> POLICY_MIN_POWER = 2
> };
>
> +#define MSR_PKG_CST_CONFIG_CONTROL 0xE2
> +/*
> + * Below PKG CST limit mask and PC8 bits are meant for
> + * HSW,BDW SKL,ICL and Goldmont Microarch and future platforms.
> + * Refer IA S/W developers manual vol3c part3 chapter:35
> + */
> +#define PKG_CST_LIMIT_MASK 0xF
> +#define PKG_CST_LIMIT_C8 0x6
> +
> #define MAX_PERFORMANCE_STR "max_performance\n"
> #define MEDIUM_POWER_STR "medium_power\n"
> #define MIN_POWER_STR "min_power\n"
> /* Remember to fix this if adding longer strings */
> #define MAX_POLICY_STRLEN strlen(MAX_PERFORMANCE_STR)
> +int8_t *__sata_pm_policies;
> +int __scsi_host_cnt;
>
> static char __igt_pm_audio_runtime_power_save[64];
> static char * __igt_pm_audio_runtime_control_path;
> static char __igt_pm_audio_runtime_control[64];
>
> +static void __igt_pm_sata_link_pm_exit_handler(int sig);
> +static void __igt_pm_restore_sata_link_power_management(void);
> +
> static int __igt_pm_audio_restore_runtime_pm(void)
> {
> int fd;
> @@ -280,39 +295,26 @@ void igt_pm_enable_audio_runtime_pm(void)
> igt_debug("Failed to enable audio runtime PM! (%d)\n", -err);
> }
>
> -/**
> - * igt_pm_enable_sata_link_power_management:
> - *
> - * Enable the min_power policy for SATA link power management.
> - * Without this we cannot reach deep runtime power states.
> - *
> - * We don't have any assertions on open since the system might not have
> - * a SATA host.
> - *
> - * Returns:
> - * An opaque pointer to the data needed to restore the default values
> - * after the test has terminated, or NULL if SATA link power management
> - * is not supported. This pointer should be freed when no longer used
> - * (typically after having called restore_sata_link_power_management()).
> - */
> -int8_t *igt_pm_enable_sata_link_power_management(void)
> +static void __igt_pm_enable_sata_link_power_management(void)
> {
> int fd, i;
> ssize_t len;
> char *buf;
> char *file_name;
> - int8_t *link_pm_policies = NULL;
> + int8_t policy;
>
> file_name = malloc(PATH_MAX);
> buf = malloc(MAX_POLICY_STRLEN + 1);
>
> - for (i = 0; ; i++) {
> - int8_t policy;
> -
> + for (__scsi_host_cnt = 0; ; __scsi_host_cnt++) {
> snprintf(file_name, PATH_MAX,
> "/sys/class/scsi_host/host%d/link_power_management_policy",
> - i);
> + __scsi_host_cnt);
>
> + /*
> + * We don't have any assertions on open since the system
> + * might not have a SATA host.
> + */
> fd = open(file_name, O_RDWR);
> if (fd < 0)
> break;
> @@ -332,12 +334,26 @@ int8_t *igt_pm_enable_sata_link_power_management(void)
> else
> policy = POLICY_UNKNOWN;
>
> - if (!(i % 256))
> - link_pm_policies = realloc(link_pm_policies,
> - (i / 256 + 1) * 256 + 1);
> + if (!(__scsi_host_cnt % 256))
> + __sata_pm_policies = realloc(__sata_pm_policies,
> + (__scsi_host_cnt / 256 + 1)
> + * 256 + 1);
> +
> + __sata_pm_policies[__scsi_host_cnt] = policy;
> + close(fd);
> + }
> +
> + igt_install_exit_handler(__igt_pm_sata_link_pm_exit_handler);
> +
> + for (i = 0; i < __scsi_host_cnt; i++) {
> + snprintf(file_name, PATH_MAX,
> + "/sys/class/scsi_host/host%d/link_power_management_policy",
> + i);
> + fd = open(file_name, O_RDWR);
> + if (fd < 0)
> + break;
>
> - link_pm_policies[i] = policy;
> - link_pm_policies[i + 1] = 0;
> + policy = __sata_pm_policies[i];
>
> /* If the policy is something we don't know about,
> * don't touch it, since we might potentially break things.
> @@ -355,39 +371,25 @@ int8_t *igt_pm_enable_sata_link_power_management(void)
> }
> free(buf);
> free(file_name);
> -
> - return link_pm_policies;
> }
>
> -/**
> - * igt_pm_restore_sata_link_power_management:
> - * @pm_data: An opaque pointer with saved link PM policies;
> - * If NULL is passed we force enable the "max_performance" policy.
> - *
> - * Restore the link power management policies to the values
> - * prior to enabling min_power.
> - *
> - * Caveat: If the system supports hotplugging and hotplugging takes
> - * place during our testing so that the hosts change numbers
> - * we might restore the settings to the wrong hosts.
> - */
> -void igt_pm_restore_sata_link_power_management(int8_t *pm_data)
> -
> +static void __igt_pm_restore_sata_link_power_management(void)
> {
> int fd, i;
> char *file_name;
>
> + if (!__sata_pm_policies)
> + return;
> +
> /* Disk runtime PM policies. */
> file_name = malloc(PATH_MAX);
> - for (i = 0; ; i++) {
> + for (i = 0; i < __scsi_host_cnt; i++) {
> int8_t policy;
>
> - if (!pm_data)
> - policy = POLICY_MAX_PERFORMANCE;
> - else if (pm_data[i] == POLICY_UNKNOWN)
> + if (__sata_pm_policies[i] == POLICY_UNKNOWN)
> continue;
> else
> - policy = pm_data[i];
> + policy = __sata_pm_policies[i];
>
> snprintf(file_name, PATH_MAX,
> "/sys/class/scsi_host/host%d/link_power_management_policy",
> @@ -421,7 +423,48 @@ void igt_pm_restore_sata_link_power_management(int8_t *pm_data)
> close(fd);
> }
> free(file_name);
> + free(__sata_pm_policies);
> + __sata_pm_policies = NULL;
> }
> +
> +/**
> + * igt_pm_enable_sata_link_power_management:
> + *
> + * Enable the min_power policy for SATA link power management.
> + * Without this we cannot reach deep runtime power states.
> + */
> +void igt_pm_enable_sata_link_power_management(void)
> +{
> + /* Check if has been already saved. */
> + if (__sata_pm_policies)
> + return;
> +
> + __igt_pm_enable_sata_link_power_management();
> +}
> +
> +/**
> + * igt_pm_restore_sata_link_power_management:
> + *
> + * Restore the link power management policies to the values
> + * prior to enabling min_power.
> + *
> + * Caveat: If the system supports hotplugging and hotplugging takes
> + * place during our testing so that the hosts change numbers
> + * we might restore the settings to the wrong hosts.
> + */
> +void igt_pm_restore_sata_link_power_management(void)
> +{
> + if (!__sata_pm_policies)
> + return;
> +
> + __igt_pm_restore_sata_link_power_management();
> +}
> +
> +static void __igt_pm_sata_link_pm_exit_handler(int sig)
> +{
> + __igt_pm_restore_sata_link_power_management();
> +}
> +
> #define POWER_DIR "/sys/devices/pci0000:00/0000:00:02.0/power"
> /* We just leak this on exit ... */
> int pm_status_fd = -1;
> @@ -585,6 +628,34 @@ bool igt_setup_runtime_pm(void)
> return true;
> }
>
> +/**
> + * igt_disable_runtime_pm:
> + *
> + * Disable the runtime pm for i915 device.
> + * igt_disable_runtime_pm assumes that igt_setup_runtime_pm has already
> + * called to save runtime autosuspend and control attributes.
> + */
> +void igt_disable_runtime_pm(void)
> +{
> + int fd;
> + ssize_t size;
> + char buf[6];
> +
> + igt_assert_fd(pm_status_fd);
> +
> + /* We know we support runtime PM, let's try to disable it now. */
> + fd = open(POWER_DIR "/control", O_RDWR);
> + igt_assert_f(fd >= 0, "Can't open " POWER_DIR "/control\n");
> +
> + size = write(fd, "on\n", 3);
> + igt_assert(size == 3);
> + lseek(fd, 0, SEEK_SET);
> + size = read(fd, buf, ARRAY_SIZE(buf));
> + igt_assert(size == 3);
> + igt_assert(strncmp(buf, "on\n", 3) == 0);
> + close(fd);
> +}
> +
> /**
> * igt_get_runtime_pm_status:
> *
> @@ -628,3 +699,53 @@ bool igt_wait_for_pm_status(enum igt_runtime_pm_status status)
> {
> return igt_wait(igt_get_runtime_pm_status() == status, 10000, 100);
> }
> +
> +/**
> + * dmc_loaded:
> + * @debugfs: fd to the debugfs dir.
> +
The DocBook header is misformatted.
> + * Check whether DMC FW is loaded or not. DMC FW is require for few Display C
> + * states like DC5 and DC6. FW does the Context Save and Restore during Display
> + * C States entry and exit.
> + *
> + * Returns:
> + * True if DMC FW is loaded otherwise false.
> + */
> +bool igt_pm_dmc_loaded(int debugfs)
> +{
> + 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");
> +}
> +
> +/**
> + * is_bios_limits_pc8_plus_residencies:
For library functions we need a proper prefix and I think something like
igt_pm_pc8_plus_residencies_disabled
would be more descriptive.
> +
Misformatted DocBook header.
With the above fixed, on the whole series:
Reviewed-by: Imre Deak <imre.deak@intel.com>
Note that the new tests will fail consistenctly on a bunch of machines,
but those failures are most probably caused by another device blocking a
low-power state (and thus preventing DC6 entry/exit). Imo we should
still merge these patches since we want the coverage on machines w/o
such problematic devices and we could follow up trying to enable the low
power states for other devices too later (for instance by tweaking the
corresponding BIOS power setup settings).
> + * Check whether BIOS has disabled the PC8 package deeper state.
> + *
> + * Returns:
> + * True if PC8+ package deeper state enabled on machine otherwise false.
> + */
> +bool is_bios_limits_pc8_plus_residencies(int msr_fd)
> +{
> + int rc;
> + uint64_t val;
> +
> + 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;
> +}
> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> index 10cc6794..f4d6c496 100644
> --- a/lib/igt_pm.h
> +++ b/lib/igt_pm.h
> @@ -25,8 +25,8 @@
> #define IGT_PM_H
>
> void igt_pm_enable_audio_runtime_pm(void);
> -int8_t *igt_pm_enable_sata_link_power_management(void);
> -void igt_pm_restore_sata_link_power_management(int8_t *pm_data);
> +void igt_pm_enable_sata_link_power_management(void);
> +void igt_pm_restore_sata_link_power_management(void);
>
> /**
> * igt_runtime_pm_status:
> @@ -47,8 +47,11 @@ enum igt_runtime_pm_status {
> };
>
> bool igt_setup_runtime_pm(void);
> +void igt_disable_runtime_pm(void);
> void igt_restore_runtime_pm(void);
> enum igt_runtime_pm_status igt_get_runtime_pm_status(void);
> bool igt_wait_for_pm_status(enum igt_runtime_pm_status status);
> +bool igt_pm_dmc_loaded(int debugfs);
> +bool is_bios_limits_pc8_plus_residencies(int msr_fd);
>
> #endif /* IGT_PM_H */
> diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
> index 4c1bff5b..9a5f4c37 100644
> --- a/tests/i915/i915_pm_backlight.c
> +++ b/tests/i915/i915_pm_backlight.c
> @@ -47,7 +47,6 @@ struct context {
> #define FADESPEED 100 /* milliseconds between steps */
>
> IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
> -static int8_t *pm_data = NULL;
>
> static int backlight_read(int *result, const char *fname)
> {
> @@ -235,7 +234,7 @@ igt_main
> igt_plane_set_fb(primary, &fb);
>
> igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
> - pm_data = igt_pm_enable_sata_link_power_management();
> + igt_pm_enable_sata_link_power_management();
> }
>
> igt_subtest("basic-brightness")
> @@ -255,8 +254,7 @@ igt_main
>
> igt_display_fini(&display);
> igt_remove_fb(display.drm_fd, &fb);
> - igt_pm_restore_sata_link_power_management(pm_data);
> - free(pm_data);
> + igt_pm_restore_sata_link_power_management();
> close(display.drm_fd);
> }
> }
> diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
> index 2168ff72..d0a0bc90 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 is_bios_limits_pc8_plus_residencies(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);
>
> --
> 2.21.0
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests
2019-09-19 17:30 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
@ 2019-09-19 17:30 ` Anshuman Gupta
0 siblings, 0 replies; 11+ messages in thread
From: Anshuman Gupta @ 2019-09-19 17:30 UTC (permalink / raw)
To: igt-dev; +Cc: jyoti.r.yadav, petri.latvala
From: Jyoti Yadav <jyoti.r.yadav@intel.com>
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>
---
lib/igt_pm.c | 215 ++++++++++++++++++++++++++-------
lib/igt_pm.h | 7 +-
tests/i915/i915_pm_backlight.c | 6 +-
tests/i915/i915_pm_rpm.c | 39 +-----
4 files changed, 179 insertions(+), 88 deletions(-)
diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index fd22273a..64ce240e 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -38,6 +38,7 @@
#include "drmtest.h"
#include "igt_pm.h"
#include "igt_aux.h"
+#include "igt_sysfs.h"
/**
* SECTION:igt_pm
@@ -58,16 +59,30 @@ enum {
POLICY_MIN_POWER = 2
};
+#define MSR_PKG_CST_CONFIG_CONTROL 0xE2
+/*
+ * Below PKG CST limit mask and PC8 bits are meant for
+ * HSW,BDW SKL,ICL and Goldmont Microarch and future platforms.
+ * Refer IA S/W developers manual vol3c part3 chapter:35
+ */
+#define PKG_CST_LIMIT_MASK 0xF
+#define PKG_CST_LIMIT_C8 0x6
+
#define MAX_PERFORMANCE_STR "max_performance\n"
#define MEDIUM_POWER_STR "medium_power\n"
#define MIN_POWER_STR "min_power\n"
/* Remember to fix this if adding longer strings */
#define MAX_POLICY_STRLEN strlen(MAX_PERFORMANCE_STR)
+int8_t *__sata_pm_policies;
+int __scsi_host_cnt;
static char __igt_pm_audio_runtime_power_save[64];
static char * __igt_pm_audio_runtime_control_path;
static char __igt_pm_audio_runtime_control[64];
+static void __igt_pm_sata_link_pm_exit_handler(int sig);
+static void __igt_pm_restore_sata_link_power_management(void);
+
static int __igt_pm_audio_restore_runtime_pm(void)
{
int fd;
@@ -280,39 +295,26 @@ void igt_pm_enable_audio_runtime_pm(void)
igt_debug("Failed to enable audio runtime PM! (%d)\n", -err);
}
-/**
- * igt_pm_enable_sata_link_power_management:
- *
- * Enable the min_power policy for SATA link power management.
- * Without this we cannot reach deep runtime power states.
- *
- * We don't have any assertions on open since the system might not have
- * a SATA host.
- *
- * Returns:
- * An opaque pointer to the data needed to restore the default values
- * after the test has terminated, or NULL if SATA link power management
- * is not supported. This pointer should be freed when no longer used
- * (typically after having called restore_sata_link_power_management()).
- */
-int8_t *igt_pm_enable_sata_link_power_management(void)
+static void __igt_pm_enable_sata_link_power_management(void)
{
int fd, i;
ssize_t len;
char *buf;
char *file_name;
- int8_t *link_pm_policies = NULL;
+ int8_t policy;
file_name = malloc(PATH_MAX);
buf = malloc(MAX_POLICY_STRLEN + 1);
- for (i = 0; ; i++) {
- int8_t policy;
-
+ for (__scsi_host_cnt = 0; ; __scsi_host_cnt++) {
snprintf(file_name, PATH_MAX,
"/sys/class/scsi_host/host%d/link_power_management_policy",
- i);
+ __scsi_host_cnt);
+ /*
+ * We don't have any assertions on open since the system
+ * might not have a SATA host.
+ */
fd = open(file_name, O_RDWR);
if (fd < 0)
break;
@@ -332,12 +334,26 @@ int8_t *igt_pm_enable_sata_link_power_management(void)
else
policy = POLICY_UNKNOWN;
- if (!(i % 256))
- link_pm_policies = realloc(link_pm_policies,
- (i / 256 + 1) * 256 + 1);
+ if (!(__scsi_host_cnt % 256))
+ __sata_pm_policies = realloc(__sata_pm_policies,
+ (__scsi_host_cnt / 256 + 1)
+ * 256 + 1);
+
+ __sata_pm_policies[__scsi_host_cnt] = policy;
+ close(fd);
+ }
+
+ igt_install_exit_handler(__igt_pm_sata_link_pm_exit_handler);
+
+ for (i = 0; i < __scsi_host_cnt; i++) {
+ snprintf(file_name, PATH_MAX,
+ "/sys/class/scsi_host/host%d/link_power_management_policy",
+ i);
+ fd = open(file_name, O_RDWR);
+ if (fd < 0)
+ break;
- link_pm_policies[i] = policy;
- link_pm_policies[i + 1] = 0;
+ policy = __sata_pm_policies[i];
/* If the policy is something we don't know about,
* don't touch it, since we might potentially break things.
@@ -355,39 +371,25 @@ int8_t *igt_pm_enable_sata_link_power_management(void)
}
free(buf);
free(file_name);
-
- return link_pm_policies;
}
-/**
- * igt_pm_restore_sata_link_power_management:
- * @pm_data: An opaque pointer with saved link PM policies;
- * If NULL is passed we force enable the "max_performance" policy.
- *
- * Restore the link power management policies to the values
- * prior to enabling min_power.
- *
- * Caveat: If the system supports hotplugging and hotplugging takes
- * place during our testing so that the hosts change numbers
- * we might restore the settings to the wrong hosts.
- */
-void igt_pm_restore_sata_link_power_management(int8_t *pm_data)
-
+static void __igt_pm_restore_sata_link_power_management(void)
{
int fd, i;
char *file_name;
+ if (!__sata_pm_policies)
+ return;
+
/* Disk runtime PM policies. */
file_name = malloc(PATH_MAX);
- for (i = 0; ; i++) {
+ for (i = 0; i < __scsi_host_cnt; i++) {
int8_t policy;
- if (!pm_data)
- policy = POLICY_MAX_PERFORMANCE;
- else if (pm_data[i] == POLICY_UNKNOWN)
+ if (__sata_pm_policies[i] == POLICY_UNKNOWN)
continue;
else
- policy = pm_data[i];
+ policy = __sata_pm_policies[i];
snprintf(file_name, PATH_MAX,
"/sys/class/scsi_host/host%d/link_power_management_policy",
@@ -421,7 +423,48 @@ void igt_pm_restore_sata_link_power_management(int8_t *pm_data)
close(fd);
}
free(file_name);
+ free(__sata_pm_policies);
+ __sata_pm_policies = NULL;
+}
+
+/**
+ * igt_pm_enable_sata_link_power_management:
+ *
+ * Enable the min_power policy for SATA link power management.
+ * Without this we cannot reach deep runtime power states.
+ */
+void igt_pm_enable_sata_link_power_management(void)
+{
+ /* Check if has been already saved. */
+ if (__sata_pm_policies)
+ return;
+
+ __igt_pm_enable_sata_link_power_management();
+}
+
+/**
+ * igt_pm_restore_sata_link_power_management:
+ *
+ * Restore the link power management policies to the values
+ * prior to enabling min_power.
+ *
+ * Caveat: If the system supports hotplugging and hotplugging takes
+ * place during our testing so that the hosts change numbers
+ * we might restore the settings to the wrong hosts.
+ */
+void igt_pm_restore_sata_link_power_management(void)
+{
+ if (!__sata_pm_policies)
+ return;
+
+ __igt_pm_restore_sata_link_power_management();
+}
+
+static void __igt_pm_sata_link_pm_exit_handler(int sig)
+{
+ __igt_pm_restore_sata_link_power_management();
}
+
#define POWER_DIR "/sys/devices/pci0000:00/0000:00:02.0/power"
/* We just leak this on exit ... */
int pm_status_fd = -1;
@@ -585,6 +628,34 @@ bool igt_setup_runtime_pm(void)
return true;
}
+/**
+ * igt_disable_runtime_pm:
+ *
+ * Disable the runtime pm for i915 device.
+ * igt_disable_runtime_pm assumes that igt_setup_runtime_pm has already
+ * called to save runtime autosuspend and control attributes.
+ */
+void igt_disable_runtime_pm(void)
+{
+ int fd;
+ ssize_t size;
+ char buf[6];
+
+ igt_assert_fd(pm_status_fd);
+
+ /* We know we support runtime PM, let's try to disable it now. */
+ fd = open(POWER_DIR "/control", O_RDWR);
+ igt_assert_f(fd >= 0, "Can't open " POWER_DIR "/control\n");
+
+ size = write(fd, "on\n", 3);
+ igt_assert(size == 3);
+ lseek(fd, 0, SEEK_SET);
+ size = read(fd, buf, ARRAY_SIZE(buf));
+ igt_assert(size == 3);
+ igt_assert(strncmp(buf, "on\n", 3) == 0);
+ close(fd);
+}
+
/**
* igt_get_runtime_pm_status:
*
@@ -628,3 +699,53 @@ bool igt_wait_for_pm_status(enum igt_runtime_pm_status status)
{
return igt_wait(igt_get_runtime_pm_status() == status, 10000, 100);
}
+
+/**
+ * dmc_loaded:
+ * @debugfs: fd to the debugfs dir.
+ *
+ * Check whether DMC FW is loaded or not. DMC FW is require for few Display C
+ * states like DC5 and DC6. FW does the Context Save and Restore during Display
+ * C States entry and exit.
+ *
+ * Returns:
+ * True if DMC FW is loaded otherwise false.
+ */
+bool igt_pm_dmc_loaded(int debugfs)
+{
+ 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");
+}
+
+/**
+ * igt_pm_pc8_plus_residencies_enabled:
+ * @msr_fd: fd to /dev/cpu/0/msr
+ * Check whether BIOS has disabled the PC8 package deeper state.
+ *
+ * Returns:
+ * True if PC8+ package deeper state enabled on machine otherwise false.
+ */
+bool igt_pm_pc8_plus_residencies_enabled(int msr_fd)
+{
+ int rc;
+ uint64_t val;
+
+ 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;
+}
diff --git a/lib/igt_pm.h b/lib/igt_pm.h
index 10cc6794..7dc24174 100644
--- a/lib/igt_pm.h
+++ b/lib/igt_pm.h
@@ -25,8 +25,8 @@
#define IGT_PM_H
void igt_pm_enable_audio_runtime_pm(void);
-int8_t *igt_pm_enable_sata_link_power_management(void);
-void igt_pm_restore_sata_link_power_management(int8_t *pm_data);
+void igt_pm_enable_sata_link_power_management(void);
+void igt_pm_restore_sata_link_power_management(void);
/**
* igt_runtime_pm_status:
@@ -47,8 +47,11 @@ enum igt_runtime_pm_status {
};
bool igt_setup_runtime_pm(void);
+void igt_disable_runtime_pm(void);
void igt_restore_runtime_pm(void);
enum igt_runtime_pm_status igt_get_runtime_pm_status(void);
bool igt_wait_for_pm_status(enum igt_runtime_pm_status status);
+bool igt_pm_dmc_loaded(int debugfs);
+bool igt_pm_pc8_plus_residencies_enabled(int msr_fd);
#endif /* IGT_PM_H */
diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
index 4c1bff5b..9a5f4c37 100644
--- a/tests/i915/i915_pm_backlight.c
+++ b/tests/i915/i915_pm_backlight.c
@@ -47,7 +47,6 @@ struct context {
#define FADESPEED 100 /* milliseconds between steps */
IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
-static int8_t *pm_data = NULL;
static int backlight_read(int *result, const char *fname)
{
@@ -235,7 +234,7 @@ igt_main
igt_plane_set_fb(primary, &fb);
igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
- pm_data = igt_pm_enable_sata_link_power_management();
+ igt_pm_enable_sata_link_power_management();
}
igt_subtest("basic-brightness")
@@ -255,8 +254,7 @@ igt_main
igt_display_fini(&display);
igt_remove_fb(display.drm_fd, &fb);
- igt_pm_restore_sata_link_power_management(pm_data);
- free(pm_data);
+ igt_pm_restore_sata_link_power_management();
close(display.drm_fd);
}
}
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index 2168ff72..20c4ff90 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);
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests
2019-09-04 17:51 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
@ 2019-09-04 17:51 ` Anshuman Gupta
0 siblings, 0 replies; 11+ messages in thread
From: Anshuman Gupta @ 2019-09-04 17:51 UTC (permalink / raw)
To: igt-dev; +Cc: jyoti.r.yadav
From: Jyoti Yadav <jyoti.r.yadav@intel.com>
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 is_bios_limits_pc8_plus_residencies() 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>
---
lib/igt_pm.c | 215 ++++++++++++++++++++++++++-------
lib/igt_pm.h | 7 +-
tests/i915/i915_pm_backlight.c | 6 +-
tests/i915/i915_pm_rpm.c | 39 +-----
4 files changed, 179 insertions(+), 88 deletions(-)
diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index fd22273a..540a9f92 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -38,6 +38,7 @@
#include "drmtest.h"
#include "igt_pm.h"
#include "igt_aux.h"
+#include "igt_sysfs.h"
/**
* SECTION:igt_pm
@@ -58,16 +59,30 @@ enum {
POLICY_MIN_POWER = 2
};
+#define MSR_PKG_CST_CONFIG_CONTROL 0xE2
+/*
+ * Below PKG CST limit mask and PC8 bits are meant for
+ * HSW,BDW SKL,ICL and Goldmont Microarch and future platforms.
+ * Refer IA S/W developers manual vol3c part3 chapter:35
+ */
+#define PKG_CST_LIMIT_MASK 0xF
+#define PKG_CST_LIMIT_C8 0x6
+
#define MAX_PERFORMANCE_STR "max_performance\n"
#define MEDIUM_POWER_STR "medium_power\n"
#define MIN_POWER_STR "min_power\n"
/* Remember to fix this if adding longer strings */
#define MAX_POLICY_STRLEN strlen(MAX_PERFORMANCE_STR)
+int8_t *__sata_pm_policies;
+int __scsi_host_cnt;
static char __igt_pm_audio_runtime_power_save[64];
static char * __igt_pm_audio_runtime_control_path;
static char __igt_pm_audio_runtime_control[64];
+static void __igt_pm_sata_link_pm_exit_handler(int sig);
+static void __igt_pm_restore_sata_link_power_management(void);
+
static int __igt_pm_audio_restore_runtime_pm(void)
{
int fd;
@@ -280,39 +295,26 @@ void igt_pm_enable_audio_runtime_pm(void)
igt_debug("Failed to enable audio runtime PM! (%d)\n", -err);
}
-/**
- * igt_pm_enable_sata_link_power_management:
- *
- * Enable the min_power policy for SATA link power management.
- * Without this we cannot reach deep runtime power states.
- *
- * We don't have any assertions on open since the system might not have
- * a SATA host.
- *
- * Returns:
- * An opaque pointer to the data needed to restore the default values
- * after the test has terminated, or NULL if SATA link power management
- * is not supported. This pointer should be freed when no longer used
- * (typically after having called restore_sata_link_power_management()).
- */
-int8_t *igt_pm_enable_sata_link_power_management(void)
+static void __igt_pm_enable_sata_link_power_management(void)
{
int fd, i;
ssize_t len;
char *buf;
char *file_name;
- int8_t *link_pm_policies = NULL;
+ int8_t policy;
file_name = malloc(PATH_MAX);
buf = malloc(MAX_POLICY_STRLEN + 1);
- for (i = 0; ; i++) {
- int8_t policy;
-
+ for (__scsi_host_cnt = 0; ; __scsi_host_cnt++) {
snprintf(file_name, PATH_MAX,
"/sys/class/scsi_host/host%d/link_power_management_policy",
- i);
+ __scsi_host_cnt);
+ /*
+ * We don't have any assertions on open since the system
+ * might not have a SATA host.
+ */
fd = open(file_name, O_RDWR);
if (fd < 0)
break;
@@ -332,12 +334,26 @@ int8_t *igt_pm_enable_sata_link_power_management(void)
else
policy = POLICY_UNKNOWN;
- if (!(i % 256))
- link_pm_policies = realloc(link_pm_policies,
- (i / 256 + 1) * 256 + 1);
+ if (!(__scsi_host_cnt % 256))
+ __sata_pm_policies = realloc(__sata_pm_policies,
+ (__scsi_host_cnt / 256 + 1)
+ * 256 + 1);
+
+ __sata_pm_policies[__scsi_host_cnt] = policy;
+ close(fd);
+ }
+
+ igt_install_exit_handler(__igt_pm_sata_link_pm_exit_handler);
+
+ for (i = 0; i < __scsi_host_cnt; i++) {
+ snprintf(file_name, PATH_MAX,
+ "/sys/class/scsi_host/host%d/link_power_management_policy",
+ i);
+ fd = open(file_name, O_RDWR);
+ if (fd < 0)
+ break;
- link_pm_policies[i] = policy;
- link_pm_policies[i + 1] = 0;
+ policy = __sata_pm_policies[i];
/* If the policy is something we don't know about,
* don't touch it, since we might potentially break things.
@@ -355,39 +371,25 @@ int8_t *igt_pm_enable_sata_link_power_management(void)
}
free(buf);
free(file_name);
-
- return link_pm_policies;
}
-/**
- * igt_pm_restore_sata_link_power_management:
- * @pm_data: An opaque pointer with saved link PM policies;
- * If NULL is passed we force enable the "max_performance" policy.
- *
- * Restore the link power management policies to the values
- * prior to enabling min_power.
- *
- * Caveat: If the system supports hotplugging and hotplugging takes
- * place during our testing so that the hosts change numbers
- * we might restore the settings to the wrong hosts.
- */
-void igt_pm_restore_sata_link_power_management(int8_t *pm_data)
-
+static void __igt_pm_restore_sata_link_power_management(void)
{
int fd, i;
char *file_name;
+ if (!__sata_pm_policies)
+ return;
+
/* Disk runtime PM policies. */
file_name = malloc(PATH_MAX);
- for (i = 0; ; i++) {
+ for (i = 0; i < __scsi_host_cnt; i++) {
int8_t policy;
- if (!pm_data)
- policy = POLICY_MAX_PERFORMANCE;
- else if (pm_data[i] == POLICY_UNKNOWN)
+ if (__sata_pm_policies[i] == POLICY_UNKNOWN)
continue;
else
- policy = pm_data[i];
+ policy = __sata_pm_policies[i];
snprintf(file_name, PATH_MAX,
"/sys/class/scsi_host/host%d/link_power_management_policy",
@@ -421,7 +423,48 @@ void igt_pm_restore_sata_link_power_management(int8_t *pm_data)
close(fd);
}
free(file_name);
+ free(__sata_pm_policies);
+ __sata_pm_policies = NULL;
}
+
+/**
+ * igt_pm_enable_sata_link_power_management:
+ *
+ * Enable the min_power policy for SATA link power management.
+ * Without this we cannot reach deep runtime power states.
+ */
+void igt_pm_enable_sata_link_power_management(void)
+{
+ /* Check if has been already saved. */
+ if (__sata_pm_policies)
+ return;
+
+ __igt_pm_enable_sata_link_power_management();
+}
+
+/**
+ * igt_pm_restore_sata_link_power_management:
+ *
+ * Restore the link power management policies to the values
+ * prior to enabling min_power.
+ *
+ * Caveat: If the system supports hotplugging and hotplugging takes
+ * place during our testing so that the hosts change numbers
+ * we might restore the settings to the wrong hosts.
+ */
+void igt_pm_restore_sata_link_power_management(void)
+{
+ if (!__sata_pm_policies)
+ return;
+
+ __igt_pm_restore_sata_link_power_management();
+}
+
+static void __igt_pm_sata_link_pm_exit_handler(int sig)
+{
+ __igt_pm_restore_sata_link_power_management();
+}
+
#define POWER_DIR "/sys/devices/pci0000:00/0000:00:02.0/power"
/* We just leak this on exit ... */
int pm_status_fd = -1;
@@ -585,6 +628,34 @@ bool igt_setup_runtime_pm(void)
return true;
}
+/**
+ * igt_disable_runtime_pm:
+ *
+ * Disable the runtime pm for i915 device.
+ * igt_disable_runtime_pm assumes that igt_setup_runtime_pm has already
+ * called to save runtime autosuspend and control attributes.
+ */
+void igt_disable_runtime_pm(void)
+{
+ int fd;
+ ssize_t size;
+ char buf[6];
+
+ igt_assert_fd(pm_status_fd);
+
+ /* We know we support runtime PM, let's try to disable it now. */
+ fd = open(POWER_DIR "/control", O_RDWR);
+ igt_assert_f(fd >= 0, "Can't open " POWER_DIR "/control\n");
+
+ size = write(fd, "on\n", 3);
+ igt_assert(size == 3);
+ lseek(fd, 0, SEEK_SET);
+ size = read(fd, buf, ARRAY_SIZE(buf));
+ igt_assert(size == 3);
+ igt_assert(strncmp(buf, "on\n", 3) == 0);
+ close(fd);
+}
+
/**
* igt_get_runtime_pm_status:
*
@@ -628,3 +699,53 @@ bool igt_wait_for_pm_status(enum igt_runtime_pm_status status)
{
return igt_wait(igt_get_runtime_pm_status() == status, 10000, 100);
}
+
+/**
+ * dmc_loaded:
+ * @debugfs: fd to the debugfs dir.
+
+ * Check whether DMC FW is loaded or not. DMC FW is require for few Display C
+ * states like DC5 and DC6. FW does the Context Save and Restore during Display
+ * C States entry and exit.
+ *
+ * Returns:
+ * True if DMC FW is loaded otherwise false.
+ */
+bool igt_pm_dmc_loaded(int debugfs)
+{
+ 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");
+}
+
+/**
+ * is_bios_limits_pc8_plus_residencies:
+
+ * Check whether BIOS has disabled the PC8 package deeper state.
+ *
+ * Returns:
+ * True if PC8+ package deeper state enabled on machine otherwise false.
+ */
+bool is_bios_limits_pc8_plus_residencies(int msr_fd)
+{
+ int rc;
+ uint64_t val;
+
+ 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;
+}
diff --git a/lib/igt_pm.h b/lib/igt_pm.h
index 10cc6794..f4d6c496 100644
--- a/lib/igt_pm.h
+++ b/lib/igt_pm.h
@@ -25,8 +25,8 @@
#define IGT_PM_H
void igt_pm_enable_audio_runtime_pm(void);
-int8_t *igt_pm_enable_sata_link_power_management(void);
-void igt_pm_restore_sata_link_power_management(int8_t *pm_data);
+void igt_pm_enable_sata_link_power_management(void);
+void igt_pm_restore_sata_link_power_management(void);
/**
* igt_runtime_pm_status:
@@ -47,8 +47,11 @@ enum igt_runtime_pm_status {
};
bool igt_setup_runtime_pm(void);
+void igt_disable_runtime_pm(void);
void igt_restore_runtime_pm(void);
enum igt_runtime_pm_status igt_get_runtime_pm_status(void);
bool igt_wait_for_pm_status(enum igt_runtime_pm_status status);
+bool igt_pm_dmc_loaded(int debugfs);
+bool is_bios_limits_pc8_plus_residencies(int msr_fd);
#endif /* IGT_PM_H */
diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
index 4c1bff5b..9a5f4c37 100644
--- a/tests/i915/i915_pm_backlight.c
+++ b/tests/i915/i915_pm_backlight.c
@@ -47,7 +47,6 @@ struct context {
#define FADESPEED 100 /* milliseconds between steps */
IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
-static int8_t *pm_data = NULL;
static int backlight_read(int *result, const char *fname)
{
@@ -235,7 +234,7 @@ igt_main
igt_plane_set_fb(primary, &fb);
igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
- pm_data = igt_pm_enable_sata_link_power_management();
+ igt_pm_enable_sata_link_power_management();
}
igt_subtest("basic-brightness")
@@ -255,8 +254,7 @@ igt_main
igt_display_fini(&display);
igt_remove_fb(display.drm_fd, &fb);
- igt_pm_restore_sata_link_power_management(pm_data);
- free(pm_data);
+ igt_pm_restore_sata_link_power_management();
close(display.drm_fd);
}
}
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index 2168ff72..d0a0bc90 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 is_bios_limits_pc8_plus_residencies(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);
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-09-19 17:37 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 14:05 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests Anshuman Gupta
2019-09-17 16:55 ` Imre Deak
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 3/6] tests/i915/i915_pm_dc: Added test for DC6 during PSR Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 4/6] tests/i915/i915_pm_dc: Added test for DC5 during DPMS Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 5/6] tests/i915/i915_pm_dc: Added test for DC6 " Anshuman Gupta
2019-09-06 14:05 ` [igt-dev] [PATCH i-g-t v14 6/6] tests/i915/i915_pm_dc:Skip the DC6 test if BIOS has disabled PC8+ Anshuman Gupta
2019-09-06 14:39 ` [igt-dev] ✓ Fi.CI.BAT: success for DC states igt tests patch series (rev20) Patchwork
2019-09-06 16:53 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2019-09-19 17:30 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
2019-09-19 17:30 ` [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests Anshuman Gupta
2019-09-04 17:51 [igt-dev] [PATCH i-g-t v14 0/6] DC states igt tests patch series Anshuman Gupta
2019-09-04 17:51 ` [igt-dev] [PATCH i-g-t v14 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests Anshuman Gupta
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.