fam15h_power 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. Kernel driver fam15h_power
  2. ==========================
  3. Supported chips:
  4. * AMD Family 15h Processors
  5. * AMD Family 16h Processors
  6. Prefix: 'fam15h_power'
  7. Addresses scanned: PCI space
  8. Datasheets:
  9. BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors
  10. BIOS and Kernel Developer's Guide (BKDG) For AMD Family 16h Processors
  11. AMD64 Architecture Programmer's Manual Volume 2: System Programming
  12. Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
  13. Description
  14. -----------
  15. 1) Processor TDP (Thermal design power)
  16. Given a fixed frequency and voltage, the power consumption of a
  17. processor varies based on the workload being executed. Derated power
  18. is the power consumed when running a specific application. Thermal
  19. design power (TDP) is an example of derated power.
  20. This driver permits reading of registers providing power information
  21. of AMD Family 15h and 16h processors via TDP algorithm.
  22. For AMD Family 15h and 16h processors the following power values can
  23. be calculated using different processor northbridge function
  24. registers:
  25. * BasePwrWatts: Specifies in watts the maximum amount of power
  26. consumed by the processor for NB and logic external to the core.
  27. * ProcessorPwrWatts: Specifies in watts the maximum amount of power
  28. the processor can support.
  29. * CurrPwrWatts: Specifies in watts the current amount of power being
  30. consumed by the processor.
  31. This driver provides ProcessorPwrWatts and CurrPwrWatts:
  32. * power1_crit (ProcessorPwrWatts)
  33. * power1_input (CurrPwrWatts)
  34. On multi-node processors the calculated value is for the entire
  35. package and not for a single node. Thus the driver creates sysfs
  36. attributes only for internal node0 of a multi-node processor.
  37. 2) Accumulated Power Mechanism
  38. This driver also introduces an algorithm that should be used to
  39. calculate the average power consumed by a processor during a
  40. measurement interval Tm. The feature of accumulated power mechanism is
  41. indicated by CPUID Fn8000_0007_EDX[12].
  42. * Tsample: compute unit power accumulator sample period
  43. * Tref: the PTSC counter period
  44. * PTSC: performance timestamp counter
  45. * N: the ratio of compute unit power accumulator sample period to the
  46. PTSC period
  47. * Jmax: max compute unit accumulated power which is indicated by
  48. MaxCpuSwPwrAcc MSR C001007b
  49. * Jx/Jy: compute unit accumulated power which is indicated by
  50. CpuSwPwrAcc MSR C001007a
  51. * Tx/Ty: the value of performance timestamp counter which is indicated
  52. by CU_PTSC MSR C0010280
  53. * PwrCPUave: CPU average power
  54. i. Determine the ratio of Tsample to Tref by executing CPUID Fn8000_0007.
  55. N = value of CPUID Fn8000_0007_ECX[CpuPwrSampleTimeRatio[15:0]].
  56. ii. Read the full range of the cumulative energy value from the new
  57. MSR MaxCpuSwPwrAcc.
  58. Jmax = value returned.
  59. iii. At time x, SW reads CpuSwPwrAcc MSR and samples the PTSC.
  60. Jx = value read from CpuSwPwrAcc and Tx = value read from
  61. PTSC.
  62. iv. At time y, SW reads CpuSwPwrAcc MSR and samples the PTSC.
  63. Jy = value read from CpuSwPwrAcc and Ty = value read from
  64. PTSC.
  65. v. Calculate the average power consumption for a compute unit over
  66. time period (y-x). Unit of result is uWatt.
  67. if (Jy < Jx) // Rollover has occurred
  68. Jdelta = (Jy + Jmax) - Jx
  69. else
  70. Jdelta = Jy - Jx
  71. PwrCPUave = N * Jdelta * 1000 / (Ty - Tx)
  72. This driver provides PwrCPUave and interval(default is 10 millisecond
  73. and maximum is 1 second):
  74. * power1_average (PwrCPUave)
  75. * power1_average_interval (Interval)
  76. The power1_average_interval can be updated at /etc/sensors3.conf file
  77. as below:
  78. chip "fam15h_power-*"
  79. set power1_average_interval 0.01
  80. Then save it with "sensors -s".