Commit 693c1d78 authored by Zhang Rui's avatar Zhang Rui Committed by Rafael J. Wysocki

powercap: intel_rapl: Remove redundant cpu parameter

For rapl_packages that rely on online CPUs to work, rp->lead_cpu always
has a valid CPU id.

Remove the redundant cpu parameter in rapl_check_domain(),
rapl_detect_domains() and .check_unit() callbacks.

No functional change.
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
Tested-by: default avatarWang Wendy <wendy.wang@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent f442bd27
...@@ -178,7 +178,7 @@ static int get_pl_prim(struct rapl_domain *rd, int pl, enum pl_prims prim) ...@@ -178,7 +178,7 @@ static int get_pl_prim(struct rapl_domain *rd, int pl, enum pl_prims prim)
struct rapl_defaults { struct rapl_defaults {
u8 floor_freq_reg_addr; u8 floor_freq_reg_addr;
int (*check_unit)(struct rapl_domain *rd, int cpu); int (*check_unit)(struct rapl_domain *rd);
void (*set_floor_freq)(struct rapl_domain *rd, bool mode); void (*set_floor_freq)(struct rapl_domain *rd, bool mode);
u64 (*compute_time_window)(struct rapl_domain *rd, u64 val, u64 (*compute_time_window)(struct rapl_domain *rd, u64 val,
bool to_raw); bool to_raw);
...@@ -828,16 +828,16 @@ static int rapl_write_pl_data(struct rapl_domain *rd, int pl, ...@@ -828,16 +828,16 @@ static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
* power unit : microWatts : Represented in milliWatts by default * power unit : microWatts : Represented in milliWatts by default
* time unit : microseconds: Represented in seconds by default * time unit : microseconds: Represented in seconds by default
*/ */
static int rapl_check_unit_core(struct rapl_domain *rd, int cpu) static int rapl_check_unit_core(struct rapl_domain *rd)
{ {
struct reg_action ra; struct reg_action ra;
u32 value; u32 value;
ra.reg = rd->regs[RAPL_DOMAIN_REG_UNIT]; ra.reg = rd->regs[RAPL_DOMAIN_REG_UNIT];
ra.mask = ~0; ra.mask = ~0;
if (rd->rp->priv->read_raw(cpu, &ra)) { if (rd->rp->priv->read_raw(rd->rp->lead_cpu, &ra)) {
pr_err("Failed to read power unit REG 0x%llx on CPU %d, exit.\n", pr_err("Failed to read power unit REG 0x%llx on CPU %d, exit.\n",
ra.reg, cpu); ra.reg, rd->rp->lead_cpu);
return -ENODEV; return -ENODEV;
} }
...@@ -856,16 +856,16 @@ static int rapl_check_unit_core(struct rapl_domain *rd, int cpu) ...@@ -856,16 +856,16 @@ static int rapl_check_unit_core(struct rapl_domain *rd, int cpu)
return 0; return 0;
} }
static int rapl_check_unit_atom(struct rapl_domain *rd, int cpu) static int rapl_check_unit_atom(struct rapl_domain *rd)
{ {
struct reg_action ra; struct reg_action ra;
u32 value; u32 value;
ra.reg = rd->regs[RAPL_DOMAIN_REG_UNIT]; ra.reg = rd->regs[RAPL_DOMAIN_REG_UNIT];
ra.mask = ~0; ra.mask = ~0;
if (rd->rp->priv->read_raw(cpu, &ra)) { if (rd->rp->priv->read_raw(rd->rp->lead_cpu, &ra)) {
pr_err("Failed to read power unit REG 0x%llx on CPU %d, exit.\n", pr_err("Failed to read power unit REG 0x%llx on CPU %d, exit.\n",
ra.reg, cpu); ra.reg, rd->rp->lead_cpu);
return -ENODEV; return -ENODEV;
} }
...@@ -1242,7 +1242,7 @@ static int rapl_package_register_powercap(struct rapl_package *rp) ...@@ -1242,7 +1242,7 @@ static int rapl_package_register_powercap(struct rapl_package *rp)
return ret; return ret;
} }
static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp) static int rapl_check_domain(int domain, struct rapl_package *rp)
{ {
struct reg_action ra; struct reg_action ra;
...@@ -1263,7 +1263,7 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp) ...@@ -1263,7 +1263,7 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
*/ */
ra.mask = ENERGY_STATUS_MASK; ra.mask = ENERGY_STATUS_MASK;
if (rp->priv->read_raw(cpu, &ra) || !ra.value) if (rp->priv->read_raw(rp->lead_cpu, &ra) || !ra.value)
return -ENODEV; return -ENODEV;
return 0; return 0;
...@@ -1292,7 +1292,7 @@ static int rapl_get_domain_unit(struct rapl_domain *rd) ...@@ -1292,7 +1292,7 @@ static int rapl_get_domain_unit(struct rapl_domain *rd)
return -ENODEV; return -ENODEV;
} }
ret = defaults->check_unit(rd, rd->rp->lead_cpu); ret = defaults->check_unit(rd);
if (ret) if (ret)
return ret; return ret;
...@@ -1334,14 +1334,14 @@ static void rapl_detect_powerlimit(struct rapl_domain *rd) ...@@ -1334,14 +1334,14 @@ static void rapl_detect_powerlimit(struct rapl_domain *rd)
/* Detect active and valid domains for the given CPU, caller must /* Detect active and valid domains for the given CPU, caller must
* ensure the CPU belongs to the targeted package and CPU hotlug is disabled. * ensure the CPU belongs to the targeted package and CPU hotlug is disabled.
*/ */
static int rapl_detect_domains(struct rapl_package *rp, int cpu) static int rapl_detect_domains(struct rapl_package *rp)
{ {
struct rapl_domain *rd; struct rapl_domain *rd;
int i; int i;
for (i = 0; i < RAPL_DOMAIN_MAX; i++) { for (i = 0; i < RAPL_DOMAIN_MAX; i++) {
/* use physical package id to read counters */ /* use physical package id to read counters */
if (!rapl_check_domain(cpu, i, rp)) { if (!rapl_check_domain(i, rp)) {
rp->domain_map |= 1 << i; rp->domain_map |= 1 << i;
pr_info("Found RAPL domain %s\n", rapl_domain_names[i]); pr_info("Found RAPL domain %s\n", rapl_domain_names[i]);
} }
...@@ -1445,7 +1445,7 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv) ...@@ -1445,7 +1445,7 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv)
topology_physical_package_id(cpu)); topology_physical_package_id(cpu));
/* check if the package contains valid domains */ /* check if the package contains valid domains */
if (rapl_detect_domains(rp, cpu)) { if (rapl_detect_domains(rp)) {
ret = -ENODEV; ret = -ENODEV;
goto err_free_package; goto err_free_package;
} }
......
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