drm/amdkfd: refactor runtime pm for baco
authorRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Wed, 22 Jan 2020 00:11:03 +0000 (19:11 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 12 Feb 2020 21:00:54 +0000 (16:00 -0500)
commit9593f4d6a69b0bc9577a7edb4c79be533957c161
tree4ae1d3632f83c3ea1424cb9ae6a92999191e21ce
parent3c1224c02e995685bb386f259ae2f737eca739f3
drm/amdkfd: refactor runtime pm for baco

So far the kfd driver implemented same routines for runtime and system
wide suspend and resume (s2idle or mem). During system wide suspend the
kfd aquires an atomic lock that prevents any more user processes to
create queues and interact with kfd driver and amd gpu. This mechanism
created problem when amdgpu device is runtime suspended with BACO
enabled. Any application that relies on kfd driver fails to load because
the driver reports a locked kfd device since gpu is runtime suspended.

However, in an ideal case, when gpu is runtime  suspended the kfd driver
should be able to:

 - auto resume amdgpu driver whenever a client requests compute service
 - prevent runtime suspend for amdgpu  while kfd is in use

This change refactors the amdgpu and amdkfd drivers to support BACO and
runtime power management.

Reviewed-by: Oak Zeng <oak.zeng@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdkfd/kfd_device.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
drivers/gpu/drm/amd/amdkfd/kfd_process.c