Skip to content

Commit 8b356e5

Browse files
superm1rafaeljw
authored andcommitted
ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported
commit 72f2ecb ("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 this 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: 72f2ecb ("Set CPPC _OSC bits for all and when CPPC_LIB is supported") Reported-by: Perry Yuan <perry.yuan@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 7feec74 commit 8b356e5

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

arch/x86/kernel/acpi/cppc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111

1212
/* Refer to drivers/acpi/cppc_acpi.c for the description of functions */
1313

14+
bool cpc_supported_by_cpu(void)
15+
{
16+
switch (boot_cpu_data.x86_vendor) {
17+
case X86_VENDOR_AMD:
18+
case X86_VENDOR_HYGON:
19+
return boot_cpu_has(X86_FEATURE_CPPC);
20+
}
21+
return false;
22+
}
23+
1424
bool cpc_ffh_supported(void)
1525
{
1626
return true;

drivers/acpi/cppc_acpi.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,19 @@ bool __weak cpc_ffh_supported(void)
577577
return false;
578578
}
579579

580+
/**
581+
* cpc_supported_by_cpu() - check if CPPC is supported by CPU
582+
*
583+
* Check if the architectural support for CPPC is present even
584+
* if the _OSC hasn't prescribed it
585+
*
586+
* Return: true for supported, false for not supported
587+
*/
588+
bool __weak cpc_supported_by_cpu(void)
589+
{
590+
return false;
591+
}
592+
580593
/**
581594
* pcc_data_alloc() - Allocate the pcc_data memory for pcc subspace
582595
*
@@ -686,7 +699,8 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
686699

687700
if (!osc_sb_cppc2_support_acked) {
688701
pr_debug("CPPC v2 _OSC not acked\n");
689-
return -ENODEV;
702+
if (!cpc_supported_by_cpu())
703+
return -ENODEV;
690704
}
691705

692706
/* Parse the ACPI _CPC table for this CPU. */

include/acpi/cppc_acpi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ extern bool cppc_allow_fast_switch(void);
145145
extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data);
146146
extern unsigned int cppc_get_transition_latency(int cpu);
147147
extern bool cpc_ffh_supported(void);
148+
extern bool cpc_supported_by_cpu(void);
148149
extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val);
149150
extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val);
150151
#else /* !CONFIG_ACPI_CPPC_LIB */

0 commit comments

Comments
 (0)