Skip to contentSkip to conversation

drm/amdgpu: fix power state when port pm is unavailable

PATCH In review Peter Wu 5 participants 17 messages Nov 23, 2016 – Nov 29, 2016 9 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Peter Wu

author
#0 lore raw

PATCH 1/2 drm/amdgpu: fix power state when port pm is unavailable

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still be marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the first year where hybrid graphics platforms using power resources was introduced), but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505

---
Hi,

This patch is already three weeks old. One alternative idea was lowering BIOS date in PCI core, but as pcie_port_pm=force did not have the desired effect, I do not think that this would help though.

I have also not contacted linux-pci or Mika about lowering the year due to the lack of a good reason. Might do it later though once ACPICA bug 1333 is sorted out such that lowering the year actually has benefits for a Nvidia laptop (or if some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing 2f5af82eeab2 and b8c9fd5ad4b4 ("track whether if this is a hybrid graphics platform"). There have been some ifdef 0's and reverts in between, so I was not sure if adding the Fixes tag is appropriate.

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +8 -1
index 10b5ddf..951addf 100644
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
 static struct amdgpu_atpx_priv {
 	bool atpx_detected;
+	bool bridge_pm_usable;
 	/* handle for device - and atpx */
 	acpi_handle dhandle;
 	acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
 	atpx->is_hybrid = false;
 	if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
 		printk("ATPX Hybrid Graphics\n");
-		atpx->functions.power_cntl = false;
+		/*
+		 * Disable legacy PM methods only when pcie port PM is usable,
+		 * otherwise the device might fail to power off or power on.
+		 */
+		atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable;
 		atpx->is_hybrid = true;
 	}
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id,
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+	struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
 	acpi_handle dhandle, atpx_handle;
 	acpi_status status;
 
@@ -485,6 +491,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 	}
 	amdgpu_atpx_priv.dhandle = dhandle;
 	amdgpu_atpx_priv.atpx.handle = atpx_handle;
+	amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
 	return true;
 }
 
Signature · 6 lines
2.10.2

_______________________________________________
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): 20161123012225.11586-1-peter-VTkQYDcBqhK7DlmcbJSQ7g@public.gmane.org

author
#2 lore raw

PATCH 2/2 drm/radeon: fix power state when port pm is unavailable

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still be marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the first year where hybrid graphics platforms using power resources was introduced), but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505

---
 drivers/gpu/drm/radeon/radeon_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_atpx_handler.c +8 -1
index ddef0d4..298949c 100644
@@ -33,6 +33,7 @@ struct radeon_atpx {
 
 static struct radeon_atpx_priv {
 	bool atpx_detected;
+	bool bridge_pm_usable;
 	/* handle for device - and atpx */
 	acpi_handle dhandle;
 	struct radeon_atpx atpx;
@@ -199,7 +200,11 @@ static int radeon_atpx_validate(struct radeon_atpx *atpx)
 	if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
 		printk("ATPX Hybrid Graphics\n");
 		atpx->functions.power_cntl = false;
-		atpx->is_hybrid = true;
+		/*
+		 * Disable legacy PM methods only when pcie port PM is usable,
+		 * otherwise the device might fail to power off or power on.
+		 */
+		atpx->functions.power_cntl = !radeon_atpx_priv.bridge_pm_usable;
 	}
 
 	return 0;
@@ -469,6 +474,7 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id,
  */
 static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+	struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
 	acpi_handle dhandle, atpx_handle;
 	acpi_status status;
 
@@ -482,6 +488,7 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
 
 	radeon_atpx_priv.dhandle = dhandle;
 	radeon_atpx_priv.atpx.handle = atpx_handle;
+	radeon_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
 	return true;
 }
 
Signature · 6 lines
2.10.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw
In reply to a message not in the archive

Am 23.11.2016 um 02:22 schrieb Peter Wu:

Quoted 5 lines

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still be marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Quoted 8 lines

Ideally the BIOS date in the PCI core is lowered to 2013 (the first year where hybrid graphics platforms using power resources was introduced), but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505

Even when lowering the BIOS date this sounds reasonable to me in the case of pcie_port_pm=off.

But since I'm not very deep into power management the patch is only Acked-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 57 lines

---
Hi,

This patch is already three weeks old. One alternative idea was lowering BIOS date in PCI core, but as pcie_port_pm=force did not have the desired effect, I do not think that this would help though.

I have also not contacted linux-pci or Mika about lowering the year due to the lack of a good reason. Might do it later though once ACPICA bug 1333 is sorted out such that lowering the year actually has benefits for a Nvidia laptop (or if some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing 2f5af82eeab2 and b8c9fd5ad4b4 ("track whether if this is a hybrid graphics platform"). There have been some ifdef 0's and reverts in between, so I was not sure if adding the Fixes tag is appropriate.

Kind regards,
Peter

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +7 -1
index 10b5ddf..951addf 100644
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
  static struct amdgpu_atpx_priv {
  	bool atpx_detected;
+	bool bridge_pm_usable;
  	/* handle for device - and atpx */
  	acpi_handle dhandle;
  	acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
  	atpx->is_hybrid = false;
  	if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
  		printk("ATPX Hybrid Graphics\n");
-		atpx->functions.power_cntl = false;
+		/*
+		 * Disable legacy PM methods only when pcie port PM is usable,
+		 * otherwise the device might fail to power off or power on.
+		 */
+		atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable;
  		atpx->is_hybrid = true;
  	}
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id,
   */
  static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
  {
+	struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
  	acpi_handle dhandle, atpx_handle;
  	acpi_status status;
 

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev) · line 497

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
@@ -485,6 +491,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
  	}
  	amdgpu_atpx_priv.dhandle = dhandle;
  	amdgpu_atpx_priv.atpx.handle = atpx_handle;
+	amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
  	return true;
  }
 

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

Reviewed-by
#4 lore raw
In reply to a message not in the archive
Quoted 11 lines · Peter Wu

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still be marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the first year where hybrid graphics platforms using power resources was introduced), but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505

Quoted 8 lines

---
Hi,

This patch is already three weeks old. One alternative idea was lowering BIOS date in PCI core, but as pcie_port_pm=force did not have the desired effect, I do not think that this would help though.

Thanks for doing this.

Quoted 10 lines

I have also not contacted linux-pci or Mika about lowering the year due to the lack of a good reason. Might do it later though once ACPICA bug 1333 is sorted out such that lowering the year actually has benefits for a Nvidia laptop (or if some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing 2f5af82eeab2 and b8c9fd5ad4b4 ("track whether if this is a hybrid graphics platform"). There have been some ifdef 0's and reverts in between, so I was not sure if adding the Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't attempt to do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work around lack of upstream ACPI support for D3cold)
which was reverted for 4.9.

Series is:

Quoted 51 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +8 -2
index 10b5ddf..951addf 100644
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie port PM is usable,
+                * otherwise the device might fail to power off or power on.
+                */
+               atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable;
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id,
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+       struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
        return true;
 }
 
--

2.10.2

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_On72XmLrE3wjD0u1=tmwghv6GofzfEGM5mhGoVtJav+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#6 lore raw
Quoted 34 lines · Alex Deucher
Quoted 11 lines · Peter Wu

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still be marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the first year where hybrid graphics platforms using power resources was introduced), but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505

Quoted 8 lines

---
Hi,

This patch is already three weeks old. One alternative idea was lowering BIOS date in PCI core, but as pcie_port_pm=force did not have the desired effect, I do not think that this would help though.

Thanks for doing this.

Quoted 10 lines

I have also not contacted linux-pci or Mika about lowering the year due to the lack of a good reason. Might do it later though once ACPICA bug 1333 is sorted out such that lowering the year actually has benefits for a Nvidia laptop (or if some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing 2f5af82eeab2 and b8c9fd5ad4b4 ("track whether if this is a hybrid graphics platform"). There have been some ifdef 0's and reverts in between, so I was not sure if adding the Fixes tag is appropriate.

Quoted 5 lines

I don't think we need to cc stable. In kernel 4.8 we don't attempt to do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work around lack of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f | grep v4.8
v4.8

Can you double-check? v4.8 was the first kernel with D3cold support in PCI core.

Quoted 2 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 49 lines
Quoted 49 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +8 -1
index 10b5ddf..951addf 100644
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie port PM is usable,
+                * otherwise the device might fail to power off or power on.
+                */
+               atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable;
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id,
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+       struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
        return true;
 }
 
Quoted 2 lines
Quoted 2 lines

--
2.10.2

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

#7 lore raw
Quoted 58 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port pm is unavailable

Quoted 6 lines · Alex Deucher
Quoted 5 lines · Peter Wu

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still be marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Quoted 7 lines
Quoted 7 lines

Ideally the BIOS date in the PCI core is lowered to 2013 (the first year where hybrid graphics platforms using power resources was introduced), but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative idea was lowering

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have the desired

effect, I

Quoted 6 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about lowering the year due to

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once ACPICA bug 1333 is

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits for a Nvidia laptop

