Commit 8b356e53 authored by Mario Limonciello's avatar Mario Limonciello Committed by Rafael J. Wysocki

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

commit 72f2ecb7 ("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: 72f2ecb7 ("Set CPPC _OSC bits for all and when CPPC_LIB is supported")
Reported-by: default avatarPerry Yuan <perry.yuan@amd.com>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7feec743
...@@ -11,6 +11,16 @@ ...@@ -11,6 +11,16 @@
/* Refer to drivers/acpi/cppc_acpi.c for the description of functions */ /* Refer to drivers/acpi/cppc_acpi.c for the description of functions */
bool cpc_supported_by_cpu(void)
{
switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_AMD:
case X86_VENDOR_HYGON:
return boot_cpu_has(X86_FEATURE_CPPC);
}
return false;
}
bool cpc_ffh_supported(void) bool cpc_ffh_supported(void)
{ {
return true; return true;
......
...@@ -577,6 +577,19 @@ bool __weak cpc_ffh_supported(void) ...@@ -577,6 +577,19 @@ bool __weak cpc_ffh_supported(void)
return false; return false;
} }
/**
* cpc_supported_by_cpu() - check if CPPC is supported by CPU
*
* Check if the architectural support for CPPC is present even
* if the _OSC hasn't prescribed it
*
* Return: true for supported, false for not supported
*/
bool __weak cpc_supported_by_cpu(void)
{
return false;
}
/** /**
* pcc_data_alloc() - Allocate the pcc_data memory for pcc subspace * pcc_data_alloc() - Allocate the pcc_data memory for pcc subspace
* *
...@@ -686,7 +699,8 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) ...@@ -686,7 +699,8 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
if (!osc_sb_cppc2_support_acked) { if (!osc_sb_cppc2_support_acked) {
pr_debug("CPPC v2 _OSC not acked\n"); pr_debug("CPPC v2 _OSC not acked\n");
return -ENODEV; if (!cpc_supported_by_cpu())
return -ENODEV;
} }
/* Parse the ACPI _CPC table for this CPU. */ /* Parse the ACPI _CPC table for this CPU. */
......
...@@ -145,6 +145,7 @@ extern bool cppc_allow_fast_switch(void); ...@@ -145,6 +145,7 @@ extern bool cppc_allow_fast_switch(void);
extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data); extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data);
extern unsigned int cppc_get_transition_latency(int cpu); extern unsigned int cppc_get_transition_latency(int cpu);
extern bool cpc_ffh_supported(void); extern bool cpc_ffh_supported(void);
extern bool cpc_supported_by_cpu(void);
extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val); extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val);
extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val); extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val);
#else /* !CONFIG_ACPI_CPPC_LIB */ #else /* !CONFIG_ACPI_CPPC_LIB */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment