From: Lukas Wunner <lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Cc: Michael Jamet <michael.jamet-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>, Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>, Darren Hart <dvhart-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>, Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>, Christian Koenig <christian.koenig-5C7GfCeVMHo@public.gmane.org>, Andy Shevchenko <andy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> Subject: [PATCH 0/5] Thunderbolt GPU fixes Date: Fri, 24 Feb 2017 20:19:45 +0100 [thread overview] Message-ID: <cover.1487938188.git.lukas@wunner.de> (raw) 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
WARNING: multiple messages have this Message-ID (diff)
From: Lukas Wunner <lukas@wunner.de> To: dri-devel@lists.freedesktop.org Cc: Bjorn Helgaas <bhelgaas@google.com>, Michael Jamet <michael.jamet@intel.com>, Mika Westerberg <mika.westerberg@linux.intel.com>, linux-pci@vger.kernel.org, Darren Hart <dvhart@infradead.org>, Andy Shevchenko <andy@infradead.org>, platform-driver-x86@vger.kernel.org, Ben Skeggs <bskeggs@redhat.com>, nouveau@lists.freedesktop.org, Alex Deucher <alexander.deucher@amd.com>, Christian Koenig <christian.koenig@amd.com>, amd-gfx@lists.freedesktop.org, Peter Wu <peter@lekensteyn.nl> Subject: [PATCH 0/5] Thunderbolt GPU fixes Date: Fri, 24 Feb 2017 20:19:45 +0100 [thread overview] Message-ID: <cover.1487938188.git.lukas@wunner.de> (raw) 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
next reply other threads:[~2017-02-24 19:19 UTC|newest] Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-24 19:19 Lukas Wunner [this message] 2017-02-24 19:19 ` [PATCH 0/5] Thunderbolt GPU fixes 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
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=cover.1487938188.git.lukas@wunner.de \ --to=lukas-jfq808j9c/izqb+pc5nmwq@public.gmane.org \ --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \ --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \ --cc=andy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \ --cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \ --cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \ --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \ --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \ --cc=dvhart-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \ --cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=michael.jamet-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \ --cc=mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \ --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \ --cc=platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@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: linkBe 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.