From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: kexec@lists.infradead.org
Subject: [RFC PATCH 4/5] powerpc/kdump: enable kexec_file_load system call to use kexec crash FDT
Date: Mon, 21 Feb 2022 14:16:23 +0530 [thread overview]
Message-ID: <20220221084624.85792-5-sourabhjain@linux.ibm.com> (raw)
In-Reply-To: <20220221084624.85792-1-sourabhjain@linux.ibm.com>
This patch enables the kexec_file_load system to utilize the pre-allocated
space for kexec crash FDT during the system boot.
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
arch/powerpc/kexec/elf_64.c | 22 +++++++++++++++++++---
arch/powerpc/kexec/file_load_64.c | 4 ++++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c
index eeb258002d1e..3176dea0910d 100644
--- a/arch/powerpc/kexec/elf_64.c
+++ b/arch/powerpc/kexec/elf_64.c
@@ -116,13 +116,29 @@ static void *elf64_load(struct kimage *image, char *kernel_buf,
if (ret)
goto out_free_fdt;
- fdt_pack(fdt);
+#ifdef CONFIG_KEXEC_CRASH_FDT
+ if (kexec_crash_fdt && image->type == KEXEC_TYPE_CRASH) {
+ memcpy(kexec_crash_fdt, fdt, fdt_totalsize(fdt));
+ /* retain the original total size */
+ ((struct fdt_header *)(kexec_crash_fdt))->totalsize = cpu_to_fdt32(kexec_crash_fdt_size);
+ } else
+#endif
+ {
+ kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
+ }
kbuf.buffer = fdt;
- kbuf.bufsz = kbuf.memsz = fdt_totalsize(fdt);
+
+#ifdef CONFIG_KEXEC_CRASH_FDT
+ if (kexec_crash_fdt && image->type == KEXEC_TYPE_CRASH) {
+ kbuf.bufsz = kbuf.memsz = fdt_totalsize(kexec_crash_fdt);
+ } else
+#endif
+ {
+ kbuf.bufsz = kbuf.memsz = fdt_totalsize(fdt);
+ }
kbuf.buf_align = PAGE_SIZE;
kbuf.top_down = true;
- kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
ret = kexec_add_buffer(&kbuf);
if (ret)
goto out_free_fdt;
diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
index 02bb2adb1fe2..7a320d9e2098 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -906,6 +906,10 @@ int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
u64 buf_min, buf_max;
int ret;
+ /* kbuf.mem is already pointing to validate memory hole */
+ if (kbuf->mem != KEXEC_BUF_MEM_UNKNOWN)
+ return 0;
+
/* Look up the exclude ranges list while locating the memory hole */
emem = &(kbuf->image->arch.exclude_ranges);
if (!(*emem) || ((*emem)->nr_ranges == 0)) {
--
2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: linuxppc-dev@ozlabs.org, mpe@ellerman.id.au
Cc: mahesh@linux.vnet.ibm.com, kexec@lists.infradead.org,
hbathini@linux.ibm.com
Subject: [RFC PATCH 4/5] powerpc/kdump: enable kexec_file_load system call to use kexec crash FDT
Date: Mon, 21 Feb 2022 14:16:23 +0530 [thread overview]
Message-ID: <20220221084624.85792-5-sourabhjain@linux.ibm.com> (raw)
In-Reply-To: <20220221084624.85792-1-sourabhjain@linux.ibm.com>
This patch enables the kexec_file_load system to utilize the pre-allocated
space for kexec crash FDT during the system boot.
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
arch/powerpc/kexec/elf_64.c | 22 +++++++++++++++++++---
arch/powerpc/kexec/file_load_64.c | 4 ++++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c
index eeb258002d1e..3176dea0910d 100644
--- a/arch/powerpc/kexec/elf_64.c
+++ b/arch/powerpc/kexec/elf_64.c
@@ -116,13 +116,29 @@ static void *elf64_load(struct kimage *image, char *kernel_buf,
if (ret)
goto out_free_fdt;
- fdt_pack(fdt);
+#ifdef CONFIG_KEXEC_CRASH_FDT
+ if (kexec_crash_fdt && image->type == KEXEC_TYPE_CRASH) {
+ memcpy(kexec_crash_fdt, fdt, fdt_totalsize(fdt));
+ /* retain the original total size */
+ ((struct fdt_header *)(kexec_crash_fdt))->totalsize = cpu_to_fdt32(kexec_crash_fdt_size);
+ } else
+#endif
+ {
+ kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
+ }
kbuf.buffer = fdt;
- kbuf.bufsz = kbuf.memsz = fdt_totalsize(fdt);
+
+#ifdef CONFIG_KEXEC_CRASH_FDT
+ if (kexec_crash_fdt && image->type == KEXEC_TYPE_CRASH) {
+ kbuf.bufsz = kbuf.memsz = fdt_totalsize(kexec_crash_fdt);
+ } else
+#endif
+ {
+ kbuf.bufsz = kbuf.memsz = fdt_totalsize(fdt);
+ }
kbuf.buf_align = PAGE_SIZE;
kbuf.top_down = true;
- kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
ret = kexec_add_buffer(&kbuf);
if (ret)
goto out_free_fdt;
diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
index 02bb2adb1fe2..7a320d9e2098 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -906,6 +906,10 @@ int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
u64 buf_min, buf_max;
int ret;
+ /* kbuf.mem is already pointing to validate memory hole */
+ if (kbuf->mem != KEXEC_BUF_MEM_UNKNOWN)
+ return 0;
+
/* Look up the exclude ranges list while locating the memory hole */
emem = &(kbuf->image->arch.exclude_ranges);
if (!(*emem) || ((*emem)->nr_ranges == 0)) {
--
2.34.1
next prev parent reply other threads:[~2022-02-21 8:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 8:46 [RFC PATCH 0/5] Avoid kdump service reload on CPU hotplug events Sourabh Jain
2022-02-21 8:46 ` Sourabh Jain
2022-02-21 8:46 ` [RFC PATCH 1/5] powerpc/kdump: export functions from file_load_64.c Sourabh Jain
2022-02-21 8:46 ` Sourabh Jain
2022-02-21 8:46 ` [RFC PATCH 2/5] powerpc/kdump: setup kexec crash FDT Sourabh Jain
2022-02-21 8:46 ` Sourabh Jain
2022-02-21 8:46 ` [RFC PATCH 3/5] powerpc/kdump: update kexec crash FDT on CPU hot add event Sourabh Jain
2022-02-21 8:46 ` Sourabh Jain
2022-02-21 8:46 ` Sourabh Jain [this message]
2022-02-21 8:46 ` [RFC PATCH 4/5] powerpc/kdump: enable kexec_file_load system call to use kexec crash FDT Sourabh Jain
2022-02-21 8:46 ` [RFC PATCH 5/5] powerpc/kdump: export kexec crash FDT details via sysfs Sourabh Jain
2022-02-21 8:46 ` Sourabh Jain
2022-02-22 3:50 ` [RFC PATCH 0/5] Avoid kdump service reload on CPU hotplug events Baoquan He
2022-02-22 3:50 ` Baoquan He
2022-02-24 7:51 ` Sourabh Jain
2022-02-24 7:51 ` Sourabh Jain
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=20220221084624.85792-5-sourabhjain@linux.ibm.com \
--to=sourabhjain@linux.ibm.com \
--cc=kexec@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.