2021-07-14 12:52:25

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH v4 06/10] riscv: Remove non-standard linux,elfcorehdr handling

RISC-V uses platform-specific code to locate the elf core header in
memory. However, this does not conform to the standard
"linux,elfcorehdr" DT bindings, as it relies on a reserved memory node
with the "linux,elfcorehdr" compatible value, instead of on a
"linux,elfcorehdr" property under the "/chosen" node.

The non-compliant code can just be removed, as the standard behavior is
already implemented by platform-agnostic handling in the FDT core code.

Fixes: 5640975003d0234d ("RISC-V: Add crash kernel support")
Signed-off-by: Geert Uytterhoeven <[email protected]>
---
v4:
- No changes.
---
arch/riscv/mm/init.c | 20 --------------------
1 file changed, 20 deletions(-)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 269fc648ef3d84b2..4aa4b6a034086df6 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -829,26 +829,6 @@ static void __init reserve_crashkernel(void)
}
#endif /* CONFIG_KEXEC_CORE */

-#ifdef CONFIG_CRASH_DUMP
-/*
- * We keep track of the ELF core header of the crashed
- * kernel with a reserved-memory region with compatible
- * string "linux,elfcorehdr". Here we register a callback
- * to populate elfcorehdr_addr/size when this region is
- * present. Note that this region will be marked as
- * reserved once we call early_init_fdt_scan_reserved_mem()
- * later on.
- */
-static int __init elfcore_hdr_setup(struct reserved_mem *rmem)
-{
- elfcorehdr_addr = rmem->base;
- elfcorehdr_size = rmem->size;
- return 0;
-}
-
-RESERVEDMEM_OF_DECLARE(elfcorehdr, "linux,elfcorehdr", elfcore_hdr_setup);
-#endif
-
void __init paging_init(void)
{
setup_bootmem();
--
2.25.1


2021-07-20 15:58:23

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH v4 06/10] riscv: Remove non-standard linux,elfcorehdr handling

On Wed, 14 Jul 2021 05:50:16 PDT (-0700), [email protected] wrote:
> RISC-V uses platform-specific code to locate the elf core header in
> memory. However, this does not conform to the standard
> "linux,elfcorehdr" DT bindings, as it relies on a reserved memory node
> with the "linux,elfcorehdr" compatible value, instead of on a
> "linux,elfcorehdr" property under the "/chosen" node.
>
> The non-compliant code can just be removed, as the standard behavior is
> already implemented by platform-agnostic handling in the FDT core code.
>
> Fixes: 5640975003d0234d ("RISC-V: Add crash kernel support")
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> v4:
> - No changes.
> ---
> arch/riscv/mm/init.c | 20 --------------------
> 1 file changed, 20 deletions(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 269fc648ef3d84b2..4aa4b6a034086df6 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -829,26 +829,6 @@ static void __init reserve_crashkernel(void)
> }
> #endif /* CONFIG_KEXEC_CORE */
>
> -#ifdef CONFIG_CRASH_DUMP
> -/*
> - * We keep track of the ELF core header of the crashed
> - * kernel with a reserved-memory region with compatible
> - * string "linux,elfcorehdr". Here we register a callback
> - * to populate elfcorehdr_addr/size when this region is
> - * present. Note that this region will be marked as
> - * reserved once we call early_init_fdt_scan_reserved_mem()
> - * later on.
> - */
> -static int __init elfcore_hdr_setup(struct reserved_mem *rmem)
> -{
> - elfcorehdr_addr = rmem->base;
> - elfcorehdr_size = rmem->size;
> - return 0;
> -}
> -
> -RESERVEDMEM_OF_DECLARE(elfcorehdr, "linux,elfcorehdr", elfcore_hdr_setup);
> -#endif
> -
> void __init paging_init(void)
> {
> setup_bootmem();

Reviewed-by: Palmer Dabbelt <[email protected]>
Acked-by: Palmer Dabbelt <[email protected]>

LMK if you wanted me to take this series, otherwise I'm going to assume
it's going in via some other tree.

2021-07-23 15:38:37

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH v4 06/10] riscv: Remove non-standard linux,elfcorehdr handling

Hi Palmer,

On Tue, Jul 20, 2021 at 5:43 PM Palmer Dabbelt <[email protected]> wrote:
> On Wed, 14 Jul 2021 05:50:16 PDT (-0700), [email protected] wrote:
> > RISC-V uses platform-specific code to locate the elf core header in
> > memory. However, this does not conform to the standard
> > "linux,elfcorehdr" DT bindings, as it relies on a reserved memory node
> > with the "linux,elfcorehdr" compatible value, instead of on a
> > "linux,elfcorehdr" property under the "/chosen" node.
> >
> > The non-compliant code can just be removed, as the standard behavior is
> > already implemented by platform-agnostic handling in the FDT core code.
> >
> > Fixes: 5640975003d0234d ("RISC-V: Add crash kernel support")
> > Signed-off-by: Geert Uytterhoeven <[email protected]>
> > ---
> > v4:
> > - No changes.
> > ---
> > arch/riscv/mm/init.c | 20 --------------------
> > 1 file changed, 20 deletions(-)
> >
> > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> > index 269fc648ef3d84b2..4aa4b6a034086df6 100644
> > --- a/arch/riscv/mm/init.c
> > +++ b/arch/riscv/mm/init.c
> > @@ -829,26 +829,6 @@ static void __init reserve_crashkernel(void)
> > }
> > #endif /* CONFIG_KEXEC_CORE */
> >
> > -#ifdef CONFIG_CRASH_DUMP
> > -/*
> > - * We keep track of the ELF core header of the crashed
> > - * kernel with a reserved-memory region with compatible
> > - * string "linux,elfcorehdr". Here we register a callback
> > - * to populate elfcorehdr_addr/size when this region is
> > - * present. Note that this region will be marked as
> > - * reserved once we call early_init_fdt_scan_reserved_mem()
> > - * later on.
> > - */
> > -static int __init elfcore_hdr_setup(struct reserved_mem *rmem)
> > -{
> > - elfcorehdr_addr = rmem->base;
> > - elfcorehdr_size = rmem->size;
> > - return 0;
> > -}
> > -
> > -RESERVEDMEM_OF_DECLARE(elfcorehdr, "linux,elfcorehdr", elfcore_hdr_setup);
> > -#endif
> > -
> > void __init paging_init(void)
> > {
> > setup_bootmem();
>
> Reviewed-by: Palmer Dabbelt <[email protected]>
> Acked-by: Palmer Dabbelt <[email protected]>
>
> LMK if you wanted me to take this series, otherwise I'm going to assume
> it's going in via some other tree.

There will be a v5 of the series in response to the review comments.
But I think this patch can already be applied.

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds