Merge tag 'acpi-5.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fixes from Rafael Wysocki:
"These fix two recent regressions related to CPPC support.

Specifics:

- Prevent _CPC from being used if the platform firmware does not
confirm CPPC v2 support via _OSC (Mario Limonciello)

- Allow systems with X86_FEATURE_CPPC set to use _CPC even if CPPC
support cannot be agreed on via _OSC (Mario Limonciello)"

* tag 'acpi-5.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported
ACPI: CPPC: Only probe for _CPC if CPPC v2 is acked

+35 -9
+10
arch/x86/kernel/acpi/cppc.c
··· 11 11 12 12 /* Refer to drivers/acpi/cppc_acpi.c for the description of functions */ 13 13 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 + 14 24 bool cpc_ffh_supported(void) 15 25 { 16 26 return true;
+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 =
+18 -2
drivers/acpi/cppc_acpi.c
··· 578 578 } 579 579 580 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 + 593 + /** 581 594 * pcc_data_alloc() - Allocate the pcc_data memory for pcc subspace 582 595 * 583 596 * Check and allocate the cppc_pcc_data memory. ··· 697 684 acpi_status status; 698 685 int ret = -ENODATA; 699 686 700 - if (osc_sb_cppc_not_supported) 701 - return -ENODEV; 687 + if (!osc_sb_cppc2_support_acked) { 688 + pr_debug("CPPC v2 _OSC not acked\n"); 689 + if (!cpc_supported_by_cpu()) 690 + return -ENODEV; 691 + } 702 692 703 693 /* Parse the ACPI _CPC table for this CPU. */ 704 694 status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
+1
include/acpi/cppc_acpi.h
··· 145 145 extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data); 146 146 extern unsigned int cppc_get_transition_latency(int cpu); 147 147 extern bool cpc_ffh_supported(void); 148 + extern bool cpc_supported_by_cpu(void); 148 149 extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val); 149 150 extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val); 150 151 #else /* !CONFIG_ACPI_CPPC_LIB */
+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 */