aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorshaoyunl <Shaoyun.Liu@amd.com>2018-09-07 12:00:07 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-09-10 23:49:33 -0400
commit67f7cf9f76bccaadafc41b541e361ddb925c8921 (patch)
tree59a5778c6fe442a62cfb3bede79efdbba4e2da37 /drivers/gpu/drm/amd
parentae9a25aea7f33573f56a422818bfead12aa8bfd6 (diff)
drm/amdkfd: Only add bi-directional iolink on GPU with XGMI or largebar (v2)
v2: compile fix Signed-off-by: shaoyunl <Shaoyun.Liu@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_chardev.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_crat.c15
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_crat.h3
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_priv.h1
4 files changed, 13 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 297b36c26a05..758398bdb39b 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1210,7 +1210,7 @@ err_unlock:
1210 return ret; 1210 return ret;
1211} 1211}
1212 1212
1213static bool kfd_dev_is_large_bar(struct kfd_dev *dev) 1213bool kfd_dev_is_large_bar(struct kfd_dev *dev)
1214{ 1214{
1215 struct kfd_local_mem_info mem_info; 1215 struct kfd_local_mem_info mem_info;
1216 1216
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
index 130db4dc115f..d4560f1869bd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -353,8 +353,8 @@ static int kfd_parse_subtype_iolink(struct crat_subtype_iolink *iolink,
353 id_from = iolink->proximity_domain_from; 353 id_from = iolink->proximity_domain_from;
354 id_to = iolink->proximity_domain_to; 354 id_to = iolink->proximity_domain_to;
355 355
356 pr_debug("Found IO link entry in CRAT table with id_from=%d\n", 356 pr_debug("Found IO link entry in CRAT table with id_from=%d, id_to %d\n",
357 id_from); 357 id_from, id_to);
358 list_for_each_entry(dev, device_list, list) { 358 list_for_each_entry(dev, device_list, list) {
359 if (id_from == dev->proximity_domain) { 359 if (id_from == dev->proximity_domain) {
360 props = kfd_alloc_struct(props); 360 props = kfd_alloc_struct(props);
@@ -391,12 +391,12 @@ static int kfd_parse_subtype_iolink(struct crat_subtype_iolink *iolink,
391 /* CPU topology is created before GPUs are detected, so CPU->GPU 391 /* CPU topology is created before GPUs are detected, so CPU->GPU
392 * links are not built at that time. If a PCIe type is discovered, it 392 * links are not built at that time. If a PCIe type is discovered, it
393 * means a GPU is detected and we are adding GPU->CPU to the topology. 393 * means a GPU is detected and we are adding GPU->CPU to the topology.
394 * At this time, also add the corresponded CPU->GPU link. 394 * At this time, also add the corresponded CPU->GPU link if GPU
395 * is large bar.
395 * For xGMI, we only added the link with one direction in the crat 396 * For xGMI, we only added the link with one direction in the crat
396 * table, add corresponded reversed direction link now. 397 * table, add corresponded reversed direction link now.
397 */ 398 */
398 if (props && (props->iolink_type == CRAT_IOLINK_TYPE_PCIEXPRESS || 399 if (props && (iolink->flags & CRAT_IOLINK_FLAGS_BI_DIRECTIONAL)) {
399 props->iolink_type == CRAT_IOLINK_TYPE_XGMI)) {
400 to_dev = kfd_topology_device_by_proximity_domain(id_to); 400 to_dev = kfd_topology_device_by_proximity_domain(id_to);
401 if (!to_dev) 401 if (!to_dev)
402 return -ENODEV; 402 return -ENODEV;
@@ -1057,6 +1057,8 @@ static int kfd_fill_gpu_direct_io_link_to_cpu(int *avail_size,
1057 sub_type_hdr->type = CRAT_SUBTYPE_IOLINK_AFFINITY; 1057 sub_type_hdr->type = CRAT_SUBTYPE_IOLINK_AFFINITY;
1058 sub_type_hdr->length = sizeof(struct crat_subtype_iolink); 1058 sub_type_hdr->length = sizeof(struct crat_subtype_iolink);
1059 sub_type_hdr->flags |= CRAT_SUBTYPE_FLAGS_ENABLED; 1059 sub_type_hdr->flags |= CRAT_SUBTYPE_FLAGS_ENABLED;
1060 if (kfd_dev_is_large_bar(kdev))
1061 sub_type_hdr->flags |= CRAT_IOLINK_FLAGS_BI_DIRECTIONAL;
1060 1062
1061 /* Fill in IOLINK subtype. 1063 /* Fill in IOLINK subtype.
1062 * TODO: Fill-in other fields of iolink subtype 1064 * TODO: Fill-in other fields of iolink subtype
@@ -1088,7 +1090,8 @@ static int kfd_fill_gpu_xgmi_link_to_gpu(int *avail_size,
1088 1090
1089 sub_type_hdr->type = CRAT_SUBTYPE_IOLINK_AFFINITY; 1091 sub_type_hdr->type = CRAT_SUBTYPE_IOLINK_AFFINITY;
1090 sub_type_hdr->length = sizeof(struct crat_subtype_iolink); 1092 sub_type_hdr->length = sizeof(struct crat_subtype_iolink);
1091 sub_type_hdr->flags |= CRAT_SUBTYPE_FLAGS_ENABLED; 1093 sub_type_hdr->flags |= CRAT_SUBTYPE_FLAGS_ENABLED |
1094 CRAT_IOLINK_FLAGS_BI_DIRECTIONAL;
1092 1095
1093 sub_type_hdr->io_interface_type = CRAT_IOLINK_TYPE_XGMI; 1096 sub_type_hdr->io_interface_type = CRAT_IOLINK_TYPE_XGMI;
1094 sub_type_hdr->proximity_domain_from = proximity_domain_from; 1097 sub_type_hdr->proximity_domain_from = proximity_domain_from;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.h b/drivers/gpu/drm/amd/amdkfd/kfd_crat.h
index 7a93aeb984de..7c3f192fe25f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.h
@@ -232,7 +232,8 @@ struct crat_subtype_ccompute {
232#define CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT (1 << 2) 232#define CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT (1 << 2)
233#define CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT (1 << 3) 233#define CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT (1 << 3)
234#define CRAT_IOLINK_FLAGS_NO_PEER_TO_PEER_DMA (1 << 4) 234#define CRAT_IOLINK_FLAGS_NO_PEER_TO_PEER_DMA (1 << 4)
235#define CRAT_IOLINK_FLAGS_RESERVED_MASK 0xffffffe0 235#define CRAT_IOLINK_FLAGS_BI_DIRECTIONAL (1 << 31)
236#define CRAT_IOLINK_FLAGS_RESERVED_MASK 0x7fffffe0
236 237
237/* 238/*
238 * IO interface types 239 * IO interface types
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 6a5418f3d8fb..05283c99d731 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -696,6 +696,7 @@ struct amdkfd_ioctl_desc {
696 unsigned int cmd_drv; 696 unsigned int cmd_drv;
697 const char *name; 697 const char *name;
698}; 698};
699bool kfd_dev_is_large_bar(struct kfd_dev *dev);
699 700
700int kfd_process_create_wq(void); 701int kfd_process_create_wq(void);
701void kfd_process_destroy_wq(void); 702void kfd_process_destroy_wq(void);