Skip to contentSkip to conversation

drm/amdkfd: ignore crat by default

PATCH In review Alex Deucher 6 participants 10 messages Aug 7, 2023 – Aug 11, 2023

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH v2 1/5 drm/amdkfd: ignore crat by default

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0 -4
index 49f40d9f16e86..f5a6f562e2a80 100644
@@ -1543,11 +1543,7 @@ static bool kfd_ignore_crat(void)
 	if (ignore_crat)
 		return true;
 
-#ifndef KFD_SUPPORT_IOMMU_V2
 	ret = true;
-#else
-	ret = false;
-#endif
 
 	return ret;
 }
Signature · 1 line
2.41.0
author maintainer
#1 lore raw

PATCH v2 2/5 drm/amdkfd: disable IOMMUv2 support for KV/CZ

Use the dGPU path instead. There were a lot of platform issues with IOMMU in general on these chips due to windows not enabling IOMMU at the time. The dGPU path has been used for a long time with newer APUs and works fine. This also paves the way to simplify the driver significantly.

v2: use the dGPU queue manager functions

---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c               | 6 ------
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 +-------
 2 files changed, 1 insertion(+), 13 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -6
index 4827aa72dc748..44d87e04677b4 100644
@@ -234,10 +234,6 @@ static void kfd_device_info_init(struct kfd_dev *kfd,
 		    asic_type != CHIP_TONGA)
 			kfd->device_info.supports_cwsr = true;
 
-		if (asic_type == CHIP_KAVERI ||
-		    asic_type == CHIP_CARRIZO)
-			kfd->device_info.needs_iommu_device = true;
-
 		if (asic_type != CHIP_HAWAII && !vf)
 			kfd->device_info.needs_pci_atomics = true;
 	}
@@ -250,7 +246,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
 	uint32_t gfx_target_version = 0;
 
 	switch (adev->asic_type) {
-#ifdef KFD_SUPPORT_IOMMU_V2
 #ifdef CONFIG_DRM_AMDGPU_CIK
 	case CHIP_KAVERI:
 		gfx_target_version = 70000;
@@ -263,7 +258,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
 		if (!vf)
 			f2g = &gfx_v8_kfd2kgd;
 		break;
-#endif
 #ifdef CONFIG_DRM_AMDGPU_CIK
 	case CHIP_HAWAII:
 		gfx_target_version = 70001;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -7
index 05909c366504c..53b83ffe72158 100644
@@ -2558,18 +2558,12 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_node *dev)
 	}
 
 	switch (dev->adev->asic_type) {
-	case CHIP_CARRIZO:
-		device_queue_manager_init_vi(&dqm->asic_ops);
-		break;
-
 	case CHIP_KAVERI:
-		device_queue_manager_init_cik(&dqm->asic_ops);
-		break;
-
 	case CHIP_HAWAII:
 		device_queue_manager_init_cik_hawaii(&dqm->asic_ops);
 		break;
 
+	case CHIP_CARRIZO:
 	case CHIP_TONGA:
 	case CHIP_FIJI:
 	case CHIP_POLARIS10:
Signature · 1 line
2.41.0
author maintainer
#2 lore raw

PATCH v2 3/5 drm/amdkfd: disable IOMMUv2 support for Raven

In reply to Alex Deucher

Use the dGPU path instead. There were a lot of platform issues with IOMMU in general on these chips due to windows not enabling IOMMU at the time. The dGPU path has been used for a long time with newer APUs and works fine. This also paves the way to simplify the driver significantly.

---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -7
index 44d87e04677b4..c5f5efe08df40 100644
@@ -195,11 +195,6 @@ static void kfd_device_info_init(struct kfd_dev *kfd,
 
 		kfd_device_info_set_event_interrupt_class(kfd);
 
-		/* Raven */
-		if (gc_version == IP_VERSION(9, 1, 0) ||
-		    gc_version == IP_VERSION(9, 2, 2))
-			kfd->device_info.needs_iommu_device = true;
-
 		if (gc_version < IP_VERSION(11, 0, 0)) {
 			/* Navi2x+, Navi1x+ */
 			if (gc_version == IP_VERSION(10, 3, 6))
@@ -293,7 +288,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
 			gfx_target_version = 90000;
 			f2g = &gfx_v9_kfd2kgd;
 			break;
-#ifdef KFD_SUPPORT_IOMMU_V2
 		/* Raven */
 		case IP_VERSION(9, 1, 0):
 		case IP_VERSION(9, 2, 2):
@@ -301,7 +295,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
 			if (!vf)
 				f2g = &gfx_v9_kfd2kgd;
 			break;
-#endif
 		/* Vega12 */
 		case IP_VERSION(9, 2, 1):
 			gfx_target_version = 90004;
Signature · 1 line
2.41.0
author maintainer
#3 lore raw

PATCH v2 4/5 drm/amdkfd: drop IOMMUv2 support

In reply to Alex Deucher

Now that we use the dGPU path for all APUs, drop the IOMMUv2 support.

v2: drop the now unused queue manager functions for gfx7/8 APUs

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c    |  10 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h    |   7 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |   9 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  14 -
 drivers/gpu/drm/amd/amdkfd/Kconfig            |   1 -
 drivers/gpu/drm/amd/amdkfd/Makefile           |   4 -
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c      |   3 -
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c         |  73 ----
 drivers/gpu/drm/amd/amdkfd/kfd_crat.h         |   1 -
 drivers/gpu/drm/amd/amdkfd/kfd_device.c       |  37 --
 .../drm/amd/amdkfd/kfd_device_queue_manager.c |   4 +-
 .../drm/amd/amdkfd/kfd_device_queue_manager.h |   4 -
 .../amd/amdkfd/kfd_device_queue_manager_cik.c |  81 +---
 .../amd/amdkfd/kfd_device_queue_manager_v9.c  |   2 +-
 .../amd/amdkfd/kfd_device_queue_manager_vi.c  | 133 +------
 drivers/gpu/drm/amd/amdkfd/kfd_events.c       |  82 ----
 drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c  |  45 +--
 drivers/gpu/drm/amd/amdkfd/kfd_iommu.c        | 356 ------------------
 drivers/gpu/drm/amd/amdkfd/kfd_iommu.h        |  84 -----
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c  |  27 +-
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c   |  27 +-
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h         |  18 -
 drivers/gpu/drm/amd/amdkfd/kfd_process.c      |  16 -
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c     | 111 +-----
 24 files changed, 64 insertions(+), 1085 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
 delete mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_iommu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0 -10
index 629ca1ad75a86..df633e9ce9205 100644
@@ -226,16 +226,6 @@ void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool run_pm)
 		kgd2kfd_suspend(adev->kfd.dev, run_pm);
 }
 
-int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev)
-{
-	int r = 0;
-
-	if (adev->kfd.dev)
-		r = kgd2kfd_resume_iommu(adev->kfd.dev);
-
-	return r;
-}
-
 int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm)
 {
 	int r = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +0 -7
index 082c9f4cfd344..2fe9860725bd9 100644
@@ -148,7 +148,6 @@ int amdgpu_amdkfd_init(void);
 void amdgpu_amdkfd_fini(void);
 
 void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool run_pm);
-int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev);
 int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm);
 void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev,
 			const void *ih_ring_entry);
@@ -399,7 +398,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 			 const struct kgd2kfd_shared_resources *gpu_resources);
 void kgd2kfd_device_exit(struct kfd_dev *kfd);
 void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm);
-int kgd2kfd_resume_iommu(struct kfd_dev *kfd);
 int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm);
 int kgd2kfd_pre_reset(struct kfd_dev *kfd);
 int kgd2kfd_post_reset(struct kfd_dev *kfd);
@@ -439,11 +437,6 @@ static inline void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm)
 {
 }
 
-static int __maybe_unused kgd2kfd_resume_iommu(struct kfd_dev *kfd)
-{
-	return 0;
-}
-
 static inline int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
 {
 	return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -9
index 429141039365a..722576c1e013e 100644
@@ -3300,12 +3300,6 @@ static int amdgpu_device_ip_resume(struct amdgpu_device *adev)
 {
 	int r;
 
-	if (!adev->in_s0ix) {
-		r = amdgpu_amdkfd_resume_iommu(adev);
-		if (r)
-			return r;
-	}
-
 	r = amdgpu_device_ip_resume_phase1(adev);
 	if (r)
 		return r;
@@ -5005,9 +4999,6 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
 				dev_warn(tmp_adev->dev, "asic atom init failed!");
 			} else {
 				dev_info(tmp_adev->dev, "GPU reset succeeded, trying to resume\n");
-				r = amdgpu_amdkfd_resume_iommu(tmp_adev);
-				if (r)
-					goto out;
 
 				r = amdgpu_device_ip_resume_phase1(tmp_adev);
 				if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -14
index 6a69a26ba1342..15be22a203b9b 100644
@@ -756,20 +756,6 @@ module_param(debug_largebar, int, 0444);
 MODULE_PARM_DESC(debug_largebar,
 	"Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)");
 
-/**
- * DOC: ignore_crat (int)
- * Ignore CRAT table during KFD initialization. By default, KFD uses the ACPI CRAT
- * table to get information about AMD APUs. This option can serve as a workaround on
- * systems with a broken CRAT table.
- *
- * Default is auto (according to asic type, iommu_v2, and crat table, to decide
- * whether use CRAT)
- */
-int ignore_crat;
-module_param(ignore_crat, int, 0444);
-MODULE_PARM_DESC(ignore_crat,
-	"Ignore CRAT table during KFD initialization (0 = auto (default), 1 = ignore CRAT)");
-
 /**
  * DOC: halt_if_hws_hang (int)
  * Halt if HWS hang is detected. Default value, 0, disables the halt on hang.
drivers/gpu/drm/amd/amdkfd/Kconfig +0 -1
index 93bd4eda0d94f..d3c3d3ab72255 100644
@@ -6,7 +6,6 @@
 config HSA_AMD
 	bool "HSA kernel driver for AMD GPU devices"
 	depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)
-	imply AMD_IOMMU_V2 if X86_64
 	select HMM_MIRROR
 	select MMU_NOTIFIER
 	select DRM_AMDGPU_USERPTR
drivers/gpu/drm/amd/amdkfd/Makefile +0 -4
index 2ec8f27c5366c..a5ae7bcf44eb8 100644
@@ -59,10 +59,6 @@ AMDKFD_FILES	:= $(AMDKFD_PATH)/kfd_module.o \
 		$(AMDKFD_PATH)/kfd_crat.o \
 		$(AMDKFD_PATH)/kfd_debug.o
 
-ifneq ($(CONFIG_AMD_IOMMU_V2),)
-AMDKFD_FILES += $(AMDKFD_PATH)/kfd_iommu.o
-endif
-
 ifneq ($(CONFIG_DEBUG_FS),)
 AMDKFD_FILES += $(AMDKFD_PATH)/kfd_debugfs.o
 endif
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0 -3
index f3a0efbdd145d..c37f1fcd2165b 100644
@@ -1026,9 +1026,6 @@ bool kfd_dev_is_large_bar(struct kfd_node *dev)
 		return true;
 	}
 
-	if (dev->kfd->use_iommu_v2)
-		return false;
-
 	if (dev->local_mem_info.local_mem_size_private == 0 &&
 	    dev->local_mem_info.local_mem_size_public > 0)
 		return true;
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0 -73

91 lines not on this page · raw message

drivers/gpu/drm/amd/amdkfd/kfd_crat.h +0 -1
index fc719389b5d65..387a8ef493855 100644
@@ -307,7 +307,6 @@ struct kfd_gpu_cache_info {
 };
 int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pcache_info);
 
-int kfd_create_crat_image_acpi(void **crat_image, size_t *size);
 void kfd_destroy_crat_image(void *crat_image);
 int kfd_parse_crat_table(void *crat_image, struct list_head *device_list,
 			 uint32_t proximity_domain);
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -37
index c5f5efe08df40..4d1a9636866a6 100644
@@ -30,7 +30,6 @@
 #include "kfd_pm4_headers_vi.h"
 #include "kfd_pm4_headers_aldebaran.h"
 #include "cwsr_trap_handler.h"
-#include "kfd_iommu.h"
 #include "amdgpu_amdkfd.h"
 #include "kfd_smi_events.h"
 #include "kfd_svm.h"
@@ -63,7 +62,6 @@ static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
 				unsigned int chunk_size);
 static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
 
-static int kfd_resume_iommu(struct kfd_dev *kfd);
 static int kfd_resume(struct kfd_node *kfd);
 
 static void kfd_device_info_set_sdma_info(struct kfd_dev *kfd)
@@ -756,15 +754,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
 	kfd->noretry = kfd->adev->gmc.noretry;
 
-	/* If CRAT is broken, won't set iommu enabled */
-	kfd_double_confirm_iommu_support(kfd);
-
-	if (kfd_iommu_device_init(kfd)) {
-		kfd->use_iommu_v2 = false;
-		dev_err(kfd_device, "Error initializing iommuv2\n");
-		goto device_iommu_error;
-	}
-
 	kfd_cwsr_init(kfd);
 
 	dev_info(kfd_device, "Total number of KFD nodes to be created: %d\n",
@@ -839,9 +828,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
 	svm_range_set_max_pages(kfd->adev);
 
-	if (kfd_resume_iommu(kfd))
-		goto kfd_resume_iommu_error;
-
 	spin_lock_init(&kfd->watch_points_lock);
 
 	kfd->init_complete = true;
@@ -853,11 +839,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
 	goto out;
 
-kfd_resume_iommu_error:
 node_init_error:
 node_alloc_error:
 	kfd_cleanup_nodes(kfd, i);
-device_iommu_error:
 	kfd_doorbell_fini(kfd);
 kfd_doorbell_error:
 	kfd_gtt_sa_fini(kfd);
@@ -972,7 +956,6 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm)
 		node = kfd->nodes[i];
 		node->dqm->ops.stop(node->dqm);
 	}
-	kfd_iommu_suspend(kfd);
 }
 
 int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
