Skip to contentSkip to conversation

drm/amdgpu: attempt to enable gfxoff on more raven1 boards

PATCH In review Alex Deucher 4 participants 6 messages Jan 15, 2020 – Jan 16, 2020

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

PATCH 1/1 drm/amdgpu: attempt to enable gfxoff on more raven1 boards

Switch to a blacklist so we can disable specific boards that are problematic.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +38 -4
index e3d466bd5c4e..b48b07bcd0fb 100644
@@ -1031,6 +1031,37 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
 	}
 }
 
+struct amdgpu_gfxoff_quirk {
+	u16 chip_vendor;
+	u16 chip_device;
+	u16 subsys_vendor;
+	u16 subsys_device;
+	u8 revision;
+};
+
+static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {
+	/* https://bugzilla.kernel.org/show_bug.cgi?id=204689 */
+	{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
+	{ 0, 0, 0, 0, 0 },
+};
+
+static bool gfx_v9_0_raven_check_disable_gfxoff(struct pci_dev *pdev)
+{
+	const struct amdgpu_gfxoff_quirk *p = amdgpu_gfxoff_quirk_list;
+
+	while (p && p->chip_device != 0) {
+		if (pdev->vendor == p->chip_vendor &&
+		    pdev->device == p->chip_device &&
+		    pdev->subsystem_vendor == p->subsys_vendor &&
+		    pdev->subsystem_device == p->subsys_device &&
+		    pdev->revision == p->revision) {
+			return true;
+		}
+		++p;
+	}
+	return false;
+}
+
 static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
 {
 	switch (adev->asic_type) {
@@ -1039,10 +1070,13 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
 	case CHIP_VEGA20:
 		break;
 	case CHIP_RAVEN:
-		if (!(adev->rev_id >= 0x8 ||
-		      adev->pdev->device == 0x15d8) &&
-		    (adev->pm.fw_version < 0x41e2b || /* not raven1 fresh */
-		     !adev->gfx.rlc.is_rlc_v2_1)) /* without rlc save restore ucodes */
+		if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) &&
+		    ((adev->gfx.rlc_fw_version != 106 &&
+		      adev->gfx.rlc_fw_version < 531) ||
+		     (adev->gfx.rlc_fw_version == 53815) ||
+		     (adev->gfx.rlc_feature_version < 1) ||
+		     !adev->gfx.rlc.is_rlc_v2_1) &&
+		    !gfx_v9_0_raven_check_disable_gfxoff(adev->pdev))
 			adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
 
 		if (adev->pm.pp_feature & PP_GFXOFF_MASK)
Signature · 6 lines
2.24.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

[AMD Official Use Only - Internal Distribution Only]

Hi, Alex,
it is better to refine the patch as a common function, not only used for raven.

Best Regards
Dennis Li
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, January 16, 2020 1:32 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards

Switch to a blacklist so we can disable specific boards that are problematic.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +37 -4
index e3d466bd5c4e..b48b07bcd0fb 100644
@@ -1031,6 +1031,37 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
 	}
 }
 
