Re: [v3][PATCH 3/8] book3e/kexec/kdump: enable kexec for kernel

From: Scott Wood
Date: Tue Dec 17 2013 - 22:35:33 EST


On Tue, 2013-07-09 at 16:03 +0800, Tiejun Chen wrote:
> We need to active KEXEC for book3e and bypass or convert non-book3e stuff
> in kexec coverage.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxxxxxx>
> ---
> arch/powerpc/Kconfig | 2 +-
> arch/powerpc/kernel/machine_kexec_64.c | 148 ++++++++++++++++++--------------
> arch/powerpc/kernel/misc_64.S | 6 ++
> 3 files changed, 89 insertions(+), 67 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 5374776..d945435 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -357,7 +357,7 @@ config ARCH_ENABLE_MEMORY_HOTREMOVE
>
> config KEXEC
> bool "kexec system call"
> - depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP))
> + depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) || PPC_BOOK3E

Please remove the outher parentheses, and especially don't put
PPC_BOOK3E on the outside of them when there's no reason to group the
other items together.

> @@ -367,6 +301,87 @@ void default_machine_kexec(struct kimage *image)
> /* NOTREACHED */
> }
>
> +#ifdef CONFIG_PPC_BOOK3E
> +int default_machine_kexec_prepare(struct kimage *image)
> +{
> + int i;
> + /*
> + * Since we use the kernel fault handlers and paging code to
> + * handle the virtual mode, we must make sure no destination
> + * overlaps kernel static data or bss.
> + */
> + for (i = 0; i < image->nr_segments; i++)
> + if (image->segment[i].mem < __pa(_end))
> + return -ETXTBSY;
> + return 0;

Factor out this common code rather than duplicate it.

-Scott


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/