(or if

Quoted 4 lines
Quoted 4 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing 2f5af82eeab2 and b8c9fd5ad4b4 ("track whether if this is a hybrid graphics platform"). There

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not sure if adding

the

Quoted 5 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't attempt to do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work around

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

Quoted 7 lines

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f | grep v4.8
v4.8

Can you double-check? v4.8 was the first kernel with D3cold support in PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so yes, we should apply this to 4.8.

Alex

Quoted 54 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 9 lines

Review

Quoted 9 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +5 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie port PM is usable,
+                * otherwise the device might fail to power off or power on.
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+       struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
Quoted 12 lines
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev &&

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -1
        return true;
 }
 
--

2.10.2

_______________________________________________
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): MWHPR12MB16949832E9DB44C53995493AF7B70-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#9 lore raw

This patch is preventing my laptop from booting, I'm getting D3 error messages and atom bios stuck messages

I mistakenly saw the v2 patch and didn't realise it was for radeon not amdgpu - this branch and Linus's tree are currently not booting for me

Quoted 147 lines · Alexander
Quoted 10 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port pm is unavailable

Quoted 1 line · Alex Deucher

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still be marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the first

year

Quoted 1 line
Quoted 1 line
Quoted 1 line

where hybrid graphics platforms using power resources was

introduced),

Quoted 11 lines
Quoted 5 lines
Quoted 5 lines

but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative idea was

lowering

Quoted 9 lines

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have the desired

effect, I

Quoted 6 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about lowering the year

due to

Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once ACPICA bug

1333 is

Quoted 2 lines

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits for a Nvidia

laptop

Quoted 4 lines

(or if

Quoted 3 lines
Quoted 3 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

b8c9fd5ad4b4 ("track whether if this is a hybrid graphics

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not sure if

adding

Quoted 10 lines

the

Quoted 5 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't attempt to do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work around

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

Quoted 7 lines

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f | grep v4.8
v4.8

Can you double-check? v4.8 was the first kernel with D3cold support in PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so yes, we should apply this to 4.8.

Alex

Quoted 24 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 9 lines

Review

Quoted 9 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 14 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie port PM

is usable,

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 206

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
+                * otherwise the device might fail to power off or

power on.

Quoted 25 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 208

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+       struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool · line 494

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev &&

parent_pdev->bridge_d3;

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
        return true;
 }
 
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

--
2.10.2

_______________________________________________
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): CAHbf0-FgRU=6tYe2SYcm8E0ZvJuRFoqPpk77_DZdQKXdxZSsGg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#11 lore raw

Hi Mike,

Quoted 2 lines · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3 error messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working kernel? I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015? Does booting with runpm=0 work?

Quoted 2 lines

I mistakenly saw the v2 patch and didn't realise it was for radeon not amdgpu - this branch and Linus's tree are currently not booting for me

What do you mean by this?

Kind regards,
Peter

Quoted 146 lines
Quoted 143 lines · Alexander
Quoted 10 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port pm is unavailable

Quoted 1 line · Alex Deucher

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still be marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the first

year

Quoted 1 line
Quoted 1 line
Quoted 1 line

where hybrid graphics platforms using power resources was

introduced),

Quoted 11 lines
Quoted 5 lines
Quoted 5 lines

but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative idea was

lowering

Quoted 9 lines

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have the desired

effect, I

Quoted 6 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about lowering the year

due to

Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once ACPICA bug

1333 is

Quoted 2 lines

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits for a Nvidia

laptop

Quoted 4 lines

(or if

Quoted 3 lines
Quoted 3 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

b8c9fd5ad4b4 ("track whether if this is a hybrid graphics

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not sure if

adding

Quoted 10 lines

the

Quoted 5 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't attempt to do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work around

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

Quoted 7 lines

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f | grep v4.8
v4.8

Can you double-check? v4.8 was the first kernel with D3cold support in PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so yes, we should apply this to 4.8.

Alex

Quoted 24 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 9 lines

Review

Quoted 9 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 14 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie port PM

is usable,

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 206

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
+                * otherwise the device might fail to power off or

power on.

Quoted 21 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 208

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+       struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev &&
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -1
        return true;
 }
 
--

2.10.2

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

#12 lore raw

Hi

The previous working kernel, was the patch before this - reverting fixes it

My bios date is quite new 08/05/2016

Most of the messages fly straight off the screen, the journal isn't kept and the wifi driver also complains, will see if I can get a slow motion capture of the errors and screen shot them

Regards

Mike

Quoted 149 lines · On Sat, 26 Nov 2016 at 10:20 Peter Wu <[email protected]…

Hi Mike,

Quoted 2 lines · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3 error messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working kernel? I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015? Does booting with runpm=0 work?

Quoted 2 lines

I mistakenly saw the v2 patch and didn't realise it was for radeon not amdgpu - this branch and Linus's tree are currently not booting for me

What do you mean by this?

Kind regards,
Peter

Quoted 1 line

On Wed, 23 Nov 2016 at 17:16 Deucher, Alexander <

[email protected]>

Quoted 10 lines
Quoted 8 lines · wrote:
Quoted 8 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port pm is unavailable

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines · Alex Deucher
Quoted 1 line

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still

be

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the

first

Quoted 9 lines
Quoted 9 lines

year

Quoted 1 line
Quoted 1 line
Quoted 1 line

where hybrid graphics platforms using power resources was

introduced),

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative idea was

lowering

Quoted 2 lines

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have the

desired

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

effect, I

Quoted 6 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about lowering the

year

Quoted 6 lines
Quoted 6 lines

due to

Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once ACPICA bug

1333 is

Quoted 2 lines

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits for a

Nvidia

Quoted 7 lines
Quoted 7 lines

laptop

Quoted 4 lines

(or if

Quoted 3 lines
Quoted 3 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

b8c9fd5ad4b4 ("track whether if this is a hybrid graphics

Quoted 8 lines
Quoted 8 lines

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not sure if

adding

Quoted 4 lines

the

Quoted 3 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't

attempt to

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work around

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f | grep

v4.8

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

v4.8

Can you double-check? v4.8 was the first kernel with D3cold support

in

Quoted 39 lines
Quoted 39 lines
Quoted 1 line

PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so yes, we should apply this to 4.8.

Alex

Quoted 32 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 9 lines

Review

Quoted 9 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 205

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie port
Quoted 33 lines

PM

Quoted 2 lines
Quoted 2 lines

is usable,

Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
+                * otherwise the device might fail to power off

or

Quoted 28 lines
Quoted 28 lines

power on.

Quoted 27 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 208

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+       struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool · line 494

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev &&

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -1
        return true;
 }
 
--

2.10.2

_______________________________________________
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): CAHbf0-HfHGt5HvAosxgVf=rgevPK3KqBCQt4cJqjDiEaQWM1pQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#14 lore raw

He's some screen shots of the booting screens, apologies they're not that clear

https://imgur.com/a/V7mRA

Quoted 165 lines · On Sat, 26 Nov 2016 at 11:00 Mike Lothian…

Hi

The previous working kernel, was the patch before this - reverting fixes it

My bios date is quite new 08/05/2016

Most of the messages fly straight off the screen, the journal isn't kept and the wifi driver also complains, will see if I can get a slow motion capture of the errors and screen shot them

Regards

Mike

On Sat, 26 Nov 2016 at 10:20 Peter Wu <[email protected]> wrote:

Hi Mike,

Quoted 2 lines · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3 error messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working kernel? I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015? Does booting with runpm=0 work?

Quoted 2 lines

I mistakenly saw the v2 patch and didn't realise it was for radeon not amdgpu - this branch and Linus's tree are currently not booting for me

What do you mean by this?

Kind regards,
Peter

Quoted 1 line

On Wed, 23 Nov 2016 at 17:16 Deucher, Alexander <

[email protected]>

Quoted 10 lines
Quoted 8 lines · wrote:
Quoted 8 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port pm is unavailable

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines · Alex Deucher
Quoted 1 line

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still

be

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the

first

Quoted 9 lines
Quoted 9 lines

year

Quoted 1 line
Quoted 1 line
Quoted 1 line

where hybrid graphics platforms using power resources was

introduced),

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative idea was

lowering

Quoted 2 lines

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have the

desired

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

effect, I

Quoted 6 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about lowering the

year

Quoted 6 lines
Quoted 6 lines

due to

Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once ACPICA bug

1333 is

Quoted 2 lines

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits for a

Nvidia

Quoted 7 lines
Quoted 7 lines

laptop

Quoted 4 lines

(or if

Quoted 3 lines
Quoted 3 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

b8c9fd5ad4b4 ("track whether if this is a hybrid graphics

Quoted 8 lines
Quoted 8 lines

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not sure if

adding

Quoted 4 lines

the

Quoted 3 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't

attempt to

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work around

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f | grep

v4.8

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

v4.8

Can you double-check? v4.8 was the first kernel with D3cold support

in

Quoted 39 lines
Quoted 39 lines
Quoted 1 line

PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so yes, we should apply this to 4.8.

Alex

Quoted 32 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 9 lines

Review

Quoted 9 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 205

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie port
Quoted 34 lines

PM

Quoted 2 lines
Quoted 2 lines

is usable,

Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
+                * otherwise the device might fail to power off

or

Quoted 28 lines
Quoted 28 lines

power on.

Quoted 27 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 208

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+       struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool · line 494

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev &&

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -1
        return true;
 }
 
--

2.10.2

_______________________________________________
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): CAHbf0-HHFFthD3Li0wM8x5rciRreeWoE0SkQOvsENT9+ZRFEcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#16 lore raw

Hi Mike,

To grab console output, you could also try to blacklist amdgpu at startup and load it later.

Can you provide your acpidump (and lspci -nn, especially if you do not have a dmesg).

This is the call chain:

+ amdgpu_atpx_detect
+ amdgpu_atpx_pci_probe_handle
+ return if ATPX ACPI handle cannot be found
+ set amdgpu_atpx_priv.bridge_pm_usable
+ amdgpu_atpx_init
+ amdgpu_atpx_validate
+ use amdgpu_atpx_priv.bridge_pm_usable

I wonder whether newer devices remove ATPX completely. If that is the case (please provide acpidump!), can you try this hack:

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
index 951addf..5c23382 100644
@@ -487,6 +487,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 	status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
 	if (ACPI_FAILURE(status)) {
 		amdgpu_atpx_priv.other_handle = dhandle;
+		amdgpu_atpx_priv.bridge_pm_usable = true;
 		return false;
 	}
 	amdgpu_atpx_priv.dhandle = dhandle;

This is not intended for merging, but just testing a hypothesis.

Kind regards,
Peter

Quoted 204 lines · Mike Lothian

He's some screen shots of the booting screens, apologies they're not that clear

https://imgur.com/a/V7mRA

Quoted 197 lines · On Sat, 26 Nov 2016 at 11:00 Mike Lothian <[email protected]> wrote:

Hi

The previous working kernel, was the patch before this - reverting fixes it

My bios date is quite new 08/05/2016

Most of the messages fly straight off the screen, the journal isn't kept and the wifi driver also complains, will see if I can get a slow motion capture of the errors and screen shot them

Regards

Mike

On Sat, 26 Nov 2016 at 10:20 Peter Wu <[email protected]> wrote:

Hi Mike,

Quoted 2 lines · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3 error messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working kernel? I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015? Does booting with runpm=0 work?

Quoted 2 lines

I mistakenly saw the v2 patch and didn't realise it was for radeon not amdgpu - this branch and Linus's tree are currently not booting for me

What do you mean by this?

Kind regards,
Peter

Quoted 1 line

On Wed, 23 Nov 2016 at 17:16 Deucher, Alexander <

[email protected]>

Quoted 10 lines
Quoted 8 lines · wrote:
Quoted 8 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port pm is unavailable

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines · Alex Deucher
Quoted 1 line

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines

When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still

be

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the

first

Quoted 9 lines
Quoted 9 lines

year

Quoted 1 line
Quoted 1 line
Quoted 1 line

where hybrid graphics platforms using power resources was

introduced),

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

but that seems more risky at this point and would not solve the pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative idea was

lowering

Quoted 2 lines

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have the

desired

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

effect, I

Quoted 6 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about lowering the

year

Quoted 6 lines
Quoted 6 lines

due to

Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once ACPICA bug

1333 is

Quoted 2 lines

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits for a

Nvidia

Quoted 7 lines
Quoted 7 lines

laptop

Quoted 4 lines

(or if

Quoted 3 lines
Quoted 3 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

b8c9fd5ad4b4 ("track whether if this is a hybrid graphics

Quoted 8 lines
Quoted 8 lines

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not sure if

adding

Quoted 4 lines

the

Quoted 3 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't

attempt to

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work around

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f | grep

v4.8

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

v4.8

Can you double-check? v4.8 was the first kernel with D3cold support

in

Quoted 39 lines
Quoted 39 lines
Quoted 1 line

PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so yes, we should apply this to 4.8.

Alex

Quoted 32 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 9 lines

Review

Quoted 9 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 205

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie port

PM

Quoted 2 lines
Quoted 2 lines

is usable,

Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
+                * otherwise the device might fail to power off

or

Quoted 28 lines
Quoted 28 lines

power on.

Quoted 27 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 208

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
+       struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool · line 494

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev &&

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -1
        return true;
 }
 
--

2.10.2

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

#17 lore raw

Hi

axion fireburn # acpidump > acpidump
Wrong checksum for FADT!

ACPI Dump attached

axion fireburn # lspci -nn
00:00.0 Host bridge [0600]: Intel Corporation Skylake Host Bridge/DRAM Registers [8086:1910] (rev 07)
00:01.0 PCI bridge [0604]: Intel Corporation Skylake PCIe Controller (x16) [8086:1901] (rev 07)
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 530 [8086:191b] (rev 06)
00:04.0 Signal processing controller [1180]: Intel Corporation Skylake Processor Thermal Subsystem [8086:1903] (rev 07)
00:14.0 USB controller [0c03]: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller [8086:a12f] (rev 31)
00:14.2 Signal processing controller [1180]: Intel Corporation Sunrise Point-H Thermal subsystem [8086:a131] (rev 31)
00:16.0 Communication controller [0780]: Intel Corporation Sunrise Point-H CSME HECI #1 [8086:a13a] (rev 31)
00:17.0 SATA controller [0106]: Intel Corporation Sunrise Point-H SATA Controller [AHCI mode] [8086:a103] (rev 31)
00:1c.0 PCI bridge [0604]: Intel Corporation Sunrise Point-H PCI Express Root Port #1 [8086:a110] (rev f1)
00:1c.4 PCI bridge [0604]: Intel Corporation Sunrise Point-H PCI Express Root Port #5 [8086:a114] (rev f1)
00:1c.5 PCI bridge [0604]: Intel Corporation Sunrise Point-H PCI Express Root Port #6 [8086:a115] (rev f1)
00:1c.6 PCI bridge [0604]: Intel Corporation Sunrise Point-H PCI Express Root Port #7 [8086:a116] (rev f1)
00:1d.0 PCI bridge [0604]: Intel Corporation Sunrise Point-H PCI Express Root Port #9 [8086:a118] (rev f1)
00:1f.0 ISA bridge [0601]: Intel Corporation Sunrise Point-H LPC Controller [8086:a14e] (rev 31)
00:1f.2 Memory controller [0580]: Intel Corporation Sunrise Point-H PMC [8086:a121] (rev 31)
00:1f.3 Audio device [0403]: Intel Corporation Sunrise Point-H HD Audio [8086:a170] (rev 31)
00:1f.4 SMBus [0c05]: Intel Corporation Sunrise Point-H SMBus [8086:a123] (rev 31)
01:00.0 Display controller [0380]: Advanced Micro Devices, Inc. [AMD/ATI] Amethyst XT [Radeon R9 M295X] [1002:6921]
3b:00.0 Ethernet controller [0200]: Qualcomm Atheros Killer E2400 Gigabit Ethernet Controller [1969:e0a1] (rev 10)
3c:00.0 Network controller [0280]: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter [168c:003e] (rev 32)
3d:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5227 PCI Express Card Reader [10ec:5227] (rev 01)
3e:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd NVMe SSD Controller [144d:a802] (rev 01)

I expected an instant lock up when insmodding the modules however that didn't happen

Please also find the dmesg attached

On Sat, 26 Nov 2016 at 11:39 Peter Wu <[email protected]> wrote:

Hi Mike,

To grab console output, you could also try to blacklist amdgpu at startup and load it later.

Can you provide your acpidump (and lspci -nn, especially if you do not have a dmesg).

This is the call chain:

+ amdgpu_atpx_detect
+ amdgpu_atpx_pci_probe_handle
+ return if ATPX ACPI handle cannot be found
+ set amdgpu_atpx_priv.bridge_pm_usable
+ amdgpu_atpx_init
+ amdgpu_atpx_validate
+ use amdgpu_atpx_priv.bridge_pm_usable

I wonder whether newer devices remove ATPX completely. If that is the case (please provide acpidump!), can you try this hack:

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index 951addf..5c23382 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -487,6 +487,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev

*pdev)

        status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
        if (ACPI_FAILURE(status)) {
                amdgpu_atpx_priv.other_handle = dhandle;
+               amdgpu_atpx_priv.bridge_pm_usable = true;
                return false;
        }
        amdgpu_atpx_priv.dhandle = dhandle;

This is not intended for merging, but just testing a hypothesis.

Kind regards,
Peter

Quoted 10 lines · Mike Lothian

He's some screen shots of the booting screens, apologies they're not that clear

https://imgur.com/a/V7mRA

Quoted 3 lines · On Sat, 26 Nov 2016 at 11:00 Mike Lothian…