+struct amdgpu_gfxoff_quirk {
+	u16 chip_vendor;
+	u16 chip_device;
+	u16 subsys_vendor;
+	u16 subsys_device;
+	u8 revision;
+};
+
+static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {
+	/* https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D204689&amp;data=02%7C01%7CDennis.Li%40amd.com%7C33990b7157714a2f943a08d799e0cda3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637147063123345220&amp;sdata=2mT3Eug%2FEDKGGbI1bqymp2tnMqLX4x%2B2BAWnLUnq5m0%3D&amp;reserved=0 */
+	{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
+	{ 0, 0, 0, 0, 0 },
+};
+
+static bool gfx_v9_0_raven_check_disable_gfxoff(struct pci_dev *pdev) {
+	const struct amdgpu_gfxoff_quirk *p = amdgpu_gfxoff_quirk_list;
+
+	while (p && p->chip_device != 0) {
+		if (pdev->vendor == p->chip_vendor &&
+		    pdev->device == p->chip_device &&
+		    pdev->subsystem_vendor == p->subsys_vendor &&
+		    pdev->subsystem_device == p->subsys_device &&
+		    pdev->revision == p->revision) {
+			return true;
+		}
+		++p;
+	}
+	return false;
+}
+
 static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)  {
 	switch (adev->asic_type) {
@@ -1039,10 +1070,13 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
 	case CHIP_VEGA20:
 		break;
 	case CHIP_RAVEN:
-		if (!(adev->rev_id >= 0x8 ||
-		      adev->pdev->device == 0x15d8) &&
-		    (adev->pm.fw_version < 0x41e2b || /* not raven1 fresh */
-		     !adev->gfx.rlc.is_rlc_v2_1)) /* without rlc save restore ucodes */
+		if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) &&
+		    ((adev->gfx.rlc_fw_version != 106 &&
+		      adev->gfx.rlc_fw_version < 531) ||
+		     (adev->gfx.rlc_fw_version == 53815) ||
+		     (adev->gfx.rlc_feature_version < 1) ||
+		     !adev->gfx.rlc.is_rlc_v2_1) &&
+		    !gfx_v9_0_raven_check_disable_gfxoff(adev->pdev))
 			adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
 
 		if (adev->pm.pp_feature & PP_GFXOFF_MASK)

--
2.24.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CDennis.Li%40amd.com%7C33990b7157714a2f943a08d799e0cda3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637147063123345220&amp;sdata=ON7UTCOhoCaW%2Bwp0KiMCjOQHt6QohngaFxx9hgfKS7o%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw
Quoted 5 lines · Dennis

[AMD Official Use Only - Internal Distribution Only]

Hi, Alex,
it is better to refine the patch as a common function, not only used for raven.

I originally had the name as gfx_v9_0_check_disable_gfxoff(), but I changed it to be raven specific because if we call this independent of the other conditions in the CHIP_RAVEN case, we may end up disabling gfxoff in cases where we don't want to (e.g., if a raven1 refresh uses the same DID/SSID/RIDs as a non-kicker for example, and one works and the other doesn't). I guess we can revisit if we have to add cases for other asics. If you feel strongly I can change the name.

Alex

Quoted 78 lines

Best Regards
Dennis Li
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, January 16, 2020 1:32 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards

Switch to a blacklist so we can disable specific boards that are problematic.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +37 -5
index e3d466bd5c4e..b48b07bcd0fb 100644
@@ -1031,6 +1031,37 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
        }
 }
 
+struct amdgpu_gfxoff_quirk {
+       u16 chip_vendor;
+       u16 chip_device;
+       u16 subsys_vendor;
+       u16 subsys_device;
+       u8 revision;
+};
+
+static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {
+       /* https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D204689&amp;data=02%7C01%7CDennis.Li%40amd.com%7C33990b7157714a2f943a08d799e0cda3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637147063123345220&amp;sdata=2mT3Eug%2FEDKGGbI1bqymp2tnMqLX4x%2B2BAWnLUnq5m0%3D&amp;reserved=0 */
+       { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
+       { 0, 0, 0, 0, 0 },
+};
+
+static bool gfx_v9_0_raven_check_disable_gfxoff(struct pci_dev *pdev) {
+       const struct amdgpu_gfxoff_quirk *p = amdgpu_gfxoff_quirk_list;
+
+       while (p && p->chip_device != 0) {
+               if (pdev->vendor == p->chip_vendor &&
+                   pdev->device == p->chip_device &&
+                   pdev->subsystem_vendor == p->subsys_vendor &&
+                   pdev->subsystem_device == p->subsys_device &&
+                   pdev->revision == p->revision) {
+                       return true;
+               }
+               ++p;
+       }
+       return false;
+}
+
 static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)  {
        switch (adev->asic_type) {
@@ -1039,10 +1070,13 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
        case CHIP_VEGA20:
                break;
        case CHIP_RAVEN:
-               if (!(adev->rev_id >= 0x8 ||
-                     adev->pdev->device == 0x15d8) &&
-                   (adev->pm.fw_version < 0x41e2b || /* not raven1 fresh */
-                    !adev->gfx.rlc.is_rlc_v2_1)) /* without rlc save restore ucodes */
+               if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) &&
+                   ((adev->gfx.rlc_fw_version != 106 &&
+                     adev->gfx.rlc_fw_version < 531) ||
+                    (adev->gfx.rlc_fw_version == 53815) ||
+                    (adev->gfx.rlc_feature_version < 1) ||
+                    !adev->gfx.rlc.is_rlc_v2_1) &&
+                   !gfx_v9_0_raven_check_disable_gfxoff(adev->pdev))
                        adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
 
                if (adev->pm.pp_feature & PP_GFXOFF_MASK)
