All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amkfd: bail out early if no get_atc_vmid_pasid_mapping_info
@ 2022-03-09  2:09 Yifan Zhang
  2022-03-09  2:18 ` Chen, Guchun
  0 siblings, 1 reply; 2+ messages in thread
From: Yifan Zhang @ 2022-03-09  2:09 UTC (permalink / raw)
  To: amd-gfx; +Cc: nathan, Yifan Zhang, Felix.Kuehling

it makes no sense to continue with an undefined vmid.

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reported-by: Nathan Chancellor <nathan@kernel.org>
---
 .../drm/amd/amdkfd/kfd_device_queue_manager.c | 21 +++++++++++--------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 77364afdc606..acf4f7975850 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -500,21 +500,24 @@ static int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process
 
 	pr_debug("Killing all process wavefronts\n");
 
+	if (!dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) {
+		pr_err("no vmid pasid mapping supported \n");
+		return -EOPNOTSUPP;
+	}
+
 	/* Scan all registers in the range ATC_VMID8_PASID_MAPPING ..
 	 * ATC_VMID15_PASID_MAPPING
 	 * to check which VMID the current process is mapped to.
 	 */
 
-	if (dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) {
-		for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) {
-			status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info
-					(dev->adev, vmid, &queried_pasid);
+	for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) {
+		status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info
+				(dev->adev, vmid, &queried_pasid);
 
-			if (status && queried_pasid == p->pasid) {
-				pr_debug("Killing wave fronts of vmid %d and pasid 0x%x\n",
-						vmid, p->pasid);
-				break;
-			}
+		if (status && queried_pasid == p->pasid) {
+			pr_debug("Killing wave fronts of vmid %d and pasid 0x%x\n",
+					vmid, p->pasid);
+			break;
 		}
 	}
 
-- 
2.25.1


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

* RE: [PATCH] drm/amkfd: bail out early if no get_atc_vmid_pasid_mapping_info
  2022-03-09  2:09 [PATCH] drm/amkfd: bail out early if no get_atc_vmid_pasid_mapping_info Yifan Zhang
@ 2022-03-09  2:18 ` Chen, Guchun
  0 siblings, 0 replies; 2+ messages in thread
From: Chen, Guchun @ 2022-03-09  2:18 UTC (permalink / raw)
  To: Zhang, Yifan, amd-gfx; +Cc: nathan, Zhang, Yifan, Kuehling, Felix

I think you need to add a "Fixes" tag in this patch.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Yifan Zhang
Sent: Wednesday, March 9, 2022 10:10 AM
To: amd-gfx@lists.freedesktop.org
Cc: nathan@kernel.org; Zhang, Yifan <Yifan1.Zhang@amd.com>; Kuehling, Felix <Felix.Kuehling@amd.com>
Subject: [PATCH] drm/amkfd: bail out early if no get_atc_vmid_pasid_mapping_info

it makes no sense to continue with an undefined vmid.

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reported-by: Nathan Chancellor <nathan@kernel.org>
---
 .../drm/amd/amdkfd/kfd_device_queue_manager.c | 21 +++++++++++--------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 77364afdc606..acf4f7975850 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -500,21 +500,24 @@ static int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process
 
 	pr_debug("Killing all process wavefronts\n");
 
+	if (!dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) {
+		pr_err("no vmid pasid mapping supported \n");
+		return -EOPNOTSUPP;
+	}
+
 	/* Scan all registers in the range ATC_VMID8_PASID_MAPPING ..
 	 * ATC_VMID15_PASID_MAPPING
 	 * to check which VMID the current process is mapped to.
 	 */
 
-	if (dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) {
-		for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) {
-			status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info
-					(dev->adev, vmid, &queried_pasid);
+	for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) {
+		status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info
+				(dev->adev, vmid, &queried_pasid);
 
-			if (status && queried_pasid == p->pasid) {
-				pr_debug("Killing wave fronts of vmid %d and pasid 0x%x\n",
-						vmid, p->pasid);
-				break;
-			}
+		if (status && queried_pasid == p->pasid) {
+			pr_debug("Killing wave fronts of vmid %d and pasid 0x%x\n",
+					vmid, p->pasid);
+			break;
 		}
 	}
 
-- 
2.25.1


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

end of thread, other threads:[~2022-03-09  2:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09  2:09 [PATCH] drm/amkfd: bail out early if no get_atc_vmid_pasid_mapping_info Yifan Zhang
2022-03-09  2:18 ` Chen, Guchun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.