DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wathsala Vithanage <wathsala.vithanage@arm.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>,
	David Hunt <david.hunt@intel.com>,
	Sivaprasad Tummala <sivaprasad.tummala@amd.com>
Cc: dev@dpdk.org, Wathsala Vithanage <wathsala.vithanage@arm.com>,
	Dhruv Tripathi <dhruv.tripathi@arm.com>
Subject: [PATCH 2/2] eal: detect supported driver
Date: Fri,  6 Sep 2024 21:06:37 +0000	[thread overview]
Message-ID: <20240906210637.630356-2-wathsala.vithanage@arm.com> (raw)
In-Reply-To: <20240906210637.630356-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


      reply	other threads:[~2024-09-06 21:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 21:06 [PATCH 1/2] eal: enable CPPC support in power library Wathsala Vithanage
2024-09-06 21:06 ` Wathsala Vithanage [this message]

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=20240906210637.630356-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 \
    /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).