DEBUG DC states igt tests patch series
Subsystems (2)
cover DEBUG DC states igt tests patch series
This is a resubmission of series https://patchwork.freedesktop.org/series/56713/
to collect DC6 igt test failure report from CI Bat test.
This series skip the DC6 test if in case PC8+ residencies limited by BIOS.
This series adds DC state IGT test to CI Fast feedback list.
Anshuman Gupta (1):
DO_NOT_MERGE: Debug patch to cover DC IGT test.
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 | 190 ++++++++++--- lib/igt_pm.h | 6 +- tests/Makefile.sources | 3 + tests/i915/i915_pm_backlight.c | 6 +- tests/i915/i915_pm_dc.c | 387 ++++++++++++++++++++++++++ tests/i915/i915_pm_rpm.c | 24 +- tests/intel-ci/fast-feedback.testlist | 4 + tests/meson.build | 1 + 8 files changed, 554 insertions(+), 67 deletions(-) create mode 100644 tests/i915/i915_pm_dc.c
Signature · 6 lines
2.21.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 1/6 lib/igt_pm: igt lib helper routines to support DC5/6 tests
From: Jyoti Yadav <[email protected]>
This patch does the following chnegs 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.
--- lib/igt_pm.c | 190 ++++++++++++++++++++++++++------- lib/igt_pm.h | 6 +- tests/i915/i915_pm_backlight.c | 6 +- tests/i915/i915_pm_rpm.c | 24 +---- 4 files changed, 159 insertions(+), 67 deletions(-)
lib/igt_pm.c +150 -40
@@ -38,6 +38,7 @@#include "drmtest.h" #include "igt_pm.h" #include "igt_aux.h" +#include "igt_sysfs.h" /** * SECTION:igt_pm
@@ -63,11 +64,15 @@ enum {#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_link_pm_policies;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,28 +285,12 @@ 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 ; file_name =malloc (PATH_MAX ); buf =malloc (MAX_POLICY_STRLEN +1 );
@@ -313,6 +302,9 @@ int8_t *igt_pm_enable_sata_link_power_management(void)"/sys/class/scsi_host/host%d/link_power_management_policy" , i); +/* 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 ;
@@ -333,11 +325,13 @@ int8_t *igt_pm_enable_sata_link_power_management(void) policy =POLICY_UNKNOWN ;if (!(i %256 )) - link_pm_policies =realloc (link_pm_policies, - (i /256 +1 ) *256 +1 ); + __sata_link_pm_policies = +realloc (__sata_link_pm_policies, + (i /256 +1 ) *256 +1 ); - link_pm_policies[i] = policy; - link_pm_policies[i +1 ] =0 ; + __sata_link_pm_policies[i] = policy; + __sata_link_pm_policies[i +1 ] =0 ; +igt_install_exit_handler (__igt_pm_sata_link_pm_exit_handler);/* If the policy is something we don't know about, * don't touch it, since we might potentially break things.
@@ -355,39 +349,27 @@ 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_link_pm_policies) +return ; +/* Disk runtime PM policies. */ file_name =malloc (PATH_MAX );for (i =0 ; ; i++) {int8_t policy; -if (!pm_data) +if (!__sata_link_pm_policies) policy =POLICY_MAX_PERFORMANCE ; -else if (pm_data[i] ==POLICY_UNKNOWN ) +else if (__sata_link_pm_policies[i] ==POLICY_UNKNOWN )continue ;else - policy = pm_data[i]; + policy = __sata_link_pm_policies[i]; snprintf(file_name, PATH_MAX, "/sys/class/scsi_host/host%d/link_power_management_policy",
@@ -421,7 +403,53 @@ void igt_pm_restore_sata_link_power_management(int8_t *pm_data)close (fd); }free (file_name); +free (__sata_link_pm_policies); + __sata_link_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. +* Returns: Void +*/ +void igt_pm_enable_sata_link_power_management (void ) +{ +int err; + +/* Check if has been already saved. */ +if (__sata_link_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 ) +{ +int err; + +if (!__sata_link_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 +613,61 @@ bool igt_setup_runtime_pm(void)return true; } +bool igt_disable_runtime_pm (void ) +{ +int fd; +ssize_t size; +char buf[6 ]; + +if (pm_status_fd <0 ) { + fd =open (POWER_DIR "/autosuspend_delay_ms" ,O_RDWR ); +if (fd <0 ) +return false; + + size =read (fd, __igt_pm_runtime_autosuspend, +sizeof (__igt_pm_runtime_autosuspend)); + +if (size <=0 ) { +close (fd); +return false; + } + +strchomp (__igt_pm_runtime_autosuspend); +igt_install_exit_handler (__igt_pm_runtime_exit_handler); +close (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" ); + +if (pm_status_fd <0 ) { +igt_assert (read (fd, __igt_pm_runtime_control, +sizeof (__igt_pm_runtime_control)) >0 ); +strchomp (__igt_pm_runtime_control); + +igt_debug ("Saved runtime power management as '%s' and '%s'\n" , + __igt_pm_runtime_autosuspend, + __igt_pm_runtime_control); + } + + 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); + +if (pm_status_fd <0 ) { + pm_status_fd =open (POWER_DIR "/runtime_status" ,O_RDONLY ); +igt_assert_f (pm_status_fd >=0 , +"Can't open " POWER_DIR "/runtime_status\n" ); + } + +return true; +} +/** * igt_get_runtime_pm_status: *
@@ -628,3 +711,30 @@ 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) +{ +igt_require (debugfs !=-1 ); +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" ); +}
lib/igt_pm.h +4 -2
@@ -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,10 @@ enum igt_runtime_pm_status { };bool igt_setup_runtime_pm (void ); +bool 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);#endif /* IGT_PM_H */
tests/i915/i915_pm_backlight.c +2 -4
@@ -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_mainigt_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_mainigt_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); } }
tests/i915/i915_pm_rpm.c +3 -21
@@ -122,8 +122,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 );
@@ -710,21 +708,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;
@@ -751,7 +734,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 ();
@@ -759,7 +742,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);
@@ -776,8 +759,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);
Signature · 6 lines
2.21.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 1/6] lib/igt_pm: igt lib helper routines to support DC5/6 tests
Quoted 107 lines · Anshuman Gupta
From: Jyoti Yadav <[email protected]>
This patch does the following chnegs to
lib/igt_pm.c(quoted diff) +0
-3-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 inpm_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 namepm_rpmchanged toi915_pm_rpm.
v7: Addressed review comment by savingPOWER_DIRvalues 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 ini915_pm_backlightandi915_pm_rpm.Signed-off-by Jyoti Yadav <[email protected]>Signed-off-by Anshuman Gupta <[email protected]>--- lib/igt_pm.c | 190 ++++++++++++++++++++++++++------- lib/igt_pm.h | 6 +- tests/i915/i915_pm_backlight.c | 6 +- tests/i915/i915_pm_rpm.c | 24 +---- 4 files changed, 159 insertions(+), 67 deletions(-)lib/igt_pm.c +9
-17@@ -38,6 +38,7 @@#include "drmtest.h" #include "igt_pm.h" #include "igt_aux.h" +#include "igt_sysfs.h" /** * SECTION:igt_pm @@ -63,11 +64,15 @@ enum {#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_link_pm_policies;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,28 +285,12 @@ 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 ; file_name =malloc (PATH_MAX ); buf =malloc (MAX_POLICY_STRLEN +1 );@@ -313,6 +302,9 @@ int8_t *igt_pm_enable_sata_link_power_management(void)"/sys/class/scsi_host/host%d/link_power_management_policy" , i); +/* 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 ;
lib/igt_pm.c int8_t *igt_pm_enable_sata_link_power_management(void) · line 330
Quoted 8 lines
lib/igt_pm.c +3
-2@@ -333,11 +325,13 @@ int8_t *igt_pm_enable_sata_link_power_management(void) policy =POLICY_UNKNOWN ;if (!(i %256 )) - link_pm_policies =realloc (link_pm_policies, - (i /256 +1 ) *256 +1 ); + __sata_link_pm_policies = +realloc (__sata_link_pm_policies, + (i /256 +1 ) *256 +1 );
Missing indentation.
lib/igt_pm.c int8_t *igt_pm_enable_sata_link_power_management(void) · line 340
Quoted 3 lines
lib/igt_pm.c +0
-2- link_pm_policies[i] = policy; - link_pm_policies[i +1 ] =0 ;
Not added by this patch, but can't see the purpose of this 0 termination.
lib/igt_pm.c int8_t *igt_pm_enable_sata_link_power_management(void) · line 334
Quoted 3 lines
lib/igt_pm.c +3
-0+ __sata_link_pm_policies[i] = policy; + __sata_link_pm_policies[i +1 ] =0 ; +igt_install_exit_handler (__igt_pm_sata_link_pm_exit_handler);
This would restore uninitialized values to subsequent SATA hosts, if some failure would happen before the loop ends. So I'd rather:
for (sata_host_count = 0; ; sata_host_count++)
save the link policiy
install exit handler
for (i = 0; i < sata_host_count; i++)
set link policy to min power
Quoted 30 lines
lib/igt_pm.c +1
-16/* If the policy is something we don't know about, * don't touch it, since we might potentially break things. @@ -355,39 +349,27 @@ 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;
lib/igt_pm.c int8_t *igt_pm_enable_sata_link_power_management(void) · line 367
Quoted 10 lines
lib/igt_pm.c +4
-1+if (!__sata_link_pm_policies) +return ; +/* Disk runtime PM policies. */ file_name =malloc (PATH_MAX );for (i =0 ; ; i++) {int8_t policy; -if (!pm_data) +if (!__sata_link_pm_policies)
This can't happen now.
Quoted 18 lines
lib/igt_pm.c +6
-2policy =POLICY_MAX_PERFORMANCE ; - else if (pm_data[i] == POLICY_UNKNOWN) + else if (__sata_link_pm_policies[i] == POLICY_UNKNOWN) continue; else - policy = pm_data[i]; + policy = __sata_link_pm_policies[i]; snprintf(file_name, PATH_MAX, "/sys/class/scsi_host/host%d/link_power_management_policy",@@ -421,7 +403,53 @@ void igt_pm_restore_sata_link_power_management(int8_t *pm_data)close (fd); }free (file_name); +free (__sata_link_pm_policies); + __sata_link_pm_policies =NULL ; +} +
lib/igt_pm.c void igt_pm_restore_sata_link_power_management(int8_t *pm_data) · line 419
Quoted 10 lines
lib/igt_pm.c +10
-0+/** +* 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. +* Returns: Void +*/ +void igt_pm_enable_sata_link_power_management (void ) +{ +int err;
Unused var.
Quoted 11 lines
lib/igt_pm.c +11
-0+ +/* Check if has been already saved. */ +if (__sata_link_pm_policies) +return ; + +__igt_pm_enable_sata_link_power_management (); +} + +/** +* igt_pm_restore_sata_link_power_management: +*
lib/igt_pm.c void igt_pm_restore_sata_link_power_management(int8_t *pm_data) · line 440
Quoted 10 lines
lib/igt_pm.c +10
-0+* 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 ) +{ +int err;
Ditto.
Quoted 86 lines
lib/igt_pm.c +71
-0+ +if (!__sata_link_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 +613,61 @@ bool igt_setup_runtime_pm(void)return true; } +bool igt_disable_runtime_pm (void ) +{ +int fd; +ssize_t size; +char buf[6 ]; + +if (pm_status_fd <0 ) { + fd =open (POWER_DIR "/autosuspend_delay_ms" ,O_RDWR ); +if (fd <0 ) +return false; + + size =read (fd, __igt_pm_runtime_autosuspend, +sizeof (__igt_pm_runtime_autosuspend)); + +if (size <=0 ) { +close (fd); +return false; + } + +strchomp (__igt_pm_runtime_autosuspend); +igt_install_exit_handler (__igt_pm_runtime_exit_handler); +close (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" ); + +if (pm_status_fd <0 ) { +igt_assert (read (fd, __igt_pm_runtime_control, +sizeof (__igt_pm_runtime_control)) >0 ); +strchomp (__igt_pm_runtime_control); + +igt_debug ("Saved runtime power management as '%s' and '%s'\n" , + __igt_pm_runtime_autosuspend, + __igt_pm_runtime_control); + } + + 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); + +if (pm_status_fd <0 ) { + pm_status_fd =open (POWER_DIR "/runtime_status" ,O_RDONLY ); +igt_assert_f (pm_status_fd >=0 , +"Can't open " POWER_DIR "/runtime_status\n" ); + } + +return true; +} +/** * igt_get_runtime_pm_status: * @@ -628,3 +711,30 @@ 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. +
lib/igt_pm.c bool igt_wait_for_pm_status(enum igt_runtime_pm_status status) · line 728
Quoted 10 lines
lib/igt_pm.c +10
-0+* 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) +{ +igt_require (debugfs !=-1 );
This is misplaced and probably not needed.
Quoted 135 lines
lib/igt_pm.c +12
-0+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" ); +}lib/igt_pm.h +4
-2@@ -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,10 @@ enum igt_runtime_pm_status { };bool igt_setup_runtime_pm (void ); +bool 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);#endif /* IGT_PM_H */ tests/i915/i915_pm_backlight.c +2
-4@@ -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_mainigt_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_mainigt_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); } }tests/i915/i915_pm_rpm.c +3
-21@@ -122,8 +122,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 );@@ -710,21 +708,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;@@ -751,7 +734,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 ();@@ -759,7 +742,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);@@ -776,8 +759,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);Signature · 1 line
2.21.0
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 2/6 tests/i915/i915_pm_dc: Added new test to verify Display C States
In reply to Anshuman GuptaFrom: Jyoti Yadav <[email protected]>
Currently this test validates DC5 upon PSR entry for supported platforms. Added new file for compilation inside Makefile and Meson.
v2: Used the debugfs entry for DC counters instead of Registers.
Used shorter names for variables.
Introduced timeout to read DC counters.
v3: one second timeout is introduced to read DC counters.
Skip the subtest if counters are not available for that platform.
v4: Rebased, to fix compilation error in psr_enable(), psr_wait_entry()
and replaced igt_display_init() by igt_display_require() in pm_rpm.c. Addressed the review comment by removing unused function display_init, removing redundant igt commit suggested by Imre.
Fixed typo in read_dc_counter().
v5: Addressed the review comment by removing redundant read_dc_counter(),
clubbed cleanup() function in test_dc_state_psr() suggested by Imre. Rearranged preprocessor directives at one place.
Fixed compilation warning by adding function prototype for dc_state_wait_entry() and check_dc_counter().
Listing actual change in patch set changelog to make review easier.
v6: Fixed "i915_edp_psr_status" string to "Sink support: yes".
v7: Rebased since test name changed from "pm_dc" to "i915_pm_dc",
this will align with other PM tests.
also changed the DC5/6 counter check timeout to 3 second.
v8: On few platform SATA i/p is blocking deeper package C states.
used igt_pm_enable_sata_link_power_management() function in order to use min_power policy.
v9: Removing redundant igt_pm_remove_sata_link_power_management()
as sata link policy vlaues will be restored by exit handler.
--- tests/Makefile.sources | 3 + tests/i915/i915_pm_dc.c | 257 ++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 261 insertions(+) create mode 100644 tests/i915/i915_pm_dc.c
tests/Makefile.sources +3 -0
@@ -489,6 +489,9 @@ i915_pm_rc6_residency_SOURCES = i915/i915_pm_rc6_residency.c TESTS_progs += i915_pm_rpm i915_pm_rpm_SOURCES = i915/i915_pm_rpm.c +TESTS_progs += i915_pm_dc +i915_pm_dc_SOURCES = i915/i915_pm_dc.c + TESTS_progs += i915_pm_rps i915_pm_rps_SOURCES = i915/i915_pm_rps.c
tests/i915/i915_pm_dc.c new file +257 -0
257 lines not on this page · raw message
tests/meson.build +1 -0
@@ -220,6 +220,7 @@ i915_progs = [ 'i915_pm_lpsp', 'i915_pm_rc6_residency', 'i915_pm_rpm', + 'i915_pm_dc', 'i915_pm_rps', 'i915_pm_sseu', 'i915_query',
Signature · 6 lines
2.21.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 3/6 tests/i915/i915_pm_dc: Added test for DC6 during PSR
In reply to Anshuman GuptaFrom: Jyoti Yadav <[email protected]>
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.
--- tests/i915/i915_pm_dc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
tests/i915/i915_pm_dc.c +10 -0
@@ -248,6 +248,16 @@ int main(int argc, char *argv[])test_dc_state_psr (&data,CHECK_DC5 ); } + 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" ); +igt_require_f (supports_pc8_plus_residencies (), +"PC8+ residencies not supported\n" ); +test_dc_state_psr (&data,CHECK_DC6 ); + } + igt_fixture {close (data.debugfs_fd);display_fini (&data);
Signature · 6 lines
2.21.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 4/6 tests/i915/i915_pm_dc: Added test for DC5 during DPMS
In reply to Anshuman GuptaFrom: Jyoti Yadav <[email protected]>
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]
--- tests/i915/i915_pm_dc.c | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
tests/i915/i915_pm_dc.c +62 -0
@@ -57,6 +57,7 @@ typedef struct {enum psr_mode op_psr_mode;drmModeModeInfo *mode;igt_output_t *output; +bool runtime_suspend_disabled; } data_t;int msr_fd;
@@ -213,6 +214,62 @@ static void test_dc_state_psr(data_t *data, int dc_flag)cleanup (data); } +static void setup_dc_dpms (data_t *data) +{ +if (IS_BROXTON (data->devid) ||IS_GEMINILAKE (data->devid) || +IS_ICELAKE (data->devid)) { + data->runtime_suspend_disabled =igt_disable_runtime_pm (); +igt_require_f (data->runtime_suspend_disabled, +"unable to disable runtime pm for i915\n" ); + }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; + + 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); + +/* 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 (); + } +} +int main (int argc,char *argv[]) {bool has_runtime_pm;
@@ -258,6 +315,11 @@ int main(int argc, char *argv[])test_dc_state_psr (&data,CHECK_DC6 ); } + igt_subtest("dc5-dpms") { +setup_dc_dpms (&data); +test_dc_state_dpms (&data,CHECK_DC5 ); + } + igt_fixture {close (data.debugfs_fd);display_fini (&data);
Signature · 6 lines
2.21.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 4/6] tests/i915/i915_pm_dc: Added test for DC5 during DPMS
Quoted 41 lines · Anshuman Gupta
From: Jyoti Yadav <[email protected]>
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 codecleanup().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 namepm_dcchanged toi915_pm_dc, aligning to other PM tests.
v8: Introducedsetup_dc_dpms()in order to disable runtime pm, restoring
POWER_DIRvalues to its original and enabling runtime pm for other followed sub-tests.
v9: Check DC5 counter value after DPMS off, broke thedpms_on_off
function todpms_onanddpms_off. [Imre]Signed-off-by Jyoti Yadav <[email protected]>Signed-off-by Anshuman Gupta <[email protected]>--- tests/i915/i915_pm_dc.c | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)tests/i915/i915_pm_dc.c +1
-0@@ -57,6 +57,7 @@ typedef struct {enum psr_mode op_psr_mode;drmModeModeInfo *mode;igt_output_t *output; +bool runtime_suspend_disabled; } data_t;int msr_fd;
tests/i915/i915_pm_dc.c static void test_dc_state_psr(data_t *data, int dc_flag) · line 220
Quoted 7 lines
tests/i915/i915_pm_dc.c +4
-0@@ -213,6 +214,62 @@ static void test_dc_state_psr(data_t *data, int dc_flag)cleanup (data); } +static void setup_dc_dpms (data_t *data) +{ +if (IS_BROXTON (data->devid) ||IS_GEMINILAKE (data->devid) || +IS_ICELAKE (data->devid)) {
IS_BXT || IS_GLK || intel_gen() >= 11, so that it works correctly on later GENs too?
Quoted 70 lines
tests/i915/i915_pm_dc.c +57
-0+ data->runtime_suspend_disabled =igt_disable_runtime_pm (); +igt_require_f (data->runtime_suspend_disabled, +"unable to disable runtime pm for i915\n" ); + }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; + + 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); + +/* 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 (); + } +} +int main (int argc,char *argv[]) {bool has_runtime_pm;@@ -258,6 +315,11 @@ int main(int argc, char *argv[])test_dc_state_psr (&data,CHECK_DC6 ); } + igt_subtest("dc5-dpms") { +setup_dc_dpms (&data); +test_dc_state_dpms (&data,CHECK_DC5 ); + } + igt_fixture {close (data.debugfs_fd);display_fini (&data);Signature · 1 line
2.21.0
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 4/6] tests/i915/i915_pm_dc: Added test for DC5 during DPMS
Hi Imre,
Thanks for review comments.
I have one comment below,
Quoted 45 lines · Imre Deak
Quoted 44 lines · Anshuman Gupta
From: Jyoti Yadav <[email protected]>
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 codecleanup().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 namepm_dcchanged toi915_pm_dc, aligning to other PM tests.
v8: Introducedsetup_dc_dpms()in order to disable runtime pm, restoring
POWER_DIRvalues to its original and enabling runtime pm for other followed sub-tests.
v9: Check DC5 counter value after DPMS off, broke thedpms_on_off
function todpms_onanddpms_off. [Imre]Signed-off-by Jyoti Yadav <[email protected]>Signed-off-by Anshuman Gupta <[email protected]>--- tests/i915/i915_pm_dc.c | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)tests/i915/i915_pm_dc.c +1
-0@@ -57,6 +57,7 @@ typedef struct {enum psr_mode op_psr_mode;drmModeModeInfo *mode;igt_output_t *output; +bool runtime_suspend_disabled; } data_t;int msr_fd;@@ -213,6 +214,62 @@ static void test_dc_state_psr(data_t *data, int dc_flag)cleanup (data); }
Quoted 7 lines
tests/i915/i915_pm_dc.c static void test_dc_state_psr(data_t *data, int dc_flag) · line 220
Quoted 4 lines
tests/i915/i915_pm_dc.c +4
-0+static void setup_dc_dpms (data_t *data) +{ +if (IS_BROXTON (data->devid) ||IS_GEMINILAKE (data->devid) || +IS_ICELAKE (data->devid)) {
IS_BXT||IS_GLK||intel_gen()>= 11, so that it works correctly on later GENs too?
TGL onward we have DMC_DEBUG registers, DMC_DEBUG1 for DC5 and DMC_DEBUG2 for DC6 BSpecs:49786, i believe they will retain there values upon DC9, I will confirm once again with DMC folks.
Thanks ,
Anshuman.
Quoted 60 lines
Quoted 60 lines
tests/i915/i915_pm_dc.c +52
-0+ data->runtime_suspend_disabled =igt_disable_runtime_pm (); +igt_require_f (data->runtime_suspend_disabled, +"unable to disable runtime pm for i915\n" ); + }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; + + 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); + +/* 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 (); + } +} +int main (int argc,char *argv[]) {bool has_runtime_pm;@@ -258,6 +315,11 @@ int main(int argc, char *argv[])test_dc_state_psr (&data,CHECK_DC6 ); }
Quoted 11 lines
Quoted 11 lines
tests/i915/i915_pm_dc.c +5
-0+ igt_subtest("dc5-dpms") { +setup_dc_dpms (&data); +test_dc_state_dpms (&data,CHECK_DC5 ); + } + igt_fixture {close (data.debugfs_fd);display_fini (&data);Signature · 1 line
2.21.0
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 4/6] tests/i915/i915_pm_dc: Added test for DC5 during DPMS
Quoted 55 lines · Anshuman
Hi Imre,
Thanks for review comments.
I have one comment below,Quoted 42 lines · Imre Deak
Quoted 41 lines · Anshuman Gupta
From: Jyoti Yadav <[email protected]>
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 codecleanup().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 namepm_dcchanged toi915_pm_dc, aligning to other PM tests.
v8: Introducedsetup_dc_dpms()in order to disable runtime pm, restoring
POWER_DIRvalues to its original and enabling runtime pm for other followed sub-tests.
v9: Check DC5 counter value after DPMS off, broke thedpms_on_off
function todpms_onanddpms_off. [Imre]Signed-off-by Jyoti Yadav <[email protected]>Signed-off-by Anshuman Gupta <[email protected]>--- tests/i915/i915_pm_dc.c | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)tests/i915/i915_pm_dc.c +1
-0@@ -57,6 +57,7 @@ typedef struct {enum psr_mode op_psr_mode;drmModeModeInfo *mode;igt_output_t *output; +bool runtime_suspend_disabled; } data_t;int msr_fd;@@ -213,6 +214,62 @@ static void test_dc_state_psr(data_t *data, int dc_flag)cleanup (data);Quoted 8 lines
tests/i915/i915_pm_dc.c static void test_dc_state_psr(data_t *data, int dc_flag) · line 220
Quoted 5 lines
tests/i915/i915_pm_dc.c +4
-0} +static void setup_dc_dpms (data_t *data) +{ +if (IS_BROXTON (data->devid) ||IS_GEMINILAKE (data->devid) || +IS_ICELAKE (data->devid)) {
IS_BXT||IS_GLK||intel_gen()>= 11, so that it works correctly on later GENs too?
Quoted 3 lines
TGL onward we have
DMC_DEBUGregisters,DMC_DEBUG1for DC5 andDMC_DEBUG2for DC6 BSpecs:49786, i believe they will retain there values upon DC9, I will confirm once again with DMC folks.
And even if the counters retain their value is it also guaranteed that there will be a ->DC6 transition before ->DC9 would happen?
If you clarify these it would be good to add a comment here too.
Quoted 65 lines
Thanks ,
Anshuman.Quoted 62 lines
Quoted 62 lines
tests/i915/i915_pm_dc.c +55
-0+ data->runtime_suspend_disabled =igt_disable_runtime_pm (); +igt_require_f (data->runtime_suspend_disabled, +"unable to disable runtime pm for i915\n" ); + }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; + + 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); + +/* 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 (); + } +} +int main (int argc,char *argv[]) {bool has_runtime_pm;@@ -258,6 +315,11 @@ int main(int argc, char *argv[])test_dc_state_psr (&data,CHECK_DC6 ); } + igt_subtest("dc5-dpms") { +setup_dc_dpms (&data); +test_dc_state_dpms (&data,CHECK_DC5 );
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
tests/i915/i915_pm_dc.c +2
-0+ } + igt_fixture {close (data.debugfs_fd);display_fini (&data);Signature · 1 line
2.21.0
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 5/6 tests/i915/i915_pm_dc: Added test for DC6 during DPMS
In reply to Anshuman GuptaFrom: Jyoti Yadav <[email protected]>
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.
--- tests/i915/i915_pm_dc.c | 7 +++++++ 1 file changed, 7 insertions(+)
tests/i915/i915_pm_dc.c +7 -0
@@ -320,6 +320,13 @@ int main(int argc, char *argv[])test_dc_state_dpms (&data,CHECK_DC5 ); } + igt_subtest("dc6-dpms") { +setup_dc_dpms (&data); +igt_require_f (supports_pc8_plus_residencies (), +"PC8+ residencies not supported\n" ); +test_dc_state_dpms (&data,CHECK_DC6 ); + } + igt_fixture {close (data.debugfs_fd);display_fini (&data);
Signature · 6 lines
2.21.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 6/6 DO_NOT_MERGE: Debug patch to cover DC IGT test.
In reply to Anshuman GuptaThis patch make sure DC state IGT patches run on CI Bat test. This patch print package c state counter also.
--- tests/i915/i915_pm_dc.c | 51 +++++++++++++++++++++++++++ tests/intel-ci/fast-feedback.testlist | 4 +++ 2 files changed, 55 insertions(+)
tests/i915/i915_pm_dc.c +51 -0
@@ -61,6 +61,8 @@ typedef struct { } data_t;int msr_fd; +int pmc_debugfs; +bool pmc_loaded;bool dc_state_wait_entry (int drm_fd,int dc_flag,int prev_dc_count);void check_dc_counter (int drm_fd,int dc_flag,uint32_t prev_dc_count);
@@ -92,6 +94,49 @@ static bool supports_pc8_plus_residencies(void)return true; } +static bool setup_pmc (void ) +{ +const char *debugfs_root; +char path[200 ]; + +/* Make sure our intel_pmc_core module is loaded. */ + pmc_loaded =igt_kmod_is_loaded ("intel_pmc_core" ); + +if (!pmc_loaded) + pmc_loaded =igt_kmod_load ("intel_pmc_core" ,NULL ) ==0 ; + +if (!pmc_loaded) { +igt_info ("intel_pmc_core module not loaded\n" ); +return ; + } + + debugfs_root =igt_debugfs_mount (); +igt_assert (debugfs_root); +snprintf (path,sizeof (path),"%s/pmc_core" , debugfs_root); + pmc_debugfs =open (path,O_RDONLY ); +igt_require (pmc_debugfs !=-1 ); +} + +static void dump_file (int dir,const char *filename) +{ +char *contents; + + contents =igt_sysfs_get (dir, filename); +if (!contents) +return ; + +igt_info ("%s:\n%s\n" , filename, contents); +free (contents); +} + +static void pmc_dump_file (int fd,const char *file) +{ +if (!pmc_loaded) +return ; + +dump_file (fd, file); +} +static void setup_output (data_t *data) {igt_display_t *display = &data->display;
@@ -295,6 +340,9 @@ int main(int argc, char *argv[]) msr_fd =open ("/dev/cpu/0/msr" ,O_RDONLY );igt_assert_f (msr_fd >=0 ,"Can't open /dev/cpu/0/msr.\n" ); +setup_pmc (); +igt_info ("Initial PC state residencies before test\n" ); +pmc_dump_file (pmc_debugfs,"package_cstate_show" ); } igt_subtest("dc5-psr") {
@@ -328,7 +376,10 @@ int main(int argc, char *argv[]) } igt_fixture { +igt_info ("PC state residencies after test\n" ); +pmc_dump_file (pmc_debugfs,"package_cstate_show" );close (data.debugfs_fd); +close (pmc_debugfs);display_fini (&data); }
tests/intel-ci/fast-feedback.testlist +4 -0
@@ -229,6 +229,10 @@ igt@kms_setmode@basic-clone-single-crtc igt@i915_pm_backlight@basic-brightness igt@i915_pm_rpm@basic-pci-d3-state igt@i915_pm_rpm@basic-rte +igt@i915_pm_dc@dc5-psr +igt@i915_pm_dc@dc6-psr +igt@i915_pm_dc@dc5-dpms +igt@i915_pm_dc@dc6-dpms igt@i915_pm_rps@basic-api igt@prime_busy@basic-after-default igt@prime_busy@basic-before-default
Signature · 6 lines
2.21.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for DEBUG DC states igt tests patch series
In reply to Anshuman Gupta== Series Details ==
== Series Details ==
Series: DEBUG DC states igt tests patch series
URL : https://patchwork.freedesktop.org/series/62332/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6297 -> IGTPW_3173
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/62332/revisions/1/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_3173:
### IGT changes ###
#### Possible regressions ####
* {igt@i915_pm_dc@dc6-dpms} (NEW):
- fi-skl-6600u: NOTRUN -> [FAIL][1] +1 similar issue
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-skl-6600u/igt@[email protected]
- fi-kbl-7567u: NOTRUN -> [FAIL][2]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-kbl-7567u/igt@[email protected]
- fi-cfl-8109u: NOTRUN -> [FAIL][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-cfl-8109u/igt@[email protected]
* {igt@i915_pm_dc@dc6-psr} (NEW):
- fi-icl-u2: NOTRUN -> [FAIL][4] +1 similar issue
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-icl-u2/igt@[email protected]
New tests
---------
New tests have been introduced between CI_DRM_6297 and IGTPW_3173:
### New IGT tests (4) ###
* igt@i915_pm_dc@dc5-dpms:
- Statuses : 13 pass(s) 23 skip(s)
- Exec time: [0.0, 5.26] s
* igt@i915_pm_dc@dc5-psr:
- Statuses : 3 pass(s) 33 skip(s)
- Exec time: [0.0, 3.36] s
* igt@i915_pm_dc@dc6-dpms:
- Statuses : 4 fail(s) 2 pass(s) 30 skip(s)
- Exec time: [0.0, 7.47] s
* igt@i915_pm_dc@dc6-psr:
- Statuses : 2 fail(s) 1 pass(s) 33 skip(s)
- Exec time: [0.0, 3.72] s
Known issues
------------
Here are the changes found in IGTPW_3173 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm: [PASS][5] -> [DMESG-FAIL][6] ([fdo#110235])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6297/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html
* igt@kms_busy@basic-flip-a:
- fi-icl-dsi: [PASS][7] -> [DMESG-WARN][8] ([fdo#106107]) +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6297/fi-icl-dsi/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-icl-dsi/igt@[email protected]
* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u3: [PASS][9] -> [FAIL][10] ([fdo#103167])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6297/fi-icl-u3/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-icl-u3/igt@[email protected]
#### Possible fixes ####
* igt@debugfs_test@read_all_entries:
- fi-icl-u3: [DMESG-WARN][11] ([fdo#107724]) -> [PASS][12] +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6297/fi-icl-u3/igt@debugfs_test@read_all_entries.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-icl-u3/igt@debugfs_test@read_all_entries.html
* igt@gem_ctx_switch@basic-default:
- fi-icl-guc: [INCOMPLETE][13] ([fdo#107713] / [fdo#108569]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6297/fi-icl-guc/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-icl-guc/igt@[email protected]
* igt@gem_sync@basic-store-each:
- fi-bdw-5557u: [FAIL][15] -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6297/fi-bdw-5557u/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-bdw-5557u/igt@[email protected]
* igt@i915_selftest@live_hangcheck:
- fi-icl-dsi: [INCOMPLETE][17] ([fdo#107713] / [fdo#108569]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6297/fi-icl-dsi/igt@i915_selftest@live_hangcheck.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-icl-dsi/igt@i915_selftest@live_hangcheck.html
* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u2: [FAIL][19] ([fdo#103167]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6297/fi-icl-u2/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/fi-icl-u2/igt@[email protected]
{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#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#110235]: https://bugs.freedesktop.org/show_bug.cgi?id=110235
Participating hosts (44 -> 37)
------------------------------
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus
Build changes
-------------
* IGT: IGT_5059 -> IGTPW_3173
CI_DRM_6297: 8ebd162995143d1cc5c3ec699891e7fe059cea4c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3173: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3173/
IGT_5059: 1f67ee0d09d6513f487f2be74aae9700e755258a @ 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_3173/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev