From: Wathsala Vithanage <wathsala.vithanage@arm.com>
To: dev@dpdk.org, Anatoly Burakov <anatoly.burakov@intel.com>,
David Hunt <david.hunt@intel.com>,
Sivaprasad Tummala <sivaprasad.tummala@amd.com>
Cc: stable@dpdk.org, Wathsala Vithanage <wathsala.vithanage@arm.com>,
Dhruv Tripathi <dhruv.tripathi@arm.com>
Subject: [PATCH v3 2/2] power: detect supported driver
Date: Thu, 10 Oct 2024 14:17:37 +0000 [thread overview]
Message-ID: <20241010141737.1135905-2-wathsala.vithanage@arm.com> (raw)
In-Reply-To: <20241010141737.1135905-1-wathsala.vithanage@arm.com>
Check if the frequency scaling driver is supported before attempting
to initialize.
Signed-off-by: Wathsala Vithanage <wathsala.vithanage@arm.com>
Reviewed-by: Dhruv Tripathi <dhruv.tripathi@arm.com>
---
lib/power/power_acpi_cpufreq.c | 6 ++++++
lib/power/power_amd_pstate_cpufreq.c | 6 ++++++
lib/power/power_cppc_cpufreq.c | 6 ++++++
lib/power/power_pstate_cpufreq.c | 6 ++++++
4 files changed, 24 insertions(+)
diff --git a/lib/power/power_acpi_cpufreq.c b/lib/power/power_acpi_cpufreq.c
index 81996e1c13..abad53bef1 100644
--- a/lib/power/power_acpi_cpufreq.c
+++ b/lib/power/power_acpi_cpufreq.c
@@ -236,6 +236,12 @@ power_acpi_cpufreq_init(unsigned int lcore_id)
struct acpi_power_info *pi;
uint32_t exp_state;
+ if (!power_acpi_cpufreq_check_supported()) {
+ POWER_LOG(ERR, "%s driver is not supported",
+ POWER_ACPI_DRIVER);
+ return -1;
+ }
+
if (lcore_id >= RTE_MAX_LCORE) {
POWER_LOG(ERR, "Lcore id %u can not exceeds %u",
lcore_id, RTE_MAX_LCORE - 1U);
diff --git a/lib/power/power_amd_pstate_cpufreq.c b/lib/power/power_amd_pstate_cpufreq.c
index 090a0d96cb..4809d45a22 100644
--- a/lib/power/power_amd_pstate_cpufreq.c
+++ b/lib/power/power_amd_pstate_cpufreq.c
@@ -354,6 +354,12 @@ power_amd_pstate_cpufreq_init(unsigned int lcore_id)
struct amd_pstate_power_info *pi;
uint32_t exp_state;
+ if (!power_amd_pstate_cpufreq_check_supported()) {
+ POWER_LOG(ERR, "%s driver is not supported",
+ POWER_AMD_PSTATE_DRIVER);
+ return -1;
+ }
+
if (lcore_id >= RTE_MAX_LCORE) {
POWER_LOG(ERR, "Lcore id %u can not exceeds %u",
lcore_id, RTE_MAX_LCORE - 1U);
diff --git a/lib/power/power_cppc_cpufreq.c b/lib/power/power_cppc_cpufreq.c
index e68b39b424..e73f4520d0 100644
--- a/lib/power/power_cppc_cpufreq.c
+++ b/lib/power/power_cppc_cpufreq.c
@@ -340,6 +340,12 @@ power_cppc_cpufreq_init(unsigned int lcore_id)
struct cppc_power_info *pi;
uint32_t exp_state;
+ if (!power_cppc_cpufreq_check_supported()) {
+ POWER_LOG(ERR, "%s driver is not supported",
+ POWER_CPPC_DRIVER);
+ return -1;
+ }
+
if (lcore_id >= RTE_MAX_LCORE) {
POWER_LOG(ERR, "Lcore id %u can not exceeds %u",
lcore_id, RTE_MAX_LCORE - 1U);
diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c
index 2343121621..1c2a91a178 100644
--- a/lib/power/power_pstate_cpufreq.c
+++ b/lib/power/power_pstate_cpufreq.c
@@ -542,6 +542,12 @@ power_pstate_cpufreq_init(unsigned int lcore_id)
struct pstate_power_info *pi;
uint32_t exp_state;
+ if (!power_pstate_cpufreq_check_supported()) {
+ POWER_LOG(ERR, "%s driver is not supported",
+ POWER_PSTATE_DRIVER);
+ return -1;
+ }
+
if (lcore_id >= RTE_MAX_LCORE) {
POWER_LOG(ERR, "Lcore id %u can not exceed %u",
lcore_id, RTE_MAX_LCORE - 1U);
--
2.34.1
next prev parent reply other threads:[~2024-10-10 14:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240906210637.630356>
2024-10-10 14:17 ` [PATCH v3 1/2] power: enable CPPC support in power library Wathsala Vithanage
2024-10-10 14:17 ` Wathsala Vithanage [this message]
2024-10-10 21:44 ` Thomas Monjalon
2024-10-10 21:51 ` Wathsala Wathawana Vithanage
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=20241010141737.1135905-2-wathsala.vithanage@arm.com \
--to=wathsala.vithanage@arm.com \
--cc=anatoly.burakov@intel.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=dhruv.tripathi@arm.com \
--cc=sivaprasad.tummala@amd.com \
--cc=stable@dpdk.org \
/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;
as well as URLs for NNTP newsgroup(s).