Skip to content

Commit 9527264

Browse files
mwilczyrafaeljw
authored andcommitted
ACPI: processor: Use _OSC to convey OSPM processor support information
Change acpi_early_processor_osc() to return a value in case of a failure and make it static. Also make it run acpi_processor_osc() for every processor object or processor device found in the ACPI Namespace (previously, its only purpose was to work around platform firmware defects on Skylake systems). Introduce a new function called acpi_early_processor_control_setup() that will invoke acpi_early_processor_osc() first in order to convey the OS processor support information to the platform firmware and if that fails, it will fall back to using _PDC. Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> [ rjw: Subject and changelog edits, change function return value to bool, add missing 'static', change messages ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 5ba30be commit 9527264

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

drivers/acpi/acpi_processor.c

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -624,16 +624,33 @@ static acpi_status __init acpi_hwp_native_thermal_lvt_osc(acpi_handle handle,
624624
return AE_OK;
625625
}
626626

627-
void __init acpi_early_processor_osc(void)
627+
static bool __init acpi_early_processor_osc(void)
628628
{
629-
if (boot_cpu_has(X86_FEATURE_HWP)) {
630-
acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
631-
ACPI_UINT32_MAX,
632-
acpi_hwp_native_thermal_lvt_osc,
633-
NULL, NULL, NULL);
634-
acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID,
635-
acpi_hwp_native_thermal_lvt_osc,
636-
NULL, NULL);
629+
acpi_status status;
630+
631+
acpi_proc_quirk_mwait_check();
632+
633+
status = acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
634+
ACPI_UINT32_MAX, acpi_processor_osc, NULL,
635+
NULL, NULL);
636+
if (ACPI_FAILURE(status))
637+
return false;
638+
639+
status = acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, acpi_processor_osc,
640+
NULL, NULL);
641+
if (ACPI_FAILURE(status))
642+
return false;
643+
644+
return true;
645+
}
646+
647+
void __init acpi_early_processor_control_setup(void)
648+
{
649+
if (acpi_early_processor_osc()) {
650+
pr_info("_OSC evaluated successfully\n");
651+
} else {
652+
pr_info("_OSC evaluation failed, trying _PDC\n");
653+
acpi_early_processor_set_pdc();
637654
}
638655
}
639656
#endif

drivers/acpi/bus.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,9 +1296,6 @@ static int __init acpi_bus_init(void)
12961296
goto error1;
12971297
}
12981298

1299-
/* Set capability bits for _OSC under processor scope */
1300-
acpi_early_processor_osc();
1301-
13021299
/*
13031300
* _OSC method may exist in module level code,
13041301
* so it must be run after ACPI_FULL_INITIALIZATION
@@ -1314,7 +1311,7 @@ static int __init acpi_bus_init(void)
13141311

13151312
acpi_sysfs_init();
13161313

1317-
acpi_early_processor_set_pdc();
1314+
acpi_early_processor_control_setup();
13181315

13191316
/*
13201317
* Maybe EC region is required at bus_scan/acpi_get_devices. So it

drivers/acpi/internal.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,13 @@ int acpi_wakeup_device_init(void);
152152
Processor
153153
-------------------------------------------------------------------------- */
154154
#ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC
155+
void acpi_early_processor_control_setup(void);
155156
void acpi_early_processor_set_pdc(void);
156157

157158
void acpi_proc_quirk_mwait_check(void);
158159
bool processor_physically_present(acpi_handle handle);
159160
#else
160-
static inline void acpi_early_processor_set_pdc(void) {}
161-
#endif
162-
163-
#ifdef CONFIG_X86
164-
void acpi_early_processor_osc(void);
165-
#else
166-
static inline void acpi_early_processor_osc(void) {}
161+
static inline void acpi_early_processor_control_setup(void) {}
167162
#endif
168163

169164
/* --------------------------------------------------------------------------

0 commit comments

Comments
 (0)