Hi

The previous working kernel, was the patch before this - reverting

fixes it

Quoted 33 lines
Quoted 33 lines

My bios date is quite new 08/05/2016

Most of the messages fly straight off the screen, the journal isn't kept and the wifi driver also complains, will see if I can get a slow motion capture of the errors and screen shot them

Regards

Mike

On Sat, 26 Nov 2016 at 10:20 Peter Wu <[email protected]> wrote:

Hi Mike,

Quoted 2 lines · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3 error messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working kernel? I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015? Does booting with runpm=0 work?

Quoted 2 lines

I mistakenly saw the v2 patch and didn't realise it was for radeon not amdgpu - this branch and Linus's tree are currently not booting for me

What do you mean by this?

Kind regards,
Peter

Quoted 1 line

On Wed, 23 Nov 2016 at 17:16 Deucher, Alexander <

[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · wrote:
Quoted 6 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port pm

is

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

unavailable

Quoted 1 line · Alex Deucher

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <[email protected]>

Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line

When PCIe port PM is not enabled (system BIOS is pre-2015 or

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

pcie_port_pm=off parameter is set), legacy ATPX PM should

still

Quoted 2 lines
Quoted 2 lines

be

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

marked as supported. Otherwise the GPU can fail to power on

after

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the

first

Quoted 4 lines
Quoted 4 lines

year

Quoted 1 line
Quoted 1 line
Quoted 1 line

where hybrid graphics platforms using power resources was

introduced),

Quoted 1 line
Quoted 1 line
Quoted 1 line

but that seems more risky at this point and would not solve

the

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative idea

was

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

lowering

Quoted 2 lines

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have the

desired

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

effect, I

Quoted 2 lines
Quoted 1 line

do not think that this would help though.

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about lowering the

year

Quoted 3 lines
Quoted 3 lines

due to

Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once ACPICA

bug

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

1333 is

Quoted 2 lines

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits for a

Nvidia

Quoted 2 lines
Quoted 2 lines

laptop

Quoted 1 line

(or if

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

b8c9fd5ad4b4 ("track whether if this is a hybrid graphics

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not sure

if

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

adding

Quoted 4 lines

the

Quoted 3 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't

attempt to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work

around

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f |

grep

Quoted 4 lines
Quoted 4 lines

v4.8

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

v4.8

Can you double-check? v4.8 was the first kernel with D3cold

support

Quoted 4 lines
Quoted 4 lines

in

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so yes,

we

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

should apply this to 4.8.

Alex

Quoted 11 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 2 lines
Quoted 2 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9

++++++++-

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 3 lines

Review

Quoted 3 lines
 1 file changed, 8 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 205

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie

port

Quoted 3 lines
Quoted 3 lines

PM

Quoted 2 lines
Quoted 2 lines

is usable,

Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
+                * otherwise the device might fail to power

off

Quoted 4 lines
Quoted 4 lines

or

Quoted 3 lines
Quoted 3 lines

power on.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev

*pdev)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum · line 479

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 {
+       struct pci_dev *parent_pdev =

pci_upstream_bridge(pdev);

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev &&
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -1
        return true;
 }
 
--

2.10.2

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

#18 lore raw
In reply to Peter Wu

I can confirm the patch allows my machine to boot again

Quoted 247 lines · On Sat, 26 Nov 2016 at 11:39 Peter Wu <[email protected]…

Hi Mike,

To grab console output, you could also try to blacklist amdgpu at startup and load it later.

Can you provide your acpidump (and lspci -nn, especially if you do not have a dmesg).

This is the call chain:

+ amdgpu_atpx_detect
+ amdgpu_atpx_pci_probe_handle
+ return if ATPX ACPI handle cannot be found
+ set amdgpu_atpx_priv.bridge_pm_usable
+ amdgpu_atpx_init
+ amdgpu_atpx_validate
+ use amdgpu_atpx_priv.bridge_pm_usable

I wonder whether newer devices remove ATPX completely. If that is the case (please provide acpidump!), can you try this hack:

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
index 951addf..5c23382 100644
@@ -487,6 +487,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct
 pci_dev *pdev)
        status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
        if (ACPI_FAILURE(status)) {
                amdgpu_atpx_priv.other_handle = dhandle;
+               amdgpu_atpx_priv.bridge_pm_usable = true;
                return false;
        }
        amdgpu_atpx_priv.dhandle = dhandle;

This is not intended for merging, but just testing a hypothesis.

Kind regards,
Peter

Quoted 10 lines · Mike Lothian

He's some screen shots of the booting screens, apologies they're not that clear

https://imgur.com/a/V7mRA

Quoted 3 lines · On Sat, 26 Nov 2016 at 11:00 Mike Lothian…

Hi

The previous working kernel, was the patch before this - reverting

fixes it

Quoted 4 lines
Quoted 4 lines

My bios date is quite new 08/05/2016

Most of the messages fly straight off the screen, the journal isn't

kept

Quoted 9 lines
Quoted 9 lines

and the wifi driver also complains, will see if I can get a slow motion capture of the errors and screen shot them

Regards

Mike

On Sat, 26 Nov 2016 at 10:20 Peter Wu <[email protected]> wrote:

Quoted 7 lines
Quoted 7 lines

Hi Mike,

Quoted 2 lines · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3 error messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working

kernel?

Quoted 4 lines
Quoted 4 lines

I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015? Does booting with runpm=0 work?

Quoted 1 line

I mistakenly saw the v2 patch and didn't realise it was for radeon

not

Quoted 1 line
Quoted 1 line
Quoted 1 line

amdgpu - this branch and Linus's tree are currently not booting for

me

Quoted 8 lines
Quoted 8 lines

What do you mean by this?

Kind regards,
Peter

Quoted 1 line

On Wed, 23 Nov 2016 at 17:16 Deucher, Alexander <

[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · wrote:
Quoted 6 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port

pm is

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

unavailable

Quoted 1 line · Alex Deucher

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <

[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line

When PCIe port PM is not enabled (system BIOS is pre-2015 or

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

pcie_port_pm=off parameter is set), legacy ATPX PM should

still

Quoted 2 lines
Quoted 2 lines

be

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

marked as supported. Otherwise the GPU can fail to power on

after

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the

first

Quoted 4 lines
Quoted 4 lines

year

Quoted 1 line
Quoted 1 line
Quoted 1 line

where hybrid graphics platforms using power resources was

introduced),

Quoted 1 line
Quoted 1 line
Quoted 1 line

but that seems more risky at this point and would not solve

the

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative idea

was

Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines

lowering

Quoted 2 lines

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have the

desired

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

effect, I

Quoted 6 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about lowering

the

Quoted 4 lines
Quoted 4 lines

year

Quoted 3 lines
Quoted 3 lines

due to

Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once ACPICA

bug

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

1333 is

Quoted 2 lines

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits for a

Nvidia

Quoted 2 lines
Quoted 2 lines

laptop

Quoted 1 line

(or if

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

b8c9fd5ad4b4 ("track whether if this is a hybrid graphics

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not

sure if

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

adding

Quoted 4 lines

the

Quoted 3 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't

attempt to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work

around

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f |

grep

Quoted 4 lines
Quoted 4 lines

v4.8

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

v4.8

Can you double-check? v4.8 was the first kernel with D3cold

support

Quoted 4 lines
Quoted 4 lines

in

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so

yes, we

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

should apply this to 4.8.

Alex

Quoted 11 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 2 lines
Quoted 2 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9

++++++++-

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 3 lines

Review

Quoted 3 lines
 1 file changed, 8 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 205

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie

port

Quoted 3 lines
Quoted 3 lines

PM

Quoted 2 lines
Quoted 2 lines

is usable,

Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
+                * otherwise the device might fail to power

off

Quoted 8 lines
Quoted 8 lines

or

Quoted 7 lines
Quoted 7 lines

power on.

Quoted 6 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 208

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
Quoted 24 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev

*pdev)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum · line 479

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 {
+       struct pci_dev *parent_pdev =

pci_upstream_bridge(pdev);

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev &&

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -1
        return true;
 }
 
--

2.10.2

_______________________________________________
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): CAHbf0-GjBMb2GfFoTADxYjfuLU=+hkJ8AcZCbh70zrpn56cD8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#20 lore raw

Found the problem.

amdgpu_atpx_pci_probe_handle is used to detect the ATPX handle, but this does not necessarily have to be on the dGPU. In fact, on your machine it is located on the Intel iGPU (00:02.0):

[  134.760509] vga_switcheroo: detected switching method \_SB_.PCI0.GFX0.ATPX handle

The parent device of the iGPU (00:00.0) is the root port which has no PCIe capability, hence bridge_d3 evaluated to false.

Can you try the attached patch?

Kind regards,
Peter

Quoted 268 lines · Mike Lothian

I can confirm the patch allows my machine to boot again

Quoted 264 lines · On Sat, 26 Nov 2016 at 11:39 Peter Wu <[email protected]…

Hi Mike,

To grab console output, you could also try to blacklist amdgpu at startup and load it later.

Can you provide your acpidump (and lspci -nn, especially if you do not have a dmesg).

This is the call chain:

+ amdgpu_atpx_detect
+ amdgpu_atpx_pci_probe_handle
+ return if ATPX ACPI handle cannot be found
+ set amdgpu_atpx_priv.bridge_pm_usable
+ amdgpu_atpx_init
+ amdgpu_atpx_validate
+ use amdgpu_atpx_priv.bridge_pm_usable

I wonder whether newer devices remove ATPX completely. If that is the case (please provide acpidump!), can you try this hack:

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
index 951addf..5c23382 100644
@@ -487,6 +487,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct
 pci_dev *pdev)
        status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
        if (ACPI_FAILURE(status)) {
                amdgpu_atpx_priv.other_handle = dhandle;
+               amdgpu_atpx_priv.bridge_pm_usable = true;
                return false;
        }
        amdgpu_atpx_priv.dhandle = dhandle;

