[igt-dev] [PATCH i-g-t v2 2/2] tests/i915/i915_suspend: Disable d3cold_allowed for basic-s2idle-without-i915

Gupta, Anshuman anshuman.gupta at intel.com
Fri Sep 9 07:35:27 UTC 2022



> -----Original Message-----
> From: Tauro, Riana <riana.tauro at intel.com>
> Sent: Friday, September 9, 2022 12:58 PM
> To: igt-dev at lists.freedesktop.org
> Cc: Tauro, Riana <riana.tauro at intel.com>; Gupta, Anshuman
> <anshuman.gupta at intel.com>; Vivi, Rodrigo <rodrigo.vivi at intel.com>
> Subject: [PATCH i-g-t v2 2/2] tests/i915/i915_suspend: Disable d3cold_allowed
> for basic-s2idle-without-i915
> 
> When module is unloaded and s2idle is triggered, PCI core leaves the endpoint in
> D0 and the bridge in D3 state causing PCIE spec violation. The config space is
> read as 0xFF
> 
> Keep the bridge in D0 before module unload to prevent this issue
> 
> v2: Addressed cosmetic review comments (Anshuman)
> 
> Signed-off-by: Riana Tauro <riana.tauro at intel.com>
Reviewed-by: Anshuman Gupta <anshuman.gupta at intel.com>
> ---
>  tests/i915/i915_suspend.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c index
> 94935595..815f1c8a 100644
> --- a/tests/i915/i915_suspend.c
> +++ b/tests/i915/i915_suspend.c
> @@ -43,6 +43,7 @@
>  #include "igt.h"
>  #include "igt_kmod.h"
>  #include "igt_device.h"
> +#include "igt_device_scan.h"
> 
>  #define OBJECT_SIZE (16*1024*1024)
> 
> @@ -206,13 +207,38 @@ test_forcewake(int fd, bool hibernate)  static void
> test_suspend_without_i915(int state)  {
> +	struct igt_device_card card;
> +	char d3cold_allowed[2];
> +	int fd;
> +
> +	fd = __drm_open_driver(DRIVER_INTEL);
> +	igt_devices_scan(false);
> +
> +	/*
> +	 * When module is unloaded and s2idle is triggered, PCI core leaves the
> endpoint
> +	 * in D0 and the bridge in D3 state causing PCIE spec violation and config
> space
> +	 * is read as 0xFF. Keep the bridge in D0 before module unload to
> prevent
> +	 * this issue
> +	 */
> +	if (state == SUSPEND_STATE_FREEZE &&
> +	    igt_device_find_first_i915_discrete_card(&card)) {
> +		igt_pm_get_d3cold_allowed(&card, d3cold_allowed);
> +		igt_pm_set_d3cold_allowed(&card, "0\n");
> +	}
> +	close(fd);
> +
>  	igt_kmsg(KMSG_INFO "Unloading i915\n");
>  	igt_assert_eq(igt_i915_driver_unload(),0);
> 
>  	igt_system_suspend_autoresume(state, SUSPEND_TEST_NONE);
> 
> +	if (state == SUSPEND_STATE_FREEZE && strlen(card.card))
> +		igt_pm_set_d3cold_allowed(&card, d3cold_allowed);
> +
>  	igt_kmsg(KMSG_INFO "Re-loading i915 \n");
>  	igt_assert_eq(igt_i915_driver_load(NULL), 0);
> +
> +	igt_devices_free();
>  }
> 
>  int fd;
> --
> 2.25.1



More information about the igt-dev mailing list