cpufreq_drivers.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. .. SPDX-License-Identifier: GPL-2.0
  2. =======================================================
  3. Legacy Documentation of CPU Performance Scaling Drivers
  4. =======================================================
  5. Included below are historic documents describing assorted
  6. :doc:`CPU performance scaling <cpufreq>` drivers. They are reproduced verbatim,
  7. with the original white space formatting and indentation preserved, except for
  8. the added leading space character in every line of text.
  9. AMD PowerNow! Drivers
  10. =====================
  11. ::
  12. PowerNow! and Cool'n'Quiet are AMD names for frequency
  13. management capabilities in AMD processors. As the hardware
  14. implementation changes in new generations of the processors,
  15. there is a different cpu-freq driver for each generation.
  16. Note that the driver's will not load on the "wrong" hardware,
  17. so it is safe to try each driver in turn when in doubt as to
  18. which is the correct driver.
  19. Note that the functionality to change frequency (and voltage)
  20. is not available in all processors. The drivers will refuse
  21. to load on processors without this capability. The capability
  22. is detected with the cpuid instruction.
  23. The drivers use BIOS supplied tables to obtain frequency and
  24. voltage information appropriate for a particular platform.
  25. Frequency transitions will be unavailable if the BIOS does
  26. not supply these tables.
  27. 6th Generation: powernow-k6
  28. 7th Generation: powernow-k7: Athlon, Duron, Geode.
  29. 8th Generation: powernow-k8: Athlon, Athlon 64, Opteron, Sempron.
  30. Documentation on this functionality in 8th generation processors
  31. is available in the "BIOS and Kernel Developer's Guide", publication
  32. 26094, in chapter 9, available for download from www.amd.com.
  33. BIOS supplied data, for powernow-k7 and for powernow-k8, may be
  34. from either the PSB table or from ACPI objects. The ACPI support
  35. is only available if the kernel config sets CONFIG_ACPI_PROCESSOR.
  36. The powernow-k8 driver will attempt to use ACPI if so configured,
  37. and fall back to PST if that fails.
  38. The powernow-k7 driver will try to use the PSB support first, and
  39. fall back to ACPI if the PSB support fails. A module parameter,
  40. acpi_force, is provided to force ACPI support to be used instead
  41. of PSB support.
  42. ``cpufreq-nforce2``
  43. ===================
  44. ::
  45. The cpufreq-nforce2 driver changes the FSB on nVidia nForce2 platforms.
  46. This works better than on other platforms, because the FSB of the CPU
  47. can be controlled independently from the PCI/AGP clock.
  48. The module has two options:
  49. fid: multiplier * 10 (for example 8.5 = 85)
  50. min_fsb: minimum FSB
  51. If not set, fid is calculated from the current CPU speed and the FSB.
  52. min_fsb defaults to FSB at boot time - 50 MHz.
  53. IMPORTANT: The available range is limited downwards!
  54. Also the minimum available FSB can differ, for systems
  55. booting with 200 MHz, 150 should always work.
  56. ``pcc-cpufreq``
  57. ===============
  58. ::
  59. /*
  60. * pcc-cpufreq.txt - PCC interface documentation
  61. *
  62. * Copyright (C) 2009 Red Hat, Matthew Garrett <mjg@redhat.com>
  63. * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
  64. * Nagananda Chumbalkar <nagananda.chumbalkar@hp.com>
  65. */
  66. Processor Clocking Control Driver
  67. ---------------------------------
  68. Contents:
  69. ---------
  70. 1. Introduction
  71. 1.1 PCC interface
  72. 1.1.1 Get Average Frequency
  73. 1.1.2 Set Desired Frequency
  74. 1.2 Platforms affected
  75. 2. Driver and /sys details
  76. 2.1 scaling_available_frequencies
  77. 2.2 cpuinfo_transition_latency
  78. 2.3 cpuinfo_cur_freq
  79. 2.4 related_cpus
  80. 3. Caveats
  81. 1. Introduction:
  82. ----------------
  83. Processor Clocking Control (PCC) is an interface between the platform
  84. firmware and OSPM. It is a mechanism for coordinating processor
  85. performance (ie: frequency) between the platform firmware and the OS.
  86. The PCC driver (pcc-cpufreq) allows OSPM to take advantage of the PCC
  87. interface.
  88. OS utilizes the PCC interface to inform platform firmware what frequency the
  89. OS wants for a logical processor. The platform firmware attempts to achieve
  90. the requested frequency. If the request for the target frequency could not be
  91. satisfied by platform firmware, then it usually means that power budget
  92. conditions are in place, and "power capping" is taking place.
  93. 1.1 PCC interface:
  94. ------------------
  95. The complete PCC specification is available here:
  96. https://acpica.org/sites/acpica/files/Processor-Clocking-Control-v1p0.pdf
  97. PCC relies on a shared memory region that provides a channel for communication
  98. between the OS and platform firmware. PCC also implements a "doorbell" that
  99. is used by the OS to inform the platform firmware that a command has been
  100. sent.
  101. The ACPI PCCH() method is used to discover the location of the PCC shared
  102. memory region. The shared memory region header contains the "command" and
  103. "status" interface. PCCH() also contains details on how to access the platform
  104. doorbell.
  105. The following commands are supported by the PCC interface:
  106. * Get Average Frequency
  107. * Set Desired Frequency
  108. The ACPI PCCP() method is implemented for each logical processor and is
  109. used to discover the offsets for the input and output buffers in the shared
  110. memory region.
  111. When PCC mode is enabled, the platform will not expose processor performance
  112. or throttle states (_PSS, _TSS and related ACPI objects) to OSPM. Therefore,
  113. the native P-state driver (such as acpi-cpufreq for Intel, powernow-k8 for
  114. AMD) will not load.
  115. However, OSPM remains in control of policy. The governor (eg: "ondemand")
  116. computes the required performance for each processor based on server workload.
  117. The PCC driver fills in the command interface, and the input buffer and
  118. communicates the request to the platform firmware. The platform firmware is
  119. responsible for delivering the requested performance.
  120. Each PCC command is "global" in scope and can affect all the logical CPUs in
  121. the system. Therefore, PCC is capable of performing "group" updates. With PCC
  122. the OS is capable of getting/setting the frequency of all the logical CPUs in
  123. the system with a single call to the BIOS.
  124. 1.1.1 Get Average Frequency:
  125. ----------------------------
  126. This command is used by the OSPM to query the running frequency of the
  127. processor since the last time this command was completed. The output buffer
  128. indicates the average unhalted frequency of the logical processor expressed as
  129. a percentage of the nominal (ie: maximum) CPU frequency. The output buffer
  130. also signifies if the CPU frequency is limited by a power budget condition.
  131. 1.1.2 Set Desired Frequency:
  132. ----------------------------
  133. This command is used by the OSPM to communicate to the platform firmware the
  134. desired frequency for a logical processor. The output buffer is currently
  135. ignored by OSPM. The next invocation of "Get Average Frequency" will inform
  136. OSPM if the desired frequency was achieved or not.
  137. 1.2 Platforms affected:
  138. -----------------------
  139. The PCC driver will load on any system where the platform firmware:
  140. * supports the PCC interface, and the associated PCCH() and PCCP() methods
  141. * assumes responsibility for managing the hardware clocking controls in order
  142. to deliver the requested processor performance
  143. Currently, certain HP ProLiant platforms implement the PCC interface. On those
  144. platforms PCC is the "default" choice.
  145. However, it is possible to disable this interface via a BIOS setting. In
  146. such an instance, as is also the case on platforms where the PCC interface
  147. is not implemented, the PCC driver will fail to load silently.
  148. 2. Driver and /sys details:
  149. ---------------------------
  150. When the driver loads, it merely prints the lowest and the highest CPU
  151. frequencies supported by the platform firmware.
  152. The PCC driver loads with a message such as:
  153. pcc-cpufreq: (v1.00.00) driver loaded with frequency limits: 1600 MHz, 2933
  154. MHz
  155. This means that the OPSM can request the CPU to run at any frequency in
  156. between the limits (1600 MHz, and 2933 MHz) specified in the message.
  157. Internally, there is no need for the driver to convert the "target" frequency
  158. to a corresponding P-state.
  159. The VERSION number for the driver will be of the format v.xy.ab.
  160. eg: 1.00.02
  161. ----- --
  162. | |
  163. | -- this will increase with bug fixes/enhancements to the driver
  164. |-- this is the version of the PCC specification the driver adheres to
  165. The following is a brief discussion on some of the fields exported via the
  166. /sys filesystem and how their values are affected by the PCC driver:
  167. 2.1 scaling_available_frequencies:
  168. ----------------------------------
  169. scaling_available_frequencies is not created in /sys. No intermediate
  170. frequencies need to be listed because the BIOS will try to achieve any
  171. frequency, within limits, requested by the governor. A frequency does not have
  172. to be strictly associated with a P-state.
  173. 2.2 cpuinfo_transition_latency:
  174. -------------------------------
  175. The cpuinfo_transition_latency field is 0. The PCC specification does
  176. not include a field to expose this value currently.
  177. 2.3 cpuinfo_cur_freq:
  178. ---------------------
  179. A) Often cpuinfo_cur_freq will show a value different than what is declared
  180. in the scaling_available_frequencies or scaling_cur_freq, or scaling_max_freq.
  181. This is due to "turbo boost" available on recent Intel processors. If certain
  182. conditions are met the BIOS can achieve a slightly higher speed than requested
  183. by OSPM. An example:
  184. scaling_cur_freq : 2933000
  185. cpuinfo_cur_freq : 3196000
  186. B) There is a round-off error associated with the cpuinfo_cur_freq value.
  187. Since the driver obtains the current frequency as a "percentage" (%) of the
  188. nominal frequency from the BIOS, sometimes, the values displayed by
  189. scaling_cur_freq and cpuinfo_cur_freq may not match. An example:
  190. scaling_cur_freq : 1600000
  191. cpuinfo_cur_freq : 1583000
  192. In this example, the nominal frequency is 2933 MHz. The driver obtains the
  193. current frequency, cpuinfo_cur_freq, as 54% of the nominal frequency:
  194. 54% of 2933 MHz = 1583 MHz
  195. Nominal frequency is the maximum frequency of the processor, and it usually
  196. corresponds to the frequency of the P0 P-state.
  197. 2.4 related_cpus:
  198. -----------------
  199. The related_cpus field is identical to affected_cpus.
  200. affected_cpus : 4
  201. related_cpus : 4
  202. Currently, the PCC driver does not evaluate _PSD. The platforms that support
  203. PCC do not implement SW_ALL. So OSPM doesn't need to perform any coordination
  204. to ensure that the same frequency is requested of all dependent CPUs.
  205. 3. Caveats:
  206. -----------
  207. The "cpufreq_stats" module in its present form cannot be loaded and
  208. expected to work with the PCC driver. Since the "cpufreq_stats" module
  209. provides information wrt each P-state, it is not applicable to the PCC driver.