From: Ingo Molnar <mingo@kernel.org>
To: Mike Rapoport <rppt@kernel.org>
Cc: x86@kernel.org, Andy Lutomirski <luto@kernel.org>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Ning Sun <ning.sun@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, tboot-devel@lists.sourceforge.net
Subject: Re: [PATCH 3/4] x86/boot: split parsing of boot_params into a helper function
Date: Thu, 5 Dec 2024 14:31:42 +0100 [thread overview]
Message-ID: <Z1GrPjyFQvhHYIIm@gmail.com> (raw)
In-Reply-To: <20241203112525.591496-4-rppt@kernel.org>
* Mike Rapoport <rppt@kernel.org> wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
>
> Makes setup_arch a bit easier to comprehend.
>
> No functional changes.
>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> arch/x86/kernel/setup.c | 72 +++++++++++++++++++++++------------------
> 1 file changed, 41 insertions(+), 31 deletions(-)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index d299fe5bda25..d4bb9a2e8f15 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -426,6 +426,42 @@ static void __init parse_setup_data(void)
> }
> }
>
> +static void __init parse_boot_params(void)
> +{
> + ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
> + screen_info = boot_params.screen_info;
> + edid_info = boot_params.edid_info;
> +#ifdef CONFIG_X86_32
> + apm_info.bios = boot_params.apm_bios_info;
> + ist_info = boot_params.ist_info;
> +#endif
> + saved_video_mode = boot_params.hdr.vid_mode;
> + bootloader_type = boot_params.hdr.type_of_loader;
> + if ((bootloader_type >> 4) == 0xe) {
> + bootloader_type &= 0xf;
> + bootloader_type |= (boot_params.hdr.ext_loader_type+0x10) << 4;
> + }
> + bootloader_version = bootloader_type & 0xf;
> + bootloader_version |= boot_params.hdr.ext_loader_ver << 4;
> +
> +#ifdef CONFIG_BLK_DEV_RAM
> + rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
> +#endif
> +#ifdef CONFIG_EFI
> + if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
> + EFI32_LOADER_SIGNATURE, 4)) {
> + set_bit(EFI_BOOT, &efi.flags);
> + } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
> + EFI64_LOADER_SIGNATURE, 4)) {
> + set_bit(EFI_BOOT, &efi.flags);
> + set_bit(EFI_64BIT, &efi.flags);
> + }
> +#endif
> +
> + if (!boot_params.hdr.root_flags)
> + root_mountflags &= ~MS_RDONLY;
> +}
> +
> static void __init memblock_x86_reserve_range_setup_data(void)
> {
> struct setup_indirect *indirect;
> @@ -803,35 +839,11 @@ void __init setup_arch(char **cmdline_p)
>
> setup_olpc_ofw_pgd();
>
> - ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
> - screen_info = boot_params.screen_info;
> - edid_info = boot_params.edid_info;
> -#ifdef CONFIG_X86_32
> - apm_info.bios = boot_params.apm_bios_info;
> - ist_info = boot_params.ist_info;
> -#endif
> - saved_video_mode = boot_params.hdr.vid_mode;
> - bootloader_type = boot_params.hdr.type_of_loader;
> - if ((bootloader_type >> 4) == 0xe) {
> - bootloader_type &= 0xf;
> - bootloader_type |= (boot_params.hdr.ext_loader_type+0x10) << 4;
> - }
> - bootloader_version = bootloader_type & 0xf;
> - bootloader_version |= boot_params.hdr.ext_loader_ver << 4;
> -
> -#ifdef CONFIG_BLK_DEV_RAM
> - rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
> -#endif
> -#ifdef CONFIG_EFI
> - if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
> - EFI32_LOADER_SIGNATURE, 4)) {
> - set_bit(EFI_BOOT, &efi.flags);
> - } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
> - EFI64_LOADER_SIGNATURE, 4)) {
> - set_bit(EFI_BOOT, &efi.flags);
> - set_bit(EFI_64BIT, &efi.flags);
> - }
> -#endif
> + /*
> + * Translate the fields of struct boot_param into global variables
s/struct boot_param
/'struct boot_param'
> + * represting these parameters.
Typo...
> + */
> + parse_boot_params();
Also, why not move this explanatory comment to the definition of the new
helper function?
Thanks,
Ingo
next prev parent reply other threads:[~2024-12-05 13:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 11:25 [PATCH 0/4] x86/boot: a few cleanups Mike Rapoport
2024-12-03 11:25 ` [PATCH 1/4] x86/boot: move setting of memblock parameters to e820__memblock_setup() Mike Rapoport
2024-12-03 11:25 ` [PATCH 2/4] x86/boot: split kernel resources setup into a helper function Mike Rapoport
2024-12-05 13:32 ` Ingo Molnar
2024-12-03 11:25 ` [PATCH 3/4] x86/boot: split parsing of boot_params " Mike Rapoport
2024-12-05 13:31 ` Ingo Molnar [this message]
2024-12-03 11:25 ` [PATCH 4/4] x86/e820: drop E820_TYPE_RESERVED_KERN and related code Mike Rapoport
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=Z1GrPjyFQvhHYIIm@gmail.com \
--to=mingo@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=ning.sun@intel.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=tboot-devel@lists.sourceforge.net \
--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