Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: update df_v3_6 for xgmi perfmons (v2)

add pmu attribute groups and structures for perf events.
add sysfs to track available df perfmon counters
fix overflow handling in perfmon counter reads.

v2: squash in fix (Alex)

Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Jonathan Kim and committed by
Alex Deucher
e4cf4bf5 496091fa

+226 -258
+18
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 679 679 680 680 struct amdgpu_df_funcs { 681 681 void (*init)(struct amdgpu_device *adev); 682 + void (*sw_init)(struct amdgpu_device *adev); 682 683 void (*enable_broadcast_mode)(struct amdgpu_device *adev, 683 684 bool enable); 684 685 u32 (*get_fb_channel_number)(struct amdgpu_device *adev); ··· 730 729 }; 731 730 732 731 #define AMDGPU_RESET_MAGIC_NUM 64 732 + #define AMDGPU_MAX_DF_PERFMONS 4 733 733 struct amdgpu_device { 734 734 struct device *dev; 735 735 struct drm_device *ddev; ··· 961 959 long compute_timeout; 962 960 963 961 uint64_t unique_id; 962 + uint64_t df_perfmon_config_assign_mask[AMDGPU_MAX_DF_PERFMONS]; 964 963 }; 965 964 966 965 static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev) ··· 1201 1198 #endif 1202 1199 1203 1200 #include "amdgpu_object.h" 1201 + 1202 + /* used by df_v3_6.c and amdgpu_pmu.c */ 1203 + #define AMDGPU_PMU_ATTR(_name, _object) \ 1204 + static ssize_t \ 1205 + _name##_show(struct device *dev, \ 1206 + struct device_attribute *attr, \ 1207 + char *page) \ 1208 + { \ 1209 + BUILD_BUG_ON(sizeof(_object) >= PAGE_SIZE - 1); \ 1210 + return sprintf(page, _object "\n"); \ 1211 + } \ 1212 + \ 1213 + static struct device_attribute pmu_attr_##_name = __ATTR_RO(_name) 1214 + 1204 1215 #endif 1216 +
+199 -245
drivers/gpu/drm/amd/amdgpu/df_v3_6.c
··· 30 30 static u32 df_v3_6_channel_number[] = {1, 2, 0, 4, 0, 8, 0, 31 31 16, 32, 0, 0, 0, 2, 4, 8}; 32 32 33 - static void df_v3_6_init(struct amdgpu_device *adev) 33 + /* init df format attrs */ 34 + AMDGPU_PMU_ATTR(event, "config:0-7"); 35 + AMDGPU_PMU_ATTR(instance, "config:8-15"); 36 + AMDGPU_PMU_ATTR(umask, "config:16-23"); 37 + 38 + /* df format attributes */ 39 + static struct attribute *df_v3_6_format_attrs[] = { 40 + &pmu_attr_event.attr, 41 + &pmu_attr_instance.attr, 42 + &pmu_attr_umask.attr, 43 + NULL 44 + }; 45 + 46 + /* df format attribute group */ 47 + static struct attribute_group df_v3_6_format_attr_group = { 48 + .name = "format", 49 + .attrs = df_v3_6_format_attrs, 50 + }; 51 + 52 + /* df event attrs */ 53 + AMDGPU_PMU_ATTR(cake0_pcsout_txdata, 54 + "event=0x7,instance=0x46,umask=0x2"); 55 + AMDGPU_PMU_ATTR(cake1_pcsout_txdata, 56 + "event=0x7,instance=0x47,umask=0x2"); 57 + AMDGPU_PMU_ATTR(cake0_pcsout_txmeta, 58 + "event=0x7,instance=0x46,umask=0x4"); 59 + AMDGPU_PMU_ATTR(cake1_pcsout_txmeta, 60 + "event=0x7,instance=0x47,umask=0x4"); 61 + AMDGPU_PMU_ATTR(cake0_ftiinstat_reqalloc, 62 + "event=0xb,instance=0x46,umask=0x4"); 63 + AMDGPU_PMU_ATTR(cake1_ftiinstat_reqalloc, 64 + "event=0xb,instance=0x47,umask=0x4"); 65 + AMDGPU_PMU_ATTR(cake0_ftiinstat_rspalloc, 66 + "event=0xb,instance=0x46,umask=0x8"); 67 + AMDGPU_PMU_ATTR(cake1_ftiinstat_rspalloc, 68 + "event=0xb,instance=0x47,umask=0x8"); 69 + 70 + /* df event attributes */ 71 + static struct attribute *df_v3_6_event_attrs[] = { 72 + &pmu_attr_cake0_pcsout_txdata.attr, 73 + &pmu_attr_cake1_pcsout_txdata.attr, 74 + &pmu_attr_cake0_pcsout_txmeta.attr, 75 + &pmu_attr_cake1_pcsout_txmeta.attr, 76 + &pmu_attr_cake0_ftiinstat_reqalloc.attr, 77 + &pmu_attr_cake1_ftiinstat_reqalloc.attr, 78 + &pmu_attr_cake0_ftiinstat_rspalloc.attr, 79 + &pmu_attr_cake1_ftiinstat_rspalloc.attr, 80 + NULL 81 + }; 82 + 83 + /* df event attribute group */ 84 + static struct attribute_group df_v3_6_event_attr_group = { 85 + .name = "events", 86 + .attrs = df_v3_6_event_attrs 87 + }; 88 + 89 + /* df event attr groups */ 90 + const struct attribute_group *df_v3_6_attr_groups[] = { 91 + &df_v3_6_format_attr_group, 92 + &df_v3_6_event_attr_group, 93 + NULL 94 + }; 95 + 96 + /* get the number of df counters available */ 97 + static ssize_t df_v3_6_get_df_cntr_avail(struct device *dev, 98 + struct device_attribute *attr, 99 + char *buf) 34 100 { 101 + struct amdgpu_device *adev; 102 + struct drm_device *ddev; 103 + int i, count; 104 + 105 + ddev = dev_get_drvdata(dev); 106 + adev = ddev->dev_private; 107 + count = 0; 108 + 109 + for (i = 0; i < DF_V3_6_MAX_COUNTERS; i++) { 110 + if (adev->df_perfmon_config_assign_mask[i] == 0) 111 + count++; 112 + } 113 + 114 + return snprintf(buf, PAGE_SIZE, "%i\n", count); 115 + } 116 + 117 + /* device attr for available perfmon counters */ 118 + static DEVICE_ATTR(df_cntr_avail, S_IRUGO, df_v3_6_get_df_cntr_avail, NULL); 119 + 120 + /* init perfmons */ 121 + static void df_v3_6_sw_init(struct amdgpu_device *adev) 122 + { 123 + int i, ret; 124 + 125 + ret = device_create_file(adev->dev, &dev_attr_df_cntr_avail); 126 + if (ret) 127 + DRM_ERROR("failed to create file for available df counters\n"); 128 + 129 + for (i = 0; i < AMDGPU_MAX_DF_PERFMONS; i++) 130 + adev->df_perfmon_config_assign_mask[i] = 0; 35 131 } 36 132 37 133 static void df_v3_6_enable_broadcast_mode(struct amdgpu_device *adev, ··· 201 105 *flags |= AMD_CG_SUPPORT_DF_MGCG; 202 106 } 203 107 204 - /* hold counter assignment per gpu struct */ 205 - struct df_v3_6_event_mask { 206 - struct amdgpu_device gpu; 207 - uint64_t config_assign_mask[AMDGPU_DF_MAX_COUNTERS]; 208 - }; 209 - 210 108 /* get assigned df perfmon ctr as int */ 211 - static void df_v3_6_pmc_config_2_cntr(struct amdgpu_device *adev, 212 - uint64_t config, 213 - int *counter) 109 + static int df_v3_6_pmc_config_2_cntr(struct amdgpu_device *adev, 110 + uint64_t config) 214 111 { 215 - struct df_v3_6_event_mask *mask; 216 112 int i; 217 113 218 - mask = container_of(adev, struct df_v3_6_event_mask, gpu); 219 - 220 - for (i = 0; i < AMDGPU_DF_MAX_COUNTERS; i++) { 221 - if ((config & 0x0FFFFFFUL) == mask->config_assign_mask[i]) { 222 - *counter = i; 223 - return; 224 - } 114 + for (i = 0; i < DF_V3_6_MAX_COUNTERS; i++) { 115 + if ((config & 0x0FFFFFFUL) == 116 + adev->df_perfmon_config_assign_mask[i]) 117 + return i; 225 118 } 119 + 120 + return -EINVAL; 226 121 } 227 122 228 123 /* get address based on counter assignment */ ··· 223 136 uint32_t *lo_base_addr, 224 137 uint32_t *hi_base_addr) 225 138 { 226 - 227 - int target_cntr = -1; 228 - 229 - df_v3_6_pmc_config_2_cntr(adev, config, &target_cntr); 139 + int target_cntr = df_v3_6_pmc_config_2_cntr(adev, config); 230 140 231 141 if (target_cntr < 0) 232 142 return; ··· 268 184 uint32_t *lo_val, 269 185 uint32_t *hi_val) 270 186 { 271 - 272 - uint32_t eventsel, instance, unitmask; 273 - uint32_t es_5_0, es_13_0, es_13_6, es_13_12, es_11_8, es_7_0; 274 - 275 187 df_v3_6_pmc_get_addr(adev, config, 1, lo_base_addr, hi_base_addr); 276 188 277 - if (lo_val == NULL || hi_val == NULL) 278 - return -EINVAL; 279 - 280 189 if ((*lo_base_addr == 0) || (*hi_base_addr == 0)) { 281 - DRM_ERROR("DF PMC addressing not retrieved! Lo: %x, Hi: %x", 190 + DRM_ERROR("[DF PMC] addressing not retrieved! Lo: %x, Hi: %x", 282 191 *lo_base_addr, *hi_base_addr); 283 192 return -ENXIO; 284 193 } 285 194 286 - eventsel = GET_EVENT(config); 287 - instance = GET_INSTANCE(config); 288 - unitmask = GET_UNITMASK(config); 195 + if (lo_val && hi_val) { 196 + uint32_t eventsel, instance, unitmask; 197 + uint32_t instance_10, instance_5432, instance_76; 289 198 290 - es_5_0 = eventsel & 0x3FUL; 291 - es_13_6 = instance; 292 - es_13_0 = (es_13_6 << 6) + es_5_0; 293 - es_13_12 = (es_13_0 & 0x03000UL) >> 12; 294 - es_11_8 = (es_13_0 & 0x0F00UL) >> 8; 295 - es_7_0 = es_13_0 & 0x0FFUL; 296 - *lo_val = (es_7_0 & 0xFFUL) | ((unitmask & 0x0FUL) << 8); 297 - *hi_val = (es_11_8 | ((es_13_12)<<(29))); 199 + eventsel = DF_V3_6_GET_EVENT(config) & 0x3f; 200 + unitmask = DF_V3_6_GET_UNITMASK(config) & 0xf; 201 + instance = DF_V3_6_GET_INSTANCE(config); 202 + 203 + instance_10 = instance & 0x3; 204 + instance_5432 = (instance >> 2) & 0xf; 205 + instance_76 = (instance >> 6) & 0x3; 206 + 207 + *lo_val = (unitmask << 8) | (instance_10 << 6) | eventsel; 208 + *hi_val = (instance_76 << 29) | instance_5432; 209 + } 298 210 299 211 return 0; 300 212 } ··· 300 220 uint64_t config, 301 221 int *is_assigned) 302 222 { 303 - 304 - struct df_v3_6_event_mask *mask; 305 223 int i, target_cntr; 306 - 307 - target_cntr = -1; 308 224 309 225 *is_assigned = 0; 310 226 311 - df_v3_6_pmc_config_2_cntr(adev, config, &target_cntr); 227 + target_cntr = df_v3_6_pmc_config_2_cntr(adev, config); 312 228 313 229 if (target_cntr >= 0) { 314 230 *is_assigned = 1; 315 231 return 0; 316 232 } 317 233 318 - mask = container_of(adev, struct df_v3_6_event_mask, gpu); 319 - 320 - for (i = 0; i < AMDGPU_DF_MAX_COUNTERS; i++) { 321 - if (mask->config_assign_mask[i] == 0ULL) { 322 - mask->config_assign_mask[i] = config & 0x0FFFFFFUL; 234 + for (i = 0; i < DF_V3_6_MAX_COUNTERS; i++) { 235 + if (adev->df_perfmon_config_assign_mask[i] == 0U) { 236 + adev->df_perfmon_config_assign_mask[i] = 237 + config & 0x0FFFFFFUL; 323 238 return 0; 324 239 } 325 240 } ··· 326 251 static void df_v3_6_pmc_release_cntr(struct amdgpu_device *adev, 327 252 uint64_t config) 328 253 { 329 - 330 - struct df_v3_6_event_mask *mask; 331 - int target_cntr; 332 - 333 - target_cntr = -1; 334 - 335 - df_v3_6_pmc_config_2_cntr(adev, config, &target_cntr); 336 - 337 - mask = container_of(adev, struct df_v3_6_event_mask, gpu); 254 + int target_cntr = df_v3_6_pmc_config_2_cntr(adev, config); 338 255 339 256 if (target_cntr >= 0) 340 - mask->config_assign_mask[target_cntr] = 0ULL; 341 - 257 + adev->df_perfmon_config_assign_mask[target_cntr] = 0ULL; 342 258 } 343 259 344 - /* 345 - * get xgmi link counters via programmable data fabric (df) counters (max 4) 346 - * using cake tx event. 347 - * 348 - * @adev -> amdgpu device 349 - * @instance-> currently cake has 2 links to poll on vega20 350 - * @count -> counters to pass 351 - * 352 - */ 353 260 354 - static void df_v3_6_get_xgmi_link_cntr(struct amdgpu_device *adev, 355 - int instance, 356 - uint64_t *count) 357 - { 358 - uint32_t lo_base_addr, hi_base_addr, lo_val, hi_val; 359 - uint64_t config; 360 - 361 - config = GET_INSTANCE_CONFIG(instance); 362 - 363 - df_v3_6_pmc_get_read_settings(adev, config, &lo_base_addr, 364 - &hi_base_addr); 365 - 366 - if ((lo_base_addr == 0) || (hi_base_addr == 0)) 367 - return; 368 - 369 - lo_val = RREG32_PCIE(lo_base_addr); 370 - hi_val = RREG32_PCIE(hi_base_addr); 371 - 372 - *count = ((hi_val | 0ULL) << 32) | (lo_val | 0ULL); 373 - } 374 - 375 - /* 376 - * reset xgmi link counters 377 - * 378 - * @adev -> amdgpu device 379 - * @instance-> currently cake has 2 links to poll on vega20 380 - * 381 - */ 382 - static void df_v3_6_reset_xgmi_link_cntr(struct amdgpu_device *adev, 383 - int instance) 261 + static void df_v3_6_reset_perfmon_cntr(struct amdgpu_device *adev, 262 + uint64_t config) 384 263 { 385 264 uint32_t lo_base_addr, hi_base_addr; 386 - uint64_t config; 387 - 388 - config = 0ULL | (0x7ULL) | ((0x46ULL + instance) << 8) | (0x2 << 16); 389 265 390 266 df_v3_6_pmc_get_read_settings(adev, config, &lo_base_addr, 391 267 &hi_base_addr); ··· 348 322 WREG32_PCIE(hi_base_addr, 0UL); 349 323 } 350 324 351 - /* 352 - * add xgmi link counters 353 - * 354 - * @adev -> amdgpu device 355 - * @instance-> currently cake has 2 links to poll on vega20 356 - * 357 - */ 358 325 359 - static int df_v3_6_add_xgmi_link_cntr(struct amdgpu_device *adev, 360 - int instance) 326 + static int df_v3_6_add_perfmon_cntr(struct amdgpu_device *adev, 327 + uint64_t config) 361 328 { 362 329 uint32_t lo_base_addr, hi_base_addr, lo_val, hi_val; 363 - uint64_t config; 364 330 int ret, is_assigned; 365 - 366 - if (instance < 0 || instance > 1) 367 - return -EINVAL; 368 - 369 - config = GET_INSTANCE_CONFIG(instance); 370 331 371 332 ret = df_v3_6_pmc_assign_cntr(adev, config, &is_assigned); 372 333 ··· 370 357 if (ret) 371 358 return ret; 372 359 360 + DRM_DEBUG_DRIVER("config=%llx addr=%08x:%08x val=%08x:%08x", 361 + config, lo_base_addr, hi_base_addr, lo_val, hi_val); 362 + 373 363 WREG32_PCIE(lo_base_addr, lo_val); 374 364 WREG32_PCIE(hi_base_addr, hi_val); 375 365 376 366 return ret; 377 367 } 378 368 379 - 380 - /* 381 - * start xgmi link counters 382 - * 383 - * @adev -> amdgpu device 384 - * @instance-> currently cake has 2 links to poll on vega20 385 - * @is_enable -> either resume or assign event via df perfmon 386 - * 387 - */ 388 - 389 - static int df_v3_6_start_xgmi_link_cntr(struct amdgpu_device *adev, 390 - int instance, 391 - int is_enable) 392 - { 393 - uint32_t lo_base_addr, hi_base_addr, lo_val; 394 - uint64_t config; 395 - int ret; 396 - 397 - if (instance < 0 || instance > 1) 398 - return -EINVAL; 399 - 400 - if (is_enable) { 401 - 402 - ret = df_v3_6_add_xgmi_link_cntr(adev, instance); 403 - 404 - if (ret) 405 - return ret; 406 - 407 - } else { 408 - 409 - config = GET_INSTANCE_CONFIG(instance); 410 - 411 - df_v3_6_pmc_get_ctrl_settings(adev, 412 - config, 413 - &lo_base_addr, 414 - &hi_base_addr, 415 - NULL, 416 - NULL); 417 - 418 - if (lo_base_addr == 0) 419 - return -EINVAL; 420 - 421 - lo_val = RREG32_PCIE(lo_base_addr); 422 - 423 - WREG32_PCIE(lo_base_addr, lo_val | (1ULL << 22)); 424 - 425 - ret = 0; 426 - } 427 - 428 - return ret; 429 - 430 - } 431 - 432 - /* 433 - * start xgmi link counters 434 - * 435 - * @adev -> amdgpu device 436 - * @instance-> currently cake has 2 links to poll on vega20 437 - * @is_enable -> either pause or unassign event via df perfmon 438 - * 439 - */ 440 - 441 - static int df_v3_6_stop_xgmi_link_cntr(struct amdgpu_device *adev, 442 - int instance, 443 - int is_disable) 444 - { 445 - 446 - uint32_t lo_base_addr, hi_base_addr, lo_val; 447 - uint64_t config; 448 - 449 - config = GET_INSTANCE_CONFIG(instance); 450 - 451 - if (is_disable) { 452 - df_v3_6_reset_xgmi_link_cntr(adev, instance); 453 - df_v3_6_pmc_release_cntr(adev, config); 454 - } else { 455 - 456 - df_v3_6_pmc_get_ctrl_settings(adev, 457 - config, 458 - &lo_base_addr, 459 - &hi_base_addr, 460 - NULL, 461 - NULL); 462 - 463 - if ((lo_base_addr == 0) || (hi_base_addr == 0)) 464 - return -EINVAL; 465 - 466 - lo_val = RREG32_PCIE(lo_base_addr); 467 - 468 - WREG32_PCIE(lo_base_addr, lo_val & ~(1ULL << 22)); 469 - } 470 - 471 - return 0; 472 - } 473 - 474 369 static int df_v3_6_pmc_start(struct amdgpu_device *adev, uint64_t config, 475 370 int is_enable) 476 371 { 477 - int xgmi_tx_link, ret = 0; 372 + uint32_t lo_base_addr, hi_base_addr, lo_val; 373 + int ret = 0; 478 374 479 375 switch (adev->asic_type) { 480 376 case CHIP_VEGA20: 481 - xgmi_tx_link = IS_DF_XGMI_0_TX(config) ? 0 482 - : (IS_DF_XGMI_1_TX(config) ? 1 : -1); 483 377 484 - if (xgmi_tx_link >= 0) 485 - ret = df_v3_6_start_xgmi_link_cntr(adev, xgmi_tx_link, 486 - is_enable); 378 + df_v3_6_reset_perfmon_cntr(adev, config); 487 379 488 - if (ret) 489 - return ret; 380 + if (is_enable) { 381 + ret = df_v3_6_add_perfmon_cntr(adev, config); 382 + } else { 383 + ret = df_v3_6_pmc_get_ctrl_settings(adev, 384 + config, 385 + &lo_base_addr, 386 + &hi_base_addr, 387 + NULL, 388 + NULL); 490 389 491 - ret = 0; 390 + if (ret) 391 + return ret; 392 + 393 + lo_val = RREG32_PCIE(lo_base_addr); 394 + 395 + DRM_DEBUG_DRIVER("config=%llx addr=%08x:%08x val=%08x", 396 + config, lo_base_addr, hi_base_addr, lo_val); 397 + 398 + WREG32_PCIE(lo_base_addr, lo_val | (1ULL << 22)); 399 + } 400 + 492 401 break; 493 402 default: 494 403 break; ··· 422 487 static int df_v3_6_pmc_stop(struct amdgpu_device *adev, uint64_t config, 423 488 int is_disable) 424 489 { 425 - int xgmi_tx_link, ret = 0; 490 + uint32_t lo_base_addr, hi_base_addr, lo_val; 491 + int ret = 0; 426 492 427 493 switch (adev->asic_type) { 428 494 case CHIP_VEGA20: 429 - xgmi_tx_link = IS_DF_XGMI_0_TX(config) ? 0 430 - : (IS_DF_XGMI_1_TX(config) ? 1 : -1); 495 + ret = df_v3_6_pmc_get_ctrl_settings(adev, 496 + config, 497 + &lo_base_addr, 498 + &hi_base_addr, 499 + NULL, 500 + NULL); 431 501 432 - if (xgmi_tx_link >= 0) { 433 - ret = df_v3_6_stop_xgmi_link_cntr(adev, 434 - xgmi_tx_link, 435 - is_disable); 436 - if (ret) 437 - return ret; 438 - } 502 + if (ret) 503 + return ret; 439 504 440 - ret = 0; 441 - break; 505 + lo_val = RREG32_PCIE(lo_base_addr); 506 + 507 + DRM_DEBUG_DRIVER("config=%llx addr=%08x:%08x val=%08x", 508 + config, lo_base_addr, hi_base_addr, lo_val); 509 + 510 + WREG32_PCIE(lo_base_addr, lo_val & ~(1ULL << 22)); 511 + 512 + if (is_disable) 513 + df_v3_6_pmc_release_cntr(adev, config); 514 + 515 + break; 442 516 default: 443 517 break; 444 518 } ··· 459 515 uint64_t config, 460 516 uint64_t *count) 461 517 { 462 - 463 - int xgmi_tx_link; 518 + uint32_t lo_base_addr, hi_base_addr, lo_val, hi_val; 519 + *count = 0; 464 520 465 521 switch (adev->asic_type) { 466 522 case CHIP_VEGA20: 467 - xgmi_tx_link = IS_DF_XGMI_0_TX(config) ? 0 468 - : (IS_DF_XGMI_1_TX(config) ? 1 : -1); 469 523 470 - if (xgmi_tx_link >= 0) { 471 - df_v3_6_reset_xgmi_link_cntr(adev, xgmi_tx_link); 472 - df_v3_6_get_xgmi_link_cntr(adev, xgmi_tx_link, count); 473 - } 524 + df_v3_6_pmc_get_read_settings(adev, config, &lo_base_addr, 525 + &hi_base_addr); 526 + 527 + if ((lo_base_addr == 0) || (hi_base_addr == 0)) 528 + return; 529 + 530 + lo_val = RREG32_PCIE(lo_base_addr); 531 + hi_val = RREG32_PCIE(hi_base_addr); 532 + 533 + *count = ((hi_val | 0ULL) << 32) | (lo_val | 0ULL); 534 + 535 + if (*count >= DF_V3_6_PERFMON_OVERFLOW) 536 + *count = 0; 537 + 538 + DRM_DEBUG_DRIVER("config=%llx addr=%08x:%08x val=%08x:%08x", 539 + config, lo_base_addr, hi_base_addr, lo_val, hi_val); 474 540 475 541 break; 542 + 476 543 default: 477 544 break; 478 545 } 479 - 480 546 } 481 547 482 548 const struct amdgpu_df_funcs df_v3_6_funcs = { 483 - .init = df_v3_6_init, 549 + .sw_init = df_v3_6_sw_init, 484 550 .enable_broadcast_mode = df_v3_6_enable_broadcast_mode, 485 551 .get_fb_channel_number = df_v3_6_get_fb_channel_number, 486 552 .get_hbm_channel_number = df_v3_6_get_hbm_channel_number,
+6 -13
drivers/gpu/drm/amd/amdgpu/df_v3_6.h
··· 36 36 }; 37 37 38 38 /* Defined in global_features.h as FTI_PERFMON_VISIBLE */ 39 - #define AMDGPU_DF_MAX_COUNTERS 4 39 + #define DF_V3_6_MAX_COUNTERS 4 40 40 41 41 /* get flags from df perfmon config */ 42 - #define GET_EVENT(x) (x & 0xFFUL) 43 - #define GET_INSTANCE(x) ((x >> 8) & 0xFFUL) 44 - #define GET_UNITMASK(x) ((x >> 16) & 0xFFUL) 45 - #define GET_INSTANCE_CONFIG(x) (0ULL | (0x07ULL) \ 46 - | ((0x046ULL + x) << 8) \ 47 - | (0x02 << 16)) 42 + #define DF_V3_6_GET_EVENT(x) (x & 0xFFUL) 43 + #define DF_V3_6_GET_INSTANCE(x) ((x >> 8) & 0xFFUL) 44 + #define DF_V3_6_GET_UNITMASK(x) ((x >> 16) & 0xFFUL) 45 + #define DF_V3_6_PERFMON_OVERFLOW 0xFFFFFFFFFFFFULL 48 46 49 - /* df event conf macros */ 50 - #define IS_DF_XGMI_0_TX(x) (GET_EVENT(x) == 0x7 \ 51 - && GET_INSTANCE(x) == 0x46 && GET_UNITMASK(x) == 0x2) 52 - #define IS_DF_XGMI_1_TX(x) (GET_EVENT(x) == 0x7 \ 53 - && GET_INSTANCE(x) == 0x47 && GET_UNITMASK(x) == 0x2) 54 - 47 + extern const struct attribute_group *df_v3_6_attr_groups[]; 55 48 extern const struct amdgpu_df_funcs df_v3_6_funcs; 56 49 57 50 #endif
+3
drivers/gpu/drm/amd/amdgpu/soc15.c
··· 1034 1034 if (amdgpu_sriov_vf(adev)) 1035 1035 xgpu_ai_mailbox_add_irq_id(adev); 1036 1036 1037 + adev->df_funcs->sw_init(adev); 1038 + 1037 1039 return 0; 1038 1040 } 1039 1041 ··· 1082 1080 */ 1083 1081 if (adev->nbio_funcs->remap_hdp_registers) 1084 1082 adev->nbio_funcs->remap_hdp_registers(adev); 1083 + 1085 1084 /* enable the doorbell aperture */ 1086 1085 soc15_enable_doorbell_aperture(adev, true); 1087 1086 /* HW doorbell routing policy: doorbell writing not