All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: "Ma, Jun" <majun@amd.com>, Alex Deucher <alexdeucher@gmail.com>,
	Ma Jun <Jun.Ma2@amd.com>
Cc: Alexander.Deucher@amd.com, Kenneth.Feng@amd.com,
	amd-gfx@lists.freedesktop.org, kevinyang.wang@amd.com,
	mario.limonciello@amd.com
Subject: Re: [PATCH] drm/amdgpu: Add a new module param to disable d3cold
Date: Thu, 30 Nov 2023 14:48:40 +0530	[thread overview]
Message-ID: <f03a4515-b73f-4e13-8eec-384443c75503@amd.com> (raw)
In-Reply-To: <42d53ace-3cfb-469a-ad10-f2a2ee8609fb@amd.com>



On 11/30/2023 11:59 AM, Ma, Jun wrote:
> Hi Alex,
> 
> On 11/30/2023 12:39 AM, Alex Deucher wrote:
>> On Wed, Nov 29, 2023 at 11:37 AM Ma Jun <Jun.Ma2@amd.com> wrote:
>>>
>>> Some platforms can't resume from d3cold state, So add a
>>> new module parameter to disable d3cold state for debugging
>>> purpose or workaround.
>>
>> Doesn't the runpm parameter already handle this?  If you set runpm=0,
>> that should disable d3cold.
>>
> runpm=0  prevents calls to driver runtime_suspend/resume functions.
> While d3cold=0 allows calls to runtime_suspend/resume functions and puts
> the device in d3hot state instead of d3cold.
> 

Why not use the sysfs node to change "d3cold_allowed" on the device's 
upstream bridge?

Thanks,
Lijo

> Regards,
> Ma Jun
> 
>> Alex
>>
>>>
>>> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 8 ++++++++
>>>   3 files changed, 16 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> index a9f54df9d33e..db9f60790267 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> @@ -166,6 +166,7 @@ extern char amdgpu_lockup_timeout[AMDGPU_MAX_TIMEOUT_PARAM_LENGTH];
>>>   extern int amdgpu_dpm;
>>>   extern int amdgpu_fw_load_type;
>>>   extern int amdgpu_aspm;
>>> +extern int amdgpu_d3cold;
>>>   extern int amdgpu_runtime_pm;
>>>   extern uint amdgpu_ip_block_mask;
>>>   extern int amdgpu_bapm;
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> index 22b6a910b7f2..90501c44e7d0 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> @@ -264,6 +264,13 @@ bool amdgpu_device_supports_px(struct drm_device *dev)
>>>   bool amdgpu_device_supports_boco(struct drm_device *dev)
>>>   {
>>>          struct amdgpu_device *adev = drm_to_adev(dev);
>>> +       struct pci_dev *parent;
>>> +
>>> +       if (!amdgpu_d3cold) {
>>> +               parent = pcie_find_root_port(adev->pdev);
>>> +               pci_d3cold_disable(parent);
>>> +               return false;
>>> +       }
>>>
>>>          if (adev->has_pr3 ||
>>>              ((adev->flags & AMD_IS_PX) && amdgpu_is_atpx_hybrid()))
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> index 5f14f04cb553..c9fbb8bd4169 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> @@ -145,6 +145,7 @@ char amdgpu_lockup_timeout[AMDGPU_MAX_TIMEOUT_PARAM_LENGTH];
>>>   int amdgpu_dpm = -1;
>>>   int amdgpu_fw_load_type = -1;
>>>   int amdgpu_aspm = -1;
>>> +int amdgpu_d3cold = -1;
>>>   int amdgpu_runtime_pm = -1;
>>>   uint amdgpu_ip_block_mask = 0xffffffff;
>>>   int amdgpu_bapm = -1;
>>> @@ -359,6 +360,13 @@ module_param_named(fw_load_type, amdgpu_fw_load_type, int, 0444);
>>>   MODULE_PARM_DESC(aspm, "ASPM support (1 = enable, 0 = disable, -1 = auto)");
>>>   module_param_named(aspm, amdgpu_aspm, int, 0444);
>>>
>>> +/**
>>> + * DOC: d3cold (int)
>>> + * To disable d3cold (1 = enable, 0 = disable). The default is -1 (auto, enabled).
>>> + */
>>> +MODULE_PARM_DESC(d3cold, "d3cold support (1 = enable, 0 = disable, -1 = auto)");
>>> +module_param_named(d3cold, amdgpu_d3cold, int, 0444);
>>> +
>>>   /**
>>>    * DOC: runpm (int)
>>>    * Override for runtime power management control for dGPUs. The amdgpu driver can dynamically power down
>>> --
>>> 2.34.1
>>>



  reply	other threads:[~2023-11-30  9:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29  8:51 [PATCH] drm/amdgpu: Add a new module param to disable d3cold Ma Jun
2023-11-29 15:35 ` Mario Limonciello
2023-11-29 18:40   ` Alex Deucher
2023-11-30  9:46   ` Ma, Jun
2023-11-29 16:39 ` Alex Deucher
2023-11-30  6:29   ` Ma, Jun
2023-11-30  9:18     ` Lazar, Lijo [this message]
2023-11-30 10:47       ` Ma, Jun
2023-11-30 10:55         ` Lazar, Lijo
2023-11-30 14:21     ` 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=f03a4515-b73f-4e13-8eec-384443c75503@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jun.Ma2@amd.com \
    --cc=Kenneth.Feng@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=kevinyang.wang@amd.com \
    --cc=majun@amd.com \
    --cc=mario.limonciello@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 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.