Skip to content

Commit 9d6fa9c

Browse files
Graham Sideralexdeucher
authored andcommitted
drm/amdkfd: Expose GFXIP engine version to sysfs
Add u32 gfx_target_version field to kfd_node_properties and kfd_device_info. Populate <asic>_device_info structs accordingly and expose to sysfs. This allows eliminating device-ID-based lookup tables in user mode for future ASICs. Signed-off-by: Graham Sider <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent a204ea8 commit 9d6fa9c

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ static const struct kfd2kgd_calls *kfd2kgd_funcs[] = {
9191
static const struct kfd_device_info kaveri_device_info = {
9292
.asic_family = CHIP_KAVERI,
9393
.asic_name = "kaveri",
94+
.gfx_target_version = 70000,
9495
.max_pasid_bits = 16,
9596
/* max num of queues for KV.TODO should be a dynamic value */
9697
.max_no_of_hqd = 24,
@@ -110,6 +111,7 @@ static const struct kfd_device_info kaveri_device_info = {
110111
static const struct kfd_device_info carrizo_device_info = {
111112
.asic_family = CHIP_CARRIZO,
112113
.asic_name = "carrizo",
114+
.gfx_target_version = 80001,
113115
.max_pasid_bits = 16,
114116
/* max num of queues for CZ.TODO should be a dynamic value */
115117
.max_no_of_hqd = 24,
@@ -130,6 +132,7 @@ static const struct kfd_device_info carrizo_device_info = {
130132
static const struct kfd_device_info raven_device_info = {
131133
.asic_family = CHIP_RAVEN,
132134
.asic_name = "raven",
135+
.gfx_target_version = 90002,
133136
.max_pasid_bits = 16,
134137
.max_no_of_hqd = 24,
135138
.doorbell_size = 8,
@@ -148,6 +151,7 @@ static const struct kfd_device_info raven_device_info = {
148151
static const struct kfd_device_info hawaii_device_info = {
149152
.asic_family = CHIP_HAWAII,
150153
.asic_name = "hawaii",
154+
.gfx_target_version = 70001,
151155
.max_pasid_bits = 16,
152156
/* max num of queues for KV.TODO should be a dynamic value */
153157
.max_no_of_hqd = 24,
@@ -167,6 +171,7 @@ static const struct kfd_device_info hawaii_device_info = {
167171
static const struct kfd_device_info tonga_device_info = {
168172
.asic_family = CHIP_TONGA,
169173
.asic_name = "tonga",
174+
.gfx_target_version = 80002,
170175
.max_pasid_bits = 16,
171176
.max_no_of_hqd = 24,
172177
.doorbell_size = 4,
@@ -185,6 +190,7 @@ static const struct kfd_device_info tonga_device_info = {
185190
static const struct kfd_device_info fiji_device_info = {
186191
.asic_family = CHIP_FIJI,
187192
.asic_name = "fiji",
193+
.gfx_target_version = 80003,
188194
.max_pasid_bits = 16,
189195
.max_no_of_hqd = 24,
190196
.doorbell_size = 4,
@@ -203,6 +209,7 @@ static const struct kfd_device_info fiji_device_info = {
203209
static const struct kfd_device_info fiji_vf_device_info = {
204210
.asic_family = CHIP_FIJI,
205211
.asic_name = "fiji",
212+
.gfx_target_version = 80003,
206213
.max_pasid_bits = 16,
207214
.max_no_of_hqd = 24,
208215
.doorbell_size = 4,
@@ -222,6 +229,7 @@ static const struct kfd_device_info fiji_vf_device_info = {
222229
static const struct kfd_device_info polaris10_device_info = {
223230
.asic_family = CHIP_POLARIS10,
224231
.asic_name = "polaris10",
232+
.gfx_target_version = 80003,
225233
.max_pasid_bits = 16,
226234
.max_no_of_hqd = 24,
227235
.doorbell_size = 4,
@@ -240,6 +248,7 @@ static const struct kfd_device_info polaris10_device_info = {
240248
static const struct kfd_device_info polaris10_vf_device_info = {
241249
.asic_family = CHIP_POLARIS10,
242250
.asic_name = "polaris10",
251+
.gfx_target_version = 80003,
243252
.max_pasid_bits = 16,
244253
.max_no_of_hqd = 24,
245254
.doorbell_size = 4,
@@ -258,6 +267,7 @@ static const struct kfd_device_info polaris10_vf_device_info = {
258267
static const struct kfd_device_info polaris11_device_info = {
259268
.asic_family = CHIP_POLARIS11,
260269
.asic_name = "polaris11",
270+
.gfx_target_version = 80003,
261271
.max_pasid_bits = 16,
262272
.max_no_of_hqd = 24,
263273
.doorbell_size = 4,
@@ -276,6 +286,7 @@ static const struct kfd_device_info polaris11_device_info = {
276286
static const struct kfd_device_info polaris12_device_info = {
277287
.asic_family = CHIP_POLARIS12,
278288
.asic_name = "polaris12",
289+
.gfx_target_version = 80003,
279290
.max_pasid_bits = 16,
280291
.max_no_of_hqd = 24,
281292
.doorbell_size = 4,
@@ -294,6 +305,7 @@ static const struct kfd_device_info polaris12_device_info = {
294305
static const struct kfd_device_info vegam_device_info = {
295306
.asic_family = CHIP_VEGAM,
296307
.asic_name = "vegam",
308+
.gfx_target_version = 80003,
297309
.max_pasid_bits = 16,
298310
.max_no_of_hqd = 24,
299311
.doorbell_size = 4,
@@ -312,6 +324,7 @@ static const struct kfd_device_info vegam_device_info = {
312324
static const struct kfd_device_info vega10_device_info = {
313325
.asic_family = CHIP_VEGA10,
314326
.asic_name = "vega10",
327+
.gfx_target_version = 90000,
315328
.max_pasid_bits = 16,
316329
.max_no_of_hqd = 24,
317330
.doorbell_size = 8,
@@ -330,6 +343,7 @@ static const struct kfd_device_info vega10_device_info = {
330343
static const struct kfd_device_info vega10_vf_device_info = {
331344
.asic_family = CHIP_VEGA10,
332345
.asic_name = "vega10",
346+
.gfx_target_version = 90000,
333347
.max_pasid_bits = 16,
334348
.max_no_of_hqd = 24,
335349
.doorbell_size = 8,
@@ -348,6 +362,7 @@ static const struct kfd_device_info vega10_vf_device_info = {
348362
static const struct kfd_device_info vega12_device_info = {
349363
.asic_family = CHIP_VEGA12,
350364
.asic_name = "vega12",
365+
.gfx_target_version = 90004,
351366
.max_pasid_bits = 16,
352367
.max_no_of_hqd = 24,
353368
.doorbell_size = 8,
@@ -366,6 +381,7 @@ static const struct kfd_device_info vega12_device_info = {
366381
static const struct kfd_device_info vega20_device_info = {
367382
.asic_family = CHIP_VEGA20,
368383
.asic_name = "vega20",
384+
.gfx_target_version = 90006,
369385
.max_pasid_bits = 16,
370386
.max_no_of_hqd = 24,
371387
.doorbell_size = 8,
@@ -384,6 +400,7 @@ static const struct kfd_device_info vega20_device_info = {
384400
static const struct kfd_device_info arcturus_device_info = {
385401
.asic_family = CHIP_ARCTURUS,
386402
.asic_name = "arcturus",
403+
.gfx_target_version = 90008,
387404
.max_pasid_bits = 16,
388405
.max_no_of_hqd = 24,
389406
.doorbell_size = 8,
@@ -402,6 +419,7 @@ static const struct kfd_device_info arcturus_device_info = {
402419
static const struct kfd_device_info aldebaran_device_info = {
403420
.asic_family = CHIP_ALDEBARAN,
404421
.asic_name = "aldebaran",
422+
.gfx_target_version = 90010,
405423
.max_pasid_bits = 16,
406424
.max_no_of_hqd = 24,
407425
.doorbell_size = 8,
@@ -420,6 +438,7 @@ static const struct kfd_device_info aldebaran_device_info = {
420438
static const struct kfd_device_info renoir_device_info = {
421439
.asic_family = CHIP_RENOIR,
422440
.asic_name = "renoir",
441+
.gfx_target_version = 90002,
423442
.max_pasid_bits = 16,
424443
.max_no_of_hqd = 24,
425444
.doorbell_size = 8,
@@ -438,6 +457,7 @@ static const struct kfd_device_info renoir_device_info = {
438457
static const struct kfd_device_info navi10_device_info = {
439458
.asic_family = CHIP_NAVI10,
440459
.asic_name = "navi10",
460+
.gfx_target_version = 100100,
441461
.max_pasid_bits = 16,
442462
.max_no_of_hqd = 24,
443463
.doorbell_size = 8,
@@ -456,6 +476,7 @@ static const struct kfd_device_info navi10_device_info = {
456476
static const struct kfd_device_info navi12_device_info = {
457477
.asic_family = CHIP_NAVI12,
458478
.asic_name = "navi12",
479+
.gfx_target_version = 100101,
459480
.max_pasid_bits = 16,
460481
.max_no_of_hqd = 24,
461482
.doorbell_size = 8,
@@ -474,6 +495,7 @@ static const struct kfd_device_info navi12_device_info = {
474495
static const struct kfd_device_info navi14_device_info = {
475496
.asic_family = CHIP_NAVI14,
476497
.asic_name = "navi14",
498+
.gfx_target_version = 100102,
477499
.max_pasid_bits = 16,
478500
.max_no_of_hqd = 24,
479501
.doorbell_size = 8,
@@ -492,6 +514,7 @@ static const struct kfd_device_info navi14_device_info = {
492514
static const struct kfd_device_info sienna_cichlid_device_info = {
493515
.asic_family = CHIP_SIENNA_CICHLID,
494516
.asic_name = "sienna_cichlid",
517+
.gfx_target_version = 100300,
495518
.max_pasid_bits = 16,
496519
.max_no_of_hqd = 24,
497520
.doorbell_size = 8,
@@ -510,6 +533,7 @@ static const struct kfd_device_info sienna_cichlid_device_info = {
510533
static const struct kfd_device_info navy_flounder_device_info = {
511534
.asic_family = CHIP_NAVY_FLOUNDER,
512535
.asic_name = "navy_flounder",
536+
.gfx_target_version = 100301,
513537
.max_pasid_bits = 16,
514538
.max_no_of_hqd = 24,
515539
.doorbell_size = 8,
@@ -528,6 +552,7 @@ static const struct kfd_device_info navy_flounder_device_info = {
528552
static const struct kfd_device_info vangogh_device_info = {
529553
.asic_family = CHIP_VANGOGH,
530554
.asic_name = "vangogh",
555+
.gfx_target_version = 100303,
531556
.max_pasid_bits = 16,
532557
.max_no_of_hqd = 24,
533558
.doorbell_size = 8,
@@ -546,6 +571,7 @@ static const struct kfd_device_info vangogh_device_info = {
546571
static const struct kfd_device_info dimgrey_cavefish_device_info = {
547572
.asic_family = CHIP_DIMGREY_CAVEFISH,
548573
.asic_name = "dimgrey_cavefish",
574+
.gfx_target_version = 100302,
549575
.max_pasid_bits = 16,
550576
.max_no_of_hqd = 24,
551577
.doorbell_size = 8,
@@ -564,6 +590,7 @@ static const struct kfd_device_info dimgrey_cavefish_device_info = {
564590
static const struct kfd_device_info beige_goby_device_info = {
565591
.asic_family = CHIP_BEIGE_GOBY,
566592
.asic_name = "beige_goby",
593+
.gfx_target_version = 100304,
567594
.max_pasid_bits = 16,
568595
.max_no_of_hqd = 24,
569596
.doorbell_size = 8,
@@ -582,6 +609,7 @@ static const struct kfd_device_info beige_goby_device_info = {
582609
static const struct kfd_device_info yellow_carp_device_info = {
583610
.asic_family = CHIP_YELLOW_CARP,
584611
.asic_name = "yellow_carp",
612+
.gfx_target_version = 100305,
585613
.max_pasid_bits = 16,
586614
.max_no_of_hqd = 24,
587615
.doorbell_size = 8,
@@ -600,6 +628,7 @@ static const struct kfd_device_info yellow_carp_device_info = {
600628
static const struct kfd_device_info cyan_skillfish_device_info = {
601629
.asic_family = CHIP_CYAN_SKILLFISH,
602630
.asic_name = "cyan_skillfish",
631+
.gfx_target_version = 100103,
603632
.max_pasid_bits = 16,
604633
.max_no_of_hqd = 24,
605634
.doorbell_size = 8,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ struct kfd_event_interrupt_class {
196196
struct kfd_device_info {
197197
enum amd_asic_type asic_family;
198198
const char *asic_name;
199+
uint32_t gfx_target_version;
199200
const struct kfd_event_interrupt_class *event_interrupt_class;
200201
unsigned int max_pasid_bits;
201202
unsigned int max_no_of_hqd;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
478478
dev->node_props.simd_per_cu);
479479
sysfs_show_32bit_prop(buffer, offs, "max_slots_scratch_cu",
480480
dev->node_props.max_slots_scratch_cu);
481+
sysfs_show_32bit_prop(buffer, offs, "gfx_target_version",
482+
dev->node_props.gfx_target_version);
481483
sysfs_show_32bit_prop(buffer, offs, "vendor_id",
482484
dev->node_props.vendor_id);
483485
sysfs_show_32bit_prop(buffer, offs, "device_id",
@@ -1360,6 +1362,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
13601362
dev->node_props.simd_arrays_per_engine =
13611363
cu_info.num_shader_arrays_per_engine;
13621364

1365+
dev->node_props.gfx_target_version = gpu->device_info->gfx_target_version;
13631366
dev->node_props.vendor_id = gpu->pdev->vendor;
13641367
dev->node_props.device_id = gpu->pdev->device;
13651368
dev->node_props.capability |=

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ struct kfd_node_properties {
7878
uint32_t simd_per_cu;
7979
uint32_t max_slots_scratch_cu;
8080
uint32_t engine_id;
81+
uint32_t gfx_target_version;
8182
uint32_t vendor_id;
8283
uint32_t device_id;
8384
uint32_t location_id;

0 commit comments

Comments
 (0)