[tip: core/headers] x86/ACPI/sleep: Move acpi_wakeup_address() definition into sleep.c, remove <asm/realmode.h> from <asm/acpi.h>

From: tip-bot2 for Sean Christopherson
Date: Tue Nov 26 2019 - 03:00:37 EST


The following commit has been merged into the core/headers branch of tip:

Commit-ID: 7c8dfff8783bdc19696b563e01c588e81205ef15
Gitweb: https://git.kernel.org/tip/7c8dfff8783bdc19696b563e01c588e81205ef15
Author: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
AuthorDate: Mon, 18 Nov 2019 16:21:21 -08:00
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitterDate: Tue, 19 Nov 2019 17:50:27 +01:00

x86/ACPI/sleep: Move acpi_wakeup_address() definition into sleep.c, remove <asm/realmode.h> from <asm/acpi.h>

Move the definition of acpi_wakeup_address() into sleep.c to break
linux/acpi.h's dependency (by way of asm/acpi.h) on asm/realmode.h.
Everyone and their mother includes linux/acpi.h, i.e. modifying
realmode.h results in a full kernel rebuild, which makes the already
inscrutable real mode boot code even more difficult to understand and is
positively rage inducing when trying to make changes to x86's boot flow.

[ mingo: Renamed acpi_wakeup_address() to acpi_get_wakeup_address(), as suggested by Borislav Petkov. ]

Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Link: https://lkml.kernel.org/r/20191119002121.4107-13-sean.j.christopherson@xxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
arch/ia64/include/asm/acpi.h | 2 +-
arch/x86/include/asm/acpi.h | 6 +-----
arch/x86/kernel/acpi/sleep.c | 11 +++++++++++
drivers/acpi/sleep.c | 4 ++--
4 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index 36d7003..b66ba90 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -38,7 +38,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
/* Low-level suspend routine. */
extern int acpi_suspend_lowlevel(void);

-static inline unsigned long acpi_wakeup_address(void)
+static inline unsigned long acpi_get_wakeup_address(void)
{
return 0;
}
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 57788ec..ca09764 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -13,7 +13,6 @@
#include <asm/processor.h>
#include <asm/mmu.h>
#include <asm/mpspec.h>
-#include <asm/realmode.h>
#include <asm/x86_init.h>

#ifdef CONFIG_ACPI_APEI
@@ -62,10 +61,7 @@ static inline void acpi_disable_pci(void)
extern int (*acpi_suspend_lowlevel)(void);

/* Physical address to resume after wakeup */
-static inline unsigned long acpi_wakeup_address(void)
-{
- return ((unsigned long)(real_mode_header->wakeup_start));
-}
+unsigned long acpi_get_wakeup_address(void);

/*
* Check if the CPU can handle C2 and deeper
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index ca13851..26b7256 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -27,6 +27,17 @@ static char temp_stack[4096];
#endif

/**
+ * acpi_get_wakeup_address - provide physical address for S3 wakeup
+ *
+ * Returns the physical address where the kernel should be resumed after the
+ * system awakes from S3, e.g. for programming into the firmware waking vector.
+ */
+unsigned long acpi_get_wakeup_address(void)
+{
+ return ((unsigned long)(real_mode_header->wakeup_start));
+}
+
+/**
* x86_acpi_enter_sleep_state - enter sleep state
* @state: Sleep state to enter.
*
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index f5cca9f..6d3b2ea 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -63,9 +63,9 @@ static int acpi_sleep_prepare(u32 acpi_state)
#ifdef CONFIG_ACPI_SLEEP
/* do we have a wakeup address for S2 and S3? */
if (acpi_state == ACPI_STATE_S3) {
- if (!acpi_wakeup_address())
+ if (!acpi_get_wakeup_address())
return -EFAULT;
- acpi_set_waking_vector(acpi_wakeup_address());
+ acpi_set_waking_vector(acpi_get_wakeup_address());

}
ACPI_FLUSH_CPU_CACHE();