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 12 /* Refer to drivers/acpi/cppc_acpi.c for the description of functions */ 13 14 bool cpc_ffh_supported(void) 15 { 16 return true;
··· 11 12 /* Refer to drivers/acpi/cppc_acpi.c for the description of functions */ 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 + 24 bool cpc_ffh_supported(void) 25 { 26 return true;
+5 -6
drivers/acpi/bus.c
··· 298 bool osc_sb_native_usb4_support_confirmed; 299 EXPORT_SYMBOL_GPL(osc_sb_native_usb4_support_confirmed); 300 301 - bool osc_sb_cppc_not_supported; 302 303 static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48"; 304 static void acpi_bus_osc_negotiate_platform_control(void) ··· 358 return; 359 } 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 /* 367 * Now run _OSC again with query flag clear and with the caps 368 * supported by both the OS and the platform. ··· 371 372 capbuf_ret = context.ret.pointer; 373 if (context.ret.length > OSC_SUPPORT_DWORD) { 374 osc_sb_apei_support_acked = 375 capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT; 376 osc_pc_lpi_support_confirmed =
··· 298 bool osc_sb_native_usb4_support_confirmed; 299 EXPORT_SYMBOL_GPL(osc_sb_native_usb4_support_confirmed); 300 301 + bool osc_sb_cppc2_support_acked; 302 303 static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48"; 304 static void acpi_bus_osc_negotiate_platform_control(void) ··· 358 return; 359 } 360 361 /* 362 * Now run _OSC again with query flag clear and with the caps 363 * supported by both the OS and the platform. ··· 376 377 capbuf_ret = context.ret.pointer; 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 + 383 osc_sb_apei_support_acked = 384 capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT; 385 osc_pc_lpi_support_confirmed =
+18 -2
drivers/acpi/cppc_acpi.c
··· 578 } 579 580 /** 581 * pcc_data_alloc() - Allocate the pcc_data memory for pcc subspace 582 * 583 * Check and allocate the cppc_pcc_data memory. ··· 697 acpi_status status; 698 int ret = -ENODATA; 699 700 - if (osc_sb_cppc_not_supported) 701 - return -ENODEV; 702 703 /* Parse the ACPI _CPC table for this CPU. */ 704 status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
··· 578 } 579 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 + /** 594 * pcc_data_alloc() - Allocate the pcc_data memory for pcc subspace 595 * 596 * Check and allocate the cppc_pcc_data memory. ··· 684 acpi_status status; 685 int ret = -ENODATA; 686 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 + } 692 693 /* Parse the ACPI _CPC table for this CPU. */ 694 status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
+1
include/acpi/cppc_acpi.h
··· 145 extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data); 146 extern unsigned int cppc_get_transition_latency(int cpu); 147 extern bool cpc_ffh_supported(void); 148 extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val); 149 extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val); 150 #else /* !CONFIG_ACPI_CPPC_LIB */
··· 145 extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data); 146 extern unsigned int cppc_get_transition_latency(int cpu); 147 extern bool cpc_ffh_supported(void); 148 + extern bool cpc_supported_by_cpu(void); 149 extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val); 150 extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val); 151 #else /* !CONFIG_ACPI_CPPC_LIB */
+1 -1
include/linux/acpi.h
··· 584 extern bool osc_sb_apei_support_acked; 585 extern bool osc_pc_lpi_support_confirmed; 586 extern bool osc_sb_native_usb4_support_confirmed; 587 - extern bool osc_sb_cppc_not_supported; 588 extern bool osc_cpc_flexible_adr_space_confirmed; 589 590 /* USB4 Capabilities */
··· 584 extern bool osc_sb_apei_support_acked; 585 extern bool osc_pc_lpi_support_confirmed; 586 extern bool osc_sb_native_usb4_support_confirmed; 587 + extern bool osc_sb_cppc2_support_acked; 588 extern bool osc_cpc_flexible_adr_space_confirmed; 589 590 /* USB4 Capabilities */