Commit c1213911 authored by Felix Kuehling's avatar Felix Kuehling Committed by Alex Deucher

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: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: default avatarKent Russell <kent.russell@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent fa4a8820
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "amdgpu_ids.h" #include "amdgpu_ids.h"
static unsigned int pasid_bits = 16; 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) bool kfd_set_pasid_limit(unsigned int new_limit)
{ {
...@@ -33,7 +33,7 @@ bool kfd_set_pasid_limit(unsigned int new_limit) ...@@ -33,7 +33,7 @@ bool kfd_set_pasid_limit(unsigned int new_limit)
return false; return false;
if (new_limit < (1U << pasid_bits)) { if (new_limit < (1U << pasid_bits)) {
if (kfd2kgd) if (pasids_allocated)
/* We've already allocated user PASIDs, too late to /* We've already allocated user PASIDs, too late to
* change the limit * change the limit
*/ */
...@@ -53,32 +53,17 @@ unsigned int kfd_get_pasid_limit(void) ...@@ -53,32 +53,17 @@ unsigned int kfd_get_pasid_limit(void)
unsigned int kfd_pasid_alloc(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 (r > 0) {
if (!kfd2kgd) { pasids_allocated = true;
struct kfd_dev *dev = NULL; return r;
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;
} }
r = amdgpu_pasid_alloc(pasid_bits); return 0;
return r > 0 ? r : 0;
} }
void kfd_pasid_free(unsigned int pasid) void kfd_pasid_free(unsigned int pasid)
{ {
if (kfd2kgd)
amdgpu_pasid_free(pasid); amdgpu_pasid_free(pasid);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment