Skip to content

Commit c99a2e7

Browse files
committed
drm/amdkfd: drop IOMMUv2 support
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 Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Tested-by: Mike Lothian <mike@fireburn.co.uk> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 2b4adeb commit c99a2e7

24 files changed

+64
-1085
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,6 @@ void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool run_pm)
226226
kgd2kfd_suspend(adev->kfd.dev, run_pm);
227227
}
228228

229-
int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev)
230-
{
231-
int r = 0;
232-
233-
if (adev->kfd.dev)
234-
r = kgd2kfd_resume_iommu(adev->kfd.dev);
235-
236-
return r;
237-
}
238-
239229
int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm)
240230
{
241231
int r = 0;

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ int amdgpu_amdkfd_init(void);
148148
void amdgpu_amdkfd_fini(void);
149149

150150
void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool run_pm);
151-
int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev);
152151
int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm);
153152
void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev,
154153
const void *ih_ring_entry);
@@ -399,7 +398,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
399398
const struct kgd2kfd_shared_resources *gpu_resources);
400399
void kgd2kfd_device_exit(struct kfd_dev *kfd);
401400
void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm);
402-
int kgd2kfd_resume_iommu(struct kfd_dev *kfd);
403401
int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm);
404402
int kgd2kfd_pre_reset(struct kfd_dev *kfd);
405403
int kgd2kfd_post_reset(struct kfd_dev *kfd);
@@ -439,11 +437,6 @@ static inline void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm)
439437
{
440438
}
441439

