From 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 13 May 2024 10:30:14 +0000 Subject: [PATCH] modify sin led gpio --- kernel/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-) diff --git a/kernel/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c b/kernel/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c index 15fff44..af5816f 100644 --- a/kernel/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c +++ b/kernel/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c @@ -22,9 +22,10 @@ #include <linux/types.h> #include "kfd_priv.h" +#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) { @@ -32,7 +33,7 @@ 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 */ @@ -50,34 +51,19 @@ return 1U << pasid_bits; } -unsigned int kfd_pasid_alloc(void) +u32 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 = kfd2kgd->alloc_pasid(pasid_bits); - - return r > 0 ? r : 0; + return 0; } -void kfd_pasid_free(unsigned int pasid) +void kfd_pasid_free(u32 pasid) { - if (kfd2kgd) - kfd2kgd->free_pasid(pasid); + amdgpu_pasid_free(pasid); } -- Gitblit v1.6.2