amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards
@ 2020-01-15 17:31 Alex Deucher
  2020-01-16  1:51 ` Li, Dennis
  2020-01-16 17:27 ` Luben Tuikov
  0 siblings, 2 replies; 6+ messages in thread
From: Alex Deucher @ 2020-01-15 17:31 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

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

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index e3d466bd5c4e..b48b07bcd0fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -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)
-- 
2.24.1

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

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

* RE: [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards
  2020-01-15 17:31 [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards Alex Deucher
@ 2020-01-16  1:51 ` Li, Dennis
  2020-01-16 15:26   ` Alex Deucher
  2020-01-16 17:27 ` Luben Tuikov
  1 sibling, 1 reply; 6+ messages in thread
From: Li, Dennis @ 2020-01-16  1:51 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: Deucher, Alexander

[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 <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher
Sent: Thursday, January 16, 2020 1:32 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
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.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index e3d466bd5c4e..b48b07bcd0fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -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
amd-gfx@lists.freedesktop.org
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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards
  2020-01-16  1:51 ` Li, Dennis
@ 2020-01-16 15:26   ` Alex Deucher
  2020-01-16 15:31     ` Christian König
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Deucher @ 2020-01-16 15:26 UTC (permalink / raw)
  To: Li, Dennis; +Cc: Deucher, Alexander, amd-gfx

On Wed, Jan 15, 2020 at 8:51 PM Li, Dennis <Dennis.Li@amd.com> wrote:
>
> [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

>
> Best Regards
> Dennis Li
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher
> Sent: Thursday, January 16, 2020 1:32 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
> 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.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
>  1 file changed, 38 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index e3d466bd5c4e..b48b07bcd0fb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -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
> amd-gfx@lists.freedesktop.org
> 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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards
  2020-01-16 15:26   ` Alex Deucher
@ 2020-01-16 15:31     ` Christian König
  0 siblings, 0 replies; 6+ messages in thread
From: Christian König @ 2020-01-16 15:31 UTC (permalink / raw)
  To: Alex Deucher, Li, Dennis; +Cc: Deucher, Alexander, amd-gfx

Am 16.01.20 um 16:26 schrieb Alex Deucher:
> On Wed, Jan 15, 2020 at 8:51 PM Li, Dennis <Dennis.Li@amd.com> wrote:
>> [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.

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.

>
> Alex
>
>> Best Regards
>> Dennis Li
>> -----Original Message-----
>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher
>> Sent: Thursday, January 16, 2020 1:32 AM
>> To: amd-gfx@lists.freedesktop.org
>> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
>> 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.
>>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
>>   1 file changed, 38 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>> index e3d466bd5c4e..b48b07bcd0fb 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>> @@ -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
>> amd-gfx@lists.freedesktop.org
>> 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
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

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

* Re: [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards
  2020-01-15 17:31 [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards Alex Deucher
  2020-01-16  1:51 ` Li, Dennis
@ 2020-01-16 17:27 ` Luben Tuikov
  2020-01-16 18:07   ` Alex Deucher
  1 sibling, 1 reply; 6+ messages in thread
From: Luben Tuikov @ 2020-01-16 17:27 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: Alex Deucher

On 2020-01-15 12:31, Alex Deucher wrote:
> Switch to a blacklist so we can disable specific boards
> that are problematic.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
>  1 file changed, 38 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index e3d466bd5c4e..b48b07bcd0fb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -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 },
> +};
> +
> +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

> +		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)
> 

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

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

* Re: [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards
  2020-01-16 17:27 ` Luben Tuikov
@ 2020-01-16 18:07   ` Alex Deucher
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2020-01-16 18:07 UTC (permalink / raw)
  To: Luben Tuikov; +Cc: Alex Deucher, amd-gfx list

On Thu, Jan 16, 2020 at 12:27 PM Luben Tuikov <luben.tuikov@amd.com> wrote:
>
> On 2020-01-15 12:31, Alex Deucher wrote:
> > Switch to a blacklist so we can disable specific boards
> > that are problematic.
> >
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 42 ++++++++++++++++++++++++---
> >  1 file changed, 38 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> > index e3d466bd5c4e..b48b07bcd0fb 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> > @@ -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 },
> > +};
> > +
> > +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.

>
> 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;
> }

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

Alex

>
> Regards,
> Luben
>
> > +             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)
> >
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2020-01-16 18:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 17:31 [PATCH] drm/amdgpu: attempt to enable gfxoff on more raven1 boards Alex Deucher
2020-01-16  1:51 ` Li, Dennis
2020-01-16 15:26   ` Alex Deucher
2020-01-16 15:31     ` Christian König
2020-01-16 17:27 ` Luben Tuikov
2020-01-16 18:07   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).