Re: [PATCH 2/4] x86/boot: split kernel resources setup into a helper function
From: Ingo Molnar
Date: Thu Dec 05 2024 - 08:35:22 EST
* Mike Rapoport <rppt@xxxxxxxxxx> wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>
>
> Makes setup_arch a bit easier to comprehend.
>
> No functional changes.
>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> ---
> arch/x86/kernel/setup.c | 36 ++++++++++++++++++++++--------------
> 1 file changed, 22 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 2383e73fc140..d299fe5bda25 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -524,6 +524,23 @@ void __init reserve_standard_io_resources(void)
>
> }
>
> +static void __init setup_kernel_resources(void)
> +{
> + code_resource.start = __pa_symbol(_text);
> + code_resource.end = __pa_symbol(_etext)-1;
> + rodata_resource.start = __pa_symbol(__start_rodata);
> + rodata_resource.end = __pa_symbol(__end_rodata)-1;
> + data_resource.start = __pa_symbol(_sdata);
> + data_resource.end = __pa_symbol(_edata)-1;
> + bss_resource.start = __pa_symbol(__bss_start);
> + bss_resource.end = __pa_symbol(__bss_stop)-1;
> +
> + insert_resource(&iomem_resource, &code_resource);
> + insert_resource(&iomem_resource, &rodata_resource);
> + insert_resource(&iomem_resource, &data_resource);
> + insert_resource(&iomem_resource, &bss_resource);
> +}
> +
> static bool __init snb_gfx_workaround_needed(void)
> {
> #ifdef CONFIG_PCI
> @@ -842,15 +859,6 @@ void __init setup_arch(char **cmdline_p)
> root_mountflags &= ~MS_RDONLY;
> setup_initial_init_mm(_text, _etext, _edata, (void *)_brk_end);
>
> - code_resource.start = __pa_symbol(_text);
> - code_resource.end = __pa_symbol(_etext)-1;
> - rodata_resource.start = __pa_symbol(__start_rodata);
> - rodata_resource.end = __pa_symbol(__end_rodata)-1;
> - data_resource.start = __pa_symbol(_sdata);
> - data_resource.end = __pa_symbol(_edata)-1;
> - bss_resource.start = __pa_symbol(__bss_start);
> - bss_resource.end = __pa_symbol(__bss_stop)-1;
> -
> /*
> * x86_configure_nx() is called before parse_early_param() to detect
> * whether hardware doesn't support NX (so that the early EHCI debug
> @@ -894,11 +902,11 @@ void __init setup_arch(char **cmdline_p)
> tsc_early_init();
> x86_init.resources.probe_roms();
>
> - /* after parse_early_param, so could debug it */
> - insert_resource(&iomem_resource, &code_resource);
> - insert_resource(&iomem_resource, &rodata_resource);
> - insert_resource(&iomem_resource, &data_resource);
> - insert_resource(&iomem_resource, &bss_resource);
> + /*
> + * Add resources for kernel text and data to the iomem_resource
Missing full stop.
> + * Do it eafter parse_early_param, so could debug it
Typo...
Also, this sentence isn't proper English AFAICS.
Please do not submit write-only comments...
Thanks,
Ingo