Skip to contentSkip to conversation

cpufreq: amd-pstate: add ACPI disabled check

PATCH Superseded Perry Yuan 2 participants 3 messages Jul 7, 2022 – Jul 8, 2022

Subsystems (4)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Perry Yuan

author reviewer
#0 lore raw

PATCH 11/12 cpufreq: amd-pstate: add ACPI disabled check

Add acpi function check in case ACPI is not enabled, that will cause pstate driver failed to call cppc acpi to change perf or update epp value for shared memory solution processors.

When CPPC is invalid, warning log will be needed to be printed to tell user what is wrong.

---
 drivers/acpi/cppc_acpi.c     | 3 +++
 drivers/cpufreq/amd-pstate.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/acpi/cppc_acpi.c +3 -0
index 6ff1901d7d43..17d67e3ededf 100644
@@ -424,6 +424,9 @@ bool acpi_cpc_valid(void)
 	struct cpc_desc *cpc_ptr;
 	int cpu;
 
+	if (acpi_disabled)
+		return false;
+
 	for_each_present_cpu(cpu) {
 		cpc_ptr = per_cpu(cpc_desc_ptr, cpu);
 		if (!cpc_ptr)
drivers/cpufreq/amd-pstate.c +1 -1
index b54b3b559993..6d81a9a94dde 100644
@@ -684,7 +684,7 @@ static int __init amd_pstate_init(void)
 		return -ENODEV;
 
 	if (!acpi_cpc_valid()) {
-		pr_debug("the _CPC object is not present in SBIOS\n");
+		pr_warn_once("the _CPC object is not present in SBIOS or ACPI disabled\n");
 		return -ENODEV;
 	}
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 18 lines · Perry Yuan

Add acpi function check in case ACPI is not enabled, that will cause pstate driver failed to call cppc acpi to change perf or update epp value for shared memory solution processors.

When CPPC is invalid, warning log will be needed to be printed to tell user what is wrong.

---
 drivers/acpi/cppc_acpi.c     | 3 +++
 drivers/cpufreq/amd-pstate.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/acpi/cppc_acpi.c +0 -0
index 6ff1901d7d43..17d67e3ededf 100644

drivers/acpi/cppc_acpi.c bool acpi_cpc_valid(void) · line 428

Quoted 5 lines
drivers/acpi/cppc_acpi.c +2 -0
@@ -424,6 +424,9 @@ bool acpi_cpc_valid(void)
 	struct cpc_desc *cpc_ptr;
 	int cpu;
 
+	if (acpi_disabled)
+		return false> +

This seems ok, the only other places I find that call acpi_cpc_valid() also check for acpi_disabled.

If the acpi_disabled check is added to acpi_cpc_valid() the other calling sites should be updated to remove their check for acpi_disabled.

-Nathan

Quoted 16 lines
drivers/acpi/cppc_acpi.c +0 -0
 	for_each_present_cpu(cpu) {
 		cpc_ptr = per_cpu(cpc_desc_ptr, cpu);
 		if (!cpc_ptr)
drivers/cpufreq/amd-pstate.c +1 -1
index b54b3b559993..6d81a9a94dde 100644
@@ -684,7 +684,7 @@ static int __init amd_pstate_init(void)
 		return -ENODEV;
 
 	if (!acpi_cpc_valid()) {
-		pr_debug("the _CPC object is not present in SBIOS\n");
+		pr_warn_once("the _CPC object is not present in SBIOS or ACPI disabled\n");
 		return -ENODEV;
 	}
 
author reviewer
#2 lore raw

[AMD Official Use Only - General]

Hi Nathan.

Quoted 44 lines

-----Original Message-----
From: Fontenot, Nathan <[email protected]>
Sent: Friday, July 8, 2022 3:46 AM
To: Yuan, Perry <[email protected]>; [email protected]; [email protected]; Huang, Ray <[email protected]>; Rafael J. Wysocki <[email protected]>; Len Brown <[email protected]>; linux- [email protected]; [email protected]; linux- [email protected]
Cc: Sharma, Deepak <[email protected]>; Limonciello, Mario <[email protected]>; Fontenot, Nathan <[email protected]>; Deucher, Alexander <[email protected]>; Su, Jinzhou (Joe) <[email protected]>; Huang, Shimmer <[email protected]>; Du, Xiaojian <[email protected]>; Meng, Li (Jassmine) <[email protected]>
Subject: Re: [PATCH 11/12] cpufreq: amd-pstate: add ACPI disabled check

Quoted 18 lines · Perry Yuan

Add acpi function check in case ACPI is not enabled, that will cause pstate driver failed to call cppc acpi to change perf or update epp value for shared memory solution processors.

When CPPC is invalid, warning log will be needed to be printed to tell user what is wrong.

---
 drivers/acpi/cppc_acpi.c     | 3 +++
 drivers/cpufreq/amd-pstate.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/acpi/cppc_acpi.c index renamed from drivers/acpi/cppc_acpi.c +0 -0

6ff1901d7d43..17d67e3ededf 100644

drivers/acpi/cppc_acpi.c bool acpi_cpc_valid(void) · line 428

Quoted 5 lines
drivers/acpi/cppc_acpi.c +2 -0
@@ -424,6 +424,9 @@ bool acpi_cpc_valid(void)
 	struct cpc_desc *cpc_ptr;
 	int cpu;
 
+	if (acpi_disabled)
+		return false> +

This seems ok, the only other places I find that call acpi_cpc_valid() also check for acpi_disabled.

Quoted 4 lines

If the acpi_disabled check is added to acpi_cpc_valid() the other calling sites should be updated to remove their check for acpi_disabled.

-Nathan

You are correct. It needs to remove the same check code from other driver file. Will add this feedback into V2 patch.

Perry.

Quoted 20 lines
Quoted 6 lines
drivers/acpi/cppc_acpi.c +0 -0
 	for_each_present_cpu(cpu) {
 		cpc_ptr = per_cpu(cpc_desc_ptr, cpu);
 		if (!cpc_ptr)
(quoted diff) +0 -0

b/drivers/cpufreq/amd-pstate.c index b54b3b559993..6d81a9a94dde

100644

drivers/cpufreq/amd-pstate.c static int __init amd_pstate_init(void) · line 687

Quoted 8 lines
drivers/cpufreq/amd-pstate.c +1 -1
@@ -684,7 +684,7 @@ static int __init amd_pstate_init(void)
 		return -ENODEV;
 
 	if (!acpi_cpc_valid()) {
-		pr_debug("the _CPC object is not present in SBIOS\n");
+		pr_warn_once("the _CPC object is not present in SBIOS or

ACPI

Quoted 4 lines
drivers/cpufreq/amd-pstate.c +1 -0
+disabled\n");
 		return -ENODEV;
 	}