Skip to content

Commit caa07a8

Browse files
multics69rafaeljw
authored andcommitted
PM: EM: Rename em.yaml to dev-energymodel.yaml
The EM YNL specification used many acronyms, including ‘em’, ‘pd’, ‘ps’, etc. While the acronyms are short and convenient, they could be confusing. So, let’s spell them out to be more specific. The following changes were made in the spec. Note that the protocol name cannot exceed GENL_NAMSIZ (16). em -> dev-energymodel pds -> perf-domains pd -> perf-domain pd-id -> perf-domain-id pd-table -> perf-table ps -> perf-state get-pds -> get-perf-domains get-pd-table -> get-perf-table pd-created -> perf-domain-created pd-updated -> perf-domain-updated pd-deleted -> perf-domain-deleted In addition. doc strings were added to the spec. based on the comments in energy_model.h. Two flag attributes (perf-state-flags and perf-domain-flags) were added for easily interpreting the bit flags. Finally, the autogenerated files and em_netlink.c were updated accordingly to reflect the name changes. Suggested-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Signed-off-by: Changwoo Min <changwoo@igalia.com> Link: https://patch.msgid.link/20260108053212.642478-3-changwoo@igalia.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent ebabc32 commit caa07a8

8 files changed

Lines changed: 384 additions & 266 deletions

File tree

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2+
#
3+
# Copyright (c) 2025 Valve Corporation.
4+
#
5+
---
6+
name: dev-energymodel
7+
8+
doc: |
9+
Energy model netlink interface to notify its changes.
10+
11+
protocol: genetlink
12+
13+
uapi-header: linux/dev_energymodel.h
14+
15+
definitions:
16+
-
17+
type: flags
18+
name: perf-state-flags
19+
entries:
20+
-
21+
name: perf-state-inefficient
22+
doc: >-
23+
The performance state is inefficient. There is in this perf-domain,
24+
another performance state with a higher frequency but a lower or
25+
equal power cost.
26+
-
27+
type: flags
28+
name: perf-domain-flags
29+
entries:
30+
-
31+
name: perf-domain-microwatts
32+
doc: >-
33+
The power values are in micro-Watts or some other scale.
34+
-
35+
name: perf-domain-skip-inefficiencies
36+
doc: >-
37+
Skip inefficient states when estimating energy consumption.
38+
-
39+
name: perf-domain-artificial
40+
doc: >-
41+
The power values are artificial and might be created by platform
42+
missing real power information.
43+
44+
attribute-sets:
45+
-
46+
name: perf-domains
47+
doc: >-
48+
Information on all the performance domains.
49+
attributes:
50+
-
51+
name: perf-domain
52+
type: nest
53+
nested-attributes: perf-domain
54+
multi-attr: true
55+
-
56+
name: perf-domain
57+
doc: >-
58+
Information on a single performance domains.
59+
attributes:
60+
-
61+
name: pad
62+
type: pad
63+
-
64+
name: perf-domain-id
65+
type: u32
66+
doc: >-
67+
A unique ID number for each performance domain.
68+
-
69+
name: flags
70+
type: u64
71+
doc: >-
72+
Bitmask of performance domain flags.
73+
enum: perf-domain-flags
74+
-
75+
name: cpus
76+
type: string
77+
doc: >-
78+
CPUs that belong to this performance domain.
79+
-
80+
name: perf-table
81+
doc: >-
82+
Performance states table.
83+
attributes:
84+
-
85+
name: perf-domain-id
86+
type: u32
87+
doc: >-
88+
A unique ID number for each performance domain.
89+
-
90+
name: perf-state
91+
type: nest
92+
nested-attributes: perf-state
93+
multi-attr: true
94+
-
95+
name: perf-state
96+
doc: >-
97+
Performance state of a performance domain.
98+
attributes:
99+
-
100+
name: pad
101+
type: pad
102+
-
103+
name: performance
104+
type: u64
105+
doc: >-
106+
CPU performance (capacity) at a given frequency.
107+
-
108+
name: frequency
109+
type: u64
110+
doc: >-
111+
The frequency in KHz, for consistency with CPUFreq.
112+
-
113+
name: power
114+
type: u64
115+
doc: >-
116+
The power consumed at this level (by 1 CPU or by a registered
117+
device). It can be a total power: static and dynamic.
118+
-
119+
name: cost
120+
type: u64
121+
doc: >-
122+
The cost coefficient associated with this level, used during energy
123+
calculation. Equal to: power * max_frequency / frequency.
124+
-
125+
name: flags
126+
type: u64
127+
doc: >-
128+
Bitmask of performance state flags.
129+
enum: perf-state-flags
130+
131+
operations:
132+
list:
133+
-
134+
name: get-perf-domains
135+
attribute-set: perf-domains
136+
doc: Get the list of information for all performance domains.
137+
do:
138+
reply:
139+
attributes:
140+
- perf-domain
141+
-
142+
name: get-perf-table
143+
attribute-set: perf-table
144+
doc: Get the energy model table of a performance domain.
145+
do:
146+
request:
147+
attributes:
148+
- perf-domain-id
149+
reply:
150+
attributes:
151+
- perf-domain-id
152+
- perf-state
153+
-
154+
name: perf-domain-created
155+
doc: A performance domain is created.
156+
notify: get-perf-table
157+
mcgrp: event
158+
-
159+
name: perf-domain-updated
160+
doc: A performance domain is updated.
161+
notify: get-perf-table
162+
mcgrp: event
163+
-
164+
name: perf-domain-deleted
165+
doc: A performance domain is deleted.
166+
attribute-set: perf-table
167+
event:
168+
attributes:
169+
- perf-domain-id
170+
mcgrp: event
171+
172+
mcast-groups:
173+
list:
174+
-
175+
name: event

