diff options
| author | Jiaming Fan <fan.jiaming@hotmail.com> | 2026-11-10 15:19:10 +0000 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2026-11-18 01:44:40 -0500 |
| commit | 83876755d089321e426a58f365a31b27b2c77f3b (patch) | |
| tree | 4129db250a6fd5ca84d9e6f21a968e04def5e1a7 /tools/perf/scripts/python/bin | |
| parent | 11f1080ba1bd3df2b2539dab878b3e2a0a89681f (diff) | |
drm/radeon: only unregister the ATPX handler if we registered it
radeon_register_atpx_handler() registers the ATPX handler with
vga_switcheroo only when ATPX is detected, and ignores the result:
vga_switcheroo has a single handler slot and refuses a second handler
with -EINVAL. radeon_unregister_atpx_handler() calls
vga_switcheroo_unregister_handler() in either case, and that clears the
slot no matter who set it.
So unloading radeon removes a handler registered by another driver, such
as apple-gmux. No Radeon GPU is needed for this; loading and unloading
radeon is enough. amdgpu is another such driver: when radeon and amdgpu
are both loaded and both detect ATPX, only the first one gets the slot,
and unloading the other one clears it. Afterwards vga_switcheroo can no
longer switch outputs, and a client that uses the vga_switcheroo runtime
PM domain, such as nouveau on a non-Optimus machine with a v1 DSM, can
dereference the now NULL handler during runtime suspend.
Record whether the registration succeeded and unregister only in that
case. amdgpu has the same problem and gets the same fix.
Fixes: 6a9ee8af344e ("vga_switcheroo: initial implementation (v15)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiaming Fan <fan.jiaming@hotmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f90ef5de500fa47d8e2371d429700f0275e0b88d)
Cc: stable@vger.kernel.org
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