--

2.24.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CDennis.Li%40amd.com%7C33990b7157714a2f943a08d799e0cda3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637147063123345220&amp;sdata=ON7UTCOhoCaW%2Bwp0KiMCjOQHt6QohngaFxx9hgfKS7o%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw

Am 16.01.20 um 16:26 schrieb Alex Deucher:

Quoted 5 lines · Dennis
Quoted 4 lines

[AMD Official Use Only - Internal Distribution Only]

Hi, Alex,
it is better to refine the patch as a common function, not only used for raven.

Quoted 7 lines

I originally had the name as gfx_v9_0_check_disable_gfxoff(), but I changed it to be raven specific because if we call this independent of the other conditions in the CHIP_RAVEN case, we may end up disabling gfxoff in cases where we don't want to (e.g., if a raven1 refresh uses the same DID/SSID/RIDs as a non-kicker for example, and one works and the other doesn't). I guess we can revisit if we have to add cases for other asics. If you feel strongly I can change the name.

Maybe we should have a general feature to match an array of DID/SSID/RIDs?

Maybe having that in amdgpu_device.c or even the PCI subsystem would make a lot of sense for this.

Christian.

Quoted 80 lines

Alex

Quoted 77 lines

Best Regards
Dennis Li
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, January 16, 2020 1:32 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards

Switch to a blacklist so we can disable specific boards that are problematic.

---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
  1 file changed, 38 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +37 -5
index e3d466bd5c4e..b48b07bcd0fb 100644
@@ -1031,6 +1031,37 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
         }
  }
 
+struct amdgpu_gfxoff_quirk {
+       u16 chip_vendor;
+       u16 chip_device;
+       u16 subsys_vendor;
+       u16 subsys_device;
+       u8 revision;
+};
+
+static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {
+       /* https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D204689&amp;data=02%7C01%7CDennis.Li%40amd.com%7C33990b7157714a2f943a08d799e0cda3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637147063123345220&amp;sdata=2mT3Eug%2FEDKGGbI1bqymp2tnMqLX4x%2B2BAWnLUnq5m0%3D&amp;reserved=0 */
+       { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
+       { 0, 0, 0, 0, 0 },
+};
+
+static bool gfx_v9_0_raven_check_disable_gfxoff(struct pci_dev *pdev) {
+       const struct amdgpu_gfxoff_quirk *p = amdgpu_gfxoff_quirk_list;
+
+       while (p && p->chip_device != 0) {
+               if (pdev->vendor == p->chip_vendor &&
+                   pdev->device == p->chip_device &&
+                   pdev->subsystem_vendor == p->subsys_vendor &&
+                   pdev->subsystem_device == p->subsys_device &&
+                   pdev->revision == p->revision) {
+                       return true;
+               }
+               ++p;
+       }
+       return false;
+}
+
  static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)  {
         switch (adev->asic_type) {
@@ -1039,10 +1070,13 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
         case CHIP_VEGA20:
                 break;
         case CHIP_RAVEN:
-               if (!(adev->rev_id >= 0x8 ||
-                     adev->pdev->device == 0x15d8) &&
-                   (adev->pm.fw_version < 0x41e2b || /* not raven1 fresh */
-                    !adev->gfx.rlc.is_rlc_v2_1)) /* without rlc save restore ucodes */
+               if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) &&
+                   ((adev->gfx.rlc_fw_version != 106 &&
+                     adev->gfx.rlc_fw_version < 531) ||
+                    (adev->gfx.rlc_fw_version == 53815) ||
+                    (adev->gfx.rlc_feature_version < 1) ||
+                    !adev->gfx.rlc.is_rlc_v2_1) &&
+                   !gfx_v9_0_raven_check_disable_gfxoff(adev->pdev))
                         adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
 
                 if (adev->pm.pp_feature & PP_GFXOFF_MASK)
