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.
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Suggested-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
---
arch/x86/kernel/acpi/cstate.c | 9 +++++++++
drivers/acpi/processor_idle.c | 2 ++
include/acpi/processor.h | 5 +++++
3 files changed, 16 insertions(+)
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index f3ffd0a3a012..c80a3e6dba5f 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -204,6 +204,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_with_hint(percpu_entry->states[cx->index].eax);
+}
+
void __cpuidle acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx)
{
unsigned int cpu = smp_processor_id();
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index ce728cf7e301..83213fa47c1b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -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;
}
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index a17e97e634a6..63a37e72b721 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -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
@@ -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,
--
2.47.1
Hi Patryk, kernel test robot noticed the following build warnings: [auto build test WARNING on rafael-pm/linux-next] [also build test WARNING on rafael-pm/bleeding-edge linus/master v6.12 next-20241128] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Patryk-Wlazlyn/x86-smp-Allow-calling-mwait_play_dead-with-an-arbitrary-hint/20241128-113851 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20241127161518.432616-3-patryk.wlazlyn%40linux.intel.com patch subject: [PATCH v6 2/4] ACPI: processor_idle: Add FFH state handling config: x86_64-randconfig-074-20241128 (https://download.01.org/0day-ci/archive/20241129/202411290550.AphAcYyW-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241129/202411290550.AphAcYyW-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202411290550.AphAcYyW-lkp@intel.com/ All warnings (new ones prefixed by >>): >> vmlinux.o: warning: objtool: acpi_processor_ffh_play_dead+0xb9: mwait_play_dead_with_hint() is missing a __noreturn annotation -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Patryk,
kernel test robot noticed the following build errors:
[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge acpi/next tip/x86/core linus/master v6.12 next-20241128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Patryk-Wlazlyn/x86-smp-Allow-calling-mwait_play_dead-with-an-arbitrary-hint/20241128-113851
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20241127161518.432616-3-patryk.wlazlyn%40linux.intel.com
patch subject: [PATCH v6 2/4] ACPI: processor_idle: Add FFH state handling
config: i386-buildonly-randconfig-001-20241128 (https://download.01.org/0day-ci/archive/20241128/202411282102.WIsGlK4X-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241128/202411282102.WIsGlK4X-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411282102.WIsGlK4X-lkp@intel.com/
All errors (new ones prefixed by >>):
arch/x86/kernel/acpi/cstate.c: In function 'acpi_processor_ffh_play_dead':
>> arch/x86/kernel/acpi/cstate.c:213:9: error: implicit declaration of function 'mwait_play_dead_with_hint'; did you mean 'mwait_idle_with_hints'? [-Werror=implicit-function-declaration]
213 | mwait_play_dead_with_hint(percpu_entry->states[cx->index].eax);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| mwait_idle_with_hints
cc1: some warnings being treated as errors
vim +213 arch/x86/kernel/acpi/cstate.c
206
207 void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
208 {
209 unsigned int cpu = smp_processor_id();
210 struct cstate_entry *percpu_entry;
211
212 percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);
> 213 mwait_play_dead_with_hint(percpu_entry->states[cx->index].eax);
214 }
215
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Patryk,
kernel test robot noticed the following build errors:
[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge acpi/next tip/x86/core linus/master v6.12 next-20241128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Patryk-Wlazlyn/x86-smp-Allow-calling-mwait_play_dead-with-an-arbitrary-hint/20241128-113851
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20241127161518.432616-3-patryk.wlazlyn%40linux.intel.com
patch subject: [PATCH v6 2/4] ACPI: processor_idle: Add FFH state handling
config: i386-buildonly-randconfig-002-20241128 (https://download.01.org/0day-ci/archive/20241128/202411282127.KFanck22-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241128/202411282127.KFanck22-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411282127.KFanck22-lkp@intel.com/
All errors (new ones prefixed by >>):
>> arch/x86/kernel/acpi/cstate.c:213:2: error: call to undeclared function 'mwait_play_dead_with_hint'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
213 | mwait_play_dead_with_hint(percpu_entry->states[cx->index].eax);
| ^
1 error generated.
vim +/mwait_play_dead_with_hint +213 arch/x86/kernel/acpi/cstate.c
206
207 void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
208 {
209 unsigned int cpu = smp_processor_id();
210 struct cstate_entry *percpu_entry;
211
212 percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);
> 213 mwait_play_dead_with_hint(percpu_entry->states[cx->index].eax);
214 }
215
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.