x86/setup: do not include kexec_handover.h from asm/setup.h

x86 asm/setup.h includes linux/kexec_handover.h. This is because it is
used by setup.c and kaslr.c. But this inclusion is problematic. The
header is included in many places, so it results in the KHO header being
propagated there. Also, the setup header is used by realmode code. If
KHO header includes things like mm.h, it causes a big dump of
compilation failures.

Nothing in setup.h uses anything from KHO. Remove the header from
setup.h, and directly include it in setup.c. which does use things from
KHO. Since kaslr.c is a part of the decompressor, avoid including linux
headers there directly. Instead, split out struct kho_scratch, which is
the only thing the kaslr.c uses, and move it to
include/asm-generic/kexec_handover.h.

This should also help reduce files recompiled when kexec_handover.h
changes.

Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260706153751.1166003-1-pratyush@kernel.org
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
This commit is contained in:
Pratyush Yadav (Google)
2026-07-06 17:37:49 +02:00
committed by Mike Rapoport (Microsoft)
parent dc59e4fea9
commit 08412b8c70
7 changed files with 18 additions and 7 deletions

View File

@@ -14334,6 +14334,7 @@ S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git
F: Documentation/admin-guide/mm/kho.rst
F: Documentation/core-api/kho/*
F: include/asm-generic/kexec_handover.h
F: include/linux/kexec_handover.h
F: include/linux/kho/
F: include/linux/kho_block.h

View File

@@ -32,6 +32,8 @@
#include <asm/setup.h> /* For COMMAND_LINE_SIZE */
#undef _SETUP
#include <asm/kexec_handover.h>
extern unsigned long get_cmd_line_ptr(void);
/* Simplified build-specific string for starting entropy. */

View File

@@ -15,3 +15,4 @@ generic-y += fprobe.h
generic-y += mcs_spinlock.h
generic-y += mmzone.h
generic-y += ring_buffer.h
generic-y += kexec_handover.h

View File

@@ -69,8 +69,6 @@ extern void x86_ce4100_early_setup(void);
static inline void x86_ce4100_early_setup(void) { }
#endif
#include <linux/kexec_handover.h>
#ifndef _SETUP
#include <asm/espfix.h>

View File

@@ -16,6 +16,7 @@
#include <linux/init_ohci1394_dma.h>
#include <linux/initrd.h>
#include <linux/iscsi_ibft.h>
#include <linux/kexec_handover.h>
#include <linux/memblock.h>
#include <linux/panic_notifier.h>
#include <linux/pci.h>

View File

@@ -0,0 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_GENERIC_KEXEC_HANDOVER_H
#define __ASM_GENERIC_KEXEC_HANDOVER_H
#include <linux/types.h>
struct kho_scratch {
phys_addr_t addr;
phys_addr_t size;
};
#endif /* __ASM_GENERIC_KEXEC_HANDOVER_H */

View File

@@ -5,11 +5,7 @@
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/types.h>
struct kho_scratch {
phys_addr_t addr;
phys_addr_t size;
};
#include <asm-generic/kexec_handover.h>
struct kho_vmalloc;