All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: dri-devel@lists.freedesktop.org, Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH v2 4/5] drm/nouveau: Don't register Thunderbolt eGPU with vga_switcheroo
Date: Fri, 10 Mar 2017 21:23:45 +0100	[thread overview]
Message-ID: <8e733152b13e7c14501ad5af45c1c5c736584111.1489145162.git.lukas@wunner.de> (raw)
In-Reply-To: <cover.1489145162.git.lukas@wunner.de>

An external Thunderbolt GPU can neither drive the laptop's panel nor be
powered off by the platform, so there's no point in registering it with
vga_switcheroo.  In fact, when the external GPU is runtime suspended,
vga_switcheroo will cut power to the internal discrete GPU, resulting in
a lockup.

Cc: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/gpu/drm/nouveau/nouveau_vga.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
index ccb597eac538..a4aacbc0cec8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_vga.c
+++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
@@ -95,6 +95,10 @@ nouveau_vga_init(struct nouveau_drm *drm)
 
 	vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode);
 
+	/* don't register Thunderbolt eGPU with vga_switcheroo */
+	if (pci_is_thunderbolt_attached(dev->pdev))
+		return;
+
 	if (nouveau_runtime_pm == 1)
 		runtime = true;
 	if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
@@ -111,6 +115,11 @@ nouveau_vga_fini(struct nouveau_drm *drm)
 	struct drm_device *dev = drm->dev;
 	bool runtime = false;
 
+	vga_client_register(dev->pdev, NULL, NULL, NULL);
+
+	if (pci_is_thunderbolt_attached(dev->pdev))
+		return;
+
 	if (nouveau_runtime_pm == 1)
 		runtime = true;
 	if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
@@ -119,7 +128,6 @@ nouveau_vga_fini(struct nouveau_drm *drm)
 	vga_switcheroo_unregister_client(dev->pdev);
 	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
 		vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
-	vga_client_register(dev->pdev, NULL, NULL, NULL);
 }
 
 
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-03-10 20:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 20:23 [PATCH v2 0/5] Thunderbolt GPU fixes Lukas Wunner
2017-03-10 20:23 ` [PATCH v2 5/5] apple-gmux: Don't switch external DP port on 2011+ MacBook Pros Lukas Wunner
2017-03-10 20:23 ` [PATCH v2 2/5] drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo Lukas Wunner
2017-03-10 20:23 ` [PATCH v2 1/5] PCI: Recognize Thunderbolt devices Lukas Wunner
2017-03-10 20:47   ` Bjorn Helgaas
2017-03-11  8:22     ` Lukas Wunner
2017-03-10 20:23 ` Lukas Wunner [this message]
2017-03-10 20:23 ` [PATCH v2 3/5] drm/amdgpu: Don't register Thunderbolt eGPU with vga_switcheroo Lukas Wunner
2017-03-18  7:39 ` [PATCH v2 0/5] Thunderbolt GPU fixes Lukas Wunner
2017-03-25  8:05   ` Lukas Wunner
2017-03-25 21:06     ` Daniel Vetter
2017-03-26 15:25       ` Lukas Wunner
2017-03-31 10:11 ` Lukas Wunner
2017-03-31 13:30   ` Bjorn Helgaas
2017-04-05  8:29     ` Lukas Wunner

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=8e733152b13e7c14501ad5af45c1c5c736584111.1489145162.git.lukas@wunner.de \
    --to=lukas@wunner.de \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.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.