Based on kernel version 3.9. Page generated on 2013-05-02 22:56 EST.
1 /* 2 * pcc-cpufreq.txt - PCC interface documentation 3 * 4 * Copyright (C) 2009 Red Hat, Matthew Garrett <mjg@redhat.com> 5 * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. 6 * Nagananda Chumbalkar <nagananda.chumbalkar@hp.com> 7 * 8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; version 2 of the License. 13 * 14 * This program is distributed in the hope that it will be useful, but 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or NON 17 * INFRINGEMENT. See the GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License along 20 * with this program; if not, write to the Free Software Foundation, Inc., 21 * 675 Mass Ave, Cambridge, MA 02139, USA. 22 * 23 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 */ 25 26 27 Processor Clocking Control Driver 28 --------------------------------- 29 30 Contents: 31 --------- 32 1. Introduction 33 1.1 PCC interface 34 1.1.1 Get Average Frequency 35 1.1.2 Set Desired Frequency 36 1.2 Platforms affected 37 2. Driver and /sys details 38 2.1 scaling_available_frequencies 39 2.2 cpuinfo_transition_latency 40 2.3 cpuinfo_cur_freq 41 2.4 related_cpus 42 3. Caveats 43 44 1. Introduction: 45 ---------------- 46 Processor Clocking Control (PCC) is an interface between the platform 47 firmware and OSPM. It is a mechanism for coordinating processor 48 performance (ie: frequency) between the platform firmware and the OS. 49 50 The PCC driver (pcc-cpufreq) allows OSPM to take advantage of the PCC 51 interface. 52 53 OS utilizes the PCC interface to inform platform firmware what frequency the 54 OS wants for a logical processor. The platform firmware attempts to achieve 55 the requested frequency. If the request for the target frequency could not be 56 satisfied by platform firmware, then it usually means that power budget 57 conditions are in place, and "power capping" is taking place. 58 59 1.1 PCC interface: 60 ------------------ 61 The complete PCC specification is available here: 62 http://www.acpica.org/download/Processor-Clocking-Control-v1p0.pdf 63 64 PCC relies on a shared memory region that provides a channel for communication 65 between the OS and platform firmware. PCC also implements a "doorbell" that 66 is used by the OS to inform the platform firmware that a command has been 67 sent. 68 69 The ACPI PCCH() method is used to discover the location of the PCC shared 70 memory region. The shared memory region header contains the "command" and 71 "status" interface. PCCH() also contains details on how to access the platform 72 doorbell. 73 74 The following commands are supported by the PCC interface: 75 * Get Average Frequency 76 * Set Desired Frequency 77 78 The ACPI PCCP() method is implemented for each logical processor and is 79 used to discover the offsets for the input and output buffers in the shared 80 memory region. 81 82 When PCC mode is enabled, the platform will not expose processor performance 83 or throttle states (_PSS, _TSS and related ACPI objects) to OSPM. Therefore, 84 the native P-state driver (such as acpi-cpufreq for Intel, powernow-k8 for 85 AMD) will not load. 86 87 However, OSPM remains in control of policy. The governor (eg: "ondemand") 88 computes the required performance for each processor based on server workload. 89 The PCC driver fills in the command interface, and the input buffer and 90 communicates the request to the platform firmware. The platform firmware is 91 responsible for delivering the requested performance. 92 93 Each PCC command is "global" in scope and can affect all the logical CPUs in 94 the system. Therefore, PCC is capable of performing "group" updates. With PCC 95 the OS is capable of getting/setting the frequency of all the logical CPUs in 96 the system with a single call to the BIOS. 97 98 1.1.1 Get Average Frequency: 99 ---------------------------- 100 This command is used by the OSPM to query the running frequency of the 101 processor since the last time this command was completed. The output buffer 102 indicates the average unhalted frequency of the logical processor expressed as 103 a percentage of the nominal (ie: maximum) CPU frequency. The output buffer 104 also signifies if the CPU frequency is limited by a power budget condition. 105 106 1.1.2 Set Desired Frequency: 107 ---------------------------- 108 This command is used by the OSPM to communicate to the platform firmware the 109 desired frequency for a logical processor. The output buffer is currently 110 ignored by OSPM. The next invocation of "Get Average Frequency" will inform 111 OSPM if the desired frequency was achieved or not. 112 113 1.2 Platforms affected: 114 ----------------------- 115 The PCC driver will load on any system where the platform firmware: 116 * supports the PCC interface, and the associated PCCH() and PCCP() methods 117 * assumes responsibility for managing the hardware clocking controls in order 118 to deliver the requested processor performance 119 120 Currently, certain HP ProLiant platforms implement the PCC interface. On those 121 platforms PCC is the "default" choice. 122 123 However, it is possible to disable this interface via a BIOS setting. In 124 such an instance, as is also the case on platforms where the PCC interface 125 is not implemented, the PCC driver will fail to load silently. 126 127 2. Driver and /sys details: 128 --------------------------- 129 When the driver loads, it merely prints the lowest and the highest CPU 130 frequencies supported by the platform firmware. 131 132 The PCC driver loads with a message such as: 133 pcc-cpufreq: (v1.00.00) driver loaded with frequency limits: 1600 MHz, 2933 134 MHz 135 136 This means that the OPSM can request the CPU to run at any frequency in 137 between the limits (1600 MHz, and 2933 MHz) specified in the message. 138 139 Internally, there is no need for the driver to convert the "target" frequency 140 to a corresponding P-state. 141 142 The VERSION number for the driver will be of the format v.xy.ab. 143 eg: 1.00.02 144 ----- -- 145 | | 146 | -- this will increase with bug fixes/enhancements to the driver 147 |-- this is the version of the PCC specification the driver adheres to 148 149 150 The following is a brief discussion on some of the fields exported via the 151 /sys filesystem and how their values are affected by the PCC driver: 152 153 2.1 scaling_available_frequencies: 154 ---------------------------------- 155 scaling_available_frequencies is not created in /sys. No intermediate 156 frequencies need to be listed because the BIOS will try to achieve any 157 frequency, within limits, requested by the governor. A frequency does not have 158 to be strictly associated with a P-state. 159 160 2.2 cpuinfo_transition_latency: 161 ------------------------------- 162 The cpuinfo_transition_latency field is 0. The PCC specification does 163 not include a field to expose this value currently. 164 165 2.3 cpuinfo_cur_freq: 166 --------------------- 167 A) Often cpuinfo_cur_freq will show a value different than what is declared 168 in the scaling_available_frequencies or scaling_cur_freq, or scaling_max_freq. 169 This is due to "turbo boost" available on recent Intel processors. If certain 170 conditions are met the BIOS can achieve a slightly higher speed than requested 171 by OSPM. An example: 172 173 scaling_cur_freq : 2933000 174 cpuinfo_cur_freq : 3196000 175 176 B) There is a round-off error associated with the cpuinfo_cur_freq value. 177 Since the driver obtains the current frequency as a "percentage" (%) of the 178 nominal frequency from the BIOS, sometimes, the values displayed by 179 scaling_cur_freq and cpuinfo_cur_freq may not match. An example: 180 181 scaling_cur_freq : 1600000 182 cpuinfo_cur_freq : 1583000 183 184 In this example, the nominal frequency is 2933 MHz. The driver obtains the 185 current frequency, cpuinfo_cur_freq, as 54% of the nominal frequency: 186 187 54% of 2933 MHz = 1583 MHz 188 189 Nominal frequency is the maximum frequency of the processor, and it usually 190 corresponds to the frequency of the P0 P-state. 191 192 2.4 related_cpus: 193 ----------------- 194 The related_cpus field is identical to affected_cpus. 195 196 affected_cpus : 4 197 related_cpus : 4 198 199 Currently, the PCC driver does not evaluate _PSD. The platforms that support 200 PCC do not implement SW_ALL. So OSPM doesn't need to perform any coordination 201 to ensure that the same frequency is requested of all dependent CPUs. 202 203 3. Caveats: 204 ----------- 205 The "cpufreq_stats" module in its present form cannot be loaded and 206 expected to work with the PCC driver. Since the "cpufreq_stats" module 207 provides information wrt each P-state, it is not applicable to the PCC driver.