From: Ingo Molnar <mingo@kernel.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: James Le Cuirot <chewi@gentoo.org>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [PATCH] x86: fix oops caused by old EFI info on kexec boot
Date: Sat, 6 Dec 2025 12:45:29 +0100 [thread overview]
Message-ID: <aTQXWdVdxG6CgQoD@gmail.com> (raw)
In-Reply-To: <05db807e-887a-4502-8de1-ec9910f66b60@zytor.com>
* H. Peter Anvin <hpa@zytor.com> wrote:
> --- a/arch/x86/include/uapi/asm/bootparam.h
> +++ b/arch/x86/include/uapi/asm/bootparam.h
> @@ -26,6 +26,28 @@
> #define XLF_5LEVEL_ENABLED (1<<6)
> #define XLF_MEM_ENCRYPTION (1<<7)
>
> +/* bootloader ID */
> +#define BOOTLOADER_LILO 0x00
> +#define BOOTLOADER_LOADLIN 0x01
> +/* 0x02 used by kernel internal boot sector - long since obsolete */
> +#define BOOTLOADER_SYSLINUX 0x03
> +#define BOOTLOADER_IPXE 0x04
> +#define BOOTLOADER_ELILO 0x05
> +/* 0x06 unknown user */
> +#define BOOTLOADER_GRUB 0x07
> +#define BOOTLOADER_UBOOT 0x08
> +#define BOOTLOADER_XEN 0x09
> +#define BOOTLOADER_GUJIN 0x0a
> +#define BOOTLOADER_QEMU 0x0b
> +#define BOOTLOADER_ARCTURUS 0x0c /* "Arcturus Networks uCbootloader" */
> +#define BOOTLOADER_KEXEC_TOOLS 0x0d
> +#define BOOTLOADER_EXTENDED_ID 0x0e /* Escape into the 0x10+ space */
> +#define BOOTLOADER_MISSING_ID 0x0f /* Bootloader unknown */
> +#define BOOTLOADER_EXTID_BASE 0x10 /* Error: ext_loader_type never set */
> +#define BOOTLOADER_MINIMAL 0x11 /* "Minimal Linux Bootloader" */
> +#define BOOTLOADER_OVMF 0x12
> +#define BOOTLOADER_BAREBOX 0x13
> +
> #ifndef __ASSEMBLER__
>
> #include <linux/types.h>
> @@ -162,6 +184,28 @@ struct boot_params {
> __u8 _pad9[276]; /* 0xeec */
> } __attribute__((packed));
>
> +static inline unsigned int boot_loader_type(const struct boot_params *_bp)
> +{
> + unsigned int _type = _bp->type_of_loader >> 4;
> + if (_type == BOOTLOADER_EXTENDED_ID)
> + _type = _bp->ext_loader_type + BOOTLOADER_EXTID_BASE
> + return _type;
> +}
> +static inline unsigned int boot_loader_ver(const struct boot_params *_bp)
> +{
> + return (_bp->type_of_loader & 0x0f) + (_bp->ext_loader_ver << 4);
> +}
> +static inline void set_boot_loader(struct boot_params *_bp,
> + unsigned int _type, unsigned int _ver)
> +{
> + if (_type >= BOOTLOADER_EXTID_BASE) {
> + _bp->ext_loader_type = _type - BOOTLOADER_EXTID_BASE;
> + _type = BOOTLOADER_EXTENDED_ID;
> + }
> + _bp->ext_loader_ver = _ver >> 4;
> + _bp->type_of_loader = _type + (_ver & 0x0f);
> +}
Ack, with a s/_bp/bp, s/_type/type and s/_ver/ver side note, as this
isn't a macro and thus there's no need to obfuscate the inline
function's parameter name to avoid unintended shadowing?
Thanks,
Ingo
next prev parent reply other threads:[~2025-12-06 11:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 17:32 [PATCH] x86: fix oops caused by old EFI info on kexec boot James Le Cuirot
2025-12-03 18:12 ` Ingo Molnar
2025-12-03 20:59 ` H. Peter Anvin
2025-12-03 21:27 ` H. Peter Anvin
2025-12-06 11:45 ` Ingo Molnar [this message]
2025-12-03 22:57 ` Ard Biesheuvel
2025-12-03 23:01 ` Ard Biesheuvel
2025-12-04 21:40 ` James Le Cuirot
2025-12-04 23:18 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aTQXWdVdxG6CgQoD@gmail.com \
--to=mingo@kernel.org \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=chewi@gentoo.org \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox