treewide: break dependencies on x86's RM header
cover treewide: break dependencies on x86's RM header
x86's asm/realmode.h, which defines low level structures, variables and helpers used to bring up APs during SMP boot, ends up getting included in practically every nook and cranny of the kernel because the address used by ACPI for resuming from S3 also happens to be stored in the real mode header, and ACPI bleeds the dependency into its widely included headers.
As a result, modifying realmode.h for even the most trivial change to the boot code triggers a full kernel rebuild, which is frustrating to say the least as it some of the most difficult code to get exactly right *and* is also some of the most functionally isolated code in the kernel.
To break the kernel's widespread dependency on realmode.h, add a wrapper in the aforementioned ACPI S3 code to access the real mode header instead of derefencing the header directly in asm/acpi.h and thereby exposing it to the world via linux/acpi.h.
Build tested on x86 with allyesconfig and allmodconfig, so hopefully there aren't more build issues lurking, but at this point it wouldn't surprise me in the least if this somehow manages to break the build.
Based on tip/master, commit ceceaf1f12ba ("Merge branch 'WIP.x86/cleanups'").
Patch Synopsis:
- Patches 01-09 fix a variety of build errors that arise when patch 12 drops realmode.h from asm/acpi.h. Most of the errors are quite absurb as they have no relation whatsoever to x86's RM boot code, but occur because realmode.h happens to include asm/io.h.
- Patch 10 removes a spurious include of realmode.h from an ACPI header.
- Patches 11 and 12 implement the wrapper and move it out of acpi.h.
Sean Christopherson (12):
x86/efi: Explicitly include realmode.h to handle RM trampoline quirk x86/boot: Explicitly include realmode.h to handle RM reservations x86/ftrace: Explicitly include vmalloc.h for
set_vm_flush_reset_perms()
x86/kprobes: Explicitly include vmalloc.h for
set_vm_flush_reset_perms()
perf/x86/intel: Explicitly include asm/io.h to use virt_to_phys() efi/capsule-loader: Explicitly include linux/io.h for page_to_phys()
virt: vbox: Explicitly include linux/io.h to pick up various defs
vmw_balloon: Explicitly include linux/io.h for virt_to_phys()
ASoC: Intel: Skylake: Explicitly include linux/io.h for virt_to_phys() x86/ACPI/sleep: Remove an unnecessary include of asm/realmode.h ACPI/sleep: Convert acpi_wakeup_address into a function x86/ACPI/sleep: Move acpi_wakeup_address() definition into sleep.c
arch/ia64/include/asm/acpi.h | 5 ++++- arch/ia64/kernel/acpi.c | 2 -- arch/x86/events/intel/ds.c | 1 + arch/x86/include/asm/acpi.h | 3 +-- arch/x86/kernel/acpi/sleep.c | 11 +++++++++++ arch/x86/kernel/acpi/sleep.h | 2 +- arch/x86/kernel/ftrace.c | 1 + arch/x86/kernel/kprobes/core.c | 1 + arch/x86/kernel/setup.c | 1 + arch/x86/platform/efi/quirks.c | 1 + drivers/acpi/sleep.c | 4 ++-- drivers/firmware/efi/capsule-loader.c | 1 + drivers/misc/vmw_balloon.c | 1 + drivers/virt/vboxguest/vboxguest_core.c | 1 + drivers/virt/vboxguest/vboxguest_utils.c | 1 + sound/soc/intel/skylake/skl-sst-cldma.c | 1 + 16 files changed, 29 insertions(+), 8 deletions(-)
Signature · 1 line
2.24.0
PATCH 1/12 x86/efi: Explicitly include realmode.h to handle RM trampoline quirk
Explicitly include asm/realmode.h, which is needed to handle a real mode trampoline quirk in efi_free_boot_services(), instead of picking it up by way of linux/acpi.h. acpi.h will soon stop including realmode.h so that changing realmode.h doesn't require a full kernel rebuild.
--- arch/x86/platform/efi/quirks.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/platform/efi/quirks.c +1 -0
@@ -16,6 +16,7 @@#include <asm/efi.h> #include <asm/uv/uv.h> #include <asm/cpu_device_id.h> +#include <asm/realmode.h> #include <asm/reboot.h> #define EFI_MIN_RESERVE 5120
Signature · 1 line
2.24.0
[tip: core/headers] x86/efi: Explicitly include realmode.h to handle RM trampoline quirk
The following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: 950e3ce5372c474066ccfc66f424be6bc2828c99 Gitweb: https://git.kernel.org/tip/950e3ce5372c474066ccfc66f424be6bc2828c99 Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:10 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:26 +01:00
x86/efi: Explicitly include realmode.h to handle RM trampoline quirk
Explicitly include asm/realmode.h, which is needed to handle a real mode trampoline quirk in efi_free_boot_services(), instead of picking it up by way of linux/acpi.h. acpi.h will soon stop including realmode.h so that changing realmode.h doesn't require a full kernel rebuild.
--- arch/x86/platform/efi/quirks.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/platform/efi/quirks.c +1 -0
@@ -16,6 +16,7 @@#include <asm/efi.h> #include <asm/uv/uv.h> #include <asm/cpu_device_id.h> +#include <asm/realmode.h> #include <asm/reboot.h> #define EFI_MIN_RESERVE 5120
PATCH 2/12 x86/boot: Explicitly include realmode.h to handle RM reservations
In reply to Sean ChristophersonExplicitly include asm/realmode.h, which provides reserve_real_mode(), instead of picking it up by an indirect include of asm/acpi.h. acpi.h will soon stop including realmode.h so that changing realmode.h doesn't require a full kernel rebuild.
--- arch/x86/kernel/setup.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/setup.c +1 -0
@@ -33,6 +33,7 @@#include <asm/kaslr.h> #include <asm/mce.h> #include <asm/mtrr.h> +#include <asm/realmode.h> #include <asm/olpc_ofw.h> #include <asm/pci-direct.h> #include <asm/prom.h>
Signature · 1 line
2.24.0
[tip: core/headers] x86/boot: Explicitly include realmode.h to handle RM reservations
The following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: db802ef3c91fad3b40a240f63d8e2fda23a1a9b1 Gitweb: https://git.kernel.org/tip/db802ef3c91fad3b40a240f63d8e2fda23a1a9b1 Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:11 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:26 +01:00
x86/boot: Explicitly include realmode.h to handle RM reservations
Explicitly include asm/realmode.h, which provides reserve_real_mode(), instead of picking it up by an indirect include of asm/acpi.h. acpi.h will soon stop including realmode.h so that changing realmode.h doesn't require a full kernel rebuild.
--- arch/x86/kernel/setup.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/setup.c +1 -0
@@ -35,6 +35,7 @@#include <asm/kaslr.h> #include <asm/mce.h> #include <asm/mtrr.h> +#include <asm/realmode.h> #include <asm/olpc_ofw.h> #include <asm/pci-direct.h> #include <asm/prom.h>
PATCH 3/12 x86/ftrace: Explicitly include vmalloc.h for set_vm_flush_reset_perms()
In reply to Sean ChristophersonThe inclusion of linux/vmalloc.h, which is required for its definition of set_vm_flush_reset_perms(), is somehow dependent on asm/realmode.h being included by asm/acpi.h. Explicitly include linux/vmalloc.h so that a future patch can drop the realmode.h include from asm/acpi.h without breaking the build.
--- arch/x86/kernel/ftrace.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/ftrace.c +1 -0
@@ -23,6 +23,7 @@#include <linux/list.h> #include <linux/module.h> #include <linux/memory.h> +#include <linux/vmalloc.h> #include <trace/syscall.h>
Signature · 1 line
2.24.0
Re: [PATCH 03/12] x86/ftrace: Explicitly include vmalloc.h for set_vm_flush_reset_perms()
Quoted 8 lines · On Mon, 18 Nov 2019 16:21:12 -0800 Sean Christopherson…
The inclusion of
linux/vmalloc.h, which is required for its definition ofset_vm_flush_reset_perms(), is somehow dependent onasm/realmode.hbeing included byasm/acpi.h. Explicitly includelinux/vmalloc.hso that a future patch can drop therealmode.hinclude fromasm/acpi.hwithout breaking the build.Fixes 7fdfe1e40b225 ("x86/ftrace: Use vmalloc special flag")Signed-off-by Sean Christopherson <[email protected]>
-- Steve
Quoted 16 lines
--- arch/x86/kernel/ftrace.c | 1 + 1 file changed, 1 insertion(+)arch/x86/kernel/ftrace.c +1
-0@@ -23,6 +23,7 @@#include <linux/list.h> #include <linux/module.h> #include <linux/memory.h> +#include <linux/vmalloc.h> #include <trace/syscall.h>
[tip: core/headers] x86/ftrace: Explicitly include vmalloc.h for set_vm_flush_reset_perms()
In reply to Sean ChristophersonThe following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: 68f461af8bb9f1d4e69469aa91a741f12f679f19 Gitweb: https://git.kernel.org/tip/68f461af8bb9f1d4e69469aa91a741f12f679f19 Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:12 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:26 +01:00
x86/ftrace: Explicitly include vmalloc.h for set_vm_flush_reset_perms()
The inclusion of linux/vmalloc.h, which is required for its definition of set_vm_flush_reset_perms(), is somehow dependent on asm/realmode.h being included by asm/acpi.h. Explicitly include linux/vmalloc.h so that a future patch can drop the realmode.h include from asm/acpi.h without breaking the build.
--- arch/x86/kernel/ftrace.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/ftrace.c +1 -0
@@ -23,6 +23,7 @@#include <linux/list.h> #include <linux/module.h> #include <linux/memory.h> +#include <linux/vmalloc.h> #include <trace/syscall.h>
PATCH 4/12 x86/kprobes: Explicitly include vmalloc.h for set_vm_flush_reset_perms()
In reply to Sean ChristophersonThe inclusion of linux/vmalloc.h, which is required for its definition of set_vm_flush_reset_perms(), is somehow dependent on asm/realmode.h being included by asm/acpi.h. Explicitly include linux/vmalloc.h so that a future patch can drop the realmode.h include from asm/acpi.h without breaking the build.
--- arch/x86/kernel/kprobes/core.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/kprobes/core.c +1 -0
@@ -40,6 +40,7 @@#include <linux/frame.h> #include <linux/kasan.h> #include <linux/moduleloader.h> +#include <linux/vmalloc.h> #include <asm/text-patching.h> #include <asm/cacheflush.h>
Signature · 1 line
2.24.0
Re: [PATCH 04/12] x86/kprobes: Explicitly include vmalloc.h for set_vm_flush_reset_perms()
Quoted 8 lines · On Mon, 18 Nov 2019 16:21:13 -0800 Sean Christopherson…
The inclusion of
linux/vmalloc.h, which is required for its definition ofset_vm_flush_reset_perms(), is somehow dependent onasm/realmode.hbeing included byasm/acpi.h. Explicitly includelinux/vmalloc.hso that a future patch can drop therealmode.hinclude fromasm/acpi.hwithout breaking the build.Fixes 241a1f2238064 ("x86/kprobes: Use vmalloc special flag")Signed-off-by Sean Christopherson <[email protected]>
-- Steve
Quoted 16 lines
--- arch/x86/kernel/kprobes/core.c | 1 + 1 file changed, 1 insertion(+)arch/x86/kernel/kprobes/core.c +1
-0@@ -40,6 +40,7 @@#include <linux/frame.h> #include <linux/kasan.h> #include <linux/moduleloader.h> +#include <linux/vmalloc.h> #include <asm/text-patching.h> #include <asm/cacheflush.h>
[tip: core/headers] x86/kprobes: Explicitly include vmalloc.h for set_vm_flush_reset_perms()
In reply to Sean ChristophersonThe following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: d5d411f81e552a67f2aa7cc39bba0c1d7d3db09a Gitweb: https://git.kernel.org/tip/d5d411f81e552a67f2aa7cc39bba0c1d7d3db09a Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:13 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:26 +01:00
x86/kprobes: Explicitly include vmalloc.h for set_vm_flush_reset_perms()
The inclusion of linux/vmalloc.h, which is required for its definition of set_vm_flush_reset_perms(), is somehow dependent on asm/realmode.h being included by asm/acpi.h. Explicitly include linux/vmalloc.h so that a future patch can drop the realmode.h include from asm/acpi.h without breaking the build.
--- arch/x86/kernel/kprobes/core.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/kprobes/core.c +1 -0
@@ -40,6 +40,7 @@#include <linux/frame.h> #include <linux/kasan.h> #include <linux/moduleloader.h> +#include <linux/vmalloc.h> #include <asm/text-patching.h> #include <asm/cacheflush.h>
PATCH 5/12 perf/x86/intel: Explicitly include asm/io.h to use virt_to_phys()
In reply to Sean ChristophersonThrough a labyrinthian sequence of includes, usage of virt_to_phys() is dependent on the include of asm/io.h in asm/realmode.h via asm/acpi.h. Explicitly include asm/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- arch/x86/events/intel/ds.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/ds.c +1 -0
@@ -7,6 +7,7 @@#include <asm/perf_event.h> #include <asm/tlbflush.h> #include <asm/insn.h> +#include <asm/io.h> #include "../perf_event.h"
Signature · 1 line
2.24.0
[tip: core/headers] perf/x86/intel: Explicitly include asm/io.h to use virt_to_phys()
The following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: 7bd4cb7e93c288dbec40cd3065e4fceb21343b11 Gitweb: https://git.kernel.org/tip/7bd4cb7e93c288dbec40cd3065e4fceb21343b11 Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:14 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:26 +01:00
perf/x86/intel: Explicitly include asm/io.h to use virt_to_phys()
Through a labyrinthian sequence of includes, usage of virt_to_phys() is dependent on the include of asm/io.h in asm/realmode.h via asm/acpi.h. Explicitly include asm/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- arch/x86/events/intel/ds.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/ds.c +1 -0
@@ -7,6 +7,7 @@#include <asm/perf_event.h> #include <asm/tlbflush.h> #include <asm/insn.h> +#include <asm/io.h> #include "../perf_event.h"
PATCH 6/12 efi/capsule-loader: Explicitly include linux/io.h for page_to_phys()
In reply to Sean ChristophersonThrough a labyrinthian sequence of includes, usage of page_to_phys() is dependent on the include of asm/io.h in x86's asm/realmode.h, which is included in x86's asm/acpi.h and thus by linux/acpi.h. Explicitly include linux/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- drivers/firmware/efi/capsule-loader.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/efi/capsule-loader.c +1 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/miscdevice.h> #include <linux/highmem.h> +#include <linux/io.h> #include <linux/slab.h> #include <linux/mutex.h> #include <linux/efi.h>
Signature · 1 line
2.24.0
[tip: core/headers] efi/capsule-loader: Explicitly include linux/io.h for page_to_phys()
The following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: 53db61e1d344adda56a2a9dc8ae4fc099df0f95a Gitweb: https://git.kernel.org/tip/53db61e1d344adda56a2a9dc8ae4fc099df0f95a Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:15 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:26 +01:00
efi/capsule-loader: Explicitly include linux/io.h for page_to_phys()
Through a labyrinthian sequence of includes, usage of page_to_phys() is dependent on the include of asm/io.h in x86's asm/realmode.h, which is included in x86's asm/acpi.h and thus by linux/acpi.h. Explicitly include linux/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- drivers/firmware/efi/capsule-loader.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/efi/capsule-loader.c +1 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/miscdevice.h> #include <linux/highmem.h> +#include <linux/io.h> #include <linux/slab.h> #include <linux/mutex.h> #include <linux/efi.h>
PATCH 7/12 virt: vbox: Explicitly include linux/io.h to pick up various defs
In reply to Sean ChristophersonThrough a labyrinthian sequence of includes, usage of page_to_phys(), virt_to_phys() and out*() is dependent on the include of asm/io.h in x86's asm/realmode.h, which is included in x86's asm/acpi.h and thus by linux/acpi.h. Explicitly include linux/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- drivers/virt/vboxguest/vboxguest_core.c | 1 + drivers/virt/vboxguest/vboxguest_utils.c | 1 + 2 files changed, 2 insertions(+)
drivers/virt/vboxguest/vboxguest_core.c +1 -0
@@ -6,6 +6,7 @@*/ #include <linux/device.h> +#include <linux/io.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/sizes.h>
drivers/virt/vboxguest/vboxguest_utils.c +1 -0
@@ -7,6 +7,7 @@*/ #include <linux/errno.h> +#include <linux/io.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/module.h>
Signature · 1 line
2.24.0
[tip: core/headers] virt: vbox: Explicitly include linux/io.h to pick up various defs
The following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: 3f61b293e48068606fac988f6d72a710c0dce668 Gitweb: https://git.kernel.org/tip/3f61b293e48068606fac988f6d72a710c0dce668 Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:16 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:27 +01:00
virt: vbox: Explicitly include linux/io.h to pick up various defs
Through a labyrinthian sequence of includes, usage of page_to_phys(), virt_to_phys() and out*() is dependent on the include of asm/io.h in x86's asm/realmode.h, which is included in x86's asm/acpi.h and thus by linux/acpi.h. Explicitly include linux/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- drivers/virt/vboxguest/vboxguest_core.c | 1 + drivers/virt/vboxguest/vboxguest_utils.c | 1 + 2 files changed, 2 insertions(+)
drivers/virt/vboxguest/vboxguest_core.c +1 -0
@@ -6,6 +6,7 @@*/ #include <linux/device.h> +#include <linux/io.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/sizes.h>
drivers/virt/vboxguest/vboxguest_utils.c +1 -0
@@ -7,6 +7,7 @@*/ #include <linux/errno.h> +#include <linux/io.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/module.h>
PATCH 8/12 vmw_balloon: Explicitly include linux/io.h for virt_to_phys()
In reply to Sean ChristophersoniThrough a labyrinthian sequence of includes, usage of virt_to_phys() is dependent on the include of asm/io.h in x86's asm/realmode.h, which is included in x86's asm/acpi.h and thus by linux/acpi.h. Explicitly include linux/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- drivers/misc/vmw_balloon.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/vmw_balloon.c +1 -0
@@ -17,6 +17,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/types.h> +#include <linux/io.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/vmalloc.h>
Signature · 1 line
2.24.0
[tip: core/headers] vmw_balloon: Explicitly include linux/io.h for virt_to_phys()
The following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: 0ea1d7c60b8c88283e2656c7cfe688dc68646d44 Gitweb: https://git.kernel.org/tip/0ea1d7c60b8c88283e2656c7cfe688dc68646d44 Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:17 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:27 +01:00
vmw_balloon: Explicitly include linux/io.h for virt_to_phys()
iThrough a labyrinthian sequence of includes, usage of virt_to_phys() is dependent on the include of asm/io.h in x86's asm/realmode.h, which is included in x86's asm/acpi.h and thus by linux/acpi.h. Explicitly include linux/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- drivers/misc/vmw_balloon.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/vmw_balloon.c +1 -0
@@ -17,6 +17,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/types.h> +#include <linux/io.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/vmalloc.h>
PATCH 9/12 ASoC: Intel: Skylake: Explicitly include linux/io.h for virt_to_phys()
In reply to Sean ChristophersonThrough a labyrinthian sequence of includes, usage of virt_to_phys() is dependent on the include of asm/io.h in x86's asm/realmode.h, which is included in x86's asm/acpi.h and thus by linux/acpi.h. Explicitly include linux/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- sound/soc/intel/skylake/skl-sst-cldma.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/skylake/skl-sst-cldma.c +1 -0
@@ -8,6 +8,7 @@*/ #include <linux/device.h> +#include <linux/io.h> #include <linux/mm.h> #include <linux/delay.h> #include "../common/sst-dsp.h"
Signature · 1 line
2.24.0
Re: [PATCH 09/12] ASoC: Intel: Skylake: Explicitly include linux/io.h for virt_to_phys()
Quoted 6 lines · Sean Christopherson
Through a labyrinthian sequence of includes, usage of
virt_to_phys()is dependent on the include ofasm/io.hin x86'sasm/realmode.h, which is included in x86'sasm/acpi.hand thus bylinux/acpi.h. Explicitly includelinux/io.hto break the dependency onrealmode.hso that a future patch can remove therealmode.hinclude fromacpi.hwithout breaking the build.
[tip: core/headers] ASoC: Intel: Skylake: Explicitly include linux/io.h for virt_to_phys()
In reply to Sean ChristophersonThe following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: 6d1002c4229fa3cfdb5b73a2c8a45a4b6090ba0a Gitweb: https://git.kernel.org/tip/6d1002c4229fa3cfdb5b73a2c8a45a4b6090ba0a Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:18 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:27 +01:00
ASoC: Intel: Skylake: Explicitly include linux/io.h for virt_to_phys()
Through a labyrinthian sequence of includes, usage of virt_to_phys() is dependent on the include of asm/io.h in x86's asm/realmode.h, which is included in x86's asm/acpi.h and thus by linux/acpi.h. Explicitly include linux/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build.
--- sound/soc/intel/skylake/skl-sst-cldma.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/skylake/skl-sst-cldma.c +1 -0
@@ -8,6 +8,7 @@*/ #include <linux/device.h> +#include <linux/io.h> #include <linux/mm.h> #include <linux/delay.h> #include "../common/sst-dsp.h"
PATCH 10/12 x86/ACPI/sleep: Remove an unnecessary include of asm/realmode.h
In reply to Sean ChristophersonNone of the declarations in x86's acpi/sleep.h are in any way dependent on the real mode boot code. Remove sleep.h's include of asm/realmode.h to limit the dependencies on realmode.h to code that actually interacts with the boot code.
--- arch/x86/kernel/acpi/sleep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/acpi/sleep.h +1 -1
@@ -3,7 +3,7 @@* Variables and functions used by the code in sleep.c */ -#include <asm/realmode.h> +#include <linux/linkage.h> extern unsigned long saved_video_mode;extern long saved_magic;
Signature · 1 line
2.24.0
Re: [PATCH 10/12] x86/ACPI/sleep: Remove an unnecessary include of asm/realmode.h
Quoted 7 lines · CET Sean Christopherson
None of the declarations in x86's
acpi/sleep.hare in any way dependent on the real mode boot code. Remove sleep.h's include ofasm/realmode.hto limit the dependencies onrealmode.hto code that actually interacts with the boot code.Fixes c9b77ccb52a5c ("x86, realmode: Move ACPI wakeup to unified realmode code")Signed-off-by Sean Christopherson <[email protected]>
Quoted 18 lines
--- arch/x86/kernel/acpi/sleep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/kernel/acpi/sleep.h +1
-1@@ -3,7 +3,7 @@* Variables and functions used by the code in sleep.c */ -#include <asm/realmode.h> +#include <linux/linkage.h> extern unsigned long saved_video_mode;extern long saved_magic;
[tip: core/headers] x86/ACPI/sleep: Remove an unnecessary include of asm/realmode.h
In reply to Sean ChristophersonThe following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: 25466d56fbadb785a1342aae4b2147ea1781d55a Gitweb: https://git.kernel.org/tip/25466d56fbadb785a1342aae4b2147ea1781d55a Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:19 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:27 +01:00
x86/ACPI/sleep: Remove an unnecessary include of asm/realmode.h
None of the declarations in x86's acpi/sleep.h are in any way dependent on the real mode boot code. Remove sleep.h's include of asm/realmode.h to limit the dependencies on realmode.h to code that actually interacts with the boot code.
--- arch/x86/kernel/acpi/sleep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/acpi/sleep.h +1 -1
@@ -3,7 +3,7 @@* Variables and functions used by the code in sleep.c */ -#include <asm/realmode.h> +#include <linux/linkage.h> extern unsigned long saved_video_mode;extern long saved_magic;
PATCH 11/12 ACPI/sleep: Convert acpi_wakeup_address into a function
In reply to Sean ChristophersonConvert acpi_wakeup_address from a raw variable into a function so that x86 can wrap its dereference of the real mode boot header in a function instead of broadcasting it to the world via a #define. This sets the stage for a future patch to move the definition of acpi_wakeup_address() out of asm/acpi.h and thus break acpi.h's dependency on asm/realmode.h.
No functional change intended.
--- arch/ia64/include/asm/acpi.h | 5 ++++- arch/ia64/kernel/acpi.c | 2 -- arch/x86/include/asm/acpi.h | 5 ++++- drivers/acpi/sleep.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-)
arch/ia64/include/asm/acpi.h +4 -1
@@ -38,7 +38,10 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);/* Low-level suspend routine. */ extern int acpi_suspend_lowlevel (void ); -extern unsigned long acpi_wakeup_address; +static inline unsigned long acpi_wakeup_address (void ) +{ +return 0 ; +}/* * Record the cpei override flag and current logical cpu. This is
arch/ia64/kernel/acpi.c +0 -2
@@ -42,8 +42,6 @@ int acpi_lapic;unsigned int acpi_cpei_override;unsigned int acpi_cpei_phys_cpuid; -unsigned long acpi_wakeup_address =0 ; -#define ACPI_MAX_PLATFORM_INTERRUPTS 256/* Array to record platform interrupt vectors for generic interrupt routing. */
arch/x86/include/asm/acpi.h +4 -1
@@ -62,7 +62,10 @@ static inline void acpi_disable_pci(void)extern int (*acpi_suspend_lowlevel)(void );/* Physical address to resume after wakeup */ -#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) +static inline unsigned long acpi_wakeup_address (void ) +{ +return ((unsigned long )(real_mode_header->wakeup_start)); +}/* * Check if the CPU can handle C2 and deeper
drivers/acpi/sleep.c +2 -2
@@ -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_wakeup_address ())return -EFAULT ; -acpi_set_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address ()); }ACPI_FLUSH_CPU_CACHE ();
Signature · 1 line
2.24.0
Re: [PATCH 11/12] ACPI/sleep: Convert acpi_wakeup_address into a function
Quoted 9 lines · CET Sean Christopherson
Convert
acpi_wakeup_addressfrom a raw variable into a function so that x86 can wrap its dereference of the real mode boot header in a function instead of broadcasting it to the world via a #define. This sets the stage for a future patch to move the definition ofacpi_wakeup_address()out ofasm/acpi.hand thus break acpi.h's dependency onasm/realmode.h.No functional change intended.
Signed-off-by Sean Christopherson <[email protected]>
Quoted 69 lines
--- arch/ia64/include/asm/acpi.h | 5 ++++- arch/ia64/kernel/acpi.c | 2 -- arch/x86/include/asm/acpi.h | 5 ++++- drivers/acpi/sleep.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-)arch/ia64/include/asm/acpi.h +4
-1@@ -38,7 +38,10 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);/* Low-level suspend routine. */ extern int acpi_suspend_lowlevel (void ); -extern unsigned long acpi_wakeup_address; +static inline unsigned long acpi_wakeup_address (void ) +{ +return 0 ; +}/* * Record the cpei override flag and current logical cpu. This is arch/ia64/kernel/acpi.c +0
-2@@ -42,8 +42,6 @@ int acpi_lapic;unsigned int acpi_cpei_override;unsigned int acpi_cpei_phys_cpuid; -unsigned long acpi_wakeup_address =0 ; -#define ACPI_MAX_PLATFORM_INTERRUPTS 256/* Array to record platform interrupt vectors for generic interrupt routing. */ arch/x86/include/asm/acpi.h +4
-1@@ -62,7 +62,10 @@ static inline void acpi_disable_pci(void)extern int (*acpi_suspend_lowlevel)(void );/* Physical address to resume after wakeup */ -#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) +static inline unsigned long acpi_wakeup_address (void ) +{ +return ((unsigned long )(real_mode_header->wakeup_start)); +}/* * Check if the CPU can handle C2 and deeper drivers/acpi/sleep.c +2
-2@@ -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_wakeup_address ())return -EFAULT ; -acpi_set_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address ()); }ACPI_FLUSH_CPU_CACHE ();
Re: [PATCH 11/12] ACPI/sleep: Convert acpi_wakeup_address into a function
Quoted 13 lines · CET Sean Christopherson
Quoted 9 lines
Convert
acpi_wakeup_addressfrom a raw variable into a function so that x86 can wrap its dereference of the real mode boot header in a function instead of broadcasting it to the world via a #define. This sets the stage for a future patch to move the definition ofacpi_wakeup_address()out ofasm/acpi.hand thus break acpi.h's dependency onasm/realmode.h.No functional change intended.
Signed-off-by Sean Christopherson <[email protected]>
Quoted 12 lines
drivers/acpi/sleep.c static int acpi_sleep_prepare(u32 acpi_state) · line 69
Quoted 12 lines
drivers/acpi/sleep.c +2
-2@@ -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_wakeup_address ())return -EFAULT ; -acpi_set_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address ());
You might want to store result in a variable... especially since you are turning inline function into real one in a next patch.
And maybe function should be called get_acip_wakeup_address or something? This way it is easy to mistake actual wakeup address from function that gets it...
Best regards,
Pavel
Quoted 2 lines
Re: [PATCH 11/12] ACPI/sleep: Convert acpi_wakeup_address into a function
Quoted 29 lines · Pavel Machek
Quoted 13 lines · CET Sean Christopherson
Quoted 9 lines
Convert
acpi_wakeup_addressfrom a raw variable into a function so that x86 can wrap its dereference of the real mode boot header in a function instead of broadcasting it to the world via a #define. This sets the stage for a future patch to move the definition ofacpi_wakeup_address()out ofasm/acpi.hand thus break acpi.h's dependency onasm/realmode.h.No functional change intended.
Signed-off-by Sean Christopherson <[email protected]>Quoted 12 lines
drivers/acpi/sleep.c static int acpi_sleep_prepare(u32 acpi_state) · line 69
Quoted 12 lines
drivers/acpi/sleep.c +2
-2@@ -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_wakeup_address ())return -EFAULT ; -acpi_set_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address ());You might want to store result in a variable... especially since you are turning inline function into real one in a next patch.
Quoted 3 lines
And maybe function should be called
get_acip_wakeup_addressor something? This way it is easy to mistake actual wakeup address from function that gets it...
Agreed on both counts.
Ingo,
Would you prefer a v2 of the entire series (with Acks and removal of Fixes), or a v2 that includes only the last two patches?
Re: [PATCH 11/12] ACPI/sleep: Convert acpi_wakeup_address into a function
Quoted 34 lines · Sean Christopherson
Quoted 29 lines · Pavel Machek
Quoted 13 lines · CET Sean Christopherson
Quoted 9 lines
Convert
acpi_wakeup_addressfrom a raw variable into a function so that x86 can wrap its dereference of the real mode boot header in a function instead of broadcasting it to the world via a #define. This sets the stage for a future patch to move the definition ofacpi_wakeup_address()out ofasm/acpi.hand thus break acpi.h's dependency onasm/realmode.h.No functional change intended.
Signed-off-by Sean Christopherson <[email protected]>Quoted 12 lines
drivers/acpi/sleep.c static int acpi_sleep_prepare(u32 acpi_state) · line 69
Quoted 12 lines
drivers/acpi/sleep.c +2
-2@@ -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_wakeup_address ())return -EFAULT ; -acpi_set_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address ());You might want to store result in a variable... especially since you are turning inline function into real one in a next patch.
Quoted 3 lines
And maybe function should be called
get_acip_wakeup_addressor something? This way it is easy to mistake actual wakeup address from function that gets it...
Quoted 7 lines
Agreed on both counts.
Ingo,
Would you prefer a v2 of the entire series (with Acks and removal of Fixes), or a v2 that includes only the last two patches?
Yep, that would be handy. I have them committed to tip:core/headers, but haven't sent it to Linus yet, and can redo that all with these improvements.
Thanks,
Ingo
Re: [PATCH 11/12] ACPI/sleep: Convert acpi_wakeup_address into a function
Quoted 6 lines · Ingo Molnar
Quoted 2 lines
Would you prefer a v2 of the entire series (with Acks and removal of Fixes), or a v2 that includes only the last two patches?
Yep, that would be handy. I have them committed to tip:core/headers, but haven't sent it to Linus yet, and can redo that all with these improvements.
Now these bits are back in tip:WIP.core/headers, waiting for the v2 submission.
Thanks,
Ingo
[tip: core/headers] ACPI/sleep: Convert acpi_wakeup_address into a function
In reply to Sean ChristophersonThe following commit has been merged into the core/headers branch of tip:
The following commit has been merged into the core/headers branch of tip:
Commit-ID: a9760aba02b346e74fffe8e35e4f1e9067de5281 Gitweb: https://git.kernel.org/tip/a9760aba02b346e74fffe8e35e4f1e9067de5281 Author: Sean Christopherson <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:20 -08:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 19 Nov 2019 17:50:27 +01:00
ACPI/sleep: Convert acpi_wakeup_address into a function
Convert acpi_wakeup_address from a raw variable into a function so that x86 can wrap its dereference of the real mode boot header in a function instead of broadcasting it to the world via a #define. This sets the stage for a future patch to move the definition of acpi_wakeup_address() out of asm/acpi.h and thus break acpi.h's dependency on asm/realmode.h.
No functional change intended.
--- arch/ia64/include/asm/acpi.h | 5 ++++- arch/ia64/kernel/acpi.c | 2 -- arch/x86/include/asm/acpi.h | 5 ++++- drivers/acpi/sleep.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-)
arch/ia64/include/asm/acpi.h +4 -1
@@ -38,7 +38,10 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);/* Low-level suspend routine. */ extern int acpi_suspend_lowlevel (void ); -extern unsigned long acpi_wakeup_address; +static inline unsigned long acpi_wakeup_address (void ) +{ +return 0 ; +}/* * Record the cpei override flag and current logical cpu. This is
arch/ia64/kernel/acpi.c +0 -2
@@ -42,8 +42,6 @@ int acpi_lapic;unsigned int acpi_cpei_override;unsigned int acpi_cpei_phys_cpuid; -unsigned long acpi_wakeup_address =0 ; -#define ACPI_MAX_PLATFORM_INTERRUPTS 256/* Array to record platform interrupt vectors for generic interrupt routing. */
arch/x86/include/asm/acpi.h +4 -1
@@ -62,7 +62,10 @@ static inline void acpi_disable_pci(void)extern int (*acpi_suspend_lowlevel)(void );/* Physical address to resume after wakeup */ -#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) +static inline unsigned long acpi_wakeup_address (void ) +{ +return ((unsigned long )(real_mode_header->wakeup_start)); +}/* * Check if the CPU can handle C2 and deeper
drivers/acpi/sleep.c +2 -2
@@ -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_wakeup_address ())return -EFAULT ; -acpi_set_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address ()); }ACPI_FLUSH_CPU_CACHE ();
PATCH 12/12 x86/ACPI/sleep: Move acpi_wakeup_address() definition into sleep.c
In reply to Sean ChristophersonMove 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.
--- arch/x86/include/asm/acpi.h | 6 +----- arch/x86/kernel/acpi/sleep.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-)
arch/x86/include/asm/acpi.h +1 -5
@@ -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_wakeup_address (void );/* * Check if the CPU can handle C2 and deeper
arch/x86/kernel/acpi/sleep.c +11 -0
@@ -26,6 +26,17 @@ unsigned long acpi_realmode_flags;static char temp_stack[4096 ];#endif +/** +* acpi_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_wakeup_address (void ) +{ +return ((unsigned long )(real_mode_header->wakeup_start)); +} +/** * x86_acpi_enter_sleep_state - enter sleep state * @state: Sleep state to enter.
Signature · 1 line
2.24.0
Re: [PATCH 12/12] x86/ACPI/sleep: Move acpi_wakeup_address() definition into sleep.c
Quoted 8 lines · CET Sean Christopherson
Move the definition of
acpi_wakeup_address()intosleep.cto break linux/acpi.h's dependency (by way ofasm/acpi.h) onasm/realmode.h. Everyone and their mother includeslinux/acpi.h, i.e. modifyingrealmode.hresults 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.Signed-off-by Sean Christopherson <[email protected]>
Quoted 52 lines
--- arch/x86/include/asm/acpi.h | 6 +----- arch/x86/kernel/acpi/sleep.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-)arch/x86/include/asm/acpi.h +1
-5@@ -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_wakeup_address (void );/* * Check if the CPU can handle C2 and deeper arch/x86/kernel/acpi/sleep.c +11
-0@@ -26,6 +26,17 @@ unsigned long acpi_realmode_flags;static char temp_stack[4096 ];#endif +/** +* acpi_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_wakeup_address (void ) +{ +return ((unsigned long )(real_mode_header->wakeup_start)); +} +/** * x86_acpi_enter_sleep_state - enter sleep state * @state: Sleep state to enter.
[tip: core/headers] x86/ACPI/sleep: Move acpi_wakeup_address() definition into sleep.c, remove <asm/realmode.h> from <asm/acpi.h>
In reply to Sean ChristophersonThe following commit has been merged into the core/headers branch of tip:
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 <[email protected]> AuthorDate: Mon, 18 Nov 2019 16:21:21 -08:00 Committer: Ingo Molnar <[email protected]> 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. ]
--- 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(-)
arch/ia64/include/asm/acpi.h +1 -1
@@ -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 ; }
arch/x86/include/asm/acpi.h +1 -5
@@ -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
arch/x86/kernel/acpi/sleep.c +11 -0
@@ -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. *
drivers/acpi/sleep.c +2 -2
@@ -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 ();
Quoted 20 lines · Sean Christopherson
x86's
asm/realmode.h, which defines low level structures, variables and helpers used to bring up APs during SMP boot, ends up getting included in practically every nook and cranny of the kernel because the address used by ACPI for resuming from S3 also happens to be stored in the real mode header, and ACPI bleeds the dependency into its widely included headers.As a result, modifying
realmode.hfor even the most trivial change to the boot code triggers a full kernel rebuild, which is frustrating to say the least as it some of the most difficult code to get exactly right *and* is also some of the most functionally isolated code in the kernel.To break the kernel's widespread dependency on
realmode.h, add a wrapper in the aforementioned ACPI S3 code to access the real mode header instead of derefencing the header directly inasm/acpi.hand thereby exposing it to the world vialinux/acpi.h.Build tested on x86 with allyesconfig and allmodconfig, so hopefully there aren't more build issues lurking, but at this point it wouldn't surprise me in the least if this somehow manages to break the build.
Quoted 7 lines
Based on tip/master, commit
ceceaf1f12ba("Merge branch 'WIP.x86/cleanups'").Patch Synopsis:
- Patches 01-09 fix a variety of build errors that arise when patch 12 dropsrealmode.hfromasm/acpi.h. Most of the errors are quite absurb as they have no relation whatsoever to x86's RM boot code, but occur becauserealmode.hhappens to includeasm/io.h.
Yeah, these kind of parasitic header dependencies are the main driving force behind kernel header spaghetti hell: it's super easy to add a new header, but very hard to remove them...
Hence they practically only accumulate.
As a result header removal patches get priority, from me at least. :-)
Quoted 3 lines
- Patch 10 removes a spurious include of
realmode.hfrom an ACPI header.- Patches 11 and 12 implement the wrapper and move it out of
acpi.h.
So if the ACPI maintainers are fine with -tip carrying patches #11 and #12 then I'd be glad to route these patches upstream.
I've applied them to tip:WIP.core/headers as a work-in-progress tree, and I'm testing them on randconfigs to make sure there's no broken dependencies. I'll wait for the ACPI acks.
I edited the title of patch 12 slightly, to:
c8bceb321209: x86/ACPI/sleep: Move acpi_wakeup_address() definition into sleep.c, remove <asm/realmode.h> from <asm/acpi.h>
to make sure the big header dependency change is obvious at first sight.
Thanks,
Ingo
PATCH 1/1 x86/platform/intel/quark: Explicitly include linux/io.h for virt_to_phys()
Quoted 3 lines · Ingo Molnar
I've applied them to tip:WIP.core/headers as a work-in-progress tree, and I'm testing them on randconfigs to make sure there's no broken dependencies. I'll wait for the ACPI acks.
One more fix was needed, for the intel-quark driver that is only built on 32-bit configs:
=========>
From: Ingo Molnar <[email protected]>
Date: Tue, 19 Nov 2019 12:51:56 +0100
Subject: [PATCH] x86/platform/intel/quark: Explicitly include linux/io.h for virt_to_phys()
Similarly to the previous patches by Sean Christopherson:
"Through a labyrinthian sequence of includes, usage of virt_to_phys() is
dependent on the include of asm/io.h in x86's asm/realmode.h, which is included in x86's asm/acpi.h and thus by linux/acpi.h. Explicitly include linux/io.h to break the dependency on realmode.h so that a future patch can remove the realmode.h include from acpi.h without breaking the build."
--- arch/x86/platform/intel-quark/imr.c | 2 ++ arch/x86/platform/intel-quark/imr_selftest.c | 2 ++ 2 files changed, 4 insertions(+)
arch/x86/platform/intel-quark/imr.c +2 -0
@@ -29,6 +29,8 @@#include <asm/cpu_device_id.h> #include <asm/imr.h> #include <asm/iosf_mbi.h> +#include <asm/io.h> +#include <linux/debugfs.h> #include <linux/init.h> #include <linux/mm.h>
arch/x86/platform/intel-quark/imr_selftest.c +2 -0
@@ -14,6 +14,8 @@#include <asm-generic/sections.h> #include <asm/cpu_device_id.h> #include <asm/imr.h> +#include <asm/io.h> +#include <linux/init.h> #include <linux/mm.h> #include <linux/types.h>
Re: [PATCH] x86/platform/intel/quark: Explicitly include linux/io.h for virt_to_phys()
Quoted 16 lines · Ingo Molnar
Quoted 3 lines · Ingo Molnar
I've applied them to tip:WIP.core/headers as a work-in-progress tree, and I'm testing them on randconfigs to make sure there's no broken dependencies. I'll wait for the ACPI acks.
One more fix was needed, for the intel-quark driver that is only built on 32-bit configs:
=========>
From: Ingo Molnar <[email protected]>
Date: Tue, 19 Nov 2019 12:51:56 +0100
Subject: [PATCH] x86/platform/intel/quark: Explicitly includelinux/io.hforvirt_to_phys()
Quoted 9 lines
Similarly to the previous patches by Sean Christopherson:
"Through a labyrinthian sequence of includes, usage of
virt_to_phys()is
dependent on the include ofasm/io.hin x86'sasm/realmode.h, which is included in x86'sasm/acpi.hand thus bylinux/acpi.h. Explicitly includelinux/io.hto break the dependency onrealmode.hso that a future patch can remove therealmode.hinclude fromacpi.hwithout breaking the build."
LGTM,
Quoted 17 lines
Cc Sean Christopherson <[email protected]>Cc Borislav Petkov <[email protected]>Cc Linus Torvalds <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Signed-off-by Ingo Molnar <[email protected]>--- arch/x86/platform/intel-quark/imr.c | 2 ++ arch/x86/platform/intel-quark/imr_selftest.c | 2 ++ 2 files changed, 4 insertions(+)arch/x86/platform/intel-quark/imr.c +0
-0
arch/x86/platform/intel-quark/imr.c line 32
Quoted 4 lines
arch/x86/platform/intel-quark/imr.c +1
-0@@ -29,6 +29,8 @@#include <asm/cpu_device_id.h> #include <asm/imr.h> #include <asm/iosf_mbi.h> +#include <asm/io.h>
A nit: perhaps put it after imr.h.
Quoted 18 lines
arch/x86/platform/intel-quark/imr.c +1
-0+#include <linux/debugfs.h> #include <linux/init.h> #include <linux/mm.h> arch/x86/platform/intel-quark/imr_selftest.c +2
-0@@ -14,6 +14,8 @@#include <asm-generic/sections.h> #include <asm/cpu_device_id.h> #include <asm/imr.h> +#include <asm/io.h> +#include <linux/init.h> #include <linux/mm.h> #include <linux/types.h>
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 51 lines · Ingo Molnar
Quoted 20 lines · Sean Christopherson
x86's
asm/realmode.h, which defines low level structures, variables and helpers used to bring up APs during SMP boot, ends up getting included in practically every nook and cranny of the kernel because the address used by ACPI for resuming from S3 also happens to be stored in the real mode header, and ACPI bleeds the dependency into its widely included headers.As a result, modifying
realmode.hfor even the most trivial change to the boot code triggers a full kernel rebuild, which is frustrating to say the least as it some of the most difficult code to get exactly right *and* is also some of the most functionally isolated code in the kernel.To break the kernel's widespread dependency on
realmode.h, add a wrapper in the aforementioned ACPI S3 code to access the real mode header instead of derefencing the header directly inasm/acpi.hand thereby exposing it to the world vialinux/acpi.h.Build tested on x86 with allyesconfig and allmodconfig, so hopefully there aren't more build issues lurking, but at this point it wouldn't surprise me in the least if this somehow manages to break the build.
Quoted 7 lines
Based on tip/master, commit
ceceaf1f12ba("Merge branch 'WIP.x86/cleanups'").Patch Synopsis:
- Patches 01-09 fix a variety of build errors that arise when patch 12 dropsrealmode.hfromasm/acpi.h. Most of the errors are quite absurb as they have no relation whatsoever to x86's RM boot code, but occur becauserealmode.hhappens to includeasm/io.h.Yeah, these kind of parasitic header dependencies are the main driving force behind kernel header spaghetti hell: it's super easy to add a new header, but very hard to remove them...
Hence they practically only accumulate.
As a result header removal patches get priority, from me at least. :-)
Quoted 3 lines
- Patch 10 removes a spurious include of
realmode.hfrom an ACPI header.- Patches 11 and 12 implement the wrapper and move it out of
acpi.h.So if the ACPI maintainers are fine with -tip carrying patches #11 and #12 then I'd be glad to route these patches upstream.
I've applied them to tip:WIP.core/headers as a work-in-progress tree, and I'm testing them on randconfigs to make sure there's no broken dependencies. I'll wait for the ACPI acks.
Quoted 6 lines
I edited the title of patch 12 slightly, to:
c8bceb321209: x86/ACPI/sleep: Moveacpi_wakeup_address()definition intosleep.c, remove <asm/realmode.h> from <asm/acpi.h>to make sure the big header dependency change is obvious at first sight.
I'm fine with the patches but can we drop the fixes headers please? This doesn't actually fix anything, and touching early boot stuff for no good reason should be avoided imo.
Quoted 54 lines · Ard Biesheuvel
Quoted 53 lines · Ingo Molnar
Quoted 20 lines · Sean Christopherson
x86's
asm/realmode.h, which defines low level structures, variables and helpers used to bring up APs during SMP boot, ends up getting included in practically every nook and cranny of the kernel because the address used by ACPI for resuming from S3 also happens to be stored in the real mode header, and ACPI bleeds the dependency into its widely included headers.As a result, modifying
realmode.hfor even the most trivial change to the boot code triggers a full kernel rebuild, which is frustrating to say the least as it some of the most difficult code to get exactly right *and* is also some of the most functionally isolated code in the kernel.To break the kernel's widespread dependency on
realmode.h, add a wrapper in the aforementioned ACPI S3 code to access the real mode header instead of derefencing the header directly inasm/acpi.hand thereby exposing it to the world vialinux/acpi.h.Build tested on x86 with allyesconfig and allmodconfig, so hopefully there aren't more build issues lurking, but at this point it wouldn't surprise me in the least if this somehow manages to break the build.
Quoted 7 lines
Based on tip/master, commit
ceceaf1f12ba("Merge branch 'WIP.x86/cleanups'").Patch Synopsis:
- Patches 01-09 fix a variety of build errors that arise when patch 12 dropsrealmode.hfromasm/acpi.h. Most of the errors are quite absurb as they have no relation whatsoever to x86's RM boot code, but occur becauserealmode.hhappens to includeasm/io.h.Yeah, these kind of parasitic header dependencies are the main driving force behind kernel header spaghetti hell: it's super easy to add a new header, but very hard to remove them...
Hence they practically only accumulate.
As a result header removal patches get priority, from me at least. :-)
Quoted 3 lines
- Patch 10 removes a spurious include of
realmode.hfrom an ACPI header.- Patches 11 and 12 implement the wrapper and move it out of
acpi.h.So if the ACPI maintainers are fine with -tip carrying patches #11 and #12 then I'd be glad to route these patches upstream.
I've applied them to tip:WIP.core/headers as a work-in-progress tree, and I'm testing them on randconfigs to make sure there's no broken dependencies. I'll wait for the ACPI acks.
I edited the title of patch 12 slightly, to:
Quoted 8 lines
Quoted 4 lines
c8bceb321209: x86/ACPI/sleep: Moveacpi_wakeup_address()definition intosleep.c, remove <asm/realmode.h> from <asm/acpi.h>to make sure the big header dependency change is obvious at first sight.
I'm fine with the patches but can we drop the fixes headers please? This doesn't actually fix anything, and touching early boot stuff for no good reason should be avoided imo.
Agreed and done.
Thanks,
Ingo
Quoted 60 lines · Ingo Molnar
Quoted 56 lines · Ard Biesheuvel
Quoted 55 lines · Ingo Molnar
Quoted 20 lines · Sean Christopherson
x86's
asm/realmode.h, which defines low level structures, variables and helpers used to bring up APs during SMP boot, ends up getting included in practically every nook and cranny of the kernel because the address used by ACPI for resuming from S3 also happens to be stored in the real mode header, and ACPI bleeds the dependency into its widely included headers.As a result, modifying
realmode.hfor even the most trivial change to the boot code triggers a full kernel rebuild, which is frustrating to say the least as it some of the most difficult code to get exactly right *and* is also some of the most functionally isolated code in the kernel.To break the kernel's widespread dependency on
realmode.h, add a wrapper in the aforementioned ACPI S3 code to access the real mode header instead of derefencing the header directly inasm/acpi.hand thereby exposing it to the world vialinux/acpi.h.Build tested on x86 with allyesconfig and allmodconfig, so hopefully there aren't more build issues lurking, but at this point it wouldn't surprise me in the least if this somehow manages to break the build.
Quoted 7 lines
Based on tip/master, commit
ceceaf1f12ba("Merge branch 'WIP.x86/cleanups'").Patch Synopsis:
- Patches 01-09 fix a variety of build errors that arise when patch 12 dropsrealmode.hfromasm/acpi.h. Most of the errors are quite absurb as they have no relation whatsoever to x86's RM boot code, but occur becauserealmode.hhappens to includeasm/io.h.Yeah, these kind of parasitic header dependencies are the main driving force behind kernel header spaghetti hell: it's super easy to add a new header, but very hard to remove them...
Hence they practically only accumulate.
As a result header removal patches get priority, from me at least. :-)
Quoted 3 lines
- Patch 10 removes a spurious include of
realmode.hfrom an ACPI header.- Patches 11 and 12 implement the wrapper and move it out of
acpi.h.So if the ACPI maintainers are fine with -tip carrying patches #11 and #12 then I'd be glad to route these patches upstream.
I've applied them to tip:WIP.core/headers as a work-in-progress tree, and I'm testing them on randconfigs to make sure there's no broken dependencies. I'll wait for the ACPI acks.
I edited the title of patch 12 slightly, to:
c8bceb321209: x86/ACPI/sleep: Moveacpi_wakeup_address()definition intosleep.c, remove <asm/realmode.h> from <asm/acpi.h>
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
to make sure the big header dependency change is obvious at first sight.
I'm fine with the patches but can we drop the fixes headers please? This doesn't actually fix anything, and touching early boot stuff for no good reason should be avoided imo.
Agreed and done.
Thanks Ingo