All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Thunderbolt GPU fixes
@ 2017-02-24 19:19 ` Lukas Wunner
  0 siblings, 0 replies; 29+ messages in thread
From: Lukas Wunner @ 2017-02-24 19:19 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Michael Jamet, linux-pci-u79uwXL29TY76Z2rM5mHXA,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	platform-driver-x86-u79uwXL29TY76Z2rM5mHXA, Alex Deucher,
	Ben Skeggs, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Bjorn Helgaas, Darren Hart, Mika Westerberg, Christian Koenig,
	Andy Shevchenko

Fix Thunderbolt-related issues in apple-gmux and vga_switcheroo:

Patch [1/5] ("Recognize Thunderbolt devices") has already been subjected
to a fair amount of scrutiny over at linux-pci@, I've submitted it 5 times
total since May 2016.  With luck it may be in ack-able shape now.

Patch [2/5] amends apple-gmux to handle combined DP/Thunderbolt ports
properly on newer MacBook Pros.

Patches [3/5] to [5/5] avoid registering external Thunderbolt GPUs with
vga_switcheroo:  Dave Airlie designed vga_switcheroo to register GPUs
unconditionally.  So if a desktop box has multiple GPUs, vga_switcheroo
will see more than one discrete GPU but that's not a problem because on
desktop boxes no handler is registered and thus vga_switcheroo_enable()
is never called.  Hybrid graphics laptops on the other hand do register
a handler, but are assumed to never register more than one discrete GPU.
However once a Thunderbolt eGPU is attached to a hybrid graphics laptop,
that assumption is no longer true and things go south when vga_switcheroo
runtime suspends the external discrete GPU and then calls the handler to
cut power to the internal discrete GPU.  The driver for the internal GPU
will sit there puzzled and typically cause a lockup.

This series is just a first step towards proper handling of eGPUs, another
will be support for surprise removal:  DRM drivers need to cease MMIO and
PCI config space access once a device is gone to avoid delaying device
teardown or accessing a newly attached replacement device.  Also, MMIO
reads to removed devices return "all ones", which results in an infinite
loop e.g. in nouveau's nvkm_nsec().

The question is how to recognize device removal.  One common method is to
read the vendor register with pci_device_is_present(), but this reports
a false positive if the device is present but in D3cold.  A better method
is to let the PCIe hotplug driver recognize and cache device removal.
Keith Busch has developed patches which do exactly that, they're now at
v6 and fully reviewed by Christoph Hellwig but alas were not included in
the 4.11 PCI pull for some reason:
http://www.spinics.net/lists/linux-pci/msg58123.html

I've pushed the present series to GitHub in case anyone prefers reviewing
it in a GUI:
https://github.com/l1k/linux/commits/thunderbolt_gpu_v1

Thanks,

Lukas


Lukas Wunner (5):
  PCI: Recognize Thunderbolt devices
  apple-gmux: Don't switch external DP port on 2011+ MacBook Pros
  drm/nouveau: Don't register Thunderbolt eGPU with vga_switcheroo
  drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo
  drm/amdgpu: Don't register Thunderbolt eGPU with vga_switcheroo

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  7 +++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c    |  3 ++-
 drivers/gpu/drm/nouveau/nouveau_vga.c      | 10 +++++++++-
 drivers/gpu/drm/radeon/radeon_device.c     |  7 +++++--
 drivers/gpu/drm/radeon/radeon_kms.c        |  3 ++-
 drivers/pci/pci.h                          |  2 ++
 drivers/pci/probe.c                        | 21 ++++++++++++++++++++
 drivers/platform/x86/apple-gmux.c          | 31 +++++++++++++++++++++++++++++-
 include/linux/pci.h                        | 23 ++++++++++++++++++++++
 9 files changed, 99 insertions(+), 8 deletions(-)

-- 
2.11.0

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

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

end of thread, other threads:[~2017-03-10 12:16 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-24 19:19 [PATCH 0/5] Thunderbolt GPU fixes Lukas Wunner
2017-02-24 19:19 ` Lukas Wunner
2017-02-24 19:19 ` [PATCH 4/5] drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo Lukas Wunner
     [not found]   ` <d466d25ba40b5289f2cafa881b990bf687b29abd.1487938189.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-03-07 20:30     ` Alex Deucher
2017-03-08  5:01       ` Lukas Wunner
2017-03-08 10:46         ` Peter Wu
2017-03-08 12:22           ` Lukas Wunner
     [not found]         ` <20170308050154.GA4250-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-03-08 20:34           ` Alex Deucher
2017-03-09 10:55             ` Lukas Wunner
2017-03-09 13:57               ` Alex Deucher
2017-02-24 19:19 ` [PATCH 3/5] drm/nouveau: " Lukas Wunner
2017-02-24 20:59   ` Bjorn Helgaas
2017-03-04 10:16     ` Lukas Wunner
2017-02-24 19:19 ` [PATCH 2/5] apple-gmux: Don't switch external DP port on 2011+ MacBook Pros Lukas Wunner
     [not found] ` <cover.1487938188.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-02-24 19:19   ` [PATCH 5/5] drm/amdgpu: Don't register Thunderbolt eGPU with vga_switcheroo Lukas Wunner
2017-02-24 19:19   ` [PATCH 1/5] PCI: Recognize Thunderbolt devices Lukas Wunner
2017-02-24 19:19     ` Lukas Wunner
2017-02-24 22:17     ` Bjorn Helgaas
2017-02-24 22:17       ` Bjorn Helgaas
2017-02-25  7:40       ` Lukas Wunner
2017-02-25 14:44         ` Bjorn Helgaas
     [not found]       ` <20170224221724.GA26430-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>
2017-03-04 11:14         ` Lukas Wunner
2017-03-04 11:14           ` Lukas Wunner
2017-03-09 15:03 ` [PATCH 0/5] Thunderbolt GPU fixes Daniel Vetter
2017-03-09 15:03   ` Daniel Vetter
     [not found]   ` <20170309150347.a4k4w2sclox2365t-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2017-03-10 12:07     ` Lukas Wunner
2017-03-10 12:07       ` Lukas Wunner
2017-03-10 12:15       ` Andy Shevchenko
2017-03-10 12:15         ` Andy Shevchenko

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.