This is not intended for merging, but just testing a hypothesis.

Kind regards,
Peter

Quoted 10 lines · Mike Lothian

He's some screen shots of the booting screens, apologies they're not that clear

https://imgur.com/a/V7mRA

Quoted 3 lines · On Sat, 26 Nov 2016 at 11:00 Mike Lothian…

Hi

The previous working kernel, was the patch before this - reverting

fixes it

Quoted 4 lines
Quoted 4 lines

My bios date is quite new 08/05/2016

Most of the messages fly straight off the screen, the journal isn't

kept

Quoted 9 lines
Quoted 9 lines

and the wifi driver also complains, will see if I can get a slow motion capture of the errors and screen shot them

Regards

Mike

On Sat, 26 Nov 2016 at 10:20 Peter Wu <[email protected]> wrote:

Quoted 7 lines
Quoted 7 lines

Hi Mike,

Quoted 2 lines · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3 error messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working

kernel?

Quoted 4 lines
Quoted 4 lines

I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015? Does booting with runpm=0 work?

Quoted 1 line

I mistakenly saw the v2 patch and didn't realise it was for radeon

not

Quoted 1 line
Quoted 1 line
Quoted 1 line

amdgpu - this branch and Linus's tree are currently not booting for

me

Quoted 8 lines
Quoted 8 lines

What do you mean by this?

Kind regards,
Peter

Quoted 1 line

On Wed, 23 Nov 2016 at 17:16 Deucher, Alexander <

[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · wrote:
Quoted 6 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port

pm is

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

unavailable

Quoted 1 line · Alex Deucher

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <

[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line

When PCIe port PM is not enabled (system BIOS is pre-2015 or

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

pcie_port_pm=off parameter is set), legacy ATPX PM should

still

Quoted 2 lines
Quoted 2 lines

be

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

marked as supported. Otherwise the GPU can fail to power on

after

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the

first

Quoted 4 lines
Quoted 4 lines

year

Quoted 1 line
Quoted 1 line
Quoted 1 line

where hybrid graphics platforms using power resources was

introduced),

Quoted 1 line
Quoted 1 line
Quoted 1 line

but that seems more risky at this point and would not solve

the

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative idea

was

Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines

lowering

Quoted 2 lines

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have the

desired

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

effect, I

Quoted 6 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about lowering

the

Quoted 4 lines
Quoted 4 lines

year

Quoted 3 lines
Quoted 3 lines

due to

Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once ACPICA

bug

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

1333 is

Quoted 2 lines

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits for a

Nvidia

Quoted 2 lines
Quoted 2 lines

laptop

Quoted 1 line

(or if

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

b8c9fd5ad4b4 ("track whether if this is a hybrid graphics

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not

sure if

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

adding

Quoted 4 lines

the

Quoted 3 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't

attempt to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work

around

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains c39b487f195b93235ee76384427467786f7bf29f |

grep

Quoted 4 lines
Quoted 4 lines

v4.8

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

v4.8

Can you double-check? v4.8 was the first kernel with D3cold

support

Quoted 4 lines
Quoted 4 lines

in

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so

yes, we

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

should apply this to 4.8.

Alex

Quoted 11 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 2 lines
Quoted 2 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9

++++++++-

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 3 lines

Review

Quoted 3 lines
 1 file changed, 8 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct · line 205

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when pcie

port

Quoted 3 lines
Quoted 3 lines

PM

Quoted 2 lines
Quoted 2 lines

is usable,

Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
+                * otherwise the device might fail to power

off

Quoted 4 lines
Quoted 4 lines

or

Quoted 3 lines
Quoted 3 lines

power on.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev

*pdev)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_power_state(enum · line 479

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 {
+       struct pci_dev *parent_pdev =

pci_upstream_bridge(pdev);

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev &&
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -1
        return true;
 }
 
--

2.10.2

From 483607ff5c5dc6932e2f854d205cf41f9fbf26c8 Mon Sep 17 00:00:00 2001

From: Peter Wu <[email protected]>
Date: Sat, 26 Nov 2016 15:05:01 +0100
Subject: [PATCH] drm/amdgpu: fix check for port PM availability

The ATPX method does not always exist on the dGPU, it may be located at the iGPU. The parent device of the iGPU is the root port for which bridge_d3 is false. This accidentally enables the legacy PM method which conflicts with port PM and prevented the dGPU from powering on.

Fixes 1db4496f167b ("drm/amdgpu: fix power state when port pm is unavailable")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +9 -2
index 951addf..1ed085f 100644
@@ -476,7 +476,6 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id,
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
-	struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
 	acpi_handle dhandle, atpx_handle;
 	acpi_status status;
 
@@ -491,7 +490,6 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
 	}
 	amdgpu_atpx_priv.dhandle = dhandle;
 	amdgpu_atpx_priv.atpx.handle = atpx_handle;
-	amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
 	return true;
 }
 
@@ -553,17 +551,25 @@ static bool amdgpu_atpx_detect(void)
 	struct pci_dev *pdev = NULL;
 	bool has_atpx = false;
 	int vga_count = 0;
+	bool d3_supported = false;
+	struct pci_dev *parent_pdev;
 
 	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
 		vga_count++;
 
 		has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
+
+		parent_pdev = pci_upstream_bridge(pdev);
+		d3_supported |= parent_pdev && parent_pdev->bridge_d3;
 	}
 
 	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
 		vga_count++;
 
 		has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
+
+		parent_pdev = pci_upstream_bridge(pdev);
+		d3_supported |= parent_pdev && parent_pdev->bridge_d3;
 	}
 
 	if (has_atpx && vga_count == 2) {
@@ -571,6 +577,7 @@ static bool amdgpu_atpx_detect(void)
 		printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",
 		       acpi_method_name);
 		amdgpu_atpx_priv.atpx_detected = true;
+		amdgpu_atpx_priv.bridge_pm_usable = d3_supported;
 		amdgpu_atpx_init();
 		return true;
 	}
Signature · 1 line
2.10.2

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

#21 lore raw

The attached patch allows my machine to boot also

Thanks

Mike

Quoted 303 lines · On Sat, 26 Nov 2016 at 14:14 Peter Wu <[email protected]…

Found the problem.

amdgpu_atpx_pci_probe_handle is used to detect the ATPX handle, but this does not necessarily have to be on the dGPU. In fact, on your machine it is located on the Intel iGPU (00:02.0):

[  134.760509] vga_switcheroo: detected switching method

\_SB_.PCI0.GFX0.ATPX handle

The parent device of the iGPU (00:00.0) is the root port which has no PCIe capability, hence bridge_d3 evaluated to false.

Can you try the attached patch?

Kind regards,
Peter

Quoted 47 lines · Mike Lothian

I can confirm the patch allows my machine to boot again

Quoted 43 lines · On Sat, 26 Nov 2016 at 11:39 Peter Wu <[email protected]…

Hi Mike,

To grab console output, you could also try to blacklist amdgpu at startup and load it later.

Can you provide your acpidump (and lspci -nn, especially if you do not have a dmesg).

This is the call chain:

+ amdgpu_atpx_detect
+ amdgpu_atpx_pci_probe_handle
+ return if ATPX ACPI handle cannot be found
+ set amdgpu_atpx_priv.bridge_pm_usable
+ amdgpu_atpx_init
+ amdgpu_atpx_validate
+ use amdgpu_atpx_priv.bridge_pm_usable

I wonder whether newer devices remove ATPX completely. If that is the case (please provide acpidump!), can you try this hack:

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
index 951addf..5c23382 100644
@@ -487,6 +487,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct
 pci_dev *pdev)
        status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
        if (ACPI_FAILURE(status)) {
                amdgpu_atpx_priv.other_handle = dhandle;
+               amdgpu_atpx_priv.bridge_pm_usable = true;
                return false;
        }
        amdgpu_atpx_priv.dhandle = dhandle;

This is not intended for merging, but just testing a hypothesis.

Kind regards,
Peter

Quoted 1 line · Mike Lothian

He's some screen shots of the booting screens, apologies they're not

that

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

clear

https://imgur.com/a/V7mRA

On Sat, 26 Nov 2016 at 11:00 Mike Lothian <[email protected]>

Quoted 11 lines · wrote:
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines

Hi

The previous working kernel, was the patch before this - reverting

fixes it

Quoted 4 lines
Quoted 4 lines

My bios date is quite new 08/05/2016

Most of the messages fly straight off the screen, the journal isn't

kept

Quoted 1 line
Quoted 1 line

and the wifi driver also complains, will see if I can get a slow

motion

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

capture of the errors and screen shot them

Regards

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Mike

On Sat, 26 Nov 2016 at 10:20 Peter Wu <[email protected]> wrote:

Hi Mike,

Quoted 1 line · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3

error

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working

kernel?

Quoted 4 lines
Quoted 4 lines

I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015? Does booting with runpm=0 work?

Quoted 1 line

I mistakenly saw the v2 patch and didn't realise it was for

radeon

Quoted 2 lines
Quoted 2 lines

not

Quoted 1 line
Quoted 1 line
Quoted 1 line

amdgpu - this branch and Linus's tree are currently not booting

for

Quoted 9 lines
Quoted 9 lines

me

Quoted 8 lines
Quoted 8 lines

What do you mean by this?

Kind regards,
Peter

Quoted 1 line

On Wed, 23 Nov 2016 at 17:16 Deucher, Alexander <

[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · wrote:
Quoted 6 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when

port

Quoted 8 lines
Quoted 8 lines

pm is

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

unavailable

Quoted 1 line · Alex Deucher

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <

[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line

When PCIe port PM is not enabled (system BIOS is

pre-2015 or

Quoted 5 lines
Quoted 5 lines

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

pcie_port_pm=off parameter is set), legacy ATPX PM should

still

Quoted 2 lines
Quoted 2 lines

be

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

marked as supported. Otherwise the GPU can fail to power

on

Quoted 4 lines
Quoted 4 lines

after

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013

(the

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

first

Quoted 4 lines
Quoted 4 lines

year

Quoted 1 line
Quoted 1 line
Quoted 1 line

where hybrid graphics platforms using power resources was

introduced),

Quoted 1 line
Quoted 1 line
Quoted 1 line

but that seems more risky at this point and would not

solve

Quoted 4 lines
Quoted 4 lines

the

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

pcie_port_pm=off issue.

Bugzilla:

https://bugs.freedesktop.org/show_bug.cgi?id=98505

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

Reported-and-tested-by: Nayan Deshmukh

<[email protected]>

Quoted 5 lines
Quoted 5 lines

---
Hi,

This patch is already three weeks old. One alternative

idea

Quoted 4 lines
Quoted 4 lines

was

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

lowering

Quoted 2 lines

BIOS

Quoted 1 line
Quoted 1 line

date in PCI core, but as pcie_port_pm=force did not have

the

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

desired

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

effect, I

Quoted 6 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 2 lines

I have also not contacted linux-pci or Mika about

lowering

Quoted 5 lines
Quoted 5 lines

the

Quoted 4 lines
Quoted 4 lines

year

Quoted 3 lines
Quoted 3 lines

due to

Quoted 2 lines

the

Quoted 1 line
Quoted 1 line

lack of a good reason. Might do it later though once

ACPICA

Quoted 4 lines
Quoted 4 lines

bug

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

1333 is

Quoted 2 lines

sorted

Quoted 1 line
Quoted 1 line

out such that lowering the year actually has benefits

for a

Quoted 20 lines
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines

Nvidia

Quoted 10 lines
Quoted 10 lines

laptop

Quoted 4 lines

(or if

Quoted 3 lines
Quoted 3 lines

some amdgpu problem can be solved by this).

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

b8c9fd5ad4b4 ("track whether if this is a hybrid graphics

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not

sure if

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

adding

Quoted 4 lines

the

Quoted 3 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't

attempt to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work

Quoted 8 lines
Quoted 8 lines

around

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains

c39b487f195b93235ee76384427467786f7bf29f |

Quoted 26 lines
Quoted 26 lines

grep

Quoted 4 lines
Quoted 4 lines

v4.8

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

v4.8

Can you double-check? v4.8 was the first kernel with D3cold

support

Quoted 4 lines
Quoted 4 lines

in

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so

yes, we

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

should apply this to 4.8.

Alex

Quoted 11 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9

++++++++-

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int

amdgpu_atpx_validate(struct

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

amdgpu_atpx *atpx)

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when

pcie

Quoted 4 lines
Quoted 4 lines

port

Quoted 3 lines
Quoted 3 lines

PM

Quoted 2 lines
Quoted 2 lines

is usable,

Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
+                * otherwise the device might fail to

power

Quoted 10 lines
Quoted 10 lines

off

Quoted 9 lines
Quoted 9 lines

or

Quoted 8 lines
Quoted 8 lines

power on.

Quoted 7 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int · line 208

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
                atpx->is_hybrid = true;
        }
 
@@ -471,6 +476,7 @@ static int

amdgpu_atpx_power_state(enum

Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

vga_switcheroo_client_id id,

Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
  */
 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev

*pdev)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int · line 479

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 {
+       struct pci_dev *parent_pdev =

pci_upstream_bridge(pdev);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev

&&

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -1
        return true;
 }
 
--

2.10.2

_______________________________________________
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): CAHbf0-HzBPXOqS_XLctTu-eTuxUUwP62_TcODVPwKb8T2PFrFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#23 lore raw
Quoted 21 lines · Mike Lothian

The attached patch allows my machine to boot also

Thanks

Mike

Quoted 14 lines · On Sat, 26 Nov 2016 at 14:14 Peter Wu <[email protected]…

Found the problem.

amdgpu_atpx_pci_probe_handle is used to detect the ATPX handle, but this does not necessarily have to be on the dGPU. In fact, on your machine it is located on the Intel iGPU (00:02.0):

[  134.760509] vga_switcheroo: detected switching method

\_SB_.PCI0.GFX0.ATPX handle

The parent device of the iGPU (00:00.0) is the root port which has no PCIe capability, hence bridge_d3 evaluated to false.

Can you try the attached patch?

Looks good to me. Patch for radeon included as well.

Alex

Quoted 304 lines
Quoted 304 lines

Kind regards,
Peter

Quoted 299 lines · Mike Lothian

I can confirm the patch allows my machine to boot again

Quoted 295 lines · On Sat, 26 Nov 2016 at 11:39 Peter Wu <[email protected]…

Hi Mike,

To grab console output, you could also try to blacklist amdgpu at startup and load it later.

Can you provide your acpidump (and lspci -nn, especially if you do not have a dmesg).

This is the call chain:

+ amdgpu_atpx_detect
+ amdgpu_atpx_pci_probe_handle
+ return if ATPX ACPI handle cannot be found
+ set amdgpu_atpx_priv.bridge_pm_usable
+ amdgpu_atpx_init
+ amdgpu_atpx_validate
+ use amdgpu_atpx_priv.bridge_pm_usable

I wonder whether newer devices remove ATPX completely. If that is the case (please provide acpidump!), can you try this hack:

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
index 951addf..5c23382 100644
@@ -487,6 +487,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct
 pci_dev *pdev)
        status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
        if (ACPI_FAILURE(status)) {
                amdgpu_atpx_priv.other_handle = dhandle;
+               amdgpu_atpx_priv.bridge_pm_usable = true;
                return false;
        }
        amdgpu_atpx_priv.dhandle = dhandle;

This is not intended for merging, but just testing a hypothesis.

Kind regards,
Peter

Quoted 4 lines · Mike Lothian

He's some screen shots of the booting screens, apologies they're not that
clear

Quoted 8 lines

https://imgur.com/a/V7mRA

Quoted 3 lines · On Sat, 26 Nov 2016 at 11:00 Mike Lothian…

Hi

The previous working kernel, was the patch before this - reverting

fixes it

Quoted 5 lines
Quoted 5 lines

My bios date is quite new 08/05/2016

Most of the messages fly straight off the screen, the journal isn't

kept

Quoted 10 lines
Quoted 10 lines

and the wifi driver also complains, will see if I can get a slow motion
capture of the errors and screen shot them

Regards

Mike

On Sat, 26 Nov 2016 at 10:20 Peter Wu <[email protected]> wrote:

Quoted 8 lines
Quoted 8 lines

Hi Mike,

Quoted 3 lines · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3 error
messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working

kernel?

Quoted 6 lines
Quoted 6 lines

I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015?
Does booting with runpm=0 work?

Quoted 2 lines

I mistakenly saw the v2 patch and didn't realise it was for radeon

not

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

amdgpu - this branch and Linus's tree are currently not booting for

me

Quoted 10 lines
Quoted 10 lines

What do you mean by this?

Kind regards,
Peter

Quoted 1 line

On Wed, 23 Nov 2016 at 17:16 Deucher, Alexander <

[email protected]>