@@ -1002,26 +985,6 @@ int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
 	return ret;
 }
 
-int kgd2kfd_resume_iommu(struct kfd_dev *kfd)
-{
-	if (!kfd->init_complete)
-		return 0;
-
-	return kfd_resume_iommu(kfd);
-}
-
-static int kfd_resume_iommu(struct kfd_dev *kfd)
-{
-	int err = 0;
-
-	err = kfd_iommu_resume(kfd);
-	if (err)
-		dev_err(kfd_device,
-			"Failed to resume IOMMU for device %x:%x\n",
-			kfd->adev->pdev->vendor, kfd->adev->pdev->device);
-	return err;
-}
-
 static int kfd_resume(struct kfd_node *node)
 {
 	int err = 0;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2 -2
index 53b83ffe72158..20aa3b7dbc362 100644
@@ -2560,7 +2560,7 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_node *dev)
 	switch (dev->adev->asic_type) {
 	case CHIP_KAVERI:
 	case CHIP_HAWAII:
-		device_queue_manager_init_cik_hawaii(&dqm->asic_ops);
+		device_queue_manager_init_cik(&dqm->asic_ops);
 		break;
 
 	case CHIP_CARRIZO:
@@ -2570,7 +2570,7 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_node *dev)
 	case CHIP_POLARIS11:
 	case CHIP_POLARIS12:
 	case CHIP_VEGAM:
-		device_queue_manager_init_vi_tonga(&dqm->asic_ops);
+		device_queue_manager_init_vi(&dqm->asic_ops);
 		break;
 
 	default:
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +0 -4
index 7dd4b177219de..805d2e4f907a8 100644
@@ -269,12 +269,8 @@ struct device_queue_manager {
 
 void device_queue_manager_init_cik(
 		struct device_queue_manager_asic_ops *asic_ops);
-void device_queue_manager_init_cik_hawaii(
-		struct device_queue_manager_asic_ops *asic_ops);
 void device_queue_manager_init_vi(
 		struct device_queue_manager_asic_ops *asic_ops);
-void device_queue_manager_init_vi_tonga(
-		struct device_queue_manager_asic_ops *asic_ops);
 void device_queue_manager_init_v9(
 		struct device_queue_manager_asic_ops *asic_ops);
 void device_queue_manager_init_v10_navi10(
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c +9 -72

107 lines not on this page · raw message

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v9.c +1 -1
index 8af6433887687..54eb1bff903c7 100644
@@ -60,7 +60,7 @@ static int update_qpd_v9(struct device_queue_manager *dqm,
 		qpd->sh_mem_config = SH_MEM_ALIGNMENT_MODE_UNALIGNED <<
 					SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT;
 
-		if (dqm->dev->kfd->noretry && !dqm->dev->kfd->use_iommu_v2)
+		if (dqm->dev->kfd->noretry)
 			qpd->sh_mem_config |= 1 << SH_MEM_CONFIG__RETRY_DISABLE__SHIFT;
 
 		if (KFD_GC_VERSION(dqm->dev->kfd) == IP_VERSION(9, 4, 3))
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_vi.c +14 -119

166 lines not on this page · raw message

drivers/gpu/drm/amd/amdkfd/kfd_events.c +0 -82

94 lines not on this page · raw message

drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c +17 -28

58 lines not on this page · raw message

drivers/gpu/drm/amd/amdkfd/kfd_iommu.c deleted +0 -356

356 lines not on this page · raw message

drivers/gpu/drm/amd/amdkfd/kfd_iommu.h deleted +0 -84

84 lines not on this page · raw message

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c +3 -24
index 65c9f01a1f86c..ee1d32d957f2b 100644
@@ -206,13 +206,6 @@ static void __update_mqd(struct mqd_manager *mm, void *mqd,
 	q->is_active = QUEUE_IS_ACTIVE(*q);
 }
 
-static void update_mqd(struct mqd_manager *mm, void *mqd,
-			struct queue_properties *q,
-			struct mqd_update_info *minfo)
-{
-	__update_mqd(mm, mqd, q, minfo, 1);
-}
-
 static uint32_t read_doorbell_id(void *mqd)
 {
 	struct cik_mqd *m = (struct cik_mqd *)mqd;
@@ -220,9 +213,9 @@ static uint32_t read_doorbell_id(void *mqd)
 	return m->queue_doorbell_id0;
 }
 
-static void update_mqd_hawaii(struct mqd_manager *mm, void *mqd,
-			struct queue_properties *q,
-			struct mqd_update_info *minfo)
+static void update_mqd(struct mqd_manager *mm, void *mqd,
+		       struct queue_properties *q,
+		       struct mqd_update_info *minfo)
 {
 	__update_mqd(mm, mqd, q, minfo, 0);
 }
@@ -387,7 +380,6 @@ static int debugfs_show_mqd_sdma(struct seq_file *m, void *data)
 
 #endif
 
-
 struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,
 		struct kfd_node *dev)
 {
@@ -470,16 +462,3 @@ struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,
 
 	return mqd;
 }
-
-struct mqd_manager *mqd_manager_init_cik_hawaii(enum KFD_MQD_TYPE type,
-			struct kfd_node *dev)
-{
-	struct mqd_manager *mqd;
-
-	mqd = mqd_manager_init_cik(type, dev);
-	if (!mqd)
-		return NULL;
-	if (type == KFD_MQD_TYPE_CP)
-		mqd->update_mqd = update_mqd_hawaii;
-	return mqd;
-}
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c +3 -24
index d1e962da51dd3..657c378229808 100644
@@ -237,14 +237,6 @@ static void __update_mqd(struct mqd_manager *mm, void *mqd,
 	q->is_active = QUEUE_IS_ACTIVE(*q);
 }
 
-
-static void update_mqd(struct mqd_manager *mm, void *mqd,
-			struct queue_properties *q,
-			struct mqd_update_info *minfo)
-{
-	__update_mqd(mm, mqd, q, minfo, MTYPE_CC, 1);
-}
-
 static uint32_t read_doorbell_id(void *mqd)
 {
 	struct vi_mqd *m = (struct vi_mqd *)mqd;
@@ -252,9 +244,9 @@ static uint32_t read_doorbell_id(void *mqd)
 	return m->queue_doorbell_id0;
 }
 
-static void update_mqd_tonga(struct mqd_manager *mm, void *mqd,
-			struct queue_properties *q,
-			struct mqd_update_info *minfo)
+static void update_mqd(struct mqd_manager *mm, void *mqd,
+		       struct queue_properties *q,
+		       struct mqd_update_info *minfo)
 {
 	__update_mqd(mm, mqd, q, minfo, MTYPE_UC, 0);
 }
@@ -529,16 +521,3 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type,
 
 	return mqd;
 }
-
-struct mqd_manager *mqd_manager_init_vi_tonga(enum KFD_MQD_TYPE type,
-			struct kfd_node *dev)
-{
-	struct mqd_manager *mqd;
-
-	mqd = mqd_manager_init_vi(type, dev);
-	if (!mqd)
-		return NULL;
-	if (type == KFD_MQD_TYPE_CP)
-		mqd->update_mqd = update_mqd_tonga;
-	return mqd;
-}
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0 -18
index 4f07b88aa8a6f..3d9ce44d88da5 100644
@@ -175,12 +175,6 @@ extern int send_sigterm;
  */
 extern int debug_largebar;
 
-/*
- * Ignore CRAT table during KFD initialization, can be used to work around
- * broken CRAT tables on some AMD systems
- */
-extern int ignore_crat;
-
 /* Set sh_mem_config.retry_disable on GFX v9 */
 extern int amdgpu_noretry;
 
@@ -234,7 +228,6 @@ struct kfd_device_info {
 	uint8_t num_of_watch_points;
 	uint16_t mqd_size_aligned;
 	bool supports_cwsr;
-	bool needs_iommu_device;
 	bool needs_pci_atomics;
 	uint32_t no_atomic_fw_version;
 	unsigned int num_sdma_queues_per_engine;
@@ -357,9 +350,6 @@ struct kfd_dev {
 
 	bool pci_atomic_requested;
 
-	/* Use IOMMU v2 flag */
-	bool use_iommu_v2;
-
 	/* Compute Profile ref. count */
 	atomic_t compute_profile;
 
@@ -1149,7 +1139,6 @@ static inline struct kfd_node *kfd_node_by_irq_ids(struct amdgpu_device *adev,
 }
 int kfd_topology_enum_kfd_devices(uint8_t idx, struct kfd_node **kdev);
 int kfd_numa_node_to_apic_id(int numa_node_id);
-void kfd_double_confirm_iommu_support(struct kfd_dev *gpu);
 
 /* Interrupts */
 #define	KFD_IRQ_FENCE_CLIENTID	0xff
@@ -1296,12 +1285,8 @@ void print_queue(struct queue *q);
 
 struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,
 		struct kfd_node *dev);
-struct mqd_manager *mqd_manager_init_cik_hawaii(enum KFD_MQD_TYPE type,
-		struct kfd_node *dev);
 struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type,
 		struct kfd_node *dev);
-struct mqd_manager *mqd_manager_init_vi_tonga(enum KFD_MQD_TYPE type,
-		struct kfd_node *dev);
 struct mqd_manager *mqd_manager_init_v9(enum KFD_MQD_TYPE type,
 		struct kfd_node *dev);
 struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
@@ -1456,9 +1441,6 @@ int kfd_wait_on_events(struct kfd_process *p,
 		       uint32_t *wait_result);
 void kfd_signal_event_interrupt(u32 pasid, uint32_t partial_id,
 				uint32_t valid_id_bits);
-void kfd_signal_iommu_event(struct kfd_node *dev,
-			    u32 pasid, unsigned long address,
-			    bool is_write_requested, bool is_execute_requested);
 void kfd_signal_hw_exception_event(u32 pasid);
 int kfd_set_event(struct kfd_process *p, uint32_t event_id);
 int kfd_reset_event(struct kfd_process *p, uint32_t event_id);
drivers/gpu/drm/amd/amdkfd/kfd_process.c +0 -16
index b7e8512170ac9..fbf053001af97 100644
@@ -28,7 +28,6 @@
 #include <linux/sched/task.h>
 #include <linux/mmu_context.h>
 #include <linux/slab.h>
-#include <linux/amd-iommu.h>
 #include <linux/notifier.h>
 #include <linux/compat.h>
 #include <linux/mman.h>
@@ -41,7 +40,6 @@ struct mm_struct;
 
 #include "kfd_priv.h"
 #include "kfd_device_queue_manager.h"
-#include "kfd_iommu.h"
 #include "kfd_svm.h"
 #include "kfd_smi_events.h"
 #include "kfd_debug.h"
@@ -1122,7 +1120,6 @@ static void kfd_process_wq_release(struct work_struct *work)
 	dma_fence_signal(p->ef);
 
 	kfd_process_remove_sysfs(p);
-	kfd_iommu_unbind_process(p);
 
 	kfd_process_kunmap_signal_bo(p);
 	kfd_process_free_outstanding_kfd_bos(p);
@@ -1728,10 +1725,6 @@ struct kfd_process_device *kfd_bind_process_to_device(struct kfd_node *dev,
 		}
 	}
 
-	err = kfd_iommu_bind_process_to_device(pdd);
-	if (err)
-		goto out;
-
 	/*
 	 * make sure that runtime_usage counter is incremented just once
 	 * per pdd
@@ -1739,15 +1732,6 @@ struct kfd_process_device *kfd_bind_process_to_device(struct kfd_node *dev,
 	pdd->runtime_inuse = true;
 
 	return pdd;
-
-out:
-	/* balance runpm reference count and exit with error */
-	if (!pdd->runtime_inuse) {
-		pm_runtime_mark_last_busy(adev_to_drm(dev->adev)->dev);
-		pm_runtime_put_autosuspend(adev_to_drm(dev->adev)->dev);
-	}
-
-	return ERR_PTR(err);
 }
 
 /* Create specific handle mapped to mem from process local memory idr
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +15 -96

159 lines not on this page · raw message

Signature · 1 line
2.41.0
author maintainer
#4 lore raw

PATCH v2 5/5 drm/amdkfd: rename device_queue_manager_init_v10_navi10()

In reply to Alex Deucher

Drop the navi10 in the name for consistency with other families. All gfx10 parts use the same implementation.

---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c     | 2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h     | 2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -1
index 20aa3b7dbc362..24ea3a596b382 100644
@@ -2577,7 +2577,7 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_node *dev)
 		if (KFD_GC_VERSION(dev) >= IP_VERSION(11, 0, 0))
 			device_queue_manager_init_v11(&dqm->asic_ops);
 		else if (KFD_GC_VERSION(dev) >= IP_VERSION(10, 1, 1))
-			device_queue_manager_init_v10_navi10(&dqm->asic_ops);
+			device_queue_manager_init_v10(&dqm->asic_ops);
 		else if (KFD_GC_VERSION(dev) >= IP_VERSION(9, 0, 1))
 			device_queue_manager_init_v9(&dqm->asic_ops);
 		else {
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +1 -1
index 805d2e4f907a8..cf7e182588f80 100644
@@ -273,7 +273,7 @@ void device_queue_manager_init_vi(
 		struct device_queue_manager_asic_ops *asic_ops);
 void device_queue_manager_init_v9(
 		struct device_queue_manager_asic_ops *asic_ops);
-void device_queue_manager_init_v10_navi10(
+void device_queue_manager_init_v10(
 		struct device_queue_manager_asic_ops *asic_ops);
 void device_queue_manager_init_v11(
 		struct device_queue_manager_asic_ops *asic_ops);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c +1 -1
index f1a1f5753e652..245a90dfc2f6b 100644
@@ -32,7 +32,7 @@ static int update_qpd_v10(struct device_queue_manager *dqm,
 static void init_sdma_vm_v10(struct device_queue_manager *dqm, struct queue *q,
 			    struct qcm_process_device *qpd);
 
-void device_queue_manager_init_v10_navi10(
+void device_queue_manager_init_v10(
 	struct device_queue_manager_asic_ops *asic_ops)
 {
 	asic_ops->update_qpd = update_qpd_v10;
Signature · 1 line
2.41.0
Acked-by on v2 1/5
#5 lore raw
In reply to Alex Deucher

Am 08.08.23 um 00:05 schrieb Alex Deucher:

Quoted 4 lines

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

Bye ATC, it wasn't really nice with you :)

Quoted 20 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ----
  1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0 -4
index 49f40d9f16e86..f5a6f562e2a80 100644
@@ -1543,11 +1543,7 @@ static bool kfd_ignore_crat(void)
  	if (ignore_crat)
  		return true;
 
-#ifndef KFD_SUPPORT_IOMMU_V2
  	ret = true;
-#else
-	ret = false;
-#endif
 
  	return ret;
  }
maintainer Reviewed-by on v2 1/5
#7 lore raw
In reply to Alex Deucher
Quoted 4 lines · Alex Deucher

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

The series is

Quoted 20 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ----
  1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0 -4
index 49f40d9f16e86..f5a6f562e2a80 100644
@@ -1543,11 +1543,7 @@ static bool kfd_ignore_crat(void)
  	if (ignore_crat)
  		return true;
 
-#ifndef KFD_SUPPORT_IOMMU_V2
  	ret = true;
-#else
-	ret = false;
-#endif
 
  	return ret;
  }
#8 lore raw
In reply to Alex Deucher
Quoted 7 lines · Alex Deucher

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ----
 1 file changed, 4 deletions(-)

For the series, please can we go ahead with this ASAP?

The iommu side desperately needs the removal of the iommu_v2 private interface to the GPU.

I'm really glad to see we can just delete the whole thing!

Thanks,
Jason

#9 lore raw
Quoted 10 lines · Jason Gunthorpe
Quoted 7 lines · Alex Deucher

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ----
 1 file changed, 4 deletions(-)
Quoted 6 lines

For the series, please can we go ahead with this ASAP?

The iommu side desperately needs the removal of the iommu_v2 private interface to the GPU.

I'm really glad to see we can just delete the whole thing!

Yes, that is the plan.

Alex