]>
Commit | Line | Data |
---|---|---|
bf1db69f | 1 | PM Quality Of Service Interface. |
d82b3518 MG |
2 | |
3 | This interface provides a kernel and user mode interface for registering | |
4 | performance expectations by drivers, subsystems and user space applications on | |
5 | one of the parameters. | |
6 | ||
7 | Currently we have {cpu_dma_latency, network_latency, network_throughput} as the | |
8 | initial set of pm_qos parameters. | |
9 | ||
bf1db69f RH |
10 | Each parameters have defined units: |
11 | * latency: usec | |
12 | * timeout: usec | |
13 | * throughput: kbs (kilo bit / sec) | |
14 | ||
d82b3518 MG |
15 | The infrastructure exposes multiple misc device nodes one per implemented |
16 | parameter. The set of parameters implement is defined by pm_qos_power_init() | |
17 | and pm_qos_params.h. This is done because having the available parameters | |
18 | being runtime configurable or changeable from a driver was seen as too easy to | |
19 | abuse. | |
20 | ||
ed77134b | 21 | For each parameter a list of performance requests is maintained along with |
d82b3518 | 22 | an aggregated target value. The aggregated target value is updated with |
ed77134b MG |
23 | changes to the request list or elements of the list. Typically the |
24 | aggregated target value is simply the max or min of the request values held | |
d82b3518 MG |
25 | in the parameter list elements. |
26 | ||
27 | From kernel mode the use of this interface is simple: | |
d82b3518 | 28 | |
ed77134b MG |
29 | handle = pm_qos_add_request(param_class, target_value): |
30 | Will insert an element into the list for that identified PM_QOS class with the | |
31 | target value. Upon change to this list the new target is recomputed and any | |
32 | registered notifiers are called only if the target value is now different. | |
33 | Clients of pm_qos need to save the returned handle. | |
d82b3518 | 34 | |
ed77134b MG |
35 | void pm_qos_update_request(handle, new_target_value): |
36 | Will update the list element pointed to by the handle with the new target value | |
37 | and recompute the new aggregated target, calling the notification tree if the | |
38 | target is changed. | |
39 | ||
40 | void pm_qos_remove_request(handle): | |
41 | Will remove the element. After removal it will update the aggregate target and | |
42 | call the notification tree if the target was changed as a result of removing | |
43 | the request. | |
d82b3518 MG |
44 | |
45 | ||
46 | From user mode: | |
ed77134b MG |
47 | Only processes can register a pm_qos request. To provide for automatic |
48 | cleanup of a process, the interface requires the process to register its | |
49 | parameter requests in the following way: | |
d82b3518 MG |
50 | |
51 | To register the default pm_qos target for the specific parameter, the process | |
52 | must open one of /dev/[cpu_dma_latency, network_latency, network_throughput] | |
53 | ||
54 | As long as the device node is held open that process has a registered | |
ed77134b | 55 | request on the parameter. |
d82b3518 | 56 | |
ed77134b MG |
57 | To change the requested target value the process needs to write an s32 value to |
58 | the open device node. Alternatively the user mode program could write a hex | |
59 | string for the value using 10 char long format e.g. "0x12345678". This | |
60 | translates to a pm_qos_update_request call. | |
d82b3518 MG |
61 | |
62 | To remove the user mode request for a target value simply close the device | |
63 | node. | |
64 | ||
65 | ||
66 |