From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02625416110 for ; Mon, 6 Jul 2026 15:38:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783352286; cv=none; b=E9dcCqGxDbInBXGujnyEhEq/jtf6zyUs0Bko7nZpNYiGLHg0WnqAYWKgnbXFPJ75pwpeCibVHCQf2r5pbbhBpm2fnJmOTFXTBEs8S91ZoLsZFX+ydkfwiO8yJSATJgeJGWdsgPaRVEhghM7fJyd1ei3JQuoVYP2naE8gDANnhi4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783352286; c=relaxed/simple; bh=FHWimrONgenWFwz/eX0ZadbkQJLxpVx0p7yGQ6AcNOE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XNHXwrFbZgjQh/HDN7DOsiNOEvIwd8LviXddWbQhhAywjwj8w1REcmm7vjCVplIwGQ29h3EyaG1Ux7E5eC6RC6Urs7z5GgfSoZOsdQw4qsC5Plon5pL5jL9CDMqZCkKmRyVESS969G/l9kwYXG5tMHB79WOR/ho8hIcX5KRdrIs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g3vcBRGS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g3vcBRGS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A70121F000E9; Mon, 6 Jul 2026 15:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783352284; bh=YQ9Hvr15QYl19jYxj1XsZwlcckoCKeNx5qunpqWNxow=; h=From:To:Cc:Subject:Date; b=g3vcBRGSqUKuPD4I67beXNUHw1GYuxDim0yfH/UBLE/EAVBC7JrgR3tlezmCyWX86 iAU6ta4/p9kpNNSAAwTT8QTqr40ZVdUJBkidqTloae8V4oWTkegRptfgyPs1jn3D5S BVmvkc2oaGNUqFtA2TI7kjwvV5tQ5setmDS98z9UON8P0+RnurRYVjiDEwpF5jtU8o 503SdCYVr2fBvN+xxsKzZt1NexU7P4mSe3BTmPuoU0rD7q3gKXs7UAQyyn783ii1tB WnJ9hlnxaPIdFoHyMIUJExn49tAF6tLqwJbGl+yEOKE86bhnVP/b+0+bxaRPVMRHOX vxKXSddkevR8g== From: Pratyush Yadav To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Pasha Tatashin , Mike Rapoport , Pratyush Yadav Cc: linux-kernel@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org Subject: [PATCH v3] x86/setup: do not include kexec_handover.h from asm/setup.h Date: Mon, 6 Jul 2026 17:37:49 +0200 Message-ID: <20260706153751.1166003-1-pratyush@kernel.org> X-Mailer: git-send-email 2.55.0.rc2.803.g1fd1e6609c-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Pratyush Yadav (Google)" 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) --- Notes: Thomas/Ingo/Borislav/Dave, is it okay if we take this patch through the live update tree? I have a patch series for KHO that depends on this, but it is 20 odd patches and I don't want to spam the x86 list with them. So I am sending this change out separately. It is an improvement on its own anyway since it reduces recompilation on kexec_handover.h changes. All the changed files see relatively low patch traffic so chances of conflicts should minimal I think. And if there are any, I imagine they will be relatively simple to resolve. Changes in v3: - Fix changelog nitpicks. - Add kexec_handover.h to generic-y and use asm/kexec_handover.h in kaslr.c Changes in v2: - Do not include linux/kexec_handover.h in kaslr.c. Instead, split out struct kho_scratch, which is the only thing kaslr uses. Move it to its own header in include/asm-generic/kexec_handover.h MAINTAINERS | 1 + arch/x86/boot/compressed/kaslr.c | 2 ++ arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/setup.h | 2 -- arch/x86/kernel/setup.c | 1 + include/asm-generic/kexec_handover.h | 12 ++++++++++++ include/linux/kexec_handover.h | 6 +----- 7 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 include/asm-generic/kexec_handover.h diff --git a/MAINTAINERS b/MAINTAINERS index 15011f5752a9..a3ed337e827d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -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 diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 8e4bf5365ac6..22267a83e064 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -32,6 +32,8 @@ #include /* For COMMAND_LINE_SIZE */ #undef _SETUP +#include + extern unsigned long get_cmd_line_ptr(void); /* Simplified build-specific string for starting entropy. */ diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild index 078fd2c0d69d..47ef8cb482e3 100644 --- a/arch/x86/include/asm/Kbuild +++ b/arch/x86/include/asm/Kbuild @@ -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 diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h index 914eb32581c7..895d09faaf83 100644 --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h @@ -69,8 +69,6 @@ extern void x86_ce4100_early_setup(void); static inline void x86_ce4100_early_setup(void) { } #endif -#include - #ifndef _SETUP #include diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 46882ce79c3a..5ebb521e136d 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/include/asm-generic/kexec_handover.h b/include/asm-generic/kexec_handover.h new file mode 100644 index 000000000000..50839fb5ee8e --- /dev/null +++ b/include/asm-generic/kexec_handover.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_GENERIC_KEXEC_HANDOVER_H +#define __ASM_GENERIC_KEXEC_HANDOVER_H + +#include + +struct kho_scratch { + phys_addr_t addr; + phys_addr_t size; +}; + +#endif /* __ASM_GENERIC_KEXEC_HANDOVER_H */ diff --git a/include/linux/kexec_handover.h b/include/linux/kexec_handover.h index 8968c56d2d73..48a9793c2b76 100644 --- a/include/linux/kexec_handover.h +++ b/include/linux/kexec_handover.h @@ -5,11 +5,7 @@ #include #include #include - -struct kho_scratch { - phys_addr_t addr; - phys_addr_t size; -}; +#include struct kho_vmalloc; -- 2.55.0.rc2.803.g1fd1e6609c-goog