AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	amd-gfx@lists.freedesktop.org
Cc: Peter Kopec <pekopec@redhat.com>
Subject: Re: [PATCH v2 3/3] drm/amd: Add special handling for system s0ix state w/ dGPUs
Date: Tue, 28 Feb 2023 13:53:53 +0530	[thread overview]
Message-ID: <b0fc8660-dbc9-b424-1e4e-2cd18de8b94a@amd.com> (raw)
In-Reply-To: <20230228044304.27940-4-mario.limonciello@amd.com>



On 2/28/2023 10:13 AM, Mario Limonciello wrote:
> With dGPUs that support BACO or BOCO we want them to go into those
> states when the system goes to s2idle.  Detect that the system will
> be targeting this state and force the call into runtime suspend.
> 
> If the runtime suspend call fails for any reason, then fallback to
> standard suspend flow.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> v1->v2:
>   * New patch
>   drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c |  3 +--
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 12 +++++++++++-
>   2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 711f2a1bf525..7c3c6380135a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -1073,8 +1073,7 @@ bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
>    */
>   bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
>   {
> -	if (!(adev->flags & AMD_IS_APU) ||
> -	    (pm_suspend_target_state != PM_SUSPEND_TO_IDLE))
> +	if (pm_suspend_target_state != PM_SUSPEND_TO_IDLE)
>   		return false;
>

This will set adev->in_s0ix flag to be true for all dGPUs. There are 
many places through out suspend/resume logic where it is assumed that 
adev->in_s0ix is set only for APUs. For ex: it skips suspend of GFX 
assuming GFXOFF is a pre-condition for s0ix.

Basically this will break suspend/resume of dGPUs in s2idle if the 
device is not already suspended.

Thanks,
Lijo


>   	if (adev->asic_type < CHIP_RAVEN)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 750984517192..acc032c4c250 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2415,8 +2415,18 @@ static int amdgpu_pmops_suspend(struct device *dev)
>   	struct drm_device *drm_dev = dev_get_drvdata(dev);
>   	struct amdgpu_device *adev = drm_to_adev(drm_dev);
>   
> -	if (amdgpu_acpi_is_s0ix_active(adev))
> +	if (amdgpu_acpi_is_s0ix_active(adev)) {
> +		/* try to explicitly enter runtime suspend for s2idle on BACO/BOCO */
> +		if (dev_pm_test_driver_flags(drm_dev->dev, DPM_FLAG_SMART_SUSPEND)) {
> +			int ret;
> +
> +			ret = pm_runtime_suspend(dev);
> +			if (!ret)
> +				return 0;
> +			DRM_WARN("failed to enter runtime suspend, running system suspend: %d\n", ret);
> +		}
>   		adev->in_s0ix = true;
> +	}
>   	else if (amdgpu_acpi_is_s3_active(adev))
>   		adev->in_s3 = true;
>   	if (!adev->in_s0ix && !adev->in_s3)

  parent reply	other threads:[~2023-02-28  8:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28  4:43 [PATCH v2 0/3] Adjust dGPU handling for BACO Mario Limonciello
2023-02-28  4:43 ` [PATCH v2 1/3] drm/amd: Allow dGPUs that support BACO to use smart suspend Mario Limonciello
2023-02-28  4:43 ` [PATCH v2 2/3] drm/amd: Don't always set s3 for dGPUs in all sleep modes Mario Limonciello
2023-02-28  4:43 ` [PATCH v2 3/3] drm/amd: Add special handling for system s0ix state w/ dGPUs Mario Limonciello
2023-02-28  6:20   ` Quan, Evan
2023-02-28  8:23   ` Lazar, Lijo [this message]
2023-02-28  6:18 ` [PATCH v2 0/3] Adjust dGPU handling for BACO Quan, Evan

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=b0fc8660-dbc9-b424-1e4e-2cd18de8b94a@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=mario.limonciello@amd.com \
    --cc=pekopec@redhat.com \
    /path/to/YOUR_REPLY

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

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