From: Boyuan Zhang <Boyuan.Zhang@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: amd-gfx@lists.freedesktop.org, leo.liu@amd.com,
christian.koenig@amd.com, alexander.deucher@amd.com,
sunil.khatri@amd.com
Subject: Re: [PATCH 09/29] drm/amdgpu: track instances of the same IP block
Date: Tue, 29 Oct 2024 13:47:38 -0400 [thread overview]
Message-ID: <c8c19f39-008c-43ab-bfd4-d3b88263e279@amd.com> (raw)
In-Reply-To: <CADnq5_OiMxw4a6ejyY944+AQ+k9aAHYw9ucFKJbO758-ry-_aw@mail.gmail.com>
On 2024-10-28 16:05, Alex Deucher wrote:
> On Mon, Oct 28, 2024 at 3:53 PM Boyuan Zhang <Boyuan.Zhang@amd.com> wrote:
>>
>> On 2024-10-28 15:27, Alex Deucher wrote:
>>> On Thu, Oct 24, 2024 at 10:48 PM <boyuan.zhang@amd.com> wrote:
>>>> From: Boyuan Zhang <boyuan.zhang@amd.com>
>>>>
>>>> Add a new function to count the number of instance of the same IP block
>>>> in the current ip_block list, then use the returned count value to set
>>>> the newly defined instance variable in ip_block, to track the instance
>>>> number of each ip_block.
>>>>
>>>> Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
>>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>>> Suggested-by: Christian König <christian.koenig@amd.com>
>>>> Reviewed-by: Christian König <christian.koenig@amd.com>
>>>> ---
>>>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 25 +++++++++++++++++++++-
>>>> 2 files changed, 25 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>>> index fba10ad44be9..2e2c6a556cc8 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>>> @@ -390,6 +390,7 @@ struct amdgpu_ip_block {
>>>> struct amdgpu_ip_block_status status;
>>>> const struct amdgpu_ip_block_version *version;
>>>> struct amdgpu_device *adev;
>>>> + unsigned int instance;
>>> Thinking towards future work, we should add a `bool harvested;` member
>>> to the structure so that we can skip harvested instances in the common
>>> code going forward.
>>>
>>> Alex
>>
>> OK, so do you suggest to add it in this patch set, or a separated patch
>> set when we implement it later on?
> Later on. Just thinking out loud for when we clean up adev->vcn.
> I.e., we can remove all of the checks for (harvest & (1 << inst))
> because we can set ip_block->harvested = true in the common code and
> then in amdgpu_device_ip_early_init() we can do:
>
> if (ip_block->harvested)
> adev->ip_blocks[i].status.valid = false;
>
> and we won't have to check for harvested instances in any of the runtime code.
>
> Alex
Really good idea! Sure, will clean up this part later on! Thanks!
Boyuan
>
>> Boyuan
>>
>>
>>>> };
>>>>
>>>> int amdgpu_device_ip_block_version_cmp(struct amdgpu_device *adev,
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> index 7c06e3a9146c..065463b5d6a9 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> @@ -2322,6 +2322,28 @@ int amdgpu_device_ip_block_version_cmp(struct amdgpu_device *adev,
>>>> return 1;
>>>> }
>>>>
>>>> +/**
>>>> + * amdgpu_device_ip_get_num_instances - get number of instances of an IP block
>>>> + *
>>>> + * @adev: amdgpu_device pointer
>>>> + * @type: Type of hardware IP (SMU, GFX, UVD, etc.)
>>>> + *
>>>> + * Returns the count of the hardware IP blocks structure for that type.
>>>> + */
>>>> +static unsigned int
>>>> +amdgpu_device_ip_get_num_instances(struct amdgpu_device *adev,
>>>> + enum amd_ip_block_type type)
>>>> +{
>>>> + unsigned int i, count = 0;
>>>> +
>>>> + for (i = 0; i < adev->num_ip_blocks; i++) {
>>>> + if (adev->ip_blocks[i].version->type == type)
>>>> + count++;
>>>> + }
>>>> +
>>>> + return count;
>>>> +}
>>>> +
>>>> /**
>>>> * amdgpu_device_ip_block_add
>>>> *
>>>> @@ -2354,7 +2376,8 @@ int amdgpu_device_ip_block_add(struct amdgpu_device *adev,
>>>> ip_block_version->funcs->name);
>>>>
>>>> adev->ip_blocks[adev->num_ip_blocks].adev = adev;
>>>> -
>>>> + adev->ip_blocks[adev->num_ip_blocks].instance =
>>>> + amdgpu_device_ip_get_num_instances(adev, ip_block_version->type);
>>>> adev->ip_blocks[adev->num_ip_blocks++].version = ip_block_version;
>>>>
>>>> return 0;
>>>> --
>>>> 2.34.1
>>>>
next prev parent reply other threads:[~2024-10-29 17:47 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 2:35 [PATCH 00/29] Separating vcn power management by instance boyuan.zhang
2024-10-25 2:35 ` [PATCH 01/29] drm/amd/pm: add inst to dpm_set_vcn_enable boyuan.zhang
2024-10-28 19:05 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 02/29] drm/amd/pm: power up or down vcn by instance boyuan.zhang
2024-10-28 19:07 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 03/29] drm/amd/pm: add inst to smu_dpm_set_vcn_enable boyuan.zhang
2024-10-28 19:04 ` Alex Deucher
2024-10-29 17:44 ` Boyuan Zhang
2024-10-25 2:35 ` [PATCH 04/29] drm/amd/pm: add inst to set_powergating_by_smu boyuan.zhang
2024-10-28 19:08 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 05/29] drm/amd/pm: add inst to dpm_set_powergating_by_smu boyuan.zhang
2024-10-28 19:11 ` Alex Deucher
2024-10-29 17:45 ` Boyuan Zhang
2024-10-25 2:35 ` [PATCH 06/29] drm/amdgpu: add inst to amdgpu_dpm_enable_vcn boyuan.zhang
2024-10-28 19:12 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 07/29] drm/amdgpu: pass ip_block in set_powergating_state boyuan.zhang
2024-10-25 10:38 ` Khatri, Sunil
2024-10-28 19:16 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 08/29] drm/amdgpu: pass ip_block in set_clockgating_state boyuan.zhang
2024-10-25 10:39 ` Khatri, Sunil
2024-10-25 2:35 ` [PATCH 09/29] drm/amdgpu: track instances of the same IP block boyuan.zhang
2024-10-28 19:27 ` Alex Deucher
2024-10-28 19:53 ` Boyuan Zhang
2024-10-28 20:05 ` Alex Deucher
2024-10-29 17:47 ` Boyuan Zhang [this message]
2024-10-25 2:35 ` [PATCH 10/29] drm/amdgpu: move per inst variables to amdgpu_vcn_inst boyuan.zhang
2024-10-28 19:19 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 11/29] drm/amdgpu/vcn: separate gating state by instance boyuan.zhang
2024-10-28 19:22 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 12/29] drm/amdgpu: power vcn 2_5 " boyuan.zhang
2024-10-28 19:24 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 13/29] drm/amdgpu: power vcn 3_0 " boyuan.zhang
2024-10-28 19:25 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 14/29] drm/amdgpu: power vcn 4_0 " boyuan.zhang
2024-10-28 19:25 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 15/29] drm/amdgpu: power vcn 4_0_3 " boyuan.zhang
2024-10-28 19:28 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 16/29] drm/amdgpu: power vcn 4_0_5 " boyuan.zhang
2024-10-28 19:28 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 17/29] drm/amdgpu: power vcn 5_0_0 " boyuan.zhang
2024-10-28 19:29 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 18/29] drm/amdgpu/vcn: separate idle work " boyuan.zhang
2024-10-28 19:30 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 19/29] drm/amdgpu: set powergating state by vcn instance boyuan.zhang
2024-10-28 19:33 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 20/29] drm/amdgpu: early_init for each " boyuan.zhang
2024-10-25 11:12 ` Khatri, Sunil
2024-10-28 19:37 ` Deucher, Alexander
2024-10-25 2:35 ` [PATCH 21/29] drm/amdgpu: sw_init " boyuan.zhang
2024-10-25 11:22 ` Khatri, Sunil
2024-10-28 19:38 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 22/29] drm/amdgpu: sw_fini " boyuan.zhang
2024-10-25 13:06 ` Khatri, Sunil
2024-10-25 2:35 ` [PATCH 23/29] drm/amdgpu: hw_init " boyuan.zhang
2024-10-28 19:41 ` Alex Deucher
2024-10-29 10:04 ` Khatri, Sunil
2024-10-25 2:35 ` [PATCH 24/29] drm/amdgpu: suspend " boyuan.zhang
2024-10-28 19:42 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 25/29] drm/amdgpu: resume " boyuan.zhang
2024-10-28 19:42 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 26/29] drm/amdgpu: setup_ucode " boyuan.zhang
2024-10-28 19:43 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 27/29] drm/amdgpu: set funcs " boyuan.zhang
2024-10-28 19:44 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 28/29] drm/amdgpu: wait_for_idle " boyuan.zhang
2024-10-28 19:44 ` Alex Deucher
2024-10-25 2:35 ` [PATCH 29/29] drm/amdgpu: set_powergating " boyuan.zhang
2024-10-28 19:45 ` Alex Deucher
2024-10-28 13:18 ` [PATCH 00/29] Separating vcn power management by instance Liu, Leo
-- strict thread matches above, loose matches on Subject: below --
2024-10-29 17:42 boyuan.zhang
2024-10-29 17:42 ` [PATCH 09/29] drm/amdgpu: track instances of the same IP block boyuan.zhang
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=c8c19f39-008c-43ab-bfd4-d3b88263e279@amd.com \
--to=boyuan.zhang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=leo.liu@amd.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