From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6813F45921; Fri, 6 Sep 2024 23:07:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BC1142F31; Fri, 6 Sep 2024 23:07:14 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 181D34028F for ; Fri, 6 Sep 2024 23:07:12 +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 C3B76113E; Fri, 6 Sep 2024 14:07:38 -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 457B93F73B; Fri, 6 Sep 2024 14:07:11 -0700 (PDT) From: Wathsala Vithanage To: Anatoly Burakov , David Hunt , Sivaprasad Tummala Cc: dev@dpdk.org, Wathsala Vithanage , Dhruv Tripathi Subject: [PATCH 2/2] eal: detect supported driver Date: Fri, 6 Sep 2024 21:06:37 +0000 Message-Id: <20240906210637.630356-2-wathsala.vithanage@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240906210637.630356-1-wathsala.vithanage@arm.com> References: <20240906210637.630356-1-wathsala.vithanage@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Check if the frequency scaling driver is supported before attempting to initialize. Signed-off-by: Wathsala Vithanage Reviewed-by: Dhruv Tripathi --- 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