From patchwork Thu Oct 10 13:42:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wathsala Vithanage X-Patchwork-Id: 145607 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 525A945B04; Thu, 10 Oct 2024 15:42:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E951340652; Thu, 10 Oct 2024 15:42:43 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 12D6840612; Thu, 10 Oct 2024 15:42:42 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0506D497; Thu, 10 Oct 2024 06:43:11 -0700 (PDT) Received: from ampere-altra-2-1.usa.Arm.com (ampere-altra-2-1.usa.arm.com [10.118.91.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 587313F64C; Thu, 10 Oct 2024 06:42:41 -0700 (PDT) From: Wathsala Vithanage To: dev@dpdk.org, Thomas Monjalon , Anatoly Burakov , David Hunt , Sivaprasad Tummala Cc: stable@dpdk.org, Wathsala Vithanage , Dhruv Tripathi Subject: [PATCH v2 1/2] power: enable CPPC support in power library Date: Thu, 10 Oct 2024 13:42:12 +0000 Message-Id: <20241010134213.1134174-1-wathsala.vithanage@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Power library already supports Linux CPPC driver. Enable its use and fix the name of the CPPC driver name. Signed-off-by: Wathsala Vithanage Reviewed-by: Dhruv Tripathi --- .mailmap | 1 + lib/power/power_cppc_cpufreq.c | 2 +- lib/power/rte_power_pmd_mgmt.c | 11 ++++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.mailmap b/.mailmap index 8aef1c59a4..a6e99234d1 100644 --- a/.mailmap +++ b/.mailmap @@ -343,6 +343,7 @@ Dexia Li Dexuan Cui Dharmik Thakkar Dheemanth Mallikarjun +Dhruv Tripathi Diana Wang Didier Pallard Dilshod Urazov 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; }