ACPI: CPPC: Only probe for _CPC if CPPC v2 is acked

Previously the kernel used to ignore whether the firmware masked CPPC
or CPPCv2 and would just pretend that it worked.

When support for the USB4 bit in _OSC was introduced from commit
9e1f561afb ("ACPI: Execute platform _OSC also with query bit clear")
the kernel began to look at the return when the query bit was clear.

This caused regressions that were misdiagnosed and attempted to be solved
as part of commit 2ca8e6285250 ("Revert "ACPI: Pass the same capabilities
to the _OSC regardless of the query flag""). This caused a different
regression where non-Intel systems weren't able to negotiate _OSC
properly.

This was reverted in commit 2ca8e6285250 ("Revert "ACPI: Pass the same
capabilities to the _OSC regardless of the query flag"") and attempted to
be fixed by commit c42fa24b4475 ("ACPI: bus: Avoid using CPPC if not
supported by firmware") but the regression still returned.

These systems with the regression only load support for CPPC from an SSDT
dynamically when _OSC reports CPPC v2. Avoid the problem by not letting
CPPC satisfy the requirement in `acpi_cppc_processor_probe`.

Reported-by: CUI Hao <cuihao.leo@gmail.com>
Reported-by: maxim.novozhilov@gmail.com
Reported-by: lethe.tree@protonmail.com
Reported-by: garystephenwright@gmail.com
Reported-by: galaxyking0419@gmail.com
Fixes: c42fa24b4475 ("ACPI: bus: Avoid using CPPC if not supported by firmware")
Fixes: 2ca8e6285250 ("Revert "ACPI Pass the same capabilities to the _OSC regardless of the query flag"")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=213023
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2075387
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: CUI Hao <cuihao.leo@gmail.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Mario Limonciello and committed by
Rafael J. Wysocki
7feec743 88084a3d

+9 -8
+5 -6
drivers/acpi/bus.c
··· 298 298 bool osc_sb_native_usb4_support_confirmed; 299 299 EXPORT_SYMBOL_GPL(osc_sb_native_usb4_support_confirmed); 300 300 301 - bool osc_sb_cppc_not_supported; 301 + bool osc_sb_cppc2_support_acked; 302 302 303 303 static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48"; 304 304 static void acpi_bus_osc_negotiate_platform_control(void) ··· 358 358 return; 359 359 } 360 360 361 - #ifdef CONFIG_ACPI_CPPC_LIB 362 - osc_sb_cppc_not_supported = !(capbuf_ret[OSC_SUPPORT_DWORD] & 363 - (OSC_SB_CPC_SUPPORT | OSC_SB_CPCV2_SUPPORT)); 364 - #endif 365 - 366 361 /* 367 362 * Now run _OSC again with query flag clear and with the caps 368 363 * supported by both the OS and the platform. ··· 371 376 372 377 capbuf_ret = context.ret.pointer; 373 378 if (context.ret.length > OSC_SUPPORT_DWORD) { 379 + #ifdef CONFIG_ACPI_CPPC_LIB 380 + osc_sb_cppc2_support_acked = capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_CPCV2_SUPPORT; 381 + #endif 382 + 374 383 osc_sb_apei_support_acked = 375 384 capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT; 376 385 osc_pc_lpi_support_confirmed =
+3 -1
drivers/acpi/cppc_acpi.c
··· 684 684 acpi_status status; 685 685 int ret = -ENODATA; 686 686 687 - if (osc_sb_cppc_not_supported) 687 + if (!osc_sb_cppc2_support_acked) { 688 + pr_debug("CPPC v2 _OSC not acked\n"); 688 689 return -ENODEV; 690 + } 689 691 690 692 /* Parse the ACPI _CPC table for this CPU. */ 691 693 status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
+1 -1
include/linux/acpi.h
··· 584 584 extern bool osc_sb_apei_support_acked; 585 585 extern bool osc_pc_lpi_support_confirmed; 586 586 extern bool osc_sb_native_usb4_support_confirmed; 587 - extern bool osc_sb_cppc_not_supported; 587 + extern bool osc_sb_cppc2_support_acked; 588 588 extern bool osc_cpc_flexible_adr_space_confirmed; 589 589 590 590 /* USB4 Capabilities */