[PATCH v3] x86/setup: do not include kexec_handover.h from asm/setup.h

Borislav Petkov bp at alien8.de
Mon Jul 6 19:18:32 PDT 2026


On Mon, Jul 06, 2026 at 05:37:49PM +0200, Pratyush Yadav wrote:
> From: "Pratyush Yadav (Google)" <pratyush at kernel.org>
> 
> 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 at kernel.org>
> ---
> 
> 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

Acked-by: Borislav Petkov (AMD) <bp at alien8.de>

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette



More information about the kexec mailing list