Quoted 2 lines

wrote:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port

pm is

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

unavailable

Quoted 1 line · Alex Deucher

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <

[email protected]>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines

When PCIe port PM is not enabled (system BIOS is
pre-2015 or

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

pcie_port_pm=off parameter is set), legacy ATPX PM should

still

Quoted 3 lines
Quoted 3 lines

be

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

marked as supported. Otherwise the GPU can fail to power on

after

Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the

first

Quoted 6 lines
Quoted 6 lines

year

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

where hybrid graphics platforms using power resources was

introduced),

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

but that seems more risky at this point and would not solve

the

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

pcie_port_pm=off issue.

Bugzilla:
https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

<[email protected]>

Quoted 6 lines
Quoted 6 lines

---
Hi,

This patch is already three weeks old. One alternative idea

was

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

lowering

Quoted 3 lines

BIOS

Quoted 2 lines
Quoted 2 lines

date in PCI core, but as pcie_port_pm=force did not have the

desired

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

effect, I

Quoted 7 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 3 lines

I have also not contacted linux-pci or Mika about
lowering

the

Quoted 5 lines
Quoted 5 lines

year

Quoted 4 lines
Quoted 4 lines

due to

Quoted 3 lines

the

Quoted 2 lines
Quoted 2 lines

lack of a good reason. Might do it later though once ACPICA

bug

Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines

1333 is

Quoted 3 lines

sorted

Quoted 2 lines
Quoted 2 lines

out such that lowering the year actually has benefits for a

Nvidia

Quoted 4 lines
Quoted 4 lines

laptop

Quoted 3 lines

(or if

Quoted 2 lines
Quoted 2 lines

some amdgpu problem can be solved by this).

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

b8c9fd5ad4b4 ("track whether if this is a hybrid
graphics

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not

sure if

Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

adding

Quoted 5 lines

the

Quoted 4 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't

attempt to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work

around

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains
c39b487f195b93235ee76384427467786f7bf29f |

grep

Quoted 4 lines
Quoted 4 lines

v4.8

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

v4.8

Can you double-check? v4.8 was the first kernel with D3cold

support

Quoted 4 lines
Quoted 4 lines

in

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so

yes, we

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

should apply this to 4.8.

Alex

Quoted 11 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 2 lines
Quoted 2 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9

++++++++-

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 4 lines
Quoted 4 lines
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int

amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when

pcie

port

Quoted 4 lines
Quoted 4 lines

PM

Quoted 3 lines
Quoted 3 lines

is usable,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+ * otherwise the device might fail to
power

off

Quoted 5 lines
Quoted 5 lines

or

Quoted 4 lines
Quoted 4 lines

power on.

Quoted 3 lines
Quoted 2 lines

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

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
                atpx->is_hybrid = true;
        }
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -471,6 +476,7 @@ static int

amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 2 lines
Quoted 2 lines

*/
static bool amdgpu_atpx_pci_probe_handle(struct pci_dev

*pdev)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

{
+ struct pci_dev *parent_pdev =

pci_upstream_bridge(pdev);

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 4 lines
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev

&&

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
        return true;

}

--
2.10.2

From cd21b5055cca49b30b0caaf1107a9aaeb60a447f Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Mon, 28 Nov 2016 17:23:40 -0500
Subject: [PATCH] drm/radeon: fix check for port PM availability

The ATPX method does not always exist on the dGPU, it may be located at the iGPU. The parent device of the iGPU is the root port for which bridge_d3 is false. This accidentally enables the legacy PM method which conflicts with port PM and prevented the dGPU from powering on.

Ported from amdgpu commit:
drm/amdgpu: fix check for port PM availability
from Peter Wu.

Fixes d3ac31f3b4bf9fad (drm/radeon: fix power state when port pm is unavailable (v2))
Cc Peter Wu <[email protected]>
Cc <[email protected]> # 4.8+
---
 drivers/gpu/drm/radeon/radeon_atpx_handler.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_atpx_handler.c +9 -2
index 4129b12..0ae13cd2 100644
@@ -479,7 +479,6 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id,
  */
 static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
-	struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
 	acpi_handle dhandle, atpx_handle;
 	acpi_status status;
 
@@ -493,7 +492,6 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
 
 	radeon_atpx_priv.dhandle = dhandle;
 	radeon_atpx_priv.atpx.handle = atpx_handle;
-	radeon_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
 	return true;
 }
 
@@ -555,11 +553,16 @@ static bool radeon_atpx_detect(void)
 	struct pci_dev *pdev = NULL;
 	bool has_atpx = false;
 	int vga_count = 0;
+	bool d3_supported = false;
+	struct pci_dev *parent_pdev;
 
 	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
 		vga_count++;
 
 		has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
+
+		parent_pdev = pci_upstream_bridge(pdev);
+		d3_supported |= parent_pdev && parent_pdev->bridge_d3;
 	}
 
 	/* some newer PX laptops mark the dGPU as a non-VGA display device */
@@ -567,6 +570,9 @@ static bool radeon_atpx_detect(void)
 		vga_count++;
 
 		has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
+
+		parent_pdev = pci_upstream_bridge(pdev);
+		d3_supported |= parent_pdev && parent_pdev->bridge_d3;
 	}
 
 	if (has_atpx && vga_count == 2) {
@@ -574,6 +580,7 @@ static bool radeon_atpx_detect(void)
 		printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",
 		       acpi_method_name);
 		radeon_atpx_priv.atpx_detected = true;
+		radeon_atpx_priv.bridge_pm_usable = d3_supported;
 		radeon_atpx_init();
 		return true;
 	}
Signature · 1 line
2.5.5

_______________________________________________
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_MfLP+Ym+beD+Oak+CTxvyMVYfb9+DQDZuR9pbBWqwQtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#25 lore raw
Quoted 18 lines · Alex Deucher
Quoted 17 lines · Mike Lothian

The attached patch allows my machine to boot also

Thanks

Mike

Quoted 10 lines · On Sat, 26 Nov 2016 at 14:14 Peter Wu <[email protected]> wrote:

Found the problem.

amdgpu_atpx_pci_probe_handle is used to detect the ATPX handle, but this does not necessarily have to be on the dGPU. In fact, on your machine it is located on the Intel iGPU (00:02.0):

[  134.760509] vga_switcheroo: detected switching method

\_SB_.PCI0.GFX0.ATPX handle

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

The parent device of the iGPU (00:00.0) is the root port which has no PCIe capability, hence bridge_d3 evaluated to false.

Can you try the attached patch?

Looks good to me. Patch for radeon included as well.

Alex

Thanks, the port looks good to me. (If still possible, I think you can change Reported-by also to Reported-and-tested-by for the amdgpu patch.)

Kind regards,
Peter

Quoted 391 lines
Quoted 304 lines
Quoted 304 lines

Kind regards,
Peter

Quoted 299 lines · Mike Lothian

I can confirm the patch allows my machine to boot again

Quoted 295 lines · On Sat, 26 Nov 2016 at 11:39 Peter Wu <[email protected]> wrote:

Hi Mike,

To grab console output, you could also try to blacklist amdgpu at startup and load it later.

Can you provide your acpidump (and lspci -nn, especially if you do not have a dmesg).

This is the call chain:

+ amdgpu_atpx_detect
+ amdgpu_atpx_pci_probe_handle
+ return if ATPX ACPI handle cannot be found
+ set amdgpu_atpx_priv.bridge_pm_usable
+ amdgpu_atpx_init
+ amdgpu_atpx_validate
+ use amdgpu_atpx_priv.bridge_pm_usable

I wonder whether newer devices remove ATPX completely. If that is the case (please provide acpidump!), can you try this hack:

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
index 951addf..5c23382 100644
@@ -487,6 +487,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct
 pci_dev *pdev)
        status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
        if (ACPI_FAILURE(status)) {
                amdgpu_atpx_priv.other_handle = dhandle;
+               amdgpu_atpx_priv.bridge_pm_usable = true;
                return false;
        }
        amdgpu_atpx_priv.dhandle = dhandle;

This is not intended for merging, but just testing a hypothesis.

Kind regards,
Peter

Quoted 4 lines · Mike Lothian

He's some screen shots of the booting screens, apologies they're not that
clear

Quoted 8 lines

https://imgur.com/a/V7mRA

Quoted 3 lines · On Sat, 26 Nov 2016 at 11:00 Mike Lothian <[email protected]> wrote:

Hi

The previous working kernel, was the patch before this - reverting

fixes it

Quoted 5 lines
Quoted 5 lines

My bios date is quite new 08/05/2016

Most of the messages fly straight off the screen, the journal isn't

kept

Quoted 10 lines
Quoted 10 lines

and the wifi driver also complains, will see if I can get a slow motion
capture of the errors and screen shot them

Regards

Mike

On Sat, 26 Nov 2016 at 10:20 Peter Wu <[email protected]> wrote:

Quoted 8 lines
Quoted 8 lines

Hi Mike,

Quoted 3 lines · Mike Lothian

