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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/pm: Add NPM support for smu_v15_0_8

Add node power management support for smu_v15_0_8

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Asad Kamal and committed by
Alex Deucher
6a609b80 8847d599

+49
+49
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
··· 558 558 return 0; 559 559 } 560 560 561 + static int smu_v15_0_8_get_npm_data(struct smu_context *smu, 562 + enum amd_pp_sensors sensor, 563 + uint32_t *value) 564 + { 565 + struct smu_table_context *smu_table = &smu->smu_table; 566 + struct smu_table *tables = smu_table->tables; 567 + SystemMetricsTable_t *metrics; 568 + struct smu_table *sys_table; 569 + int ret; 570 + 571 + if (sensor == AMDGPU_PP_SENSOR_MAXNODEPOWERLIMIT) { 572 + /*TBD as of now put 0 */ 573 + *value = 0; 574 + return 0; 575 + } 576 + 577 + ret = smu_v15_0_8_get_system_metrics_table(smu); 578 + if (ret) 579 + return ret; 580 + 581 + sys_table = &tables[SMU_TABLE_PMFW_SYSTEM_METRICS]; 582 + metrics = (SystemMetricsTable_t *)sys_table->cache.buffer; 583 + 584 + switch (sensor) { 585 + case AMDGPU_PP_SENSOR_NODEPOWERLIMIT: 586 + *value = SMUQ10_ROUND(metrics->NodePowerLimit); 587 + break; 588 + case AMDGPU_PP_SENSOR_NODEPOWER: 589 + *value = SMUQ10_ROUND(metrics->NodePower); 590 + break; 591 + case AMDGPU_PP_SENSOR_GPPTRESIDENCY: 592 + *value = SMUQ10_ROUND(metrics->GlobalPPTResidencyAcc); 593 + break; 594 + default: 595 + return -EINVAL; 596 + } 597 + 598 + return 0; 599 + } 600 + 561 601 static int smu_v15_0_8_read_sensor(struct smu_context *smu, 562 602 enum amd_pp_sensors sensor, void *data, 563 603 uint32_t *size) ··· 645 605 break; 646 606 case AMDGPU_PP_SENSOR_VDDBOARD: 647 607 *(uint32_t *)data = dpm_context->board_volt; 608 + *size = 4; 609 + break; 610 + case AMDGPU_PP_SENSOR_NODEPOWERLIMIT: 611 + case AMDGPU_PP_SENSOR_NODEPOWER: 612 + case AMDGPU_PP_SENSOR_GPPTRESIDENCY: 613 + case AMDGPU_PP_SENSOR_MAXNODEPOWERLIMIT: 614 + ret = smu_v15_0_8_get_npm_data(smu, sensor, (uint32_t *)data); 615 + if (ret) 616 + return ret; 648 617 *size = 4; 649 618 break; 650 619 case AMDGPU_PP_SENSOR_GPU_AVG_POWER: