Skip to contentSkip to conversation

drm/amdgpu: limit harvest bit read on several ASICs

PATCH In review Guchun Chen 3 participants 7 messages Feb 22, 2022 – Feb 25, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: limit harvest bit read on several ASICs

Due to faulty VBIOS out there, harvest bit setting is not consistently correct especially for display IP. So far, it's hard to work out a solution on all the legacy Navi1x ASICs in a short time, so to avoid regression, limit harvest bit read on several ASICs. Will revisit later once VBIOS has corrected it in long term.

Fixes b3f4ea887d5f("drm/amdgpu: read harvest bit per IP data on legacy GPUs")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +13 -5
index 11255290f117..2e0ff1ace6fc 100644
@@ -1129,12 +1129,20 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
 	 * so read harvest bit per IP data structure to set
 	 * harvest configuration.
 	 */
-	if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0))
-		amdgpu_discovery_read_harvest_bit_per_ip(adev,
-							&vcn_harvest_count);
-	else
+	if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0)) {
+		if ((adev->pdev->device == 0x731E &&
+			(adev->pdev->revision == 0xC6 ||
+			 adev->pdev->revision == 0xC7)) ||
+			(adev->pdev->device == 0x7340 &&
+			 adev->pdev->revision == 0xC9) ||
+			(adev->pdev->device == 0x7360 &&
+			 adev->pdev->revision == 0xC7))
+			amdgpu_discovery_read_harvest_bit_per_ip(adev,
+				&vcn_harvest_count);
+	} else {
 		amdgpu_disocvery_read_from_harvest_table(adev,
-							&vcn_harvest_count);
+			&vcn_harvest_count);
+	}
 
 	amdgpu_discovery_harvest_config_quirk(adev);
 
Signature · 1 line
2.17.1
maintainer Acked-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

________________________________
From: Chen, Guchun <[email protected]>
Sent: Tuesday, February 22, 2022 10:07 AM
To: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amdgpu: limit harvest bit read on several ASICs

Due to faulty VBIOS out there, harvest bit setting is not consistently correct especially for display IP. So far, it's hard to work out a solution on all the legacy Navi1x ASICs in a short time, so to avoid regression, limit harvest bit read on several ASICs. Will revisit later once VBIOS has corrected it in long term.

Fixes b3f4ea887d5f("drm/amdgpu: read harvest bit per IP data on legacy GPUs")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +13 -5
index 11255290f117..2e0ff1ace6fc 100644
@@ -1129,12 +1129,20 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
          * so read harvest bit per IP data structure to set
          * harvest configuration.
          */
-       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0))
-               amdgpu_discovery_read_harvest_bit_per_ip(adev,
-                                                       &vcn_harvest_count);
-       else
+       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0)) {
+               if ((adev->pdev->device == 0x731E &&
+                       (adev->pdev->revision == 0xC6 ||
+                        adev->pdev->revision == 0xC7)) ||
+                       (adev->pdev->device == 0x7340 &&
+                        adev->pdev->revision == 0xC9) ||
+                       (adev->pdev->device == 0x7360 &&
+                        adev->pdev->revision == 0xC7))
+                       amdgpu_discovery_read_harvest_bit_per_ip(adev,
+                               &vcn_harvest_count);
+       } else {
                 amdgpu_disocvery_read_from_harvest_table(adev,
-                                                       &vcn_harvest_count);
+                       &vcn_harvest_count);
+       }
 
         amdgpu_discovery_harvest_config_quirk(adev);
 

--
2.17.1

#2 lore raw
In reply to Guchun Chen
Quoted 8 lines · Guchun Chen

Due to faulty VBIOS out there, harvest bit setting is not consistently correct especially for display IP. So far, it's hard to work out a solution on all the legacy Navi1x ASICs in a short time, so to avoid regression, limit harvest bit read on several ASICs. Will revisit later once VBIOS has corrected it in long term.

Looks like it may be incorrect for VCN as well. Double check that.

Alex

Quoted 39 lines
Fixes b3f4ea887d5f("drm/amdgpu: read harvest bit per IP data on legacy GPUs")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +13 -6
index 11255290f117..2e0ff1ace6fc 100644
@@ -1129,12 +1129,20 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
         * so read harvest bit per IP data structure to set
         * harvest configuration.
         */
