patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v3 1/2] power: enable CPPC support in power library
       [not found] <20240906210637.630356>
@ 2024-10-10 14:17 ` Wathsala Vithanage
  2024-10-10 14:17   ` [PATCH v3 2/2] power: detect supported driver Wathsala Vithanage
  2024-10-10 21:44   ` [PATCH v3 1/2] power: enable CPPC support in power library Thomas Monjalon
  0 siblings, 2 replies; 4+ messages in thread
From: Wathsala Vithanage @ 2024-10-10 14:17 UTC (permalink / raw)
  To: dev, Anatoly Burakov, David Hunt, Sivaprasad Tummala
  Cc: stable, Wathsala Vithanage, Dhruv Tripathi

Power library already supports Linux CPPC driver. Enable its use
and fix the name of the CPPC driver name.

Signed-off-by: Wathsala Vithanage <wathsala.vithanage@arm.com>
Reviewed-by: Dhruv Tripathi <dhruv.tripathi@arm.com>
---
 lib/power/power_cppc_cpufreq.c |  2 +-
 lib/power/rte_power_pmd_mgmt.c | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/power/power_cppc_cpufreq.c b/lib/power/power_cppc_cpufreq.c
index 32aaacb948..e68b39b424 100644
--- a/lib/power/power_cppc_cpufreq.c
+++ b/lib/power/power_cppc_cpufreq.c
@@ -36,7 +36,7 @@
 #define POWER_SYSFILE_SYS_MAX \
 		"/sys/devices/system/cpu/cpu%u/cpufreq/cpuinfo_max_freq"
 
-#define POWER_CPPC_DRIVER "cppc-cpufreq"
+#define POWER_CPPC_DRIVER "cppc_cpufreq"
 #define BUS_FREQ     100000
 
 enum power_state {
diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index b1c18a5f56..830a6c7a97 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -419,11 +419,12 @@ check_scale(unsigned int lcore)
 {
 	enum power_management_env env;
 
-	/* only PSTATE and ACPI modes are supported */
+	/* only PSTATE, AMD-PSTATE, ACPI and CPPC modes are supported */
 	if (!rte_power_check_env_supported(PM_ENV_ACPI_CPUFREQ) &&
 			!rte_power_check_env_supported(PM_ENV_PSTATE_CPUFREQ) &&
-			!rte_power_check_env_supported(PM_ENV_AMD_PSTATE_CPUFREQ)) {
-		POWER_LOG(DEBUG, "Neither ACPI nor PSTATE modes are supported");
+			!rte_power_check_env_supported(PM_ENV_AMD_PSTATE_CPUFREQ) &&
+			!rte_power_check_env_supported(PM_ENV_CPPC_CPUFREQ)) {
+		POWER_LOG(DEBUG, "Only ACPI, PSTATE, AMD-PSTATE, or CPPC modes are supported");
 		return -ENOTSUP;
 	}
 	/* ensure we could initialize the power library */
@@ -433,8 +434,8 @@ check_scale(unsigned int lcore)
 	/* ensure we initialized the correct env */
 	env = rte_power_get_env();
 	if (env != PM_ENV_ACPI_CPUFREQ && env != PM_ENV_PSTATE_CPUFREQ &&
-			env != PM_ENV_AMD_PSTATE_CPUFREQ) {
-		POWER_LOG(DEBUG, "Neither ACPI nor PSTATE modes were initialized");
+			env != PM_ENV_AMD_PSTATE_CPUFREQ && env != PM_ENV_CPPC_CPUFREQ) {
+		POWER_LOG(DEBUG, "Unable to initialize ACPI, PSTATE, AMD-PSTATE, or CPPC modes");
 		return -ENOTSUP;
 	}
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] power: detect supported driver
  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
  2024-10-10 21:44   ` [PATCH v3 1/2] power: enable CPPC support in power library Thomas Monjalon
  1 sibling, 0 replies; 4+ messages in thread
From: Wathsala Vithanage @ 2024-10-10 14:17 UTC (permalink / raw)
  To: dev, Anatoly Burakov, David Hunt, Sivaprasad Tummala
  Cc: stable, Wathsala Vithanage, Dhruv Tripathi

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] power: enable CPPC support in power library
  2024-10-10 14:17 ` [PATCH v3 1/2] power: enable CPPC support in power library Wathsala Vithanage
  2024-10-10 14:17   ` [PATCH v3 2/2] power: detect supported driver Wathsala Vithanage
@ 2024-10-10 21:44   ` Thomas Monjalon
  2024-10-10 21:51     ` Wathsala Wathawana Vithanage
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2024-10-10 21:44 UTC (permalink / raw)
  To: Wathsala Vithanage
  Cc: dev, Anatoly Burakov, David Hunt, Sivaprasad Tummala, stable,
	Dhruv Tripathi

10/10/2024 16:17, Wathsala Vithanage:
> Power library already supports Linux CPPC driver. Enable its use
> and fix the name of the CPPC driver name.
> 
> Signed-off-by: Wathsala Vithanage <wathsala.vithanage@arm.com>
> Reviewed-by: Dhruv Tripathi <dhruv.tripathi@arm.com>

Series applied with a little more details about being a real fix.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v3 1/2] power: enable CPPC support in power library
  2024-10-10 21:44   ` [PATCH v3 1/2] power: enable CPPC support in power library Thomas Monjalon
@ 2024-10-10 21:51     ` Wathsala Wathawana Vithanage
  0 siblings, 0 replies; 4+ messages in thread
From: Wathsala Wathawana Vithanage @ 2024-10-10 21:51 UTC (permalink / raw)
  To: thomas
  Cc: dev, Anatoly Burakov, David Hunt, Sivaprasad Tummala, stable,
	Dhruv Tripathi, nd

> > fix the name of the CPPC driver name.
> >
> > Signed-off-by: Wathsala Vithanage <wathsala.vithanage@arm.com>
> > Reviewed-by: Dhruv Tripathi <dhruv.tripathi@arm.com>
> 
> Series applied with a little more details about being a real fix.
> 
> 
Thanks you Thomas.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-10 21:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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   ` [PATCH v3 2/2] power: detect supported driver Wathsala Vithanage
2024-10-10 21:44   ` [PATCH v3 1/2] power: enable CPPC support in power library Thomas Monjalon
2024-10-10 21:51     ` Wathsala Wathawana Vithanage

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).