Skip to contentSkip to conversation

ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported

PATCH In review Mario Limonciello 2 participants 3 messages Jun 29, 2022 – Jul 5, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported

commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and when CPPC_LIB is supported") added support for claiming to support CPPC in _OSC on non-Intel platforms.

This unfortunately caused a regression on a vartiety of AMD platforms in the field because a number of AMD platforms don't set the _OSC bit 5 or 6 to indicate CPPC or CPPC v2 support.

As these AMD platforms already claim CPPC support via a dedicated MSR from X86_FEATURE_CPPC, use that to enable this feature rather than requiring the _OSC on platforms with a dedicated MSR.

If there is additional breakage on the shared memory designs also missing this _OSC, additional follow up changes may be needed.

Fixes 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is supported")

---
v1->v2:
* Make the code easier to follow (suggested by Rafael)
* Update commit message to reflect this is only fixing the MSR case and that any other breakage from 72f2ecb7ece7 will need additional follow ups

 drivers/acpi/cppc_acpi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/acpi/cppc_acpi.c +9 -4
index 903528f7e187..cc154519c608 100644
@@ -629,7 +629,15 @@ static bool is_cppc_supported(int revision, int num_ent)
 		return false;
 	}
 
-	return true;
+	if (!osc_sb_cppc_not_supported)
+		return true;
+
+	pr_debug("Firmware missing _OSC support\n");
+#ifdef CONFIG_X86
+	return boot_cpu_has(X86_FEATURE_CPPC);
+#else
+	return false;
+#endif
 }
 
 /*
@@ -684,9 +692,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
 	acpi_status status;
 	int ret = -ENODATA;
 
-	if (osc_sb_cppc_not_supported)
-		return -ENODEV;
-
 	/* Parse the ACPI _CPC table for this CPU. */
 	status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
 			ACPI_TYPE_PACKAGE);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 13 lines · Mario Limonciello

commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and when CPPC_LIB is supported") added support for claiming to support CPPC in _OSC on non-Intel platforms.

This unfortunately caused a regression on a vartiety of AMD platforms in the field because a number of AMD platforms don't set the _OSC bit 5 or 6 to indicate CPPC or CPPC v2 support.

As these AMD platforms already claim CPPC support via a dedicated MSR from X86_FEATURE_CPPC, use that to enable this feature rather than requiring the _OSC on platforms with a dedicated MSR.

Quoted 6 lines

If there is additional breakage on the shared memory designs also missing this _OSC, additional follow up changes may be needed.

Fixes 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is supported")

I'm still concerned about the possible cases in which there is _CPC, but it returns garbage, because the firmware thinks that the OS will not use _CPC due to the _OSC handshake.

Quoted 14 lines

---
v1->v2:
* Make the code easier to follow (suggested by Rafael)
* Update commit message to reflect this is only fixing the MSR case and that any other breakage from 72f2ecb7ece7 will need additional follow ups

 drivers/acpi/cppc_acpi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/acpi/cppc_acpi.c +0 -0
index 903528f7e187..cc154519c608 100644

drivers/acpi/cppc_acpi.c static bool is_cppc_supported(int revision, int num_ent) · line 637

Quoted 10 lines
drivers/acpi/cppc_acpi.c +6 -1
@@ -629,7 +629,15 @@ static bool is_cppc_supported(int revision, int num_ent)
                return false;
        }
 
-       return true;
+       if (!osc_sb_cppc_not_supported)
+               return true;
+
+       pr_debug("Firmware missing _OSC support\n");
+#ifdef CONFIG_X86
+       return boot_cpu_has(X86_FEATURE_CPPC);

So can you please add an additional X86_VENDOR_AMD check to the above?

Quoted 19 lines
drivers/acpi/cppc_acpi.c +3 -4
+#else
+       return false;
+#endif
 }
 
 /*
@@ -684,9 +692,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
        acpi_status status;
        int ret = -ENODATA;
 
-       if (osc_sb_cppc_not_supported)
-               return -ENODEV;
-
        /* Parse the ACPI _CPC table for this CPU. */
        status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
                        ACPI_TYPE_PACKAGE);
--

2.25.1

#2 lore raw

[Public]

Quoted 57 lines

-----Original Message-----
From: Rafael J. Wysocki <[email protected]>
Sent: Tuesday, July 5, 2022 13:12
To: Limonciello, Mario <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>; Len Brown <[email protected]>; Sudeep Holla <[email protected]>; Pierre Gondois <[email protected]>; Yuan, Perry <[email protected]>; ACPI Devel Maling List <[email protected]>; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH v2] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported

Quoted 9 lines · Mario Limonciello

commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and when CPPC_LIB is supported") added support for claiming to support CPPC in _OSC on non-Intel platforms.

This unfortunately caused a regression on a vartiety of AMD platforms in the field because a number of AMD platforms don't set the _OSC bit 5 or 6 to indicate CPPC or CPPC v2 support.

Quoted 8 lines

As these AMD platforms already claim CPPC support via a dedicated MSR from X86_FEATURE_CPPC, use that to enable this feature rather than requiring the _OSC on platforms with a dedicated MSR.

If there is additional breakage on the shared memory designs also missing this _OSC, additional follow up changes may be needed.

Fixes 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is

supported")

Quoted 2 lines

I'm still concerned about the possible cases in which there is _CPC, but it returns garbage, because the firmware thinks that the OS will not use _CPC due to the _OSC handshake.

drivers/acpi/cppc_acpi.c static bool is_cppc_supported(int revision, int

Quoted 14 lines

---
v1->v2:
* Make the code easier to follow (suggested by Rafael)
* Update commit message to reflect this is only fixing the MSR case and that any other breakage from 72f2ecb7ece7 will need additional follow ups

 drivers/acpi/cppc_acpi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/acpi/cppc_acpi.c +0 -0
index 903528f7e187..cc154519c608 100644
@@ -629,7 +629,15 @@ static bool is_cppc_supported(int revision, int

num_ent)

Quoted 3 lines
drivers/acpi/cppc_acpi.c +0 -0
                return false;
        }
 
Quoted 9 lines

drivers/acpi/cppc_acpi.c static bool is_cppc_supported(int revision, int num_ent) · line 637

Quoted 7 lines
drivers/acpi/cppc_acpi.c +6 -1
-       return true;
+       if (!osc_sb_cppc_not_supported)
+               return true;
+
+       pr_debug("Firmware missing _OSC support\n");
+#ifdef CONFIG_X86
+       return boot_cpu_has(X86_FEATURE_CPPC);

So can you please add an additional X86_VENDOR_AMD check to the above?

Very well, I'll send out v4 shortly with that modification.

Quoted 21 lines

drivers/acpi/cppc_acpi.c int acpi_cppc_processor_probe(struct

Quoted 8 lines
drivers/acpi/cppc_acpi.c +3 -0
+#else
+       return false;
+#endif
 }
 
 /*
@@ -684,9 +692,6 @@ int acpi_cppc_processor_probe(struct

acpi_processor *pr)

Quoted 12 lines
drivers/acpi/cppc_acpi.c +0 -4
        acpi_status status;
        int ret = -ENODATA;
 
-       if (osc_sb_cppc_not_supported)
-               return -ENODEV;
-
        /* Parse the ACPI _CPC table for this CPU. */
        status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
                        ACPI_TYPE_PACKAGE);
--

2.25.1