All of lore.kernel.org
 help / color / mirror / Atom feed
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 10/18] drm/amdgpu: add ip block with instance
Date: Fri, 4 Oct 2024 14:44:26 -0400	[thread overview]
Message-ID: <a150b2fa-63a3-47bf-a689-76b864acc8b7@amd.com> (raw)
In-Reply-To: <CADnq5_ODBr=ZFtZmgRym5FjEazp5BiFVK8U=fmairLKHef9zVw@mail.gmail.com>


On 2024-10-02 13:32, Alex Deucher wrote:
> On Wed, Oct 2, 2024 at 12:39 AM <boyuan.zhang@amd.com> wrote:
>> From: Boyuan Zhang <boyuan.zhang@amd.com>
>>
>> Add instance number to ip block to track which instance the ip block
>> belongs to.
>>
>> Also, add a new function to allow ip block to save the instance number
>> along with other ip block driver information.
>>
>> Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
> I think the logic can be added to the existing
> amdgpu_device_ip_block_add().  Something like the attached patch.
>
> Alex


Thanks for the suggestion. And yes, this is a much smarter way =)

Applied in the new v2 patch set.

Regards,
Boyuan


>
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  5 +++
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 39 ++++++++++++++++++++++
>>   2 files changed, 44 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index 84a9749dcd7d..d77db73c71f7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -386,6 +386,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;
>>   };
>>
>>   int amdgpu_device_ip_block_version_cmp(struct amdgpu_device *adev,
>> @@ -399,6 +400,10 @@ amdgpu_device_ip_get_ip_block(struct amdgpu_device *adev,
>>   int amdgpu_device_ip_block_add(struct amdgpu_device *adev,
>>                                 const struct amdgpu_ip_block_version *ip_block_version);
>>
>> +int amdgpu_device_ip_block_add_instance(struct amdgpu_device *adev,
>> +                              const struct amdgpu_ip_block_version *ip_block_version,
>> +                              unsigned int inst);
>> +
>>   /*
>>    * BIOS.
>>    */
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 263f25ac2d63..4bc109a0d832 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -2321,6 +2321,45 @@ int amdgpu_device_ip_block_add(struct amdgpu_device *adev,
>>          return 0;
>>   }
>>
>> +/**
>> + * amdgpu_device_ip_block_add_instance
>> + *
>> + * @adev: amdgpu_device pointer
>> + * @ip_block_version: pointer to the IP to add
>> + *
>> + * Adds the IP block driver information and instance number
>> + * to the collection of IPs on the asic.
>> + */
>> +int amdgpu_device_ip_block_add_instance(struct amdgpu_device *adev,
>> +                              const struct amdgpu_ip_block_version *ip_block_version,
>> +                              unsigned int inst)
>> +{
>> +       if (!ip_block_version)
>> +               return -EINVAL;
>> +
>> +       switch (ip_block_version->type) {
>> +       case AMD_IP_BLOCK_TYPE_VCN:
>> +               if (adev->harvest_ip_mask & AMD_HARVEST_IP_VCN_MASK)
>> +                       return 0;
>> +               break;
>> +       case AMD_IP_BLOCK_TYPE_JPEG:
>> +               if (adev->harvest_ip_mask & AMD_HARVEST_IP_JPEG_MASK)
>> +                       return 0;
>> +               break;
>> +       default:
>> +               break;
>> +       }
>> +
>> +       DRM_INFO("add ip block number %d <%s>\n", adev->num_ip_blocks,
>> +                 ip_block_version->funcs->name);
>> +
>> +       adev->ip_blocks[adev->num_ip_blocks].adev = adev;
>> +       adev->ip_blocks[adev->num_ip_blocks].instance = inst;
>> +       adev->ip_blocks[adev->num_ip_blocks++].version = ip_block_version;
>> +
>> +       return 0;
>> +}
>> +
>>   /**
>>    * amdgpu_device_enable_virtual_display - enable virtual display feature
>>    *
>> --
>> 2.34.1
>>

  reply	other threads:[~2024-10-04 18:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02  4:36 [PATCH 00/18] Separating vcn power management by instance boyuan.zhang
2024-10-02  4:36 ` [PATCH 01/18] drm/amd/pm: add new vcn enable function pointer boyuan.zhang
2024-10-02 17:10   ` Alex Deucher
2024-10-04 18:38     ` Boyuan Zhang
2024-10-02  4:36 ` [PATCH 02/18] drm/amd/pm: enable vcn by instance for smu v13 boyuan.zhang
2024-10-02  4:36 ` [PATCH 03/18] drm/amd/pm: enable vcn by instance for smu v14 boyuan.zhang
2024-10-02  4:36 ` [PATCH 04/18] drm/amd/pm: enable vcn by instance for smu 11 boyuan.zhang
2024-10-02  4:36 ` [PATCH 05/18] drm/amd/pm: set vcn enable by instance boyuan.zhang
2024-10-02 11:19   ` Christian König
2024-10-04 18:40     ` Boyuan Zhang
2024-10-02  4:36 ` [PATCH 06/18] drm/amd/pm: set powergating by smu " boyuan.zhang
2024-10-02  4:36 ` [PATCH 07/18] drm/amdgpu/vcn: separate gating state " boyuan.zhang
2024-10-02 11:28   ` Christian König
2024-10-04 18:42     ` Boyuan Zhang
2024-10-02  4:36 ` [PATCH 08/18] drm/amdgpu/vcn: separate idle work " boyuan.zhang
2024-10-02  4:36 ` [PATCH 09/18] drm/amdgpu: pass ip_block in set_powergating_state boyuan.zhang
2024-10-02 11:41   ` Christian König
2024-10-04 19:34     ` Boyuan Zhang
2024-10-02  4:36 ` [PATCH 10/18] drm/amdgpu: add ip block with instance boyuan.zhang
2024-10-02 17:32   ` Alex Deucher
2024-10-04 18:44     ` Boyuan Zhang [this message]
2024-10-02  4:36 ` [PATCH 11/18] drm/amdgpu: add set_powergating_state_instance boyuan.zhang
2024-10-02  4:36 ` [PATCH 12/18] drm/amdgpu: power vcn 2_5 by instance boyuan.zhang
2024-10-02  4:36 ` [PATCH 13/18] drm/amdgpu: power vcn 3_0 " boyuan.zhang
2024-10-02  4:36 ` [PATCH 14/18] drm/amdgpu: power vcn 4_0 " boyuan.zhang
2024-10-02  4:36 ` [PATCH 15/18] drm/amdgpu: power vcn 4_0_3 " boyuan.zhang
2024-10-02  4:36 ` [PATCH 16/18] drm/amdgpu: power vcn 4_0_5 " boyuan.zhang
2024-10-02  4:36 ` [PATCH 17/18] drm/amdgpu: power vcn 5_0_0 " boyuan.zhang
2024-10-02  4:36 ` [PATCH 18/18] drm/amdgpu: set powergating state by vcn instance 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=a150b2fa-63a3-47bf-a689-76b864acc8b7@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 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.