From: Zhang Rui <rui.zhang@intel.com>
To: linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com,
daniel.lezcano@linaro.org
Cc: linux-kernel@vger.kernel.org, srinivas.pandruvada@intel.com
Subject: [PATCH 11/15] powercap/intel_rapl: Remove redundant cpu parameter
Date: Thu, 16 Mar 2023 23:38:37 +0800 [thread overview]
Message-ID: <20230316153841.3666-12-rui.zhang@intel.com> (raw)
In-Reply-To: <20230316153841.3666-1-rui.zhang@intel.com>
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: Zhang Rui <rui.zhang@intel.com>
---
drivers/powercap/intel_rapl_common.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index 636e05aa711b..27ebc2c51803 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -169,7 +169,7 @@ static int get_pl_prim(struct rapl_domain *rd, int pl, enum pl_prims prim)
struct rapl_defaults {
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);
u64 (*compute_time_window)(struct rapl_domain *rd, u64 val,
bool to_raw);
@@ -819,16 +819,16 @@ static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
* power unit : microWatts : Represented in milliWatts 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;
u32 value;
ra.reg = rd->regs[RAPL_DOMAIN_REG_UNIT];
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",
- ra.reg, cpu);
+ ra.reg, rd->rp->lead_cpu);
return -ENODEV;
}
@@ -847,16 +847,16 @@ static int rapl_check_unit_core(struct rapl_domain *rd, int cpu)
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;
u32 value;
ra.reg = rd->regs[RAPL_DOMAIN_REG_UNIT];
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",
- ra.reg, cpu);
+ ra.reg, rd->rp->lead_cpu);
return -ENODEV;
}
@@ -1233,7 +1233,7 @@ static int rapl_package_register_powercap(struct rapl_package *rp)
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;
@@ -1254,7 +1254,7 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
*/
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 0;
@@ -1283,7 +1283,7 @@ static int rapl_get_domain_unit(struct rapl_domain *rd)
return -ENODEV;
}
- ret = rpd->check_unit(rd, rd->rp->lead_cpu);
+ ret = rpd->check_unit(rd);
if (ret)
return ret;
@@ -1324,14 +1324,14 @@ static void rapl_detect_powerlimit(struct rapl_domain *rd)
/* Detect active and valid domains for the given CPU, caller must
* 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;
int i;
for (i = 0; i < RAPL_DOMAIN_MAX; i++) {
/* 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;
pr_info("Found RAPL domain %s\n", rapl_domain_names[i]);
}
@@ -1435,7 +1435,7 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv)
topology_physical_package_id(cpu));
/* check if the package contains valid domains */
- if (rapl_detect_domains(rp, cpu)) {
+ if (rapl_detect_domains(rp)) {
ret = -ENODEV;
goto err_free_package;
}
--
2.25.1
next prev parent reply other threads:[~2023-03-16 15:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 15:38 [PATCH 0/15] powercap/intel_rapl: Introduce RAPL TPMI support Zhang Rui
2023-03-16 15:38 ` [PATCH 01/15] powercap/intel_rapl: Remove unused field in struct rapl_if_priv Zhang Rui
2023-03-16 15:38 ` [PATCH 02/15] powercap/intel_rapl: Allow probing without CPUID match Zhang Rui
2023-03-16 15:38 ` [PATCH 03/15] powercap/intel_rapl: Support per Interface rapl_defaults Zhang Rui
2023-03-30 17:54 ` Rafael J. Wysocki
2023-04-02 7:40 ` Zhang, Rui
2023-03-16 15:38 ` [PATCH 04/15] powercap/intel_rapl: Support per Interface primitive information Zhang Rui
2023-03-30 17:56 ` Rafael J. Wysocki
2023-04-02 7:43 ` Zhang, Rui
2023-04-03 17:51 ` Rafael J. Wysocki
2023-03-16 15:38 ` [PATCH 05/15] powercap/intel_rapl: Support per domain energy/power/time unit Zhang Rui
2023-03-16 15:38 ` [PATCH 06/15] powercap/intel_rapl: Use index to initialize primitive information Zhang Rui
2023-03-16 15:38 ` [PATCH 07/15] powercap/intel_rapl: Change primitive order Zhang Rui
2023-04-07 11:40 ` Rafael J. Wysocki
2023-03-16 15:38 ` [PATCH 08/15] powercap/intel_rapl: Use bitmap for Power Limits Zhang Rui
2023-03-16 15:38 ` [PATCH 09/15] powercap/intel_rapl: Cleanup Power Limits support Zhang Rui
2023-03-16 15:38 ` [PATCH 10/15] powercap/intel_rapl: Introduce per Power Limit lock Zhang Rui
2023-04-07 12:01 ` Rafael J. Wysocki
2023-03-16 15:38 ` Zhang Rui [this message]
2023-03-16 15:38 ` [PATCH 12/15] powercap/intel_rapl: Make cpu optional for rapl_package Zhang Rui
2023-03-16 15:38 ` [PATCH 13/15] powercap/intel_rapl: Introduce RAPL I/F type Zhang Rui
2023-03-16 15:38 ` [PATCH 14/15] powercap/intel_rapl: Introduce core support for TPMI interface Zhang Rui
2023-03-16 15:38 ` [PATCH 15/15] powercap/intel_rapl_tpmi: Introduce RAPL TPMI interface driver Zhang Rui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230316153841.3666-12-rui.zhang@intel.com \
--to=rui.zhang@intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=srinivas.pandruvada@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®