OSDN Git Service

drm/amdgpu: restrict debugfs register access under SR-IOV
authorYintian Tao <yttao@amd.com>
Tue, 7 Apr 2020 10:08:39 +0000 (18:08 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 13 Apr 2020 16:01:04 +0000 (12:01 -0400)
commit95a2f917387a23c8b09f4ab95e1560a69db5b1f1
tree5d624151bd3b42bea2996505804d25fe6123ff1b
parent9a785c7ad1d775f41c61bc380a98e710bc71347e
drm/amdgpu: restrict debugfs register access under SR-IOV

Under bare metal, there is no more else to take
care of the GPU register access through MMIO.
Under Virtualization, to access GPU register is
implemented through KIQ during run-time due to
world-switch.

Therefore, under SR-IOV user can only access
debugfs to r/w GPU registers when meets all
three conditions below.
- amdgpu_gpu_recovery=0
- TDR happened
- in_gpu_reset=0

v2: merge amdgpu_virt_can_access_debugfs() into
    amdgpu_virt_enable_access_debugfs()

v3: drop ret variable in amdgpu_virt_enable_access_debugfs()
    and directly return result

Signed-off-by: Yintian Tao <yttao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h