Skip to contentSkip to conversation

drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

PATCH In review Chengming Gui 3 participants 9 messages Mar 21, 2019 – Apr 11, 2019 7 messages not in the archive

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

PATCH 1/1 drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

use pcie_bandwidth_available to get real link state to update pcie table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -0
index 964a4d3..df8e58b 100644
@@ -3649,7 +3649,9 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
 {
 	struct pci_dev *pdev = adev->pdev;
 	enum pci_bus_speed cur_speed;
+	enum pci_bus_speed tmp_speed;
 	enum pcie_link_width cur_width;
+	u32 ret = 0;
 
 	*speed = PCI_SPEED_UNKNOWN;
 	*width = PCIE_LNK_WIDTH_UNKNOWN;
@@ -3657,6 +3659,11 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
 	while (pdev) {
 		cur_speed = pcie_get_speed_cap(pdev);
 		cur_width = pcie_get_width_cap(pdev);
+		if (adev->asic_type == CHIP_POLARIS10)
+			ret = pcie_bandwidth_available(adev->pdev, NULL,
+						       &tmp_speed, &cur_width);
+		if (!ret)
+			cur_width = PCIE_LNK_WIDTH_RESRV;
 
 		if (cur_speed != PCI_SPEED_UNKNOWN) {
 			if (*speed == PCI_SPEED_UNKNOWN)
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1553146497-26179-1-git-send-email-Jack.Gui-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 24 lines · Chengming Gui

use pcie_bandwidth_available to get real link state to update pcie table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 964a4d3..df8e58b 100644
@@ -3649,7 +3649,9 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
 {
        struct pci_dev *pdev = adev->pdev;
        enum pci_bus_speed cur_speed;
+       enum pci_bus_speed tmp_speed;
        enum pcie_link_width cur_width;
+       u32 ret = 0;
 
        *speed = PCI_SPEED_UNKNOWN;
        *width = PCIE_LNK_WIDTH_UNKNOWN;

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev, · line 3664

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -3657,6 +3659,11 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
        while (pdev) {
                cur_speed = pcie_get_speed_cap(pdev);
                cur_width = pcie_get_width_cap(pdev);
+               if (adev->asic_type == CHIP_POLARIS10)
+                       ret = pcie_bandwidth_available(adev->pdev, NULL,
+                                                      &tmp_speed, &cur_width);

Any reason to not just do this for all asics?

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
+               if (!ret)
+                       cur_width = PCIE_LNK_WIDTH_RESRV;
 
                if (cur_speed != PCI_SPEED_UNKNOWN) {
                        if (*speed == PCI_SPEED_UNKNOWN)
--

2.7.4

Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): CADnq5_PQcZfWOCab17V39wCBNkT42snm4T_PGC2YrxUfb-ZEKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#4 lore raw

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, March 21, 2019 9:24 PM
To: Gui, Jack <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

Quoted 28 lines · Chengming Gui

use pcie_bandwidth_available to get real link state to update pcie table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 964a4d3..df8e58b 100644
@@ -3649,7 +3649,9 @@ static void 
 amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,  {
        struct pci_dev *pdev = adev->pdev;
        enum pci_bus_speed cur_speed;
+       enum pci_bus_speed tmp_speed;
        enum pcie_link_width cur_width;
+       u32 ret = 0;
 
        *speed = PCI_SPEED_UNKNOWN;
        *width = PCIE_LNK_WIDTH_UNKNOWN; @@ -3657,6 +3659,11 @@ static 

void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,

        while (pdev) {
                cur_speed = pcie_get_speed_cap(pdev);
                cur_width = pcie_get_width_cap(pdev);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
+               if (adev->asic_type == CHIP_POLARIS10)
+                       ret = pcie_bandwidth_available(adev->pdev, NULL,
+                                                      &tmp_speed, 
+ &cur_width);

Any reason to not just do this for all asics?

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
+               if (!ret)
+                       cur_width = PCIE_LNK_WIDTH_RESRV;
 
                if (cur_speed != PCI_SPEED_UNKNOWN) {
                        if (*speed == PCI_SPEED_UNKNOWN)
--

2.7.4

Quoted 4 lines

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

From 02fe7463270a41df5d77c95d660528547962807a Mon Sep 17 00:00:00 2001
From: Chengming Gui <[email protected]>
Date: Thu, 21 Mar 2019 13:26:28 +0800
Subject: [PATCH] drm/amd/amdgpu: fix PCIe dpm feature issue (v3)

use pcie_bandwidth_available to get real link state to update pcie table.

v2: fix incorrect initialized return value
v3: expand the fetching method about the link width to all asics.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -0
index 964a4d3..680643f 100644
@@ -3649,7 +3649,9 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
 {
 	struct pci_dev *pdev = adev->pdev;
 	enum pci_bus_speed cur_speed;
+	enum pci_bus_speed tmp_speed;
 	enum pcie_link_width cur_width;
+	u32 ret = 1;
 
 	*speed = PCI_SPEED_UNKNOWN;
 	*width = PCIE_LNK_WIDTH_UNKNOWN;
@@ -3657,6 +3659,11 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
 	while (pdev) {
 		cur_speed = pcie_get_speed_cap(pdev);
 		cur_width = pcie_get_width_cap(pdev);
+		if (adev->asic_type == CHIP_POLARIS10)
+			ret = pcie_bandwidth_available(adev->pdev, NULL,
+						       &tmp_speed, &cur_width);
+		if (!ret)
+			cur_width = PCIE_LNK_WIDTH_RESRV;
 
 		if (cur_speed != PCI_SPEED_UNKNOWN) {
 			if (*speed == PCI_SPEED_UNKNOWN)
Signature · 1 line
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB358277A1FB21B5D3CA0C3B298B430-rweVpJHSKTr2mYjuiDFEwwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#6 lore raw

Attach correct patch again.

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

-----Original Message-----
From: Gui, Jack
Sent: Friday, March 22, 2019 10:28 AM
To: 'Alex Deucher' <[email protected]>; Xu, Feifei <[email protected]>; Zhang, Hawking <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: RE: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, March 21, 2019 9:24 PM
To: Gui, Jack <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

Quoted 28 lines · Chengming Gui

use pcie_bandwidth_available to get real link state to update pcie table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 964a4d3..df8e58b 100644
@@ -3649,7 +3649,9 @@ static void
 amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,  {
        struct pci_dev *pdev = adev->pdev;
        enum pci_bus_speed cur_speed;
+       enum pci_bus_speed tmp_speed;
        enum pcie_link_width cur_width;
+       u32 ret = 0;
 
        *speed = PCI_SPEED_UNKNOWN;
        *width = PCIE_LNK_WIDTH_UNKNOWN; @@ -3657,6 +3659,11 @@ static 

void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,

        while (pdev) {
                cur_speed = pcie_get_speed_cap(pdev);
                cur_width = pcie_get_width_cap(pdev);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
+               if (adev->asic_type == CHIP_POLARIS10)
+                       ret = pcie_bandwidth_available(adev->pdev, NULL,
+                                                      &tmp_speed, 
+ &cur_width);

Any reason to not just do this for all asics?

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
+               if (!ret)
+                       cur_width = PCIE_LNK_WIDTH_RESRV;
 
                if (cur_speed != PCI_SPEED_UNKNOWN) {
                        if (*speed == PCI_SPEED_UNKNOWN)
--

2.7.4

Quoted 4 lines

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

From 38a8ce2f79b0d035a2cd1e09d1a5d6575433c988 Mon Sep 17 00:00:00 2001
From: Chengming Gui <[email protected]>
Date: Thu, 21 Mar 2019 13:26:28 +0800
Subject: [PATCH] drm/amd/amdgpu: fix PCIe dpm feature issue (v3)

use pcie_bandwidth_available to get real link state to update pcie table.

v2: fix incorrect initialized return value
v3: expand the fetching method about the link width to all asics.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
index 964a4d3..e019d2d 100644
@@ -3649,7 +3649,9 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
 {
 	struct pci_dev *pdev = adev->pdev;
 	enum pci_bus_speed cur_speed;
+	enum pci_bus_speed tmp_speed;
 	enum pcie_link_width cur_width;
+	u32 ret = 1;
 
 	*speed = PCI_SPEED_UNKNOWN;
 	*width = PCIE_LNK_WIDTH_UNKNOWN;
@@ -3657,6 +3659,10 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
 	while (pdev) {
 		cur_speed = pcie_get_speed_cap(pdev);
 		cur_width = pcie_get_width_cap(pdev);
+		ret = pcie_bandwidth_available(adev->pdev, NULL,
+						       &tmp_speed, &cur_width);
+		if (!ret)
+			cur_width = PCIE_LNK_WIDTH_RESRV;
 
 		if (cur_speed != PCI_SPEED_UNKNOWN) {
 			if (*speed == PCI_SPEED_UNKNOWN)
Signature · 1 line
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3582A2C0BF7973C87923F94F8B430-rweVpJHSKTr2mYjuiDFEwwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by
#8 lore raw

I think you can even go a step further and just replace amdgpu_device_get_min_pci_speed_width() with pcie_bandwidth_available(). It does basically the same thing. Although, it looks like pcie_bandwidth_available() needs to be fixed up to handle gen3 speeds (PCI_EXP_LNKCAP2). Maybe something for the future once that gets fixed up. Also, no need for tmp_speed, you can just pass in NULL if you don't need the speed.

With that fixed:

Alex

Quoted 67 lines · Jack

Attach correct patch again.

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

-----Original Message-----
From: Gui, Jack
Sent: Friday, March 22, 2019 10:28 AM
To: 'Alex Deucher' <[email protected]>; Xu, Feifei <[email protected]>; Zhang, Hawking <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: RE: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, March 21, 2019 9:24 PM
To: Gui, Jack <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

Quoted 28 lines · Chengming Gui

use pcie_bandwidth_available to get real link state to update pcie table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 964a4d3..df8e58b 100644
@@ -3649,7 +3649,9 @@ static void
 amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,  {
        struct pci_dev *pdev = adev->pdev;
        enum pci_bus_speed cur_speed;
+       enum pci_bus_speed tmp_speed;
        enum pcie_link_width cur_width;
+       u32 ret = 0;
 
        *speed = PCI_SPEED_UNKNOWN;
        *width = PCIE_LNK_WIDTH_UNKNOWN; @@ -3657,6 +3659,11 @@ static

void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,

        while (pdev) {
                cur_speed = pcie_get_speed_cap(pdev);
                cur_width = pcie_get_width_cap(pdev);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
+               if (adev->asic_type == CHIP_POLARIS10)
+                       ret = pcie_bandwidth_available(adev->pdev, NULL,
+                                                      &tmp_speed,
+ &cur_width);

Any reason to not just do this for all asics?

Quoted 14 lines

Alex

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
+               if (!ret)
+                       cur_width = PCIE_LNK_WIDTH_RESRV;
 
                if (cur_speed != PCI_SPEED_UNKNOWN) {
                        if (*speed == PCI_SPEED_UNKNOWN)
--

2.7.4

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): CADnq5_MoRTG1oYTMvmXQF+6-GE4FTeyduwLSZTr9h0055OP4Kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#10 lore raw

Hi Alex,

Quoted 3 lines

Although, it looks like pcie_bandwidth_available() needs to be fixed up to handle gen3 speeds (PCI_EXP_LNKCAP2). Maybe something for the future once that gets fixed up.

Not sure whether I understood it correctly. But the pcie_bandwidth_available() seems handling pcie gen3 correctly.

[  651.460629] amdgpu 0000:03:00.0: cur_speed 22, cur_width 8

Regards,
Evan

Quoted 106 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, March 22, 2019 12:42 PM
To: Gui, Jack <[email protected]>
Cc: Xu, Feifei <[email protected]>; amd-gfx list <amd- [email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

I think you can even go a step further and just replace amdgpu_device_get_min_pci_speed_width() with pcie_bandwidth_available(). It does basically the same thing. Although, it looks like pcie_bandwidth_available() needs to be fixed up to handle gen3 speeds (PCI_EXP_LNKCAP2). Maybe something for the future once that gets fixed up. Also, no need for tmp_speed, you can just pass in NULL if you don't need the speed.

With that fixed:

Alex

Quoted 10 lines · Jack

Attach correct patch again.

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

Quoted 7 lines

-----Original Message-----
From: Gui, Jack
Sent: Friday, March 22, 2019 10:28 AM
To: 'Alex Deucher' <[email protected]>; Xu, Feifei <[email protected]>; Zhang, Hawking <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: RE: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature

issue.

Quoted 8 lines

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

Quoted 6 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, March 21, 2019 9:24 PM
To: Gui, Jack <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature

issue.

Quoted 2 lines

On Thu, Mar 21, 2019 at 1:35 AM Chengming Gui <[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines

use pcie_bandwidth_available to get real link state to update pcie table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 964a4d3..df8e58b 100644
@@ -3649,7 +3649,9 @@ static void

amdgpu_device_get_min_pci_speed_width(struct amdgpu_device

*adev, {

Quoted 9 lines
Quoted 9 lines
        struct pci_dev *pdev = adev->pdev;
        enum pci_bus_speed cur_speed;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
+       enum pci_bus_speed tmp_speed;
        enum pcie_link_width cur_width;
+       u32 ret = 0;
 
        *speed = PCI_SPEED_UNKNOWN;
        *width = PCIE_LNK_WIDTH_UNKNOWN; @@ -3657,6 +3659,11 @@

static void amdgpu_device_get_min_pci_speed_width(struct

amdgpu_device *adev,

Quoted 20 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
        while (pdev) {
                cur_speed = pcie_get_speed_cap(pdev);
                cur_width = pcie_get_width_cap(pdev);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
+               if (adev->asic_type == CHIP_POLARIS10)
+                       ret = pcie_bandwidth_available(adev->pdev, NULL,
+                                                      &tmp_speed,
+ &cur_width);

Any reason to not just do this for all asics?

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
+               if (!ret)
+                       cur_width = PCIE_LNK_WIDTH_RESRV;
 
                if (cur_speed != PCI_SPEED_UNKNOWN) {
                        if (*speed == PCI_SPEED_UNKNOWN)
--

2.7.4

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
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

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

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3344776F2AE0CE7491A49A8EE42F0-rweVpJHSKToDMgCC8P//[email protected]

#12 lore raw

It should be gen4. pcie_bandwidth_available() seems not able to support gen4.

Quoted 28 lines

-----Original Message-----
From: Quan, Evan
Sent: Thursday, April 11, 2019 3:48 PM
To: Alex Deucher <[email protected]>; Gui, Jack <[email protected]>
Cc: Xu, Feifei <[email protected]>; amd-gfx list <amd- [email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

Hi Alex,

Quoted 3 lines

Although, it looks like pcie_bandwidth_available() needs to be fixed up to handle gen3 speeds (PCI_EXP_LNKCAP2). Maybe something for the future once that gets fixed up.

Not sure whether I understood it correctly. But the pcie_bandwidth_available() seems handling pcie gen3 correctly.

[  651.460629] amdgpu 0000:03:00.0: cur_speed 22, cur_width 8

Regards,
Evan

Quoted 8 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, March 22, 2019 12:42 PM
To: Gui, Jack <[email protected]>
Cc: Xu, Feifei <[email protected]>; amd-gfx list <amd- [email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature

Quoted 107 lines

issue.

Quoted 106 lines

I think you can even go a step further and just replace amdgpu_device_get_min_pci_speed_width() with pcie_bandwidth_available(). It does basically the same thing. Although, it looks like pcie_bandwidth_available() needs to be fixed up to handle gen3 speeds (PCI_EXP_LNKCAP2). Maybe something for the future once that gets fixed up. Also, no need for tmp_speed, you can just pass in NULL if you don't need the speed.

With that fixed:

Alex

Quoted 10 lines · Jack

Attach correct patch again.

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

Quoted 7 lines

-----Original Message-----
From: Gui, Jack
Sent: Friday, March 22, 2019 10:28 AM
To: 'Alex Deucher' <[email protected]>; Xu, Feifei <[email protected]>; Zhang, Hawking <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: RE: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature

issue.

Quoted 8 lines

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

Quoted 6 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, March 21, 2019 9:24 PM
To: Gui, Jack <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature

issue.

Quoted 2 lines

On Thu, Mar 21, 2019 at 1:35 AM Chengming Gui <[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines

use pcie_bandwidth_available to get real link state to update pcie table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 964a4d3..df8e58b 100644
@@ -3649,7 +3649,9 @@ static void

amdgpu_device_get_min_pci_speed_width(struct amdgpu_device

*adev, {

Quoted 9 lines
Quoted 9 lines
        struct pci_dev *pdev = adev->pdev;
        enum pci_bus_speed cur_speed;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
+       enum pci_bus_speed tmp_speed;
        enum pcie_link_width cur_width;
+       u32 ret = 0;
 
        *speed = PCI_SPEED_UNKNOWN;
        *width = PCIE_LNK_WIDTH_UNKNOWN; @@ -3657,6 +3659,11 @@

static void amdgpu_device_get_min_pci_speed_width(struct

amdgpu_device *adev,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
        while (pdev) {
                cur_speed = pcie_get_speed_cap(pdev);
                cur_width = pcie_get_width_cap(pdev);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
+               if (adev->asic_type == CHIP_POLARIS10)
+                       ret = pcie_bandwidth_available(adev->pdev, NULL,
+                                                      &tmp_speed,
+ &cur_width);
Quoted 16 lines

Any reason to not just do this for all asics?

Alex

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
+               if (!ret)
+                       cur_width = PCIE_LNK_WIDTH_RESRV;
 
                if (cur_speed != PCI_SPEED_UNKNOWN) {
                        if (*speed == PCI_SPEED_UNKNOWN)
--

2.7.4

_______________________________________________
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

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

#13 lore raw
In reply to a message not in the archive
Quoted 8 lines · Evan

Hi Alex,

Quoted 3 lines

Although, it looks like pcie_bandwidth_available() needs to be fixed up to handle gen3 speeds (PCI_EXP_LNKCAP2). Maybe something for the future once that gets fixed up.

Not sure whether I understood it correctly. But the pcie_bandwidth_available() seems handling pcie gen3 correctly.

[  651.460629] amdgpu 0000:03:00.0: cur_speed 22, cur_width 8

PCI_EXP_LNKSTA only handles gen1 and 2. If you want to check for gen3 and 4, you need to use PCI_EXP_LNKCAP2. See pcie_get_speed_cap() for example. A similar thing needs to be done to pcie_bandwidth_available().

Alex

Quoted 118 lines

Regards,
Evan

Quoted 114 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, March 22, 2019 12:42 PM
To: Gui, Jack <[email protected]>
Cc: Xu, Feifei <[email protected]>; amd-gfx list <amd- [email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

I think you can even go a step further and just replace amdgpu_device_get_min_pci_speed_width() with pcie_bandwidth_available(). It does basically the same thing. Although, it looks like pcie_bandwidth_available() needs to be fixed up to handle gen3 speeds (PCI_EXP_LNKCAP2). Maybe something for the future once that gets fixed up. Also, no need for tmp_speed, you can just pass in NULL if you don't need the speed.

With that fixed:

Alex

Quoted 10 lines · Jack

Attach correct patch again.

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

Quoted 7 lines

-----Original Message-----
From: Gui, Jack
Sent: Friday, March 22, 2019 10:28 AM
To: 'Alex Deucher' <[email protected]>; Xu, Feifei <[email protected]>; Zhang, Hawking <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: RE: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature

issue.

Quoted 8 lines

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

Quoted 6 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, March 21, 2019 9:24 PM
To: Gui, Jack <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature

issue.

Quoted 2 lines

On Thu, Mar 21, 2019 at 1:35 AM Chengming Gui <[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines

use pcie_bandwidth_available to get real link state to update pcie table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 964a4d3..df8e58b 100644
@@ -3649,7 +3649,9 @@ static void

amdgpu_device_get_min_pci_speed_width(struct amdgpu_device

*adev, {

Quoted 9 lines
Quoted 9 lines
        struct pci_dev *pdev = adev->pdev;
        enum pci_bus_speed cur_speed;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
+       enum pci_bus_speed tmp_speed;
        enum pcie_link_width cur_width;
+       u32 ret = 0;
 
        *speed = PCI_SPEED_UNKNOWN;
        *width = PCIE_LNK_WIDTH_UNKNOWN; @@ -3657,6 +3659,11 @@

static void amdgpu_device_get_min_pci_speed_width(struct

amdgpu_device *adev,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
        while (pdev) {
                cur_speed = pcie_get_speed_cap(pdev);
                cur_width = pcie_get_width_cap(pdev);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
+               if (adev->asic_type == CHIP_POLARIS10)
+                       ret = pcie_bandwidth_available(adev->pdev, NULL,
+                                                      &tmp_speed,
+ &cur_width);
Quoted 16 lines

Any reason to not just do this for all asics?

Alex

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
+               if (!ret)
+                       cur_width = PCIE_LNK_WIDTH_RESRV;
 
                if (cur_speed != PCI_SPEED_UNKNOWN) {
                        if (*speed == PCI_SPEED_UNKNOWN)
--

2.7.4

_______________________________________________
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

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

A message that is not in the archive (sent off-list or not yet received): CADnq5_PbPdafB58OA75tAtL-r=d6GRTGG1rzEC+8hsB1nN+U0g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#15 lore raw
Quoted 8 lines · Alex Deucher
Quoted 6 lines · Evan

Hi Alex,

Quoted 3 lines

Although, it looks like pcie_bandwidth_available() needs to be fixed up to handle gen3 speeds (PCI_EXP_LNKCAP2). Maybe something for the future once that gets fixed up.

Quoted 8 lines
Quoted 2 lines

Not sure whether I understood it correctly. But the pcie_bandwidth_available() seems handling pcie gen3 correctly.

[  651.460629] amdgpu 0000:03:00.0: cur_speed 22, cur_width 8

PCI_EXP_LNKSTA only handles gen1 and 2. If you want to check for gen3 and 4, you need to use PCI_EXP_LNKCAP2. See pcie_get_speed_cap() for example. A similar thing needs to be done to pcie_bandwidth_available().

Whoops, nevermind, I was mixing up STA and CAP. We should be able to use it today.

Alex

Quoted 121 lines

Alex

Quoted 118 lines

Regards,
Evan

Quoted 114 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, March 22, 2019 12:42 PM
To: Gui, Jack <[email protected]>
Cc: Xu, Feifei <[email protected]>; amd-gfx list <amd- [email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature issue.

I think you can even go a step further and just replace amdgpu_device_get_min_pci_speed_width() with pcie_bandwidth_available(). It does basically the same thing. Although, it looks like pcie_bandwidth_available() needs to be fixed up to handle gen3 speeds (PCI_EXP_LNKCAP2). Maybe something for the future once that gets fixed up. Also, no need for tmp_speed, you can just pass in NULL if you don't need the speed.

With that fixed:

Alex

Quoted 10 lines · Jack

Attach correct patch again.

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

Quoted 7 lines

-----Original Message-----
From: Gui, Jack
Sent: Friday, March 22, 2019 10:28 AM
To: 'Alex Deucher' <[email protected]>; Xu, Feifei <[email protected]>; Zhang, Hawking <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: RE: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature

issue.

Quoted 8 lines

Hi Alex,

Expand the fix to all asics, please help to review.

BR,
Jack Gui

Quoted 6 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, March 21, 2019 9:24 PM
To: Gui, Jack <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd/amdgpu: fix Polaris10 PCIe dpm feature

issue.

Quoted 2 lines

On Thu, Mar 21, 2019 at 1:35 AM Chengming Gui <[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines

use pcie_bandwidth_available to get real link state to update pcie table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 964a4d3..df8e58b 100644
@@ -3649,7 +3649,9 @@ static void

amdgpu_device_get_min_pci_speed_width(struct amdgpu_device

*adev, {

Quoted 9 lines
Quoted 9 lines
        struct pci_dev *pdev = adev->pdev;
        enum pci_bus_speed cur_speed;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
+       enum pci_bus_speed tmp_speed;
        enum pcie_link_width cur_width;
+       u32 ret = 0;
 
        *speed = PCI_SPEED_UNKNOWN;
        *width = PCIE_LNK_WIDTH_UNKNOWN; @@ -3657,6 +3659,11 @@

static void amdgpu_device_get_min_pci_speed_width(struct

amdgpu_device *adev,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Quoted 7 lines
        while (pdev) {
                cur_speed = pcie_get_speed_cap(pdev);
                cur_width = pcie_get_width_cap(pdev);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
+               if (adev->asic_type == CHIP_POLARIS10)
+                       ret = pcie_bandwidth_available(adev->pdev, NULL,
+                                                      &tmp_speed,
+ &cur_width);
Quoted 16 lines

Any reason to not just do this for all asics?

Alex

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
+               if (!ret)
+                       cur_width = PCIE_LNK_WIDTH_RESRV;
 
                if (cur_speed != PCI_SPEED_UNKNOWN) {
                        if (*speed == PCI_SPEED_UNKNOWN)
--

2.7.4

_______________________________________________
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

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