This patch is preventing my laptop from booting, I'm getting D3 error
messages and atom bios stuck messages

Can you post a dmesg and acpidump? What was the previous working

kernel?

Quoted 6 lines
Quoted 6 lines

I suppose your BIOS date (/sys/class/dmi/id/bios_date) is pre-2015?
Does booting with runpm=0 work?

Quoted 2 lines

I mistakenly saw the v2 patch and didn't realise it was for radeon

not

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

amdgpu - this branch and Linus's tree are currently not booting for

me

Quoted 10 lines
Quoted 10 lines

What do you mean by this?

Kind regards,
Peter

Quoted 1 line

On Wed, 23 Nov 2016 at 17:16 Deucher, Alexander <

[email protected]>

Quoted 2 lines

wrote:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Peter Wu [mailto:[email protected]]
Sent: Wednesday, November 23, 2016 12:13 PM
To: Alex Deucher
Cc: amd-gfx list; Deucher, Alexander; Nayan Deshmukh
Subject: Re: [PATCH 1/2] drm/amdgpu: fix power state when port

pm is

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

unavailable

Quoted 1 line · Alex Deucher

On Tue, Nov 22, 2016 at 8:22 PM, Peter Wu <

[email protected]>

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines

When PCIe port PM is not enabled (system BIOS is
pre-2015 or

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

pcie_port_pm=off parameter is set), legacy ATPX PM should

still

Quoted 3 lines
Quoted 3 lines

be

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

marked as supported. Otherwise the GPU can fail to power on

after

Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the

first

Quoted 6 lines
Quoted 6 lines

year

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

where hybrid graphics platforms using power resources was

introduced),

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

but that seems more risky at this point and would not solve

the

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

pcie_port_pm=off issue.

Bugzilla:
https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

<[email protected]>

Quoted 6 lines
Quoted 6 lines

---
Hi,

This patch is already three weeks old. One alternative idea

was

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

lowering

Quoted 3 lines

BIOS

Quoted 2 lines
Quoted 2 lines

date in PCI core, but as pcie_port_pm=force did not have the

desired

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

effect, I

Quoted 7 lines
Quoted 1 line

do not think that this would help though.

Thanks for doing this.

Quoted 3 lines

I have also not contacted linux-pci or Mika about
lowering

the

Quoted 5 lines
Quoted 5 lines

year

Quoted 4 lines
Quoted 4 lines

due to

Quoted 3 lines

the

Quoted 2 lines
Quoted 2 lines

lack of a good reason. Might do it later though once ACPICA

bug

Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines

1333 is

Quoted 3 lines

sorted

Quoted 2 lines
Quoted 2 lines

out such that lowering the year actually has benefits for a

Nvidia

Quoted 4 lines
Quoted 4 lines

laptop

Quoted 3 lines

(or if

Quoted 2 lines
Quoted 2 lines

some amdgpu problem can be solved by this).

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

Both patches should probably be Cc stable (4.8+), fixing

2f5af82eeab2 and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

b8c9fd5ad4b4 ("track whether if this is a hybrid
graphics

platform"). There

Quoted 2 lines

have

Quoted 1 line
Quoted 1 line

been some ifdef 0's and reverts in between, so I was not

sure if

Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

adding

Quoted 5 lines

the

Quoted 4 lines
Quoted 1 line

Fixes tag is appropriate.

I don't think we need to cc stable. In kernel 4.8 we don't

attempt to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

do d3cold at all. 4.8 and older kernels have:
c63695cc5e5f685e924e25a8f9555f6e846f1fc6 (drm/amdgpu: work

around

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

lack

Quoted 2 lines

of upstream ACPI support for D3cold)
which was reverted for 4.9.

That patch was already reverted in 4.8 as far as I can see:

$ git tag --contains
c39b487f195b93235ee76384427467786f7bf29f |

grep

Quoted 4 lines
Quoted 4 lines

v4.8

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

v4.8

Can you double-check? v4.8 was the first kernel with D3cold

support

Quoted 4 lines
Quoted 4 lines

in

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

PCI core.

You are right. I was thinking d3cold went upstream in 4.9, so

yes, we

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

should apply this to 4.8.

Alex

Quoted 11 lines
Quoted 3 lines

Series is:

Thanks!

Kind regards,
Peter

Quoted 2 lines
Quoted 2 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Kind regards,
Peter

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9

++++++++-

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 4 lines
Quoted 4 lines
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Quoted 5 lines
Quoted 5 lines

index 10b5ddf..951addf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -33,6 +33,7 @@ struct amdgpu_atpx {
 
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
 static struct amdgpu_atpx_priv {
        bool atpx_detected;
+       bool bridge_pm_usable;
        /* handle for device - and atpx */
        acpi_handle dhandle;
        acpi_handle other_handle;
@@ -200,7 +201,11 @@ static int

amdgpu_atpx_validate(struct

amdgpu_atpx *atpx)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
        atpx->is_hybrid = false;
        if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
                printk("ATPX Hybrid Graphics\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -1
-               atpx->functions.power_cntl = false;
+               /*
+                * Disable legacy PM methods only when

pcie

port

Quoted 4 lines
Quoted 4 lines

PM

Quoted 3 lines
Quoted 3 lines

is usable,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+ * otherwise the device might fail to
power

off

Quoted 5 lines
Quoted 5 lines

or

Quoted 4 lines
Quoted 4 lines

power on.

Quoted 3 lines
Quoted 2 lines

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

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -0
+                */
+               atpx->functions.power_cntl =

!amdgpu_atpx_priv.bridge_pm_usable;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
                atpx->is_hybrid = true;
        }
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -471,6 +476,7 @@ static int

amdgpu_atpx_power_state(enum

vga_switcheroo_client_id id,

Quoted 2 lines
Quoted 2 lines

*/
static bool amdgpu_atpx_pci_probe_handle(struct pci_dev

*pdev)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

{
+ struct pci_dev *parent_pdev =

pci_upstream_bridge(pdev);

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static bool

Quoted 4 lines
        acpi_handle dhandle, atpx_handle;
        acpi_status status;
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +0 -0
@@ -485,6 +491,7 @@ static bool

amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +1 -0
        }
        amdgpu_atpx_priv.dhandle = dhandle;
        amdgpu_atpx_priv.atpx.handle = atpx_handle;
+       amdgpu_atpx_priv.bridge_pm_usable = parent_pdev

&&

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

parent_pdev->bridge_d3;

Quoted 5 lines
Quoted 5 lines
        return true;

}

--
2.10.2

From cd21b5055cca49b30b0caaf1107a9aaeb60a447f Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Mon, 28 Nov 2016 17:23:40 -0500
Subject: [PATCH] drm/radeon: fix check for port PM availability

The ATPX method does not always exist on the dGPU, it may be located at the iGPU. The parent device of the iGPU is the root port for which bridge_d3 is false. This accidentally enables the legacy PM method which conflicts with port PM and prevented the dGPU from powering on.

Ported from amdgpu commit:
drm/amdgpu: fix check for port PM availability
from Peter Wu.

Fixes d3ac31f3b4bf9fad (drm/radeon: fix power state when port pm is unavailable (v2))
Cc Peter Wu <[email protected]>
Cc <[email protected]> # 4.8+
---
 drivers/gpu/drm/radeon/radeon_atpx_handler.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_atpx_handler.c +9 -2
index 4129b12..0ae13cd2 100644
@@ -479,7 +479,6 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id,
  */
 static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
 {
-	struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
 	acpi_handle dhandle, atpx_handle;
 	acpi_status status;
 
@@ -493,7 +492,6 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
 
 	radeon_atpx_priv.dhandle = dhandle;
 	radeon_atpx_priv.atpx.handle = atpx_handle;
-	radeon_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
 	return true;
 }
 
@@ -555,11 +553,16 @@ static bool radeon_atpx_detect(void)
 	struct pci_dev *pdev = NULL;
 	bool has_atpx = false;
 	int vga_count = 0;
+	bool d3_supported = false;
+	struct pci_dev *parent_pdev;
 
 	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
 		vga_count++;
 
 		has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
+
+		parent_pdev = pci_upstream_bridge(pdev);
+		d3_supported |= parent_pdev && parent_pdev->bridge_d3;
 	}
 
 	/* some newer PX laptops mark the dGPU as a non-VGA display device */
@@ -567,6 +570,9 @@ static bool radeon_atpx_detect(void)
 		vga_count++;
 
 		has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
+
+		parent_pdev = pci_upstream_bridge(pdev);
+		d3_supported |= parent_pdev && parent_pdev->bridge_d3;
 	}
 
 	if (has_atpx && vga_count == 2) {
@@ -574,6 +580,7 @@ static bool radeon_atpx_detect(void)
 		printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",
 		       acpi_method_name);
 		radeon_atpx_priv.atpx_detected = true;
+		radeon_atpx_priv.bridge_pm_usable = d3_supported;
 		radeon_atpx_init();
 		return true;
 	}
Signature · 1 line
2.5.5

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