All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Wu <peter-VTkQYDcBqhK7DlmcbJSQ7g@public.gmane.org>
To: amd-gfx list <amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
	Nayan Deshmukh
	<nayan26deshmukh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 2/2] drm/radeon: fix power state when port pm is unavailable
Date: Wed, 23 Nov 2016 02:22:25 +0100	[thread overview]
Message-ID: <20161123012225.11586-2-peter@lekensteyn.nl> (raw)
In-Reply-To: <20161123012225.11586-1-peter-VTkQYDcBqhK7DlmcbJSQ7g@public.gmane.org>

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
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
---
 drivers/gpu/drm/radeon/radeon_atpx_handler.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index ddef0d4..298949c 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -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;
 }
 
-- 
2.10.2

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

  parent reply	other threads:[~2016-11-23  1:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23  1:22 [PATCH 1/2] drm/amdgpu: fix power state when port pm is unavailable Peter Wu
     [not found] ` <20161123012225.11586-1-peter-VTkQYDcBqhK7DlmcbJSQ7g@public.gmane.org>
2016-11-23  1:22   ` Peter Wu [this message]
2016-11-23  7:53   ` Christian König
2016-11-23 17:01   ` Alex Deucher
     [not found]     ` <CADnq5_On72XmLrE3wjD0u1=tmwghv6GofzfEGM5mhGoVtJav+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-23 17:12       ` Peter Wu
2016-11-23 17:16         ` Deucher, Alexander
     [not found]           ` <MWHPR12MB16949832E9DB44C53995493AF7B70-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-11-26  0:36             ` Mike Lothian
     [not found]               ` <CAHbf0-FgRU=6tYe2SYcm8E0ZvJuRFoqPpk77_DZdQKXdxZSsGg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-26 10:19                 ` Peter Wu
2016-11-26 11:00                   ` Mike Lothian
     [not found]                     ` <CAHbf0-HfHGt5HvAosxgVf=rgevPK3KqBCQt4cJqjDiEaQWM1pQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-26 11:20                       ` Mike Lothian
     [not found]                         ` <CAHbf0-HHFFthD3Li0wM8x5rciRreeWoE0SkQOvsENT9+ZRFEcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-26 11:38                           ` Peter Wu
2016-11-26 13:43                             ` Mike Lothian
2016-11-26 13:49                             ` Mike Lothian
     [not found]                               ` <CAHbf0-GjBMb2GfFoTADxYjfuLU=+hkJ8AcZCbh70zrpn56cD8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-26 14:14                                 ` Peter Wu
2016-11-28  5:48                                   ` Mike Lothian
     [not found]                                     ` <CAHbf0-HzBPXOqS_XLctTu-eTuxUUwP62_TcODVPwKb8T2PFrFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-28 22:28                                       ` Alex Deucher
     [not found]                                         ` <CADnq5_MfLP+Ym+beD+Oak+CTxvyMVYfb9+DQDZuR9pbBWqwQtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-29  0:58                                           ` Peter Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161123012225.11586-2-peter@lekensteyn.nl \
    --to=peter-vtkqydcbqhk7dlmcbjsq7g@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=nayan26deshmukh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.