Commit 71d47b53 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'pm-core', 'pm-sleep', 'pm-tools' and 'powercap'

* pm-core:
  PM: runtime: Fix typo in pm_runtime_set_active() helper comment

* pm-sleep:
  PM: sleep: remove unreachable break

* pm-tools:
  cpupower: speed up generating git version string
  cpupowerutils: fix spelling mistake "dependant" -> "dependent"

* powercap:
  powercap: Fix typo in Kconfig "Plance" -> "Plane"
  powercap/intel_rapl: enumerate Psys RAPL domain together with package RAPL domain
  powercap/intel_rapl: Fix domain detection
...@@ -363,7 +363,6 @@ static pm_callback_t pm_op(const struct dev_pm_ops *ops, pm_message_t state) ...@@ -363,7 +363,6 @@ static pm_callback_t pm_op(const struct dev_pm_ops *ops, pm_message_t state)
case PM_EVENT_THAW: case PM_EVENT_THAW:
case PM_EVENT_RECOVER: case PM_EVENT_RECOVER:
return ops->thaw; return ops->thaw;
break;
case PM_EVENT_RESTORE: case PM_EVENT_RESTORE:
return ops->restore; return ops->restore;
#endif /* CONFIG_HIBERNATE_CALLBACKS */ #endif /* CONFIG_HIBERNATE_CALLBACKS */
......
...@@ -30,7 +30,7 @@ config INTEL_RAPL ...@@ -30,7 +30,7 @@ config INTEL_RAPL
In RAPL, the platform level settings are divided into domains for In RAPL, the platform level settings are divided into domains for
fine grained control. These domains include processor package, DRAM fine grained control. These domains include processor package, DRAM
controller, CPU core (Power Plance 0), graphics uncore (Power Plane controller, CPU core (Power Plane 0), graphics uncore (Power Plane
1), etc. 1), etc.
config IDLE_INJECT config IDLE_INJECT
......
...@@ -544,7 +544,14 @@ static void rapl_init_domains(struct rapl_package *rp) ...@@ -544,7 +544,14 @@ static void rapl_init_domains(struct rapl_package *rp)
continue; continue;
rd->rp = rp; rd->rp = rp;
rd->name = rapl_domain_names[i];
if (i == RAPL_DOMAIN_PLATFORM && rp->id > 0) {
snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH, "psys-%d",
cpu_data(rp->lead_cpu).phys_proc_id);
} else
snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH, "%s",
rapl_domain_names[i]);
rd->id = i; rd->id = i;
rd->rpl[0].prim_id = PL1_ENABLE; rd->rpl[0].prim_id = PL1_ENABLE;
rd->rpl[0].name = pl1_name; rd->rpl[0].name = pl1_name;
...@@ -1112,13 +1119,17 @@ static int rapl_package_register_powercap(struct rapl_package *rp) ...@@ -1112,13 +1119,17 @@ static int rapl_package_register_powercap(struct rapl_package *rp)
} }
/* now register domains as children of the socket/package */ /* now register domains as children of the socket/package */
for (rd = rp->domains; rd < rp->domains + rp->nr_domains; rd++) { for (rd = rp->domains; rd < rp->domains + rp->nr_domains; rd++) {
struct powercap_zone *parent = rp->power_zone;
if (rd->id == RAPL_DOMAIN_PACKAGE) if (rd->id == RAPL_DOMAIN_PACKAGE)
continue; continue;
if (rd->id == RAPL_DOMAIN_PLATFORM)
parent = NULL;
/* number of power limits per domain varies */ /* number of power limits per domain varies */
nr_pl = find_nr_power_limit(rd); nr_pl = find_nr_power_limit(rd);
power_zone = powercap_register_zone(&rd->power_zone, power_zone = powercap_register_zone(&rd->power_zone,
rp->priv->control_type, rp->priv->control_type,
rd->name, rp->power_zone, rd->name, parent,
&zone_ops[rd->id], nr_pl, &zone_ops[rd->id], nr_pl,
&constraint_ops); &constraint_ops);
...@@ -1145,67 +1156,6 @@ static int rapl_package_register_powercap(struct rapl_package *rp) ...@@ -1145,67 +1156,6 @@ static int rapl_package_register_powercap(struct rapl_package *rp)
return ret; return ret;
} }
int rapl_add_platform_domain(struct rapl_if_priv *priv)
{
struct rapl_domain *rd;
struct powercap_zone *power_zone;
struct reg_action ra;
int ret;
ra.reg = priv->regs[RAPL_DOMAIN_PLATFORM][RAPL_DOMAIN_REG_STATUS];
ra.mask = ~0;
ret = priv->read_raw(0, &ra);
if (ret || !ra.value)
return -ENODEV;
ra.reg = priv->regs[RAPL_DOMAIN_PLATFORM][RAPL_DOMAIN_REG_LIMIT];
ra.mask = ~0;
ret = priv->read_raw(0, &ra);
if (ret || !ra.value)
return -ENODEV;
rd = kzalloc(sizeof(*rd), GFP_KERNEL);
if (!rd)
return -ENOMEM;
rd->name = rapl_domain_names[RAPL_DOMAIN_PLATFORM];
rd->id = RAPL_DOMAIN_PLATFORM;
rd->regs[RAPL_DOMAIN_REG_LIMIT] =
priv->regs[RAPL_DOMAIN_PLATFORM][RAPL_DOMAIN_REG_LIMIT];
rd->regs[RAPL_DOMAIN_REG_STATUS] =
priv->regs[RAPL_DOMAIN_PLATFORM][RAPL_DOMAIN_REG_STATUS];
rd->rpl[0].prim_id = PL1_ENABLE;
rd->rpl[0].name = pl1_name;
rd->rpl[1].prim_id = PL2_ENABLE;
rd->rpl[1].name = pl2_name;
rd->rp = rapl_find_package_domain(0, priv);
power_zone = powercap_register_zone(&rd->power_zone, priv->control_type,
"psys", NULL,
&zone_ops[RAPL_DOMAIN_PLATFORM],
2, &constraint_ops);
if (IS_ERR(power_zone)) {
kfree(rd);
return PTR_ERR(power_zone);
}
priv->platform_rapl_domain = rd;
return 0;
}
EXPORT_SYMBOL_GPL(rapl_add_platform_domain);
void rapl_remove_platform_domain(struct rapl_if_priv *priv)
{
if (priv->platform_rapl_domain) {
powercap_unregister_zone(priv->control_type,
&priv->platform_rapl_domain->power_zone);
kfree(priv->platform_rapl_domain);
}
}
EXPORT_SYMBOL_GPL(rapl_remove_platform_domain);
static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp) static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
{ {
struct reg_action ra; struct reg_action ra;
...@@ -1215,11 +1165,9 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp) ...@@ -1215,11 +1165,9 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
case RAPL_DOMAIN_PP0: case RAPL_DOMAIN_PP0:
case RAPL_DOMAIN_PP1: case RAPL_DOMAIN_PP1:
case RAPL_DOMAIN_DRAM: case RAPL_DOMAIN_DRAM:
case RAPL_DOMAIN_PLATFORM:
ra.reg = rp->priv->regs[domain][RAPL_DOMAIN_REG_STATUS]; ra.reg = rp->priv->regs[domain][RAPL_DOMAIN_REG_STATUS];
break; break;
case RAPL_DOMAIN_PLATFORM:
/* PSYS(PLATFORM) is not a CPU domain, so avoid printng error */
return -EINVAL;
default: default:
pr_err("invalid domain id %d\n", domain); pr_err("invalid domain id %d\n", domain);
return -EINVAL; return -EINVAL;
...@@ -1228,7 +1176,7 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp) ...@@ -1228,7 +1176,7 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
* values, otherwise skip it. * values, otherwise skip it.
*/ */
ra.mask = ~0; ra.mask = ENERGY_STATUS_MASK;
if (rp->priv->read_raw(cpu, &ra) || !ra.value) if (rp->priv->read_raw(cpu, &ra) || !ra.value)
return -ENODEV; return -ENODEV;
......
...@@ -44,6 +44,7 @@ static struct rapl_if_priv rapl_msr_priv = { ...@@ -44,6 +44,7 @@ static struct rapl_if_priv rapl_msr_priv = {
.regs[RAPL_DOMAIN_PLATFORM] = { .regs[RAPL_DOMAIN_PLATFORM] = {
MSR_PLATFORM_POWER_LIMIT, MSR_PLATFORM_ENERGY_STATUS, 0, 0, 0}, MSR_PLATFORM_POWER_LIMIT, MSR_PLATFORM_ENERGY_STATUS, 0, 0, 0},
.limits[RAPL_DOMAIN_PACKAGE] = 2, .limits[RAPL_DOMAIN_PACKAGE] = 2,
.limits[RAPL_DOMAIN_PLATFORM] = 2,
}; };
/* Handles CPU hotplug on multi-socket systems. /* Handles CPU hotplug on multi-socket systems.
...@@ -157,9 +158,6 @@ static int rapl_msr_probe(struct platform_device *pdev) ...@@ -157,9 +158,6 @@ static int rapl_msr_probe(struct platform_device *pdev)
goto out; goto out;
rapl_msr_priv.pcap_rapl_online = ret; rapl_msr_priv.pcap_rapl_online = ret;
/* Don't bail out if PSys is not supported */
rapl_add_platform_domain(&rapl_msr_priv);
return 0; return 0;
out: out:
...@@ -171,7 +169,6 @@ static int rapl_msr_probe(struct platform_device *pdev) ...@@ -171,7 +169,6 @@ static int rapl_msr_probe(struct platform_device *pdev)
static int rapl_msr_remove(struct platform_device *pdev) static int rapl_msr_remove(struct platform_device *pdev)
{ {
cpuhp_remove_state(rapl_msr_priv.pcap_rapl_online); cpuhp_remove_state(rapl_msr_priv.pcap_rapl_online);
rapl_remove_platform_domain(&rapl_msr_priv);
powercap_unregister_control_type(rapl_msr_priv.control_type); powercap_unregister_control_type(rapl_msr_priv.control_type);
return 0; return 0;
} }
......
...@@ -79,8 +79,10 @@ struct rapl_power_limit { ...@@ -79,8 +79,10 @@ struct rapl_power_limit {
struct rapl_package; struct rapl_package;
#define RAPL_DOMAIN_NAME_LENGTH 16
struct rapl_domain { struct rapl_domain {
const char *name; char name[RAPL_DOMAIN_NAME_LENGTH];
enum rapl_domain_type id; enum rapl_domain_type id;
u64 regs[RAPL_DOMAIN_REG_MAX]; u64 regs[RAPL_DOMAIN_REG_MAX];
struct powercap_zone power_zone; struct powercap_zone power_zone;
...@@ -152,7 +154,4 @@ struct rapl_package *rapl_find_package_domain(int cpu, struct rapl_if_priv *priv ...@@ -152,7 +154,4 @@ struct rapl_package *rapl_find_package_domain(int cpu, struct rapl_if_priv *priv
struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv); struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv);
void rapl_remove_package(struct rapl_package *rp); void rapl_remove_package(struct rapl_package *rp);
int rapl_add_platform_domain(struct rapl_if_priv *priv);
void rapl_remove_platform_domain(struct rapl_if_priv *priv);
#endif /* __INTEL_RAPL_H__ */ #endif /* __INTEL_RAPL_H__ */
...@@ -479,7 +479,7 @@ static inline int pm_runtime_set_active(struct device *dev) ...@@ -479,7 +479,7 @@ static inline int pm_runtime_set_active(struct device *dev)
} }
/** /**
* pm_runtime_set_suspended - Set runtime PM status to "active". * pm_runtime_set_suspended - Set runtime PM status to "suspended".
* @dev: Target device. * @dev: Target device.
* *
* Set the runtime PM status of @dev to %RPM_SUSPENDED and ensure that * Set the runtime PM status of @dev to %RPM_SUSPENDED and ensure that
......
...@@ -51,7 +51,7 @@ DESTDIR ?= ...@@ -51,7 +51,7 @@ DESTDIR ?=
# Package-related definitions. Distributions can modify the version # Package-related definitions. Distributions can modify the version
# and _should_ modify the PACKAGE_BUGREPORT definition # and _should_ modify the PACKAGE_BUGREPORT definition
VERSION= $(shell ./utils/version-gen.sh) VERSION:= $(shell ./utils/version-gen.sh)
LIB_MAJ= 0.0.1 LIB_MAJ= 0.0.1
LIB_MIN= 0 LIB_MIN= 0
......
...@@ -71,7 +71,7 @@ int main (void) ...@@ -71,7 +71,7 @@ int main (void)
printf("\tsmi_cmd=0x?? smi_port=0x?? smi_sig=1\n"); printf("\tsmi_cmd=0x?? smi_port=0x?? smi_sig=1\n");
printf("\nUnfortunately, you have to know what exactly are " printf("\nUnfortunately, you have to know what exactly are "
"smi_cmd and smi_port, and this\nis system " "smi_cmd and smi_port, and this\nis system "
"dependant.\n"); "dependent.\n");
} }
return 1; return 1;
} }
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