summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c
diff options
context:
space:
mode:
authorFelix Kuehling <Felix.Kuehling@amd.com>2020-07-01 05:28:58 +0300
committerAlex Deucher <alexander.deucher@amd.com>2020-07-08 16:02:54 +0300
commitc12139118bb631d26d359f8e272cedeff0fb7516 (patch)
tree940bcf2740a6217359899c0e983ab641f4a733b3 /drivers/gpu/drm/amd/amdkfd/kfd_pasid.c
parentfa4a882008a71bf18a30c7f548572ecf19882fbd (diff)
downloadlinux-c12139118bb631d26d359f8e272cedeff0fb7516.tar.xz
drm/amdkfd: Remove redundant kfd2kgd interface lookup
kfd_pasid.c isn't using the kfd2kgd interface any more. Remove redundant code trying to look up a device for finding that interface. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Kent Russell <kent.russell@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_pasid.c')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_pasid.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c b/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c
index 33b08ff00b50..2a07c4f2cd0d 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c
@@ -25,7 +25,7 @@
#include "amdgpu_ids.h"
static unsigned int pasid_bits = 16;
-static const struct kfd2kgd_calls *kfd2kgd;
+static bool pasids_allocated; /* = false */
bool kfd_set_pasid_limit(unsigned int new_limit)
{
@@ -33,7 +33,7 @@ bool kfd_set_pasid_limit(unsigned int new_limit)
return false;
if (new_limit < (1U << pasid_bits)) {
- if (kfd2kgd)
+ if (pasids_allocated)
/* We've already allocated user PASIDs, too late to
* change the limit
*/
@@ -53,32 +53,17 @@ unsigned int kfd_get_pasid_limit(void)
unsigned int kfd_pasid_alloc(void)
{
- int r;
+ int r = amdgpu_pasid_alloc(pasid_bits);
- /* Find the first best KFD device for calling KGD */
- if (!kfd2kgd) {
- struct kfd_dev *dev = NULL;
- unsigned int i = 0;
-
- while ((kfd_topology_enum_kfd_devices(i, &dev)) == 0) {
- if (dev && dev->kfd2kgd) {
- kfd2kgd = dev->kfd2kgd;
- break;
- }
- i++;
- }
-
- if (!kfd2kgd)
- return false;
+ if (r > 0) {
+ pasids_allocated = true;
+ return r;
}
- r = amdgpu_pasid_alloc(pasid_bits);
-
- return r > 0 ? r : 0;
+ return 0;
}
void kfd_pasid_free(unsigned int pasid)
{
- if (kfd2kgd)
- amdgpu_pasid_free(pasid);
+ amdgpu_pasid_free(pasid);
}