Commit ace50298 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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
...@@ -116,6 +116,7 @@ examples: ...@@ -116,6 +116,7 @@ examples:
L2_0: l2-cache { L2_0: l2-cache {
compatible = "cache"; compatible = "cache";
cache-level = <2>; cache-level = <2>;
cache-unified;
}; };
}; };
...@@ -150,6 +151,7 @@ examples: ...@@ -150,6 +151,7 @@ examples:
L2_1: l2-cache { L2_1: l2-cache {
compatible = "cache"; compatible = "cache";
cache-level = <2>; cache-level = <2>;
cache-unified;
}; };
}; };
......
...@@ -30,7 +30,9 @@ patternProperties: ...@@ -30,7 +30,9 @@ patternProperties:
this OPP node. Sometimes several corners/levels shares a certain fuse this OPP node. Sometimes several corners/levels shares a certain fuse
corner/level. A fuse corner/level contains e.g. ref uV, min uV, corner/level. A fuse corner/level contains e.g. ref uV, min uV,
and max uV. and max uV.
$ref: /schemas/types.yaml#/definitions/uint32 $ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 2
required: required:
- opp-level - opp-level
......
...@@ -220,13 +220,10 @@ static void genpd_debug_add(struct generic_pm_domain *genpd); ...@@ -220,13 +220,10 @@ static void genpd_debug_add(struct generic_pm_domain *genpd);
static void genpd_debug_remove(struct generic_pm_domain *genpd) static void genpd_debug_remove(struct generic_pm_domain *genpd)
{ {
struct dentry *d;
if (!genpd_debugfs_dir) if (!genpd_debugfs_dir)
return; return;
d = debugfs_lookup(genpd->name, genpd_debugfs_dir); debugfs_lookup_and_remove(genpd->name, genpd_debugfs_dir);
debugfs_remove(d);
} }
static void genpd_update_accounting(struct generic_pm_domain *genpd) static void genpd_update_accounting(struct generic_pm_domain *genpd)
......
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
config PM_OPP config PM_OPP
bool bool
select SRCU
help help
SOCs have a standard set of tuples consisting of frequency and SOCs have a standard set of tuples consisting of frequency and
voltage pairs that the device will support per voltage domain. This voltage pairs that the device will support per voltage domain. This
......
...@@ -235,7 +235,7 @@ static void opp_migrate_dentry(struct opp_device *opp_dev, ...@@ -235,7 +235,7 @@ static void opp_migrate_dentry(struct opp_device *opp_dev,
dentry = debugfs_rename(rootdir, opp_dev->dentry, rootdir, dentry = debugfs_rename(rootdir, opp_dev->dentry, rootdir,
opp_table->dentry_name); opp_table->dentry_name);
if (!dentry) { if (IS_ERR(dentry)) {
dev_err(dev, "%s: Failed to rename link from: %s to %s\n", dev_err(dev, "%s: Failed to rename link from: %s to %s\n",
__func__, dev_name(opp_dev->dev), dev_name(dev)); __func__, dev_name(opp_dev->dev), dev_name(dev));
return; return;
......
...@@ -155,10 +155,12 @@ void idle_inject_set_duration(struct idle_inject_device *ii_dev, ...@@ -155,10 +155,12 @@ void idle_inject_set_duration(struct idle_inject_device *ii_dev,
unsigned int run_duration_us, unsigned int run_duration_us,
unsigned int idle_duration_us) unsigned int idle_duration_us)
{ {
if (run_duration_us && idle_duration_us) { if (run_duration_us + idle_duration_us) {
WRITE_ONCE(ii_dev->run_duration_us, run_duration_us); WRITE_ONCE(ii_dev->run_duration_us, run_duration_us);
WRITE_ONCE(ii_dev->idle_duration_us, idle_duration_us); WRITE_ONCE(ii_dev->idle_duration_us, idle_duration_us);
} }
if (!run_duration_us)
pr_debug("CPU is forced to 100 percent idle\n");
} }
/** /**
...@@ -201,7 +203,7 @@ int idle_inject_start(struct idle_inject_device *ii_dev) ...@@ -201,7 +203,7 @@ int idle_inject_start(struct idle_inject_device *ii_dev)
unsigned int idle_duration_us = READ_ONCE(ii_dev->idle_duration_us); unsigned int idle_duration_us = READ_ONCE(ii_dev->idle_duration_us);
unsigned int run_duration_us = READ_ONCE(ii_dev->run_duration_us); unsigned int run_duration_us = READ_ONCE(ii_dev->run_duration_us);
if (!idle_duration_us || !run_duration_us) if (!(idle_duration_us + run_duration_us))
return -EINVAL; return -EINVAL;
pr_debug("Starting injecting idle cycles on CPUs '%*pbl'\n", pr_debug("Starting injecting idle cycles on CPUs '%*pbl'\n",
......
...@@ -999,7 +999,15 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value, ...@@ -999,7 +999,15 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value,
do_div(value, rp->time_unit); do_div(value, rp->time_unit);
y = ilog2(value); y = ilog2(value);
f = div64_u64(4 * (value - (1 << y)), 1 << y);
/*
* The target hardware field is 7 bits wide, so return all ones
* if the exponent is too large.
*/
if (y > 0x1f)
return 0x7f;
f = div64_u64(4 * (value - (1ULL << y)), 1ULL << y);
value = (y & 0x1f) | ((f & 0x3) << 5); value = (y & 0x1f) | ((f & 0x3) << 5);
} }
return value; return value;
...@@ -1113,7 +1121,10 @@ static const struct x86_cpu_id rapl_ids[] __initconst = { ...@@ -1113,7 +1121,10 @@ static const struct x86_cpu_id rapl_ids[] __initconst = {
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, &rapl_defaults_core), X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, &rapl_defaults_core),
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &rapl_defaults_core), X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &rapl_defaults_core),
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, &rapl_defaults_core), X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, &rapl_defaults_core),
X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE, &rapl_defaults_core),
X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, &rapl_defaults_core),
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server), X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server),
X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &rapl_defaults_spr_server),
X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, &rapl_defaults_core), X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, &rapl_defaults_core),
X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt), X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt),
......
...@@ -530,9 +530,6 @@ struct powercap_zone *powercap_register_zone( ...@@ -530,9 +530,6 @@ struct powercap_zone *powercap_register_zone(
power_zone->name = kstrdup(name, GFP_KERNEL); power_zone->name = kstrdup(name, GFP_KERNEL);
if (!power_zone->name) if (!power_zone->name)
goto err_name_alloc; goto err_name_alloc;
dev_set_name(&power_zone->dev, "%s:%x",
dev_name(power_zone->dev.parent),
power_zone->id);
power_zone->constraints = kcalloc(nr_constraints, power_zone->constraints = kcalloc(nr_constraints,
sizeof(*power_zone->constraints), sizeof(*power_zone->constraints),
GFP_KERNEL); GFP_KERNEL);
...@@ -555,9 +552,16 @@ struct powercap_zone *powercap_register_zone( ...@@ -555,9 +552,16 @@ struct powercap_zone *powercap_register_zone(
power_zone->dev_attr_groups[0] = &power_zone->dev_zone_attr_group; power_zone->dev_attr_groups[0] = &power_zone->dev_zone_attr_group;
power_zone->dev_attr_groups[1] = NULL; power_zone->dev_attr_groups[1] = NULL;
power_zone->dev.groups = power_zone->dev_attr_groups; power_zone->dev.groups = power_zone->dev_attr_groups;
dev_set_name(&power_zone->dev, "%s:%x",
dev_name(power_zone->dev.parent),
power_zone->id);
result = device_register(&power_zone->dev); result = device_register(&power_zone->dev);
if (result) if (result) {
goto err_dev_ret; put_device(&power_zone->dev);
mutex_unlock(&control_type->lock);
return ERR_PTR(result);
}
control_type->nr_zones++; control_type->nr_zones++;
mutex_unlock(&control_type->lock); mutex_unlock(&control_type->lock);
......
...@@ -87,10 +87,7 @@ static void em_debug_create_pd(struct device *dev) ...@@ -87,10 +87,7 @@ static void em_debug_create_pd(struct device *dev)
static void em_debug_remove_pd(struct device *dev) static void em_debug_remove_pd(struct device *dev)
{ {
struct dentry *debug_dir; debugfs_lookup_and_remove(dev_name(dev), rootdir);
debug_dir = debugfs_lookup(dev_name(dev), rootdir);
debugfs_remove_recursive(debug_dir);
} }
static int __init em_debug_init(void) static int __init em_debug_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment