lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220826075655.1.I2e4958048f30c3b44a01e31519092f7d3c9204e4@changeid>
Date:   Fri, 26 Aug 2022 07:56:59 -0700
From:   Douglas Anderson <dianders@...omium.org>
To:     Viresh Kumar <vireshk@...nel.org>, Nishanth Menon <nm@...com>,
        Stephen Boyd <sboyd@...nel.org>
Cc:     linux-arm-msm@...r.kernel.org, mka@...omium.org,
        Douglas Anderson <dianders@...omium.org>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: [PATCH] opp: Expose voltage info in debugfs for OPPs w/out explicit regulators

On some cpufreq drivers we know the voltage associated with each
operating point but there is no explicit Linux "regulator" present. An
example is "qcom-cpufreq-hw.c". There the voltage is managed
automatically by the hardware but we still associate it with the OPP
table so we can do energy calculations for EAS.

The OPP framework handles this in general. In _opp_allocate() it can
be seen that we always allocate space for one supply even if
"regulator_count" is 0.

Let's handle this properly in debugfs.

NOTE: as a side effect of this a whole bunch of OPPs in the system may
get supply-related files exposed in debugfs that are mostly useless
(they'll just contain 0). I'd expect this to be OK but it's moderately
annoying. It seems better than trying to dynamically create debugfs
directories when the voltages are non-zero or adding extra complexity
in the code giving a hint to the OPP framework that voltages should be
exposed.

After this patch, on a sc7180-trogdor class device I can see voltages
for the CPU OPPs under /sys/kernel/debug/opp.

Fixes: dfbe4678d709 ("PM / OPP: Add infrastructure to manage multiple regulators")
Signed-off-by: Douglas Anderson <dianders@...omium.org>
---

 drivers/opp/debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c
index 96a30a032c5f..65234da41063 100644
--- a/drivers/opp/debugfs.c
+++ b/drivers/opp/debugfs.c
@@ -96,10 +96,11 @@ static void opp_debug_create_supplies(struct dev_pm_opp *opp,
 				      struct opp_table *opp_table,
 				      struct dentry *pdentry)
 {
+	int supply_count = max(opp_table->regulator_count, 1);
 	struct dentry *d;
 	int i;
 
-	for (i = 0; i < opp_table->regulator_count; i++) {
+	for (i = 0; i < supply_count; i++) {
 		char name[15];
 
 		snprintf(name, sizeof(name), "supply-%d", i);
-- 
2.37.2.672.g94769d06f0-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