History

drm/amdkfd: add RAS capabilities in topology for Vega20 (v2)

It is to collaborate with HSA_CAPABILITY in libhsakmt. v2: squash in NULL pointer check

Eric Huang committed 7 years ago

Commit 0dee45a1 parent 96ebb302 files · +20 −0Browse files

Unified · Split

2 files
  1. drivers/gpu/drm/amd/amdkfd/kfd_topology.c +16 −0
  2. drivers/gpu/drm/amd/amdkfd/kfd_topology.h +4 −0
drivers/gpu/drm/amd/amdkfd/kfd_topology.c+16−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include "kfd_device_queue_manager.h"
3838 #include "kfd_iommu.h"
3939 #include "amdgpu_amdkfd.h"
40+#include "amdgpu_ras.h"
4041
4142 /* topology_device_list - Master list of all topology devices */
4243 static struct list_head topology_device_list;
@@ -1197,6 +1198,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) · 1154 unmodified lines
11971198 void *crat_image = NULL;
11981199 size_t image_size = 0;
11991200 int proximity_domain;
1201+ struct amdgpu_ras *ctx;
12001202
12011203 INIT_LIST_HEAD(&temp_topology_device_list);
12021204
@@ -1328,6 +1330,20 @@ int kfd_topology_add_device(struct kfd_dev *gpu) · 125 unmodified lines
13281330 dev->node_props.capability |= HSA_CAP_ATS_PRESENT;
13291331 }
13301332
1333+ ctx = amdgpu_ras_get_context((struct amdgpu_device *)(dev->gpu->kgd));
1334+ if (ctx) {
1335+ /* kfd only concerns sram ecc on GFX/SDMA and HBM ecc on UMC */
1336+ dev->node_props.capability |=
1337+ (((ctx->features & BIT(AMDGPU_RAS_BLOCK__SDMA)) != 0) ||
1338+ ((ctx->features & BIT(AMDGPU_RAS_BLOCK__GFX)) != 0)) ?
1339+ HSA_CAP_SRAM_EDCSUPPORTED : 0;
1340+ dev->node_props.capability |= ((ctx->features & BIT(AMDGPU_RAS_BLOCK__UMC)) != 0) ?
1341+ HSA_CAP_MEM_EDCSUPPORTED : 0;
1342+
1343+ dev->node_props.capability |= (ctx->features != 0) ?
1344+ HSA_CAP_RASEVENTNOTIFY : 0;
1345+ }
1346+
13311347 kfd_debug_print_topology();
13321348
13331349 if (!res)
drivers/gpu/drm/amd/amdkfd/kfd_topology.h+4−0
@@ -48,6 +48,10 @@ · 47 unmodified lines
4848 #define HSA_CAP_DOORBELL_TYPE_2_0 0x2
4949 #define HSA_CAP_AQL_QUEUE_DOUBLE_MAP 0x00004000
5050
51+#define HSA_CAP_SRAM_EDCSUPPORTED 0x00080000
52+#define HSA_CAP_MEM_EDCSUPPORTED 0x00100000
53+#define HSA_CAP_RASEVENTNOTIFY 0x00200000
54+
5155 struct kfd_node_properties {
5256 uint64_t hive_id;
5357 uint32_t cpu_cores_count;