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