AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Khatri, Sunil" <sunil.khatri@amd.com>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	"Alex Deucher" <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 15/15] drm/amdgpu: validate get_clockgating_state before use
Date: Thu, 17 Oct 2024 15:15:34 +0200	[thread overview]
Message-ID: <29963d81-41d4-4b80-804c-8792a286e892@amd.com> (raw)
In-Reply-To: <58fef7b7-79cc-48ae-c632-199c44ed1f0e@amd.com>

[-- Attachment #1: Type: text/plain, Size: 4121 bytes --]

Am 17.10.24 um 14:55 schrieb Khatri, Sunil:
>
> On 10/17/2024 5:50 PM, Christian König wrote:
>
>> Am 17.10.24 um 12:06 schrieb Sunil Khatri:
>>> Validate the function pointer for get_clockgating_state
>>> before making a function call.
>>
>> Oh, I'm not sure if that is necessary or not. The NBIO, HDP and SMUIO 
>> functions are not IP specific.
>>
> For many socs this check is added and only missing in the 
> files/functions mentioned below. SOC where these functions are called 
> are nv_common, soc15_common, soc21_common, soc24_common
> eg: SOC15 already have these changes and its safe to add for other 
> socs that i mentioned above.

You mean that the checks are in almost all places, but here they are 
missing? Mhm, that's strange.

Let me investigate that further,
Christian.

> soc15_common_get_clockgating_state Regards Sunil
>> Christian.
>>
>>>
>>> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/nv.c    | 9 ++++++---
>>>   drivers/gpu/drm/amd/amdgpu/soc21.c | 6 ++++--
>>>   drivers/gpu/drm/amd/amdgpu/soc24.c | 6 ++++--
>>>   3 files changed, 14 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c 
>>> b/drivers/gpu/drm/amd/amdgpu/nv.c
>>> index 6b72169be8f8..40c720b32c59 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/nv.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/nv.c
>>> @@ -1084,11 +1084,14 @@ static void 
>>> nv_common_get_clockgating_state(void *handle, u64 *flags)
>>>       if (amdgpu_sriov_vf(adev))
>>>           *flags = 0;
>>>   -    adev->nbio.funcs->get_clockgating_state(adev, flags);
>>> +    if (adev->nbio.funcs && adev->nbio.funcs->get_clockgating_state)
>>> +        adev->nbio.funcs->get_clockgating_state(adev, flags);
>>>   -    adev->hdp.funcs->get_clock_gating_state(adev, flags);
>>> +    if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state)
>>> +        adev->hdp.funcs->get_clock_gating_state(adev, flags);
>>>   -    adev->smuio.funcs->get_clock_gating_state(adev, flags);
>>> +    if (adev->smuio.funcs && 
>>> adev->smuio.funcs->get_clock_gating_state)
>>> +        adev->smuio.funcs->get_clock_gating_state(adev, flags);
>>>   }
>>>     static const struct amd_ip_funcs nv_common_ip_funcs = {
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c 
>>> b/drivers/gpu/drm/amd/amdgpu/soc21.c
>>> index 1c07ebdc0d1f..196286be35b4 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/soc21.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/soc21.c
>>> @@ -975,9 +975,11 @@ static void 
>>> soc21_common_get_clockgating_state(void *handle, u64 *flags)
>>>   {
>>>       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>>>   -    adev->nbio.funcs->get_clockgating_state(adev, flags);
>>> +    if (adev->nbio.funcs && adev->nbio.funcs->get_clockgating_state)
>>> +        adev->nbio.funcs->get_clockgating_state(adev, flags);
>>>   -    adev->hdp.funcs->get_clock_gating_state(adev, flags);
>>> +    if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state)
>>> +        adev->hdp.funcs->get_clock_gating_state(adev, flags);
>>>   }
>>>     static const struct amd_ip_funcs soc21_common_ip_funcs = {
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/soc24.c 
>>> b/drivers/gpu/drm/amd/amdgpu/soc24.c
>>> index 3af10ef4b793..f4278a0fa8f7 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/soc24.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/soc24.c
>>> @@ -564,9 +564,11 @@ static void 
>>> soc24_common_get_clockgating_state(void *handle, u64 *flags)
>>>   {
>>>       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>>>   -    adev->nbio.funcs->get_clockgating_state(adev, flags);
>>> +    if (adev->nbio.funcs && adev->nbio.funcs->get_clockgating_state)
>>> +        adev->nbio.funcs->get_clockgating_state(adev, flags);
>>>   -    adev->hdp.funcs->get_clock_gating_state(adev, flags);
>>> +    if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state)
>>> +        adev->hdp.funcs->get_clock_gating_state(adev, flags);
>>>         return;
>>>   }
>>

[-- Attachment #2: Type: text/html, Size: 6985 bytes --]

  reply	other threads:[~2024-10-17 13:15 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 10:06 [PATCH v4 00/15] validate/clean the functions of ip funcs Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 01/15] drm/amdgpu: validate sw_init before function call Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 02/15] drm/amdgpu: clean the dummy sw_init functions Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 03/15] drm/amdgpu: validate sw_fini before function call Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 04/15] drm/amdgpu: clean the dummy sw_fini functions Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 05/15] drm/amdgpu: validate hw_fini before function call Sunil Khatri
2024-10-17 11:52   ` Christian König
2024-10-17 12:44     ` Khatri, Sunil
2024-10-17 10:06 ` [PATCH v4 06/15] drm/amdgpu: validate suspend " Sunil Khatri
2024-10-17 11:54   ` Christian König
2024-10-17 12:45     ` Khatri, Sunil
2024-10-17 10:06 ` [PATCH v4 07/15] drm/amdgpu: validate resume " Sunil Khatri
2024-10-17 11:55   ` Christian König
2024-10-17 12:46     ` Khatri, Sunil
2024-10-17 10:06 ` [PATCH v4 08/15] drm/amdgpu: validate wait_for_idle " Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 09/15] drm/amdgpu: clean the dummy resume functions Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 10/15] drm/amdgpu: clean the dummy suspend functions Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 11/15] drm/amdgpu: clean the dummy hw_fini functions Sunil Khatri
2024-10-17 11:58   ` Christian König
2024-10-17 12:47     ` Khatri, Sunil
2024-10-17 10:06 ` [PATCH v4 12/15] drm/amdgpu: clean the dummy wait_for_idle functions Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 13/15] drm/amdgpu: clean the dummy soft_reset functions Sunil Khatri
2024-10-17 10:06 ` [PATCH v4 14/15] drm/amdgpu: clean unused functions of amd_ip_funcs Sunil Khatri
2024-10-17 12:18   ` Christian König
2024-10-17 12:49     ` Khatri, Sunil
2024-10-17 10:06 ` [PATCH v4 15/15] drm/amdgpu: validate get_clockgating_state before use Sunil Khatri
2024-10-17 12:20   ` Christian König
2024-10-17 12:55     ` Khatri, Sunil
2024-10-17 13:15       ` Christian König [this message]
2024-10-17 12:23 ` [PATCH v4 00/15] validate/clean the functions of ip funcs Christian König
2024-10-17 12:57   ` Khatri, Sunil

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=29963d81-41d4-4b80-804c-8792a286e892@amd.com \
    --to=christian.koenig@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=sunil.khatri@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