Skip to contentSkip to conversation

ACPI: processor: allowing probing on platforms with one ACPI C-state

PATCH Applied Zhang Rui 2 participants 2 messages Apr 22, 2020 – Apr 26, 2020 ACPI

lore
Share & tools
lore

Zhang Rui

author
#0 lore raw

PATCH 1/1 ACPI: processor: allowing probing on platforms with one ACPI C-state

It is possible for ACPI _CST to return only one ACPI C-state, for example, when deep cstate disabled in the BIOS.
And it is better for the acpi_idle driver to probe in this case as well for consistency.

---
 drivers/acpi/processor_idle.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/acpi/processor_idle.c +2 -7
index dcc289e30166..75534c5b5433 100644
@@ -308,11 +308,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
 	if (ret)
 		return ret;
 
-	/*
-	 * It is expected that there will be at least 2 states, C1 and
-	 * something else (C2 or C3), so fail if that is not the case.
-	 */
-	if (pr->power.count < 2)
+	if (!pr->power.count)
 		return -EFAULT;
 
 	pr->flags.has_cst = 1;
@@ -468,8 +464,7 @@ static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
 	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
 		if (pr->power.states[i].valid) {
 			pr->power.count = i;
-			if (pr->power.states[i].type >= ACPI_STATE_C2)
-				pr->flags.power = 1;
+			pr->flags.power = 1;
 		}
 	}
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 29 lines · CEST Zhang Rui

It is possible for ACPI _CST to return only one ACPI C-state, for example, when deep cstate disabled in the BIOS.
And it is better for the acpi_idle driver to probe in this case as well for consistency.

---
 drivers/acpi/processor_idle.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/acpi/processor_idle.c +1 -5
index dcc289e30166..75534c5b5433 100644
@@ -308,11 +308,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
 	if (ret)
 		return ret;
 
-	/*
-	 * It is expected that there will be at least 2 states, C1 and
-	 * something else (C2 or C3), so fail if that is not the case.
-	 */
-	if (pr->power.count < 2)
+	if (!pr->power.count)
 		return -EFAULT;
 
 	pr->flags.has_cst = 1;

drivers/acpi/processor_idle.c static int acpi_processor_get_cstate_info(struct acpi_processor *pr) · line 470

Quoted 9 lines
drivers/acpi/processor_idle.c +1 -2
@@ -468,8 +464,7 @@ static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
 	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
 		if (pr->power.states[i].valid) {
 			pr->power.count = i;
-			if (pr->power.states[i].type >= ACPI_STATE_C2)
-				pr->flags.power = 1;
+			pr->flags.power = 1;
 		}
 	}
 

Applied as 5.8-candidate material, thanks!