AMD-GFX Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/1] drm/amdkfd: Remove redundand kfd2kgd interface lookup
@ 2020-07-01  2:33 Felix Kuehling
  2020-07-02 11:45 ` Russell, Kent
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Kuehling @ 2020-07-01  2:33 UTC (permalink / raw)
  To: amd-gfx

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>
---
 drivers/gpu/drm/amd/amdkfd/kfd_pasid.c | 31 +++++++-------------------
 1 file 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);
 }
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH 1/1] drm/amdkfd: Remove redundand kfd2kgd interface lookup
  2020-07-01  2:33 [PATCH 1/1] drm/amdkfd: Remove redundand kfd2kgd interface lookup Felix Kuehling
@ 2020-07-02 11:45 ` Russell, Kent
  0 siblings, 0 replies; 2+ messages in thread
From: Russell, Kent @ 2020-07-02 11:45 UTC (permalink / raw)
  To: Kuehling, Felix, amd-gfx

[AMD Public Use]

Reviewed-by: Kent Russell <kent.russell@amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Felix
> Kuehling
> Sent: Tuesday, June 30, 2020 10:34 PM
> To: amd-gfx@lists.freedesktop.org
> Subject: [PATCH 1/1] drm/amdkfd: Remove redundand 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>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_pasid.c | 31 +++++++-------------------
>  1 file 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);
>  }
> --
> 2.17.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.fr
> eedesktop.org%2Fmailman%2Flistinfo%2Famd-
> gfx&amp;data=02%7C01%7Ckent.russell%40amd.com%7C6064ff0aff58480be0
> ae08d81d673758%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C63
> 7291676460049430&amp;sdata=pELFzqkP3isRtcEgtYkaaTuvGB4Xtf%2BrOp615
> PARX4g%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01  2:33 [PATCH 1/1] drm/amdkfd: Remove redundand kfd2kgd interface lookup Felix Kuehling
2020-07-02 11:45 ` Russell, Kent

AMD-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/amd-gfx/0 amd-gfx/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 amd-gfx amd-gfx/ https://lore.kernel.org/amd-gfx \
		amd-gfx@lists.freedesktop.org
	public-inbox-index amd-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.amd-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git