Skip to content

Commit 525496a

Browse files
committed
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
2 parents 3784fad + 8b356e5 commit 525496a

File tree

5 files changed

+35
-9
lines changed

5 files changed

+35
-9
lines changed

arch/x86/kernel/acpi/cppc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111

1212
/* Refer to drivers/acpi/cppc_acpi.c for the description of functions */
1313

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+
1424
bool cpc_ffh_supported(void)
1525
{
1626
return true;

drivers/acpi/bus.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ EXPORT_SYMBOL_GPL(osc_cpc_flexible_adr_space_confirmed);
298298
bool osc_sb_native_usb4_support_confirmed;
299299
EXPORT_SYMBOL_GPL(osc_sb_native_usb4_support_confirmed);
300300

301-
bool osc_sb_cppc_not_supported;
301+
bool osc_sb_cppc2_support_acked;
302302

303303
static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
304304
static void acpi_bus_osc_negotiate_platform_control(void)
@@ -358,11 +358,6 @@ static void acpi_bus_osc_negotiate_platform_control(void)
358358
return;
359359
}
360360

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-
366361
/*
367362
* Now run _OSC again with query flag clear and with the caps
368363
* supported by both the OS and the platform.
@@ -376,6 +371,10 @@ static void acpi_bus_osc_negotiate_platform_control(void)
376371

377372
capbuf_ret = context.ret.pointer;
378373
if (context.ret.length > OSC_SUPPORT_DWORD) {
374+
#ifdef CONFIG_ACPI_CPPC_LIB
375+
osc_sb_cppc2_support_acked = capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_CPCV2_SUPPORT;
376+
#endif
377+
379378
osc_sb_apei_support_acked =
380379
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
381380
osc_pc_lpi_support_confirmed =

drivers/acpi/cppc_acpi.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,19 @@ bool __weak cpc_ffh_supported(void)
577577
return false;
578578
}
579579

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+
580593
/**
581594
* pcc_data_alloc() - Allocate the pcc_data memory for pcc subspace
582595
*
@@ -684,8 +697,11 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
684697
acpi_status status;
685698
int ret = -ENODATA;
686699

687-
if (osc_sb_cppc_not_supported)
688-
return -ENODEV;
700+
if (!osc_sb_cppc2_support_acked) {
701+
pr_debug("CPPC v2 _OSC not acked\n");
702+
if (!cpc_supported_by_cpu())
703+
return -ENODEV;
704+
}
689705

690706
/* Parse the ACPI _CPC table for this CPU. */
691707
status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,

include/acpi/cppc_acpi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ extern bool cppc_allow_fast_switch(void);
145145
extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data);
146146
extern unsigned int cppc_get_transition_latency(int cpu);
147147
extern bool cpc_ffh_supported(void);
148+
extern bool cpc_supported_by_cpu(void);
148149
extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val);
149150
extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val);
150151
#else /* !CONFIG_ACPI_CPPC_LIB */

include/linux/acpi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
584584
extern bool osc_sb_apei_support_acked;
585585
extern bool osc_pc_lpi_support_confirmed;
586586
extern bool osc_sb_native_usb4_support_confirmed;
587-
extern bool osc_sb_cppc_not_supported;
587+
extern bool osc_sb_cppc2_support_acked;
588588
extern bool osc_cpc_flexible_adr_space_confirmed;
589589

590590
/* USB4 Capabilities */

0 commit comments

Comments
 (0)