Skip to content

Commit c42fa24

Browse files
committed
ACPI: bus: Avoid using CPPC if not supported by firmware
If the platform firmware indicates that it does not support CPPC by clearing the OSC_SB_CPC_SUPPORT and OSC_SB_CPCV2_SUPPORT bits in the platform _OSC capabilities mask, avoid attempting to evaluate _CPC which may fail in that case. Because the OSC_SB_CPC_SUPPORT and OSC_SB_CPCV2_SUPPORT bits are only added to the supported platform capabilities mask on x86, when X86_FEATURE_HWP is supported, allow _CPC to be evaluated regardless in the other cases. Link: https://lore.kernel.org/linux-acpi/CAJZ5v0i=ecAksq0TV+iLVObm-=fUfdqPABzzkgm9K6KxO1ZCcg@mail.gmail.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Mario Limonciello <mario.limonciello@amd.com> Acked-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent 2ca8e62 commit c42fa24

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/acpi/bus.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ EXPORT_SYMBOL_GPL(osc_pc_lpi_support_confirmed);
283283
bool osc_sb_native_usb4_support_confirmed;
284284
EXPORT_SYMBOL_GPL(osc_sb_native_usb4_support_confirmed);
285285

286+
bool osc_sb_cppc_not_supported;
287+
286288
static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
287289
static void acpi_bus_osc_negotiate_platform_control(void)
288290
{
@@ -338,6 +340,12 @@ static void acpi_bus_osc_negotiate_platform_control(void)
338340
return;
339341
}
340342

343+
#ifdef CONFIG_X86
344+
if (boot_cpu_has(X86_FEATURE_HWP))
345+
osc_sb_cppc_not_supported = !(capbuf_ret[OSC_SUPPORT_DWORD] &
346+
(OSC_SB_CPC_SUPPORT | OSC_SB_CPCV2_SUPPORT));
347+
#endif
348+
341349
/*
342350
* Now run _OSC again with query flag clear and with the caps
343351
* supported by both the OS and the platform.

drivers/acpi/cppc_acpi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,9 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
656656
acpi_status status;
657657
int ret = -EFAULT;
658658

659+
if (osc_sb_cppc_not_supported)
660+
return -ENODEV;
661+
659662
/* Parse the ACPI _CPC table for this CPU. */
660663
status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
661664
ACPI_TYPE_PACKAGE);

include/linux/acpi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
580580
extern bool osc_sb_apei_support_acked;
581581
extern bool osc_pc_lpi_support_confirmed;
582582
extern bool osc_sb_native_usb4_support_confirmed;
583+
extern bool osc_sb_cppc_not_supported;
583584

584585
/* USB4 Capabilities */
585586
#define OSC_USB_USB3_TUNNELING 0x00000001

0 commit comments

Comments
 (0)