From: Nirmoy <nirmodas@amd.com>
To: Jiawei <Jiawei.Gu@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: simplify hw status clear/set logic
Date: Thu, 27 Aug 2020 09:07:19 +0200 [thread overview]
Message-ID: <23204288-401b-37b2-1cd2-82d8c6372b90@amd.com> (raw)
In-Reply-To: <20200827023219.6650-1-Jiawei.Gu@amd.com>
On 8/27/20 4:32 AM, Jiawei wrote:
> Optimize code to iterate less loops in
> amdgpu_device_ip_reinit_early_sriov()
>
> Signed-off-by: Jiawei <Jiawei.Gu@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 8f37f9f99105..696a61cc3ac6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2598,17 +2598,16 @@ static int amdgpu_device_ip_reinit_early_sriov(struct amdgpu_device *adev)
> AMD_IP_BLOCK_TYPE_IH,
> };
>
> - for (i = 0; i < adev->num_ip_blocks; i++)
> - adev->ip_blocks[i].status.hw = false;
> -
> - for (i = 0; i < ARRAY_SIZE(ip_order); i++) {
> + for (i = 0; i < adev->num_ip_blocks; i++) {
> int j;
> struct amdgpu_ip_block *block;
>
> - for (j = 0; j < adev->num_ip_blocks; j++) {
> - block = &adev->ip_blocks[j];
> + block = &adev->ip_blocks[i];
> + block->status.hw = false;
>
> - if (block->version->type != ip_order[i] ||
> + for (j = 0; j < ARRAY_SIZE(ip_order); j++) {
We could probably replace this "for" loop with a big if-statement
if ( block->version->type== AMD_IP_BLOCK_TYPE_GMC ||
block->version->type== AMD_IP_BLOCK_TYPE_COMMON ... )
But anyway it looks good to me as it is. Acked-by: Nirmoy Das
<nirmoy.das@amd.com>
> +
> + if (block->version->type != ip_order[j] ||
> !block->status.valid)
> continue;
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
prev parent reply other threads:[~2020-08-27 7:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-27 2:32 [PATCH] drm/amdgpu: simplify hw status clear/set logic Jiawei
2020-08-27 6:50 ` Gu, JiaWei (Will)
2020-08-27 6:57 ` Deng, Emily
2020-08-27 7:07 ` Nirmoy [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=23204288-401b-37b2-1cd2-82d8c6372b90@amd.com \
--to=nirmodas@amd.com \
--cc=Jiawei.Gu@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/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