--

2.24.1

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CDennis.Li%40amd.com%7C33990b7157714a2f943a08d799e0cda3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637147063123345220&amp;sdata=ON7UTCOhoCaW%2Bwp0KiMCjOQHt6QohngaFxx9hgfKS7o%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw
In reply to Alex Deucher
Quoted 25 lines · Alex Deucher

Switch to a blacklist so we can disable specific boards that are problematic.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -0
index e3d466bd5c4e..b48b07bcd0fb 100644
@@ -1031,6 +1031,37 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
 	}
 }
 
+struct amdgpu_gfxoff_quirk {
+	u16 chip_vendor;
+	u16 chip_device;
+	u16 subsys_vendor;
+	u16 subsys_device;
+	u8 revision;
+};
+
+static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev) · line 1052

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10 -0
+	/* https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D204689&amp;data=02%7C01%7Cluben.tuikov%40amd.com%7C683669e5a2c74bcbbc9108d799e0cda4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637147063903364365&amp;sdata=UL9SCKI7OchzK6a27AxkjrpeLNw%2BWH5DmpWGKutCI4A%3D&amp;reserved=0 */
+	{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
+	{ 0, 0, 0, 0, 0 },
+};
+
+static bool gfx_v9_0_raven_check_disable_gfxoff(struct pci_dev *pdev)
+{
+	const struct amdgpu_gfxoff_quirk *p = amdgpu_gfxoff_quirk_list;
+
+	while (p && p->chip_device != 0) {

Maybe a "for" loop would make it compact?

for ( ; p && p->chip_device != 0; p++) {
	if (pdev->vendor == p->chip_vendor &&
	    pdev->device == p->chip_device &&
	    pdev->subsystem_vendor == p->subsys_vendor &&
	    pdev->subsystem_device == p->subsys_device &&
	    pdev->revision == p->revision) {
		return true;
	}
}

I wonder if the structure "amdgpu_gfxoff_quirk" which stores device ID information can be named something more generic, (struct device_id?) and also used in "pdev"? (Reuse the struct.)

Then we'd only compare structs:

for ( ; p && p->chip_device != 0; p++) {
	if (pdev->dev_id == *p)
		return true;
}

Regards,
Luben

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +12 -4
+		if (pdev->vendor == p->chip_vendor &&
+		    pdev->device == p->chip_device &&
+		    pdev->subsystem_vendor == p->subsys_vendor &&
+		    pdev->subsystem_device == p->subsys_device &&
+		    pdev->revision == p->revision) {
+			return true;
+		}
+		++p;
+	}
+	return false;
+}
+
 static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
 {
 	switch (adev->asic_type) {
@@ -1039,10 +1070,13 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
 	case CHIP_VEGA20:
 		break;
 	case CHIP_RAVEN:
-		if (!(adev->rev_id >= 0x8 ||
-		      adev->pdev->device == 0x15d8) &&
-		    (adev->pm.fw_version < 0x41e2b || /* not raven1 fresh */
-		     !adev->gfx.rlc.is_rlc_v2_1)) /* without rlc save restore ucodes */

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev) · line 1082

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -0
+		if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) &&
+		    ((adev->gfx.rlc_fw_version != 106 &&
+		      adev->gfx.rlc_fw_version < 531) ||
+		     (adev->gfx.rlc_fw_version == 53815) ||
+		     (adev->gfx.rlc_feature_version < 1) ||
+		     !adev->gfx.rlc.is_rlc_v2_1) &&
+		    !gfx_v9_0_raven_check_disable_gfxoff(adev->pdev))
 			adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
 
 		if (adev->pm.pp_feature & PP_GFXOFF_MASK)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw
Quoted 31 lines · Luben Tuikov
Quoted 29 lines · Alex Deucher

Switch to a blacklist so we can disable specific boards that are problematic.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +13 -0
index e3d466bd5c4e..b48b07bcd0fb 100644
@@ -1031,6 +1031,37 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
      }
 }
 
+struct amdgpu_gfxoff_quirk {
+     u16 chip_vendor;
+     u16 chip_device;
+     u16 subsys_vendor;
+     u16 subsys_device;
+     u8 revision;
+};
+
+static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {
+     /* https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D204689&amp;data=02%7C01%7Cluben.tuikov%40amd.com%7C683669e5a2c74bcbbc9108d799e0cda4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637147063903364365&amp;sdata=UL9SCKI7OchzK6a27AxkjrpeLNw%2BWH5DmpWGKutCI4A%3D&amp;reserved=0 */
+     { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
+     { 0, 0, 0, 0, 0 },
+};
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev) · line 1052

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6 -0
+
+static bool gfx_v9_0_raven_check_disable_gfxoff(struct pci_dev *pdev)
+{
+     const struct amdgpu_gfxoff_quirk *p = amdgpu_gfxoff_quirk_list;
+
+     while (p && p->chip_device != 0) {

Maybe a "for" loop would make it compact?

Seems like the same difference either way.

Quoted 15 lines
for ( ; p && p->chip_device != 0; p++) {
        if (pdev->vendor == p->chip_vendor &&
            pdev->device == p->chip_device &&
            pdev->subsystem_vendor == p->subsys_vendor &&
            pdev->subsystem_device == p->subsys_device &&
            pdev->revision == p->revision) {
                return true;
        }
}

I wonder if the structure "amdgpu_gfxoff_quirk" which stores device ID information can be named something more generic, (struct device_id?) and also used in "pdev"? (Reuse the struct.)

Quoted 6 lines

Then we'd only compare structs:

for ( ; p && p->chip_device != 0; p++) {
        if (pdev->dev_id == *p)
                return true;
}

pdev structure is huge. All we need are the ids.

Alex

Quoted 36 lines

Regards,
Luben

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +19 -4
+             if (pdev->vendor == p->chip_vendor &&
+                 pdev->device == p->chip_device &&
+                 pdev->subsystem_vendor == p->subsys_vendor &&
+                 pdev->subsystem_device == p->subsys_device &&
+                 pdev->revision == p->revision) {
+                     return true;
+             }
+             ++p;
+     }
+     return false;
+}
+
 static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
 {
      switch (adev->asic_type) {
@@ -1039,10 +1070,13 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
      case CHIP_VEGA20:
              break;
      case CHIP_RAVEN:
-             if (!(adev->rev_id >= 0x8 ||
-                   adev->pdev->device == 0x15d8) &&
-                 (adev->pm.fw_version < 0x41e2b || /* not raven1 fresh */
-                  !adev->gfx.rlc.is_rlc_v2_1)) /* without rlc save restore ucodes */
+             if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) &&
+                 ((adev->gfx.rlc_fw_version != 106 &&
+                   adev->gfx.rlc_fw_version < 531) ||
+                  (adev->gfx.rlc_fw_version == 53815) ||
+                  (adev->gfx.rlc_feature_version < 1) ||
+                  !adev->gfx.rlc.is_rlc_v2_1) &&
+                 !gfx_v9_0_raven_check_disable_gfxoff(adev->pdev))
                      adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
 
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev) · line 1082

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
              if (adev->pm.pp_feature & PP_GFXOFF_MASK)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx