Skip to content

Commit

Permalink
ACPI/processor_idle: Add FFH state handling
Browse files Browse the repository at this point in the history
Recent Intel platforms will depend on the idle driver to pass the
correct hint for playing dead via mwait_play_dead_with_hint(). Expand
the existing enter_dead interface with handling for FFH states and pass
the MWAIT hint to the mwait_play_dead code.

Suggested-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/all/20250205155211.329780-3-artem.bityutskiy%40linux.intel.com
  • Loading branch information
Patryk Wlazlyn authored and Dave Hansen committed Feb 5, 2025
1 parent a7dd183 commit 541ddf3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/x86/kernel/acpi/cstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <asm/cpuid.h>
#include <asm/mwait.h>
#include <asm/special_insns.h>
#include <asm/smp.h>

/*
* Initialize bm_flags based on the CPU cache properties
Expand Down Expand Up @@ -205,6 +206,15 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
}
EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);

void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
{
unsigned int cpu = smp_processor_id();
struct cstate_entry *percpu_entry;

percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);
mwait_play_dead(percpu_entry->states[cx->index].eax);
}

void __cpuidle acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx)
{
unsigned int cpu = smp_processor_id();
Expand Down
2 changes: 2 additions & 0 deletions drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ static void acpi_idle_play_dead(struct cpuidle_device *dev, int index)
raw_safe_halt();
else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) {
io_idle(cx->address);
} else if (cx->entry_method == ACPI_CSTATE_FFH) {
acpi_processor_ffh_play_dead(cx);
} else
return;
}
Expand Down
5 changes: 5 additions & 0 deletions include/acpi/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
struct acpi_processor_cx *cx,
struct acpi_power_register *reg);
void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate);
void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx);
#else
static inline void acpi_processor_power_init_bm_check(struct
acpi_processor_flags
Expand All @@ -300,6 +301,10 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
{
return;
}
static inline void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
{
return;
}
#endif

static inline int call_on_cpu(int cpu, long (*fn)(void *), void *arg,
Expand Down

0 comments on commit 541ddf3

Please sign in to comment.