All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: simplify hw status clear/set logic
@ 2020-08-27  2:32 Jiawei
  2020-08-27  6:50 ` Gu, JiaWei (Will)
  2020-08-27  7:07 ` Nirmoy
  0 siblings, 2 replies; 4+ messages in thread
From: Jiawei @ 2020-08-27  2:32 UTC (permalink / raw)
  To: amd-gfx; +Cc: Jiawei

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++) {
+
+			if (block->version->type != ip_order[j] ||
 				!block->status.valid)
 				continue;
 
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] drm/amdgpu: simplify hw status clear/set logic
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Gu, JiaWei (Will) @ 2020-08-27  6:50 UTC (permalink / raw)
  To: amd-gfx; +Cc: Gu, JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

Ping...

-----Original Message-----
From: Jiawei <Jiawei.Gu@amd.com> 
Sent: Thursday, August 27, 2020 10:32 AM
To: amd-gfx@lists.freedesktop.org
Cc: Gu, JiaWei (Will) <JiaWei.Gu@amd.com>
Subject: [PATCH] drm/amdgpu: simplify hw status clear/set logic

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++) {
+
+			if (block->version->type != ip_order[j] ||
 				!block->status.valid)
 				continue;
 
-- 
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] drm/amdgpu: simplify hw status clear/set logic
  2020-08-27  6:50 ` Gu, JiaWei (Will)
@ 2020-08-27  6:57   ` Deng, Emily
  0 siblings, 0 replies; 4+ messages in thread
From: Deng, Emily @ 2020-08-27  6:57 UTC (permalink / raw)
  To: Gu, JiaWei (Will), amd-gfx; +Cc: Gu, JiaWei (Will)

Reviewed-by: Emily.Deng <Emily.Deng@amd.com>

>-----Original Message-----
>From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Gu,
>JiaWei (Will)
>Sent: Thursday, August 27, 2020 2:50 PM
>To: amd-gfx@lists.freedesktop.org
>Cc: Gu, JiaWei (Will) <JiaWei.Gu@amd.com>
>Subject: RE: [PATCH] drm/amdgpu: simplify hw status clear/set logic
>
>[AMD Official Use Only - Internal Distribution Only]
>
>Ping...
>
>-----Original Message-----
>From: Jiawei <Jiawei.Gu@amd.com>
>Sent: Thursday, August 27, 2020 10:32 AM
>To: amd-gfx@lists.freedesktop.org
>Cc: Gu, JiaWei (Will) <JiaWei.Gu@amd.com>
>Subject: [PATCH] drm/amdgpu: simplify hw status clear/set logic
>
>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++) {
>+
>+			if (block->version->type != ip_order[j] ||
> 				!block->status.valid)
> 				continue;
>
>--
>2.17.1
>_______________________________________________
>amd-gfx mailing list
>amd-gfx@lists.freedesktop.org
>https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.free
>desktop.org%2Fmailman%2Flistinfo%2Famd-
>gfx&amp;data=02%7C01%7CEmily.Deng%40amd.com%7Cd49aeebc6337454ad
>be508d84a558474%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6
>37341078483894286&amp;sdata=ORgvulljLZNfexMcXZCXi4JEmz3J357Oxa%2B
>GxYW3%2FSo%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdgpu: simplify hw status clear/set logic
  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  7:07 ` Nirmoy
  1 sibling, 0 replies; 4+ messages in thread
From: Nirmoy @ 2020-08-27  7:07 UTC (permalink / raw)
  To: Jiawei, amd-gfx


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-27  7:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.