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

cpupower: Add "perf" option to print AMD P-State information

Add "-c --perf" option in cpupower-frequency-info to get the performance
and frequency values for AMD P-State.

Commit message amended:
Shuah Khan <skhan@linuxfoundation.org>

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Huang Rui and committed by
Shuah Khan
8382dce5 d8363e29

+21 -1
+3
tools/power/cpupower/man/cpupower-frequency-info.1
··· 53 53 \fB\-n\fR \fB\-\-no-rounding\fR 54 54 Output frequencies and latencies without rounding off values. 55 55 .TP 56 + \fB\-c\fR \fB\-\-perf\fR 57 + Get performances and frequencies capabilities of CPPC, by reading it from hardware (only available on the hardware with CPPC). 58 + .TP 56 59 .SH "REMARKS" 57 60 .LP 58 61 By default only values of core zero are displayed. How to display settings of
+18 -1
tools/power/cpupower/utils/cpufreq-info.c
··· 438 438 return 0; 439 439 } 440 440 441 + /* --performance / -c */ 442 + 443 + static int get_perf_cap(unsigned int cpu) 444 + { 445 + if (cpupower_cpu_info.vendor == X86_VENDOR_AMD && 446 + cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATE) 447 + amd_pstate_show_perf_and_freq(cpu, no_rounding); 448 + 449 + return 0; 450 + } 451 + 441 452 static void debug_output_one(unsigned int cpu) 442 453 { 443 454 struct cpufreq_available_frequencies *freqs; ··· 477 466 if (get_freq_hardware(cpu, 1) < 0) 478 467 get_freq_kernel(cpu, 1); 479 468 get_boost_mode(cpu); 469 + get_perf_cap(cpu); 480 470 } 481 471 482 472 static struct option info_opts[] = { ··· 496 484 {"proc", no_argument, NULL, 'o'}, 497 485 {"human", no_argument, NULL, 'm'}, 498 486 {"no-rounding", no_argument, NULL, 'n'}, 487 + {"performance", no_argument, NULL, 'c'}, 499 488 { }, 500 489 }; 501 490 ··· 510 497 int output_param = 0; 511 498 512 499 do { 513 - ret = getopt_long(argc, argv, "oefwldpgrasmybn", info_opts, 500 + ret = getopt_long(argc, argv, "oefwldpgrasmybnc", info_opts, 514 501 NULL); 515 502 switch (ret) { 516 503 case '?': ··· 533 520 case 'e': 534 521 case 's': 535 522 case 'y': 523 + case 'c': 536 524 if (output_param) { 537 525 output_param = -1; 538 526 cont = 0; ··· 639 625 break; 640 626 case 'y': 641 627 ret = get_latency(cpu, human); 628 + break; 629 + case 'c': 630 + ret = get_perf_cap(cpu); 642 631 break; 643 632 } 644 633 if (ret)