-       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0))
-               amdgpu_discovery_read_harvest_bit_per_ip(adev,
-                                                       &vcn_harvest_count);
-       else
+       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0)) {
+               if ((adev->pdev->device == 0x731E &&
+                       (adev->pdev->revision == 0xC6 ||
+                        adev->pdev->revision == 0xC7)) ||
+                       (adev->pdev->device == 0x7340 &&
+                        adev->pdev->revision == 0xC9) ||
+                       (adev->pdev->device == 0x7360 &&
+                        adev->pdev->revision == 0xC7))
+                       amdgpu_discovery_read_harvest_bit_per_ip(adev,
+                               &vcn_harvest_count);
+       } else {
                amdgpu_disocvery_read_from_harvest_table(adev,
-                                                       &vcn_harvest_count);
+                       &vcn_harvest_count);
+       }
 
        amdgpu_discovery_harvest_config_quirk(adev);
 
--

2.17.1

#3 lore raw

Hi Alex,

This patch has covered the check of VCN as well. So you want me to modify the comments to add VCN as well?

Regards,
Guchun

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, February 23, 2022 1:00 AM
To: Chen, Guchun <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: limit harvest bit read on several ASICs

Quoted 7 lines · Guchun Chen

Due to faulty VBIOS out there, harvest bit setting is not consistently correct especially for display IP. So far, it's hard to work out a solution on all the legacy Navi1x ASICs in a short time, so to avoid regression, limit harvest bit read on several ASICs. Will revisit later once VBIOS has corrected it in long term.

Looks like it may be incorrect for VCN as well. Double check that.

Alex

Quoted 41 lines
Fixes b3f4ea887d5f("drm/amdgpu: read harvest bit per IP data on

legacy GPUs")

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +13 -6
index 11255290f117..2e0ff1ace6fc 100644
@@ -1129,12 +1129,20 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
         * so read harvest bit per IP data structure to set
         * harvest configuration.
         */
-       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0))
-               amdgpu_discovery_read_harvest_bit_per_ip(adev,
-                                                       &vcn_harvest_count);
-       else
+       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0)) {
+               if ((adev->pdev->device == 0x731E &&
+                       (adev->pdev->revision == 0xC6 ||
+                        adev->pdev->revision == 0xC7)) ||
+                       (adev->pdev->device == 0x7340 &&
+                        adev->pdev->revision == 0xC9) ||
+                       (adev->pdev->device == 0x7360 &&
+                        adev->pdev->revision == 0xC7))
+                       amdgpu_discovery_read_harvest_bit_per_ip(adev,
+                               &vcn_harvest_count);
+       } else {
                amdgpu_disocvery_read_from_harvest_table(adev,
-                                                       &vcn_harvest_count);
+                       &vcn_harvest_count);
+       }
 
        amdgpu_discovery_harvest_config_quirk(adev);
 
--

2.17.1

#4 lore raw

[AMD Official Use Only]

No that's fine. Just checking.

Alex

________________________________
From: Chen, Guchun <[email protected]>
Sent: Tuesday, February 22, 2022 9:29 PM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: limit harvest bit read on several ASICs

Hi Alex,

This patch has covered the check of VCN as well. So you want me to modify the comments to add VCN as well?

Regards,
Guchun

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, February 23, 2022 1:00 AM
To: Chen, Guchun <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: limit harvest bit read on several ASICs

Quoted 7 lines · Guchun Chen

Due to faulty VBIOS out there, harvest bit setting is not consistently correct especially for display IP. So far, it's hard to work out a solution on all the legacy Navi1x ASICs in a short time, so to avoid regression, limit harvest bit read on several ASICs. Will revisit later once VBIOS has corrected it in long term.

Looks like it may be incorrect for VCN as well. Double check that.

Alex

Quoted 41 lines
Fixes b3f4ea887d5f("drm/amdgpu: read harvest bit per IP data on

legacy GPUs")

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +13 -6
index 11255290f117..2e0ff1ace6fc 100644
@@ -1129,12 +1129,20 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
         * so read harvest bit per IP data structure to set
         * harvest configuration.
         */
-       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0))
-               amdgpu_discovery_read_harvest_bit_per_ip(adev,
-                                                       &vcn_harvest_count);
-       else
+       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0)) {
+               if ((adev->pdev->device == 0x731E &&
+                       (adev->pdev->revision == 0xC6 ||
+                        adev->pdev->revision == 0xC7)) ||
+                       (adev->pdev->device == 0x7340 &&
+                        adev->pdev->revision == 0xC9) ||
+                       (adev->pdev->device == 0x7360 &&
+                        adev->pdev->revision == 0xC7))
+                       amdgpu_discovery_read_harvest_bit_per_ip(adev,
+                               &vcn_harvest_count);
+       } else {
                amdgpu_disocvery_read_from_harvest_table(adev,
-                                                       &vcn_harvest_count);
+                       &vcn_harvest_count);
+       }
 
        amdgpu_discovery_harvest_config_quirk(adev);
 
--

2.17.1

#5 lore raw
In reply to Guchun Chen
Quoted 26 lines · Guchun Chen

Due to faulty VBIOS out there, harvest bit setting is not consistently correct especially for display IP. So far, it's hard to work out a solution on all the legacy Navi1x ASICs in a short time, so to avoid regression, limit harvest bit read on several ASICs. Will revisit later once VBIOS has corrected it in long term.

Fixes b3f4ea887d5f("drm/amdgpu: read harvest bit per IP data on legacy GPUs")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -4
index 11255290f117..2e0ff1ace6fc 100644
@@ -1129,12 +1129,20 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
         * so read harvest bit per IP data structure to set
         * harvest configuration.
         */
-       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0))
-               amdgpu_discovery_read_harvest_bit_per_ip(adev,
-                                                       &vcn_harvest_count);
-       else

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev) · line 1141

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +10 -0
+       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0)) {
+               if ((adev->pdev->device == 0x731E &&
+                       (adev->pdev->revision == 0xC6 ||
+                        adev->pdev->revision == 0xC7)) ||
+                       (adev->pdev->device == 0x7340 &&
+                        adev->pdev->revision == 0xC9) ||
+                       (adev->pdev->device == 0x7360 &&
+                        adev->pdev->revision == 0xC7))
+                       amdgpu_discovery_read_harvest_bit_per_ip(adev,
+                               &vcn_harvest_count);

Now that we have this code in place, can we drop the hardcoded harvest settings below? E.g.,

        if ((adev->pdev->device == 0x731E &&
             (adev->pdev->revision == 0xC6 || adev->pdev->revision == 0xC7)) ||
            (adev->pdev->device == 0x7340 && adev->pdev->revision == 0xC9)  ||
            (adev->pdev->device == 0x7360 && adev->pdev->revision == 0xC7)) {
                adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
                adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
        }

Looks like the same board variants in both places.

Alex

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +3 -2
+       } else {
                amdgpu_disocvery_read_from_harvest_table(adev,
-                                                       &vcn_harvest_count);
+                       &vcn_harvest_count);
+       }
 
        amdgpu_discovery_harvest_config_quirk(adev);
 
--

2.17.1

#6 lore raw

Hi Alex,

Exactly, I have the same idea, but I need to double confirm the harvest bit settings are correct on all these listed ASICs. Once confirmed, I will drop the redundant check.

Regards,
Guchun

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, February 24, 2022 11:58 PM
To: Chen, Guchun <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: limit harvest bit read on several ASICs

Quoted 27 lines · Guchun Chen

Due to faulty VBIOS out there, harvest bit setting is not consistently correct especially for display IP. So far, it's hard to work out a solution on all the legacy Navi1x ASICs in a short time, so to avoid regression, limit harvest bit read on several ASICs. Will revisit later once VBIOS has corrected it in long term.

Fixes b3f4ea887d5f("drm/amdgpu: read harvest bit per IP data on

legacy GPUs")

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -4
index 11255290f117..2e0ff1ace6fc 100644
@@ -1129,12 +1129,20 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
         * so read harvest bit per IP data structure to set
         * harvest configuration.
         */
-       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0))
-               amdgpu_discovery_read_harvest_bit_per_ip(adev,
-                                                       &vcn_harvest_count);
-       else

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev) · line 1141

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +10 -0
+       if (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 2, 0)) {
+               if ((adev->pdev->device == 0x731E &&
+                       (adev->pdev->revision == 0xC6 ||
+                        adev->pdev->revision == 0xC7)) ||
+                       (adev->pdev->device == 0x7340 &&
+                        adev->pdev->revision == 0xC9) ||
+                       (adev->pdev->device == 0x7360 &&
+                        adev->pdev->revision == 0xC7))
+                       amdgpu_discovery_read_harvest_bit_per_ip(adev,
+                               &vcn_harvest_count);

Now that we have this code in place, can we drop the hardcoded harvest settings below? E.g.,

        if ((adev->pdev->device == 0x731E &&
             (adev->pdev->revision == 0xC6 || adev->pdev->revision == 0xC7)) ||
            (adev->pdev->device == 0x7340 && adev->pdev->revision == 0xC9)  ||
            (adev->pdev->device == 0x7360 && adev->pdev->revision == 0xC7)) {
                adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
                adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
        }

Looks like the same board variants in both places.

Alex

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +3 -2
+       } else {
                amdgpu_disocvery_read_from_harvest_table(adev,
-                                                       &vcn_harvest_count);
+                       &vcn_harvest_count);
+       }
 
        amdgpu_discovery_harvest_config_quirk(adev);
 
--

2.17.1