drm/amdgpu: Init data to avoid oops while reading pp_num_states.
authorlimingyu <limingyu@uniontech.com>
Wed, 22 Apr 2020 09:01:19 +0000 (17:01 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 23 Apr 2020 19:06:41 +0000 (15:06 -0400)
commit6f81b2d047c59eb77cd04795a44245d6a52cdaec
tree68895ea3bb7878b6cab2c30cc3ddc34bfd2cbf4b
parent00aba6da21e5886e4d279bc3679cd2b4548d10f1
drm/amdgpu: Init data to avoid oops while reading pp_num_states.

For chip like CHIP_OLAND with si enabled(amdgpu.si_support=1),
the amdgpu will expose pp_num_states to the /sys directory.
In this moment, read the pp_num_states file will excute the
amdgpu_get_pp_num_states func. In our case, the data hasn't
been initialized, so the kernel will access some ilegal
address, trigger the segmentfault and system will reboot soon:

    uos@uos-PC:~$ cat /sys/devices/pci0000\:00/0000\:00\:00.0/0000\:01\:00
    .0/pp_num_states

    Message from syslogd@uos-PC at Apr 22 09:26:20 ...
     kernel:[   82.154129] Internal error: Oops: 96000004 [#1] SMP

This patch aims to fix this problem, avoid that reading file
triggers the kernel sementfault.

Signed-off-by: limingyu <limingyu@uniontech.com>
Signed-off-by: zhoubinbin <zhoubinbin@uniontech.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c