Skip to content

Commit ace5029

Browse files
committed
Merge branches 'powercap', 'pm-domains', 'pm-em' and 'pm-opp'
Merge updates of the powercap framework, generic PM domains, Energy Model and operating performance points for 6.3-rc1: - Fix possible name leak in powercap_register_zone() (Yang Yingliang). - Add Meteor Lake and Emerald Rapids support to the intel_rapl power capping driver (Zhang Rui). - Modify the idle_inject power capping facility to support 100% idle injection (Srinivas Pandruvada). - Fix large time windows handling in the intel_rapl power capping driver (Zhang Rui). - Fix memory leaks with using debugfs_lookup() in the generic PM domains and Energy Model code (Greg Kroah-Hartman). - Add missing 'cache-unified' property in example for kryo OPP bindings (Rob Herring). - Fix error checking in opp_migrate_dentry() (Qi Zheng). - Remove "select SRCU" (Paul E. McKenney). - Let qcom,opp-fuse-level be a 2-long array for qcom SoCs (Konrad Dybcio). * powercap: powercap: intel_rapl: Fix handling for large time window powercap: idle_inject: Support 100% idle injection powercap: intel_rapl: add support for Emerald Rapids powercap: intel_rapl: add support for Meteor Lake powercap: fix possible name leak in powercap_register_zone() * pm-domains: PM: domains: fix memory leak with using debugfs_lookup() * pm-em: PM: EM: fix memory leak with using debugfs_lookup() * pm-opp: OPP: fix error checking in opp_migrate_dentry() dt-bindings: opp: v2-qcom-level: Let qcom,opp-fuse-level be a 2-long array drivers/opp: Remove "select SRCU" dt-bindings: opp: opp-v2-kryo-cpu: Add missing 'cache-unified' property in example
5 parents 7e71a13 + cf835b0 + 0b6200e + a0e8c13 + 9953706 commit ace5029

File tree

9 files changed

+33
-19
lines changed

9 files changed

+33
-19
lines changed

Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ examples:
116116
L2_0: l2-cache {
117117
compatible = "cache";
118118
cache-level = <2>;
119+
cache-unified;
119120
};
120121
};
121122
@@ -150,6 +151,7 @@ examples:
150151
L2_1: l2-cache {
151152
compatible = "cache";
152153
cache-level = <2>;
154+
cache-unified;
153155
};
154156
};
155157

Documentation/devicetree/bindings/opp/opp-v2-qcom-level.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ patternProperties:
3030
this OPP node. Sometimes several corners/levels shares a certain fuse
3131
corner/level. A fuse corner/level contains e.g. ref uV, min uV,
3232
and max uV.
33-
$ref: /schemas/types.yaml#/definitions/uint32
33+
$ref: /schemas/types.yaml#/definitions/uint32-array
34+
minItems: 1
35+
maxItems: 2
3436

3537
required:
3638
- opp-level

drivers/base/power/domain.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,10 @@ static void genpd_debug_add(struct generic_pm_domain *genpd);
220220

221221
static void genpd_debug_remove(struct generic_pm_domain *genpd)
222222
{
223-
struct dentry *d;
224-
225223
if (!genpd_debugfs_dir)
226224
return;
227225

228-
d = debugfs_lookup(genpd->name, genpd_debugfs_dir);
229-
debugfs_remove(d);
226+
debugfs_lookup_and_remove(genpd->name, genpd_debugfs_dir);
230227
}
231228

232229
static void genpd_update_accounting(struct generic_pm_domain *genpd)

drivers/opp/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
config PM_OPP
33
bool
4-
select SRCU
54
help
65
SOCs have a standard set of tuples consisting of frequency and
76
voltage pairs that the device will support per voltage domain. This

drivers/opp/debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static void opp_migrate_dentry(struct opp_device *opp_dev,
235235

236236
dentry = debugfs_rename(rootdir, opp_dev->dentry, rootdir,
237237
opp_table->dentry_name);
238-
if (!dentry) {
238+
if (IS_ERR(dentry)) {
239239
dev_err(dev, "%s: Failed to rename link from: %s to %s\n",
240240
__func__, dev_name(opp_dev->dev), dev_name(dev));
241241
return;

drivers/powercap/idle_inject.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,12 @@ void idle_inject_set_duration(struct idle_inject_device *ii_dev,
155155
unsigned int run_duration_us,
156156
unsigned int idle_duration_us)
157157
{
158-
if (run_duration_us && idle_duration_us) {
158+
if (run_duration_us + idle_duration_us) {
159159
WRITE_ONCE(ii_dev->run_duration_us, run_duration_us);
160160
WRITE_ONCE(ii_dev->idle_duration_us, idle_duration_us);
161161
}
162+
if (!run_duration_us)
163+
pr_debug("CPU is forced to 100 percent idle\n");
162164
}
163165

164166
/**
@@ -201,7 +203,7 @@ int idle_inject_start(struct idle_inject_device *ii_dev)
201203
unsigned int idle_duration_us = READ_ONCE(ii_dev->idle_duration_us);
202204
unsigned int run_duration_us = READ_ONCE(ii_dev->run_duration_us);
203205

204-
if (!idle_duration_us || !run_duration_us)
206+
if (!(idle_duration_us + run_duration_us))
205207
return -EINVAL;
206208

207209
pr_debug("Starting injecting idle cycles on CPUs '%*pbl'\n",

drivers/powercap/intel_rapl_common.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,15 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value,
999999

10001000
do_div(value, rp->time_unit);
10011001
y = ilog2(value);
1002-
f = div64_u64(4 * (value - (1 << y)), 1 << y);
1002+
1003+
/*
1004+
* The target hardware field is 7 bits wide, so return all ones
1005+
* if the exponent is too large.
1006+
*/
1007+
if (y > 0x1f)
1008+
return 0x7f;
1009+
1010+
f = div64_u64(4 * (value - (1ULL << y)), 1ULL << y);
10031011
value = (y & 0x1f) | ((f & 0x3) << 5);
10041012
}
10051013
return value;
@@ -1113,7 +1121,10 @@ static const struct x86_cpu_id rapl_ids[] __initconst = {
11131121
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, &rapl_defaults_core),
11141122
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &rapl_defaults_core),
11151123
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, &rapl_defaults_core),
1124+
X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE, &rapl_defaults_core),
1125+
X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, &rapl_defaults_core),
11161126
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server),
1127+
X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &rapl_defaults_spr_server),
11171128
X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, &rapl_defaults_core),
11181129

11191130
X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt),

drivers/powercap/powercap_sys.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,6 @@ struct powercap_zone *powercap_register_zone(
530530
power_zone->name = kstrdup(name, GFP_KERNEL);
531531
if (!power_zone->name)
532532
goto err_name_alloc;
533-
dev_set_name(&power_zone->dev, "%s:%x",
534-
dev_name(power_zone->dev.parent),
535-
power_zone->id);
536533
power_zone->constraints = kcalloc(nr_constraints,
537534
sizeof(*power_zone->constraints),
538535
GFP_KERNEL);
@@ -555,9 +552,16 @@ struct powercap_zone *powercap_register_zone(
555552
power_zone->dev_attr_groups[0] = &power_zone->dev_zone_attr_group;
556553
power_zone->dev_attr_groups[1] = NULL;
557554
power_zone->dev.groups = power_zone->dev_attr_groups;
555+
dev_set_name(&power_zone->dev, "%s:%x",
556+
dev_name(power_zone->dev.parent),
557+
power_zone->id);
558558
result = device_register(&power_zone->dev);
559-
if (result)
560-
goto err_dev_ret;
559+
if (result) {
560+
put_device(&power_zone->dev);
561+
mutex_unlock(&control_type->lock);
562+
563+
return ERR_PTR(result);
564+
}
561565

562566
control_type->nr_zones++;
563567
mutex_unlock(&control_type->lock);

kernel/power/energy_model.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ static void em_debug_create_pd(struct device *dev)
8787

8888
static void em_debug_remove_pd(struct device *dev)
8989
{
90-
struct dentry *debug_dir;
91-
92-
debug_dir = debugfs_lookup(dev_name(dev), rootdir);
93-
debugfs_remove_recursive(debug_dir);
90+
debugfs_lookup_and_remove(dev_name(dev), rootdir);
9491
}
9592

9693
static int __init em_debug_init(void)

0 commit comments

Comments
 (0)