Documentation/netlink/specs/em.yaml

Lines changed: 0 additions & 116 deletions
This file was deleted.

MAINTAINERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9298,12 +9298,12 @@ M: Lukasz Luba <lukasz.luba@arm.com>
92989298
M: "Rafael J. Wysocki" <rafael@kernel.org>
92999299
L: linux-pm@vger.kernel.org
93009300
S: Maintained
9301-
F: kernel/power/energy_model.c
9302-
F: include/linux/energy_model.h
9301+
F: Documentation/netlink/specs/dev-energymodel.yaml
93039302
F: Documentation/power/energy-model.rst
9304-
F: Documentation/netlink/specs/em.yaml
9305-
F: include/uapi/linux/energy_model.h
9303+
F: include/linux/energy_model.h
9304+
F: include/uapi/linux/dev_energymodel.h
93069305
F: kernel/power/em_netlink*.*
9306+
F: kernel/power/energy_model.c
93079307

93089308
EPAPR HYPERVISOR BYTE CHANNEL DEVICE DRIVER
93099309
M: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
2+
/* Do not edit directly, auto-generated from: */
3+
/* Documentation/netlink/specs/dev-energymodel.yaml */
4+
/* YNL-GEN uapi header */
5+
/* To regenerate run: tools/net/ynl/ynl-regen.sh */
6+
7+
#ifndef _UAPI_LINUX_DEV_ENERGYMODEL_H
8+
#define _UAPI_LINUX_DEV_ENERGYMODEL_H
9+
10+
#define DEV_ENERGYMODEL_FAMILY_NAME "dev-energymodel"
11+
#define DEV_ENERGYMODEL_FAMILY_VERSION 1
12+
13+
/**
14+
* enum dev_energymodel_perf_state_flags
15+
* @DEV_ENERGYMODEL_PERF_STATE_FLAGS_PERF_STATE_INEFFICIENT: The performance
16+
* state is inefficient. There is in this perf-domain, another performance
17+
* state with a higher frequency but a lower or equal power cost.
18+
*/
19+
enum dev_energymodel_perf_state_flags {
20+
DEV_ENERGYMODEL_PERF_STATE_FLAGS_PERF_STATE_INEFFICIENT = 1,
21+
};
22+
23+
/**
24+
* enum dev_energymodel_perf_domain_flags
25+
* @DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_MICROWATTS: The power values
26+
* are in micro-Watts or some other scale.
27+
* @DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_SKIP_INEFFICIENCIES: Skip
28+
* inefficient states when estimating energy consumption.
29+
* @DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_ARTIFICIAL: The power values
30+
* are artificial and might be created by platform missing real power
31+
* information.
32+
*/
33+
enum dev_energymodel_perf_domain_flags {
34+
DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_MICROWATTS = 1,
35+
DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_SKIP_INEFFICIENCIES = 2,
36+
DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_ARTIFICIAL = 4,
37+
};
38+
39+
enum {
40+
DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN = 1,
41+
42+
__DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX,
43+
DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX = (__DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX - 1)
44+
};
45+
46+
enum {
47+
DEV_ENERGYMODEL_A_PERF_DOMAIN_PAD = 1,
48+
DEV_ENERGYMODEL_A_PERF_DOMAIN_PERF_DOMAIN_ID,
49+
DEV_ENERGYMODEL_A_PERF_DOMAIN_FLAGS,
50+
DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS,
51+
52+
__DEV_ENERGYMODEL_A_PERF_DOMAIN_MAX,
53+
DEV_ENERGYMODEL_A_PERF_DOMAIN_MAX = (__DEV_ENERGYMODEL_A_PERF_DOMAIN_MAX - 1)
54+
};
55+
56+
enum {
57+
DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID = 1,
58+
DEV_ENERGYMODEL_A_PERF_TABLE_PERF_STATE,
59+
60+
__DEV_ENERGYMODEL_A_PERF_TABLE_MAX,
61+
DEV_ENERGYMODEL_A_PERF_TABLE_MAX = (__DEV_ENERGYMODEL_A_PERF_TABLE_MAX - 1)
62+
};
63+
64+
enum {
65+
DEV_ENERGYMODEL_A_PERF_STATE_PAD = 1,
66+
DEV_ENERGYMODEL_A_PERF_STATE_PERFORMANCE,
67+
DEV_ENERGYMODEL_A_PERF_STATE_FREQUENCY,
68+
DEV_ENERGYMODEL_A_PERF_STATE_POWER,
69+
DEV_ENERGYMODEL_A_PERF_STATE_COST,
70+
DEV_ENERGYMODEL_A_PERF_STATE_FLAGS,
71+
72+
__DEV_ENERGYMODEL_A_PERF_STATE_MAX,
73+
DEV_ENERGYMODEL_A_PERF_STATE_MAX = (__DEV_ENERGYMODEL_A_PERF_STATE_MAX - 1)
74+
};
75+
76+
enum {
77+
DEV_ENERGYMODEL_CMD_GET_PERF_DOMAINS = 1,
78+
DEV_ENERGYMODEL_CMD_GET_PERF_TABLE,
79+
DEV_ENERGYMODEL_CMD_PERF_DOMAIN_CREATED,
80+
DEV_ENERGYMODEL_CMD_PERF_DOMAIN_UPDATED,
81+
DEV_ENERGYMODEL_CMD_PERF_DOMAIN_DELETED,
82+
83+
__DEV_ENERGYMODEL_CMD_MAX,
84+
DEV_ENERGYMODEL_CMD_MAX = (__DEV_ENERGYMODEL_CMD_MAX - 1)
85+
};
86+
87+
#define DEV_ENERGYMODEL_MCGRP_EVENT "event"
88+
89+
#endif /* _UAPI_LINUX_DEV_ENERGYMODEL_H */

0 commit comments

Comments
 (0)