Bug 199047

Summary: [amdgpu CARRIZO] disabled backlight after S3 resume
Product: Drivers Reporter: Johannes Hirte (johannes.hirte)
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: RESOLVED CODE_FIX    
Severity: normal CC: alexdeucher, harry.wentland
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.16-rc1 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg.log
possible fix

Description Johannes Hirte 2018-03-07 13:23:14 UTC
After S3 resume, the backlight stays disabled. Re-enabling is possible with brightness-hotkeys. The regression was introduced with:

commit 4ec6ecf48c64d1da82a008f6fb0be86c4044287d (refs/bisect/bad)
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Tue Dec 12 15:20:22 2017 -0500

    drm/amdgpu: drop scratch regs save and restore from S3/S4 handling
    
    The expectation is that the base driver doesn't mess with these.
    Some components interact with these directly so let the components
    handle these directly.
    
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Acked-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

lspci:

00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1576
00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Device 1577
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Carrizo (rev c5)
00:01.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Kabini HDMI/DP Audio
00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 157b
00:02.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 157c
00:02.3 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 157c
00:02.5 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 157c
00:03.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 157b
00:08.0 Encryption controller: Advanced Micro Devices, Inc. [AMD] Device 1578
00:09.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 157d
00:09.2 Audio device: Advanced Micro Devices, Inc. [AMD] Device 157a
00:10.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller (rev 20)
00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 49)
00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 49)
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 4a)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 11)
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1570
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1571
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1572
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1573
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1574
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 1575
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
02:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01)
Comment 1 Alex Deucher 2018-03-07 17:29:36 UTC
Are you using DC?  Please attach your dmesg output.
Comment 2 Johannes Hirte 2018-03-07 22:58:00 UTC
(In reply to Alex Deucher from comment #1)
> Are you using DC?  Please attach your dmesg output.

Not using DC. dmesg after a S3 suspend/resume cycle attached
Comment 3 Johannes Hirte 2018-03-07 23:00:13 UTC
Created attachment 274617 [details]
dmesg.log
Comment 4 Alex Deucher 2018-03-07 23:07:52 UTC
Does it work with DC enabled?
Comment 5 Johannes Hirte 2018-03-08 07:54:17 UTC
(In reply to Alex Deucher from comment #4)
> Does it work with DC enabled?

With DC it works as expected. Unfortunately this is not a workaround for me, cause there is still the use-after-free.
Comment 6 Alex Deucher 2018-03-08 14:59:30 UTC
Created attachment 274621 [details]
possible fix

Does this fix it?
Comment 7 Johannes Hirte 2018-03-08 19:55:48 UTC
(In reply to Alex Deucher from comment #6)
> Created attachment 274621 [details]
> possible fix
> 
> Does this fix it?

Yes, fixed with this patch.
Comment 8 Johannes Hirte 2018-04-17 07:55:57 UTC
fixed