mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>,
	alexander.deucher@amd.com, christian.koenig@amd.com,
	Xinhui.Pan@amd.com
Cc: "David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Bokun Zhang" <Bokun.Zhang@amd.com>,
	"Maxime Ripard" <maxime@cerno.tech>,
	"Tim Huang" <tim.huang@amd.com>,
	"Jingyu Wang" <jingyuwang_vip@163.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Hawking Zhang" <Hawking.Zhang@amd.com>,
	"Lijo Lazar" <lijo.lazar@amd.com>,
	"Andrey Grodzovsky" <andrey.grodzovsky@amd.com>,
	"YiPeng Chai" <YiPeng.Chai@amd.com>,
	"Somalapuram Amaranath" <Amaranath.Somalapuram@amd.com>,
	"Evan Quan" <evan.quan@amd.com>,
	"Guchun Chen" <guchun.chen@amd.com>,
	"Michel Dänzer" <mdaenzer@redhat.com>,
	"Kenneth Feng" <kenneth.feng@amd.com>,
	"Jiansong Chen" <Jiansong.Chen@amd.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/amdgpu: Reset GPU on S0ix when device supports BOCO
Date: Wed, 29 Mar 2023 08:23:08 -0500	[thread overview]
Message-ID: <76853776-ddfd-2fbc-a209-ca4f77faa481@amd.com> (raw)
In-Reply-To: <20230329095933.1203559-1-kai.heng.feng@canonical.com>


On 3/29/23 04:59, Kai-Heng Feng wrote:
> When the power is lost due to ACPI power resources being turned off, the
> driver should reset the GPU so it can work anew.
>
> First, _PR3 support of the hierarchy needs to be found correctly. Since
> the GPU on some discrete GFX cards is behind a PCIe switch, checking the
> _PR3 on downstream port alone is not enough, as the _PR3 can associate
> to the root port above the PCIe switch.

I think this should be split into two commits:

* One of them to look at _PR3 further up in hierarchy to fix indication
for BOCO support.

* One to adjust policy for whether to reset


> Once the _PR3 is found and BOCO support is correctly marked, use that
> information to inform the GPU should be reset. This solves an issue that
> system freeze on a Intel ADL desktop that uses S0ix for sleep and D3cold
> is supported for the GFX slot.

I'm worried this is still papering over an underlying issue with L0s
handling on ALD + Navi1x/Navi2x.

Also, what about runtime suspend?  If you unplug the monitor from this
dGPU and interact with it over SSH it should go into runtime suspend.

Is it working properly for that case now?

>
> Fixes: 0064b0ce85bb ("drm/amd/pm: enable ASPM by default")
> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1885
> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2458
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c   |  3 +++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  7 ++++++-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 12 +++++-------
>   3 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 60b1857f469e..407456ac0e84 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -987,6 +987,9 @@ bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
>   	if (amdgpu_sriov_vf(adev))
>   		return false;
>   
> +	if (amdgpu_device_supports_boco(adev_to_drm(adev)))
> +		return true;
> +
>   #if IS_ENABLED(CONFIG_SUSPEND)
>   	return pm_suspend_target_state != PM_SUSPEND_TO_IDLE;
>   #else
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index f5658359ff5c..d56b7a2bafa6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2181,7 +2181,12 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
>   
>   	if (!(adev->flags & AMD_IS_APU)) {
>   		parent = pci_upstream_bridge(adev->pdev);
> -		adev->has_pr3 = parent ? pci_pr3_present(parent) : false;
> +		do {
> +			if (pci_pr3_present(parent)) {
> +				adev->has_pr3 = true;
> +				break;
> +			}
> +		} while ((parent = pci_upstream_bridge(parent)));
>   	}
>   
>   	amdgpu_amdkfd_device_probe(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index ba5def374368..5d81fcac4b0a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2415,10 +2415,11 @@ 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))
> -		adev->in_s0ix = true;
> -	else if (amdgpu_acpi_is_s3_active(adev))
> +	if (amdgpu_acpi_is_s3_active(adev) ||
> +	    amdgpu_device_supports_boco(drm_dev))
>   		adev->in_s3 = true;
> +	else if (amdgpu_acpi_is_s0ix_active(adev))
> +		adev->in_s0ix = true;
>   	if (!adev->in_s0ix && !adev->in_s3)
>   		return 0;
>   	return amdgpu_device_suspend(drm_dev, true);
> @@ -2449,10 +2450,7 @@ static int amdgpu_pmops_resume(struct device *dev)
>   		adev->no_hw_access = true;
>   
>   	r = amdgpu_device_resume(drm_dev, true);
> -	if (amdgpu_acpi_is_s0ix_active(adev))
> -		adev->in_s0ix = false;
> -	else
> -		adev->in_s3 = false;
> +	adev->in_s0ix = adev->in_s3 = false;
>   	return r;
>   }
>   

  parent reply	other threads:[~2023-03-29 13:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29  9:59 Kai-Heng Feng
2023-03-29  9:59 ` [PATCH 2/2] drm/amdgpu: Remove ASPM workaround on VI and NV Kai-Heng Feng
2023-03-29 13:08   ` Gong, Richard
2023-03-29 13:18     ` Mario Limonciello
2023-03-29 13:21 ` [PATCH 1/2] drm/amdgpu: Reset GPU on S0ix when device supports BOCO Alex Deucher
2023-03-30  0:49   ` Kai-Heng Feng
2023-03-30  2:08     ` Alex Deucher
2023-03-29 13:23 ` Mario Limonciello [this message]
2023-03-30  3:36   ` Kai-Heng Feng
2023-03-30  4:20     ` Mario Limonciello
2023-03-30 13:22     ` Alex Deucher

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=76853776-ddfd-2fbc-a209-ca4f77faa481@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Amaranath.Somalapuram@amd.com \
    --cc=Bokun.Zhang@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Jiansong.Chen@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=YiPeng.Chai@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrey.grodzovsky@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=evan.quan@amd.com \
    --cc=guchun.chen@amd.com \
    --cc=hdegoede@redhat.com \
    --cc=jingyuwang_vip@163.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=kenneth.feng@amd.com \
    --cc=lijo.lazar@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=mdaenzer@redhat.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tim.huang@amd.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

all inboxes | Powered by JetHome®