442-
static int __maybe_unused kgd2kfd_resume_iommu(struct kfd_dev *kfd)
443-
{
444-
return 0;
445-
}
446-
447440
static inline int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
448441
{
449442
return 0;

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,12 +3236,6 @@ static int amdgpu_device_ip_resume(struct amdgpu_device *adev)
32363236
{
32373237
int r;
32383238

3239-
if (!adev->in_s0ix) {
3240-
r = amdgpu_amdkfd_resume_iommu(adev);
3241-
if (r)
3242-
return r;
3243-
}
3244-
32453239
r = amdgpu_device_ip_resume_phase1(adev);
32463240
if (r)
32473241
return r;
@@ -4946,9 +4940,6 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
49464940
dev_warn(tmp_adev->dev, "asic atom init failed!");
49474941
} else {
49484942
dev_info(tmp_adev->dev, "GPU reset succeeded, trying to resume\n");
4949-
r = amdgpu_amdkfd_resume_iommu(tmp_adev);
4950-
if (r)
4951-
goto out;
49524943

49534944
r = amdgpu_device_ip_resume_phase1(tmp_adev);
49544945
if (r)

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -755,20 +755,6 @@ module_param(debug_largebar, int, 0444);
755755
MODULE_PARM_DESC(debug_largebar,
756756
"Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)");
757757

758-
/**
759-
* DOC: ignore_crat (int)
760-
* Ignore CRAT table during KFD initialization. By default, KFD uses the ACPI CRAT
761-
* table to get information about AMD APUs. This option can serve as a workaround on
762-
* systems with a broken CRAT table.
763-
*
764-
* Default is auto (according to asic type, iommu_v2, and crat table, to decide
765-
* whether use CRAT)
766-
*/
767-
int ignore_crat;
768-
module_param(ignore_crat, int, 0444);
769-
MODULE_PARM_DESC(ignore_crat,
770-
"Ignore CRAT table during KFD initialization (0 = auto (default), 1 = ignore CRAT)");
771-
772758
/**
773759
* DOC: halt_if_hws_hang (int)
774760
* Halt if HWS hang is detected. Default value, 0, disables the halt on hang.

drivers/gpu/drm/amd/amdkfd/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
config HSA_AMD
77
bool "HSA kernel driver for AMD GPU devices"
88
depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64)
9-
imply AMD_IOMMU_V2 if X86_64
109
select HMM_MIRROR
1110
select MMU_NOTIFIER
1211
select DRM_AMDGPU_USERPTR

drivers/gpu/drm/amd/amdkfd/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ AMDKFD_FILES := $(AMDKFD_PATH)/kfd_module.o \
5959
$(AMDKFD_PATH)/kfd_crat.o \
6060
$(AMDKFD_PATH)/kfd_debug.o
6161

62-
ifneq ($(CONFIG_AMD_IOMMU_V2),)
63-
AMDKFD_FILES += $(AMDKFD_PATH)/kfd_iommu.o
64-
endif
65-
6662
ifneq ($(CONFIG_DEBUG_FS),)
6763
AMDKFD_FILES += $(AMDKFD_PATH)/kfd_debugfs.o
6864
endif

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,6 @@ bool kfd_dev_is_large_bar(struct kfd_node *dev)
10261026
return true;
10271027
}
10281028

1029-
if (dev->kfd->use_iommu_v2)
1030-
return false;
1031-
10321029
if (dev->local_mem_info.local_mem_size_private == 0 &&
10331030
dev->local_mem_info.local_mem_size_public > 0)
10341031
return true;

drivers/gpu/drm/amd/amdkfd/kfd_crat.c

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "kfd_crat.h"
2727
#include "kfd_priv.h"
2828
#include "kfd_topology.h"
29-
#include "kfd_iommu.h"
3029
#include "amdgpu.h"
3130
#include "amdgpu_amdkfd.h"
3231

@@ -1536,72 +1535,6 @@ int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pc
15361535
return num_of_cache_types;
15371536
}
15381537

1539-
static bool kfd_ignore_crat(void)
1540-
{
1541-
bool ret;
1542-
1543-
if (ignore_crat)
1544-
return true;
1545-
1546-
ret = true;
1547-
1548-
return ret;
1549-
}
1550-
1551-
/*
1552-
* kfd_create_crat_image_acpi - Allocates memory for CRAT image and
1553-
* copies CRAT from ACPI (if available).
1554-
* NOTE: Call kfd_destroy_crat_image to free CRAT image memory
1555-
*
1556-
* @crat_image: CRAT read from ACPI. If no CRAT in ACPI then
1557-
* crat_image will be NULL
1558-
* @size: [OUT] size of crat_image
1559-
*
1560-
* Return 0 if successful else return error code
1561-
*/
1562-
int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
1563-
{
1564-
struct acpi_table_header *crat_table;
1565-
acpi_status status;
1566-
void *pcrat_image;
1567-
int rc = 0;
1568-
1569-
if (!crat_image)
1570-
return -EINVAL;
1571-
1572-
*crat_image = NULL;
1573-
1574-
if (kfd_ignore_crat()) {
1575-
pr_info("CRAT table disabled by module option\n");
1576-
return -ENODATA;
1577-
}
1578-
1579-
/* Fetch the CRAT table from ACPI */
1580-
status = acpi_get_table(CRAT_SIGNATURE, 0, &crat_table);
1581-
if (status == AE_NOT_FOUND) {
1582-
pr_info("CRAT table not found\n");
1583-
return -ENODATA;
1584-
} else if (ACPI_FAILURE(status)) {
1585-
const char *err = acpi_format_exception(status);
1586-
1587-
pr_err("CRAT table error: %s\n", err);
1588-
return -EINVAL;
1589-
}
1590-
1591-
pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL);
1592-
if (!pcrat_image) {
1593-
rc = -ENOMEM;
1594-
goto out;
1595-
}
1596-
1597-
memcpy(pcrat_image, crat_table, crat_table->length);
1598-
*crat_image = pcrat_image;
1599-
*size = crat_table->length;
1600-
out:
1601-
acpi_put_table(crat_table);
1602-
return rc;
1603-
}
1604-
16051538
/* Memory required to create Virtual CRAT.
16061539
* Since there is no easy way to predict the amount of memory required, the
16071540
* following amount is allocated for GPU Virtual CRAT. This is
@@ -2169,12 +2102,6 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,
21692102

21702103
cu->hsa_capability = 0;
21712104

2172-
/* Check if this node supports IOMMU. During parsing this flag will
2173-
* translate to HSA_CAP_ATS_PRESENT
2174-
*/
2175-
if (!kfd_iommu_check_device(kdev->kfd))
2176-
cu->hsa_capability |= CRAT_CU_FLAGS_IOMMU_PRESENT;
2177-
21782105
crat_table->length += sub_type_hdr->length;
21792106
crat_table->total_entries++;
21802107

drivers/gpu/drm/amd/amdkfd/kfd_crat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ struct kfd_gpu_cache_info {
307307
};
308308
int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pcache_info);
309309

310-
int kfd_create_crat_image_acpi(void **crat_image, size_t *size);
311310
void kfd_destroy_crat_image(void *crat_image);
312311
int kfd_parse_crat_table(void *crat_image, struct list_head *device_list,
313312
uint32_t proximity_domain);

drivers/gpu/drm/amd/amdkfd/kfd_device.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "kfd_pm4_headers_vi.h"
3030
#include "kfd_pm4_headers_aldebaran.h"
3131
#include "cwsr_trap_handler.h"
32-
#include "kfd_iommu.h"
3332
#include "amdgpu_amdkfd.h"
3433
#include "kfd_smi_events.h"
3534
#include "kfd_svm.h"
@@ -62,7 +61,6 @@ static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
6261
unsigned int chunk_size);
6362
static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
6463

65-
static int kfd_resume_iommu(struct kfd_dev *kfd);
6664
static int kfd_resume(struct kfd_node *kfd);
6765

6866
static void kfd_device_info_set_sdma_info(struct kfd_dev *kfd)
@@ -755,15 +753,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
755753

756754
kfd->noretry = kfd->adev->gmc.noretry;
757755

758-
/* If CRAT is broken, won't set iommu enabled */
759-
kfd_double_confirm_iommu_support(kfd);
760-
761-
if (kfd_iommu_device_init(kfd)) {
762-
kfd->use_iommu_v2 = false;
763-
dev_err(kfd_device, "Error initializing iommuv2\n");
764-
goto device_iommu_error;
765-
}
766-
767756
kfd_cwsr_init(kfd);
768757

769758
dev_info(kfd_device, "Total number of KFD nodes to be created: %d\n",
@@ -838,9 +827,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
838827

839828
svm_range_set_max_pages(kfd->adev);
840829

841-
if (kfd_resume_iommu(kfd))
842-
goto kfd_resume_iommu_error;
843-
844830
spin_lock_init(&kfd->watch_points_lock);
845831

846832
kfd->init_complete = true;
@@ -852,11 +838,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
852838

853839
goto out;
854840

855-
kfd_resume_iommu_error:
856841
node_init_error:
857842
node_alloc_error:
858843
kfd_cleanup_nodes(kfd, i);
859-
device_iommu_error:
860844
kfd_doorbell_fini(kfd);
861845
kfd_doorbell_error:
862846
kfd_gtt_sa_fini(kfd);
@@ -971,7 +955,6 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm)
971955
node = kfd->nodes[i];
972956
node->dqm->ops.stop(node->dqm);
973957
}
974-
kfd_iommu_suspend(kfd);
975958
}
976959

977960
int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
@@ -1001,26 +984,6 @@ int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
1001984
return ret;
1002985
}
1003986

1004-
int kgd2kfd_resume_iommu(struct kfd_dev *kfd)
1005-
{
1006-
if (!kfd->init_complete)
1007-
return 0;
1008-
1009-
return kfd_resume_iommu(kfd);
1010-
}
1011-
1012-
static int kfd_resume_iommu(struct kfd_dev *kfd)
1013-
{
1014-
int err = 0;
1015-
1016-
err = kfd_iommu_resume(kfd);
1017-
if (err)
1018-
dev_err(kfd_device,
1019-
"Failed to resume IOMMU for device %x:%x\n",
1020-
kfd->adev->pdev->vendor, kfd->adev->pdev->device);
1021-
return err;
1022-
}
1023-
1024987
static int kfd_resume(struct kfd_node *node)
1025988
{
1026989
int err = 0;

0 commit comments

Comments
 (0)