Check if the frequency scaling driver is supported before attempting to initialize.
Signed-off-by: Wathsala Vithanage <wathsala.vithan...@arm.com> Reviewed-by: Dhruv Tripathi <dhruv.tripa...@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