Bug 191571

Summary: AMD APU R4 hangs during hibernation - regression
Product: Drivers Reporter: Przemek (soprwa)
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: RESOLVED CODE_FIX    
Severity: normal CC: alexdeucher, felix.schwarz
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: from 4.7 up to current Subsystem:
Regression: Yes Bisected commit-id:
Attachments: dmidecode
lscpu
dmesg
bisect log
proposed patch
possible fix

Description Przemek 2016-12-30 23:32:32 UTC
Created attachment 249371 [details]
dmidecode

I'am using Arch Linux.
After upgrade the kernel from 4.6 to 4.7 I cannot hibernate my Lenovo g50-45 netbook - AMD a6 6310 with radeon r4 Beema.
When system is triggered for hibernation screem gets dimmed and netbook hangs. I have to power it off by pressing for longer period of time the power button. Fans are getting on full rpms and machine is getting hot.

Bisected changes and the first bad commit is - drm/radeon: hard reset r600 and newer GPU when hibernating. (commit 274ad65c9d02bdcbee9bae045517864c3521d530)

Bios - file attached.
CPU info - file attached.
Log from boot/hibernate - file attached.
Bisecting log - file attached.
Comment 1 Przemek 2016-12-30 23:33:27 UTC
Created attachment 249381 [details]
lscpu
Comment 2 Przemek 2016-12-30 23:34:40 UTC
Created attachment 249391 [details]
dmesg
Comment 3 Przemek 2016-12-30 23:37:18 UTC
Created attachment 249401 [details]
bisect log
Comment 4 Felix Schwarz 2016-12-31 09:57:59 UTC
according to the reporter's bisect log (comment #3) the first bad commit is:

commit 274ad65c9d02bdcbee9bae045517864c3521d530
Author: Jérome Glisse <jglisse@redhat.com>
Date:   Fri Mar 18 16:58:39 2016 +0100

    drm/radeon: hard reset r600 and newer GPU when hibernating.
    
    Some GPU block like UVD and VCE require hard reset to be properly
    resume if there is no real powerdown of the asic like during various
    hibernation step. This patch perform such hard reset.
    
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Comment 5 Przemek 2017-01-06 18:48:57 UTC
I can confirm that this commit is makeing problems on A6 6310 APU.

I have compiled kernel 4.9 with reversed patch [274ad65c9d02bdcbee9bae045517864c3521d530] and I can hibernate without problems.

Moreover I have checked UVD hardware acceleration of h264 codec in mplayer's vdpau option and it is working correctly. I have an accelerated playback with ffmpeg12vdpau codec after resume from hibernate.

So maby forcing A6 GPU - r4 Mullins/Beema to hard reset when wakeing up from hibernate state isn't necessarily mandatory.

I am also wondering, (cause of the experimentary support of CIK GPU's in amdgpu driver as in the future GPU's from Sea Island and Southern Island families support would be implemented in amdgpu) if there is similar patch commited to amdgpu and if so I am aware that it could also affect the hibernate process on A6 6310 APU.
Comment 6 Przemek 2017-09-15 07:05:41 UTC
Created attachment 258401 [details]
proposed patch

As the problem still persist in kernel 4.13 I have made a little patch for it.
With this patch applied to source tree my laptop can hibernate and resume successfully.
As I am not a programmer please consider if this problem can be resolved in such way.
Thanks,
Przemek.
Comment 7 Alex Deucher 2017-09-15 15:57:59 UTC
Created attachment 258405 [details]
possible fix

How about just disabling the reset on all APUs.
Comment 8 Przemek 2017-09-15 17:20:33 UTC
I cant say about all APUs, but I have tested the patch, and on MULLINS chip this solution is working perfect.
Thanks,
Przemek.
Comment 9 Przemek 2017-10-05 13:27:02 UTC
Fixed upstream by commit 820608548737e315c6f93e3099b4e65bde062334.