From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: "Ma, Jun" <majun@amd.com>, Ma Jun <Jun.Ma2@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: Kenneth.Feng@amd.com, Alexander.Deucher@amd.com, kevinyang.wang@amd.com
Subject: Re: [PATCH] drm/amdgpu/pm: Fix the ppfeature value
Date: Wed, 13 Mar 2024 08:57:55 +0530 [thread overview]
Message-ID: <050e8df9-3de7-4e59-82b4-27632127a3e1@amd.com> (raw)
In-Reply-To: <5a0fc9c5-13d3-465b-b0c3-2431f1bd0995@amd.com>
On 3/13/2024 8:15 AM, Ma, Jun wrote:
>
>
> On 3/12/2024 8:57 PM, Lazar, Lijo wrote:
>>
>>
>> On 3/12/2024 4:29 PM, Ma Jun wrote:
>>> Sometimes user may want to enable the od feature
>>> by setting ppfeaturemask when loading amdgpu driver.
>>> However,not all Asics support this feature.
>>> So we need to restore the ppfeature value and print
>>> a warning info.
>>>
>>> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
>>> ---
>>> drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 15 ++++++++++++---
>>> drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 2 +-
>>> 2 files changed, 13 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
>>> index f84bfed50681..d777056b2f9d 100644
>>> --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
>>> +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
>>> @@ -1548,12 +1548,14 @@ int amdgpu_dpm_get_smu_prv_buf_details(struct amdgpu_device *adev,
>>> return ret;
>>> }
>>>
>>> -int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev)
>>> +bool amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev)
>>> {
>>> + bool od_support;
>>> +
>>> if (is_support_sw_smu(adev)) {
>>> struct smu_context *smu = adev->powerplay.pp_handle;
>>>
>>> - return (smu->od_enabled || smu->is_apu);
>>> + od_support = (smu->od_enabled || smu->is_apu);
>>> } else {
>>> struct pp_hwmgr *hwmgr;
>>>
>>> @@ -1566,8 +1568,15 @@ int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev)
>>>
>>> hwmgr = (struct pp_hwmgr *)adev->powerplay.pp_handle;
>>>
>>> - return hwmgr->od_enabled;
>>> + od_support = hwmgr->od_enabled;
>>> + }
>>> +
>>> + if (!od_support && (adev->pm.pp_feature & PP_OVERDRIVE_MASK)) {
>>> + adev->pm.pp_feature &= ~PP_OVERDRIVE_MASK;
>>> + DRM_WARN("overdrive feature is not supported\n");
>>> }
>>> +
>>> + return od_support;
>>
>> Instead of doing this inside DPM API, suggest to keep it outside towards
>> the end of initialization phase.
>>
>
> This function is called before the driver creates the OD related sys interface,
> which is almost the last initialization phase. I think there's probably not much
> need to break the whole logic and call this function again anywhere else.
>
amdgpu_dpm_* are meant as APIs and not meant to do internal manipulation
of pp_feature with every invocation.
This is indeed not the right way to do this. There is already another
place during driver initialization -
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/amd/pm/amdgpu_pm.c#L4277
This could be done even there.
Thanks,
Lijo
> Regards,
> Ma Jun
>
>> Thanks,
>> Lijo
>>
>>> }
>>>
>>> int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
>>> diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
>>> index 621200e0823f..0635f9d3a61a 100644
>>> --- a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
>>> +++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
>>> @@ -551,7 +551,7 @@ int amdgpu_dpm_debugfs_print_current_performance_level(struct amdgpu_device *ade
>>> int amdgpu_dpm_get_smu_prv_buf_details(struct amdgpu_device *adev,
>>> void **addr,
>>> size_t *size);
>>> -int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev);
>>> +bool amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev);
>>> int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
>>> const char *buf,
>>> size_t size);
prev parent reply other threads:[~2024-03-13 3:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 10:59 [PATCH] drm/amdgpu/pm: Fix the ppfeature value Ma Jun
2024-03-12 12:57 ` Lazar, Lijo
2024-03-13 2:45 ` Ma, Jun
2024-03-13 3:27 ` Lazar, Lijo [this message]
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=050e8df9-3de7-4e59-82b4-27632127a3e1@amd.com \
--to=lijo.lazar@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Jun.Ma2@amd.com \
--cc=Kenneth.Feng@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=kevinyang.wang@amd.com \
--cc=majun@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