linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Dufour <ldufour@linux.ibm.com>
To: Sourabh Jain <sourabhjain@linux.ibm.com>,
	linuxppc-dev@ozlabs.org, mpe@ellerman.id.au
Cc: mahesh@linux.vnet.ibm.com, eric.devolder@oracle.com,
	kexec@lists.infradead.org, bhe@redhat.com,
	hbathini@linux.ibm.com
Subject: Re: [PATCH v5 4/5] powerpc/crash hp: add crash hotplug support for kexec_load
Date: Wed, 22 Jun 2022 17:25:30 +0200	[thread overview]
Message-ID: <4a217cf4-a634-04a7-4ff6-85d27736090a@linux.ibm.com> (raw)
In-Reply-To: <20220620070106.93141-5-sourabhjain@linux.ibm.com>

On 20/06/2022, 09:01:05, Sourabh Jain wrote:
> A common crash hotplug handler is used for both kexec_load and
> kexec_file_load, which is already implemented in earlier patches while
> adding support for kexec_file_load.
> 
> To enable the crash hotplug handler to work for kexec_load case the
> fdt_index attribute of kimage_arch needs to be populated with index of
> FDT segment in kexec segment array.
> 
> After loading kexec segments the FDT segment is identified by looping
> through all the kexec segments and fdt_index is updated accordingly.
> 
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> ---
>  arch/powerpc/kexec/core_64.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/powerpc/kexec/core_64.c b/arch/powerpc/kexec/core_64.c
> index 6d448b55dfad..373cb46bcc0e 100644
> --- a/arch/powerpc/kexec/core_64.c
> +++ b/arch/powerpc/kexec/core_64.c
> @@ -74,6 +74,31 @@ int machine_kexec_prepare(struct kimage *image)
>  	return 0;
>  }
>  
> +#if defined(CONFIG_HOTPLUG_CPU)
> +int machine_kexec_post_load(struct kimage *kimage)
> +{
> +	int i;
> +	void *ptr;
> +	unsigned long mem;
> +
> +	if (kimage->type != KEXEC_TYPE_CRASH)
> +		return 0;
> +
> +	/* Mark fdt_index invalid */
> +	kimage->arch.fdt_index = -1;

If fdt_index should be set to -1, this should be done in
machine_kexec_prepare().  Anyway, there is no need to set it to -1 because
this image will not be registered in do_kexec_load() before the following
loop is complete.

> +
> +	for (i = 0; i < kimage->nr_segments; i++) {
> +		mem = kimage->segment[i].mem;
> +		ptr = __va(mem);
> +
> +		if (ptr && fdt_magic(ptr) == FDT_MAGIC)
> +			kimage->arch.fdt_index = i;
			break;

there is no need to check the other segments, isn't it?

Cheers,
Laurent.

> +	}
> +
> +	return 0;
> +}
> +#endif
> +
>  /* Called during kexec sequence with MMU off */
>  static notrace void copy_segments(unsigned long ind)
>  {


  reply	other threads:[~2022-06-22 15:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  7:01 [PATCH v5 0/5] In kernel handling of CPU hotplug events for crash kernel Sourabh Jain
2022-06-20  7:01 ` [PATCH v5 1/5] powerpc/kexec: make update_cpus_node non-static Sourabh Jain
2022-06-21  8:59   ` Laurent Dufour
2022-06-22  8:40     ` Sourabh Jain
2022-06-20  7:01 ` [PATCH v5 2/5] powerpc/crash hp: update kimage_arch struct Sourabh Jain
2022-06-20  7:01 ` [PATCH v5 3/5] powerpc/crash hp: add crash hotplug support for kexec_file_load Sourabh Jain
2022-06-22 15:11   ` Laurent Dufour
2022-06-20  7:01 ` [PATCH v5 4/5] powerpc/crash hp: add crash hotplug support for kexec_load Sourabh Jain
2022-06-22 15:25   ` Laurent Dufour [this message]
2022-06-20  7:01 ` [PATCH v5 5/5] powerpc/crash hp: add crash page helper functions Sourabh Jain
2022-06-22 15:33   ` Laurent Dufour

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=4a217cf4-a634-04a7-4ff6-85d27736090a@linux.ibm.com \
    --to=ldufour@linux.ibm.com \
    --cc=bhe@redhat.com \
    --cc=eric.devolder@oracle.com \
    --cc=hbathini@linux.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mahesh@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=sourabhjain@linux.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).