All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: handle svm migrate init error
@ 2021-09-17 19:15 Philip Yang
  0 siblings, 0 replies; only message in thread
From: Philip Yang @ 2021-09-17 19:15 UTC (permalink / raw)
  To: amd-gfx; +Cc: Philip Yang

If svm migration init failed to create pages for device memory, set flag
to disable SVM capability, svm migrate fini skip release device pages
and mem region.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
index dab290a4d19d..21f745e0b86c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
@@ -894,6 +894,9 @@ int svm_migrate_init(struct amdgpu_device *adev)
 	r = devm_memremap_pages(adev->dev, pgmap);
 	if (IS_ERR(r)) {
 		pr_err("failed to register HMM device memory\n");
+
+		/* Disable SVM support capability */
+		pgmap->type = 0;
 		devm_release_mem_region(adev->dev, res->start,
 					res->end - res->start + 1);
 		return PTR_ERR(r);
@@ -913,6 +916,9 @@ void svm_migrate_fini(struct amdgpu_device *adev)
 {
 	struct dev_pagemap *pgmap = &adev->kfd.dev->pgmap;
 
+	if (!KFD_IS_SVM_API_SUPPORTED(adev->kfd.dev))
+		return;
+
 	devm_memunmap_pages(adev->dev, pgmap);
 	devm_release_mem_region(adev->dev, pgmap->range.start,
 				pgmap->range.end - pgmap->range.start + 1);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-17 19:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 19:15 [PATCH] drm/amdkfd: handle svm migrate init error Philip Yang

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.