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 5/5] powerpc/kdump: export kexec crash FDT details via sysfs
Date: Mon, 21 Feb 2022 14:16:24 +0530 [thread overview]
Message-ID: <20220221084624.85792-6-sourabhjain@linux.ibm.com> (raw)
In-Reply-To: <20220221084624.85792-1-sourabhjain@linux.ibm.com>
Export kexec crash FDT address and size to /sys/kernel/kexec_crash_fdt
and /sys/kernel/kexec_crash_fdt_size files to enabled kexec tool to
utilize pre-allocated space kdump FDT.
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
arch/powerpc/kexec/core_64.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/arch/powerpc/kexec/core_64.c b/arch/powerpc/kexec/core_64.c
index 57afceee53a6..9bc9973ab3d3 100644
--- a/arch/powerpc/kexec/core_64.c
+++ b/arch/powerpc/kexec/core_64.c
@@ -677,6 +677,23 @@ static u32 get_kexec_crash_fdt_size(void)
return 1024*1024;
}
+static ssize_t kexec_crash_fdt_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%lx\n", __pa(kexec_crash_fdt));
+}
+static struct kobj_attribute kexec_crash_fdt_attr = __ATTR_RO(kexec_crash_fdt);
+
+static ssize_t kexec_crash_fdt_size_show(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%d\n", kexec_crash_fdt_size);
+}
+static struct kobj_attribute kexec_crash_fdt_size_attr = \
+ __ATTR_RO(kexec_crash_fdt_size);
+
+
/* Setup the memory hole for kdump fdt in reserved region below RMA.
*/
static int __init setup_kexec_crash_fdt(void)
@@ -707,6 +724,16 @@ static int __init setup_kexec_crash_fdt(void)
kexec_crash_fdt = __va(kbuf.mem);
kexec_crash_fdt_size = kbuf.memsz;
+ if (sysfs_create_file(kernel_kobj, &kexec_crash_fdt_attr.attr)) {
+ pr_err("unable to create kdump_fdt sysfs file\n.");
+ return -1;
+ }
+
+ if (sysfs_create_file(kernel_kobj, &kexec_crash_fdt_size_attr.attr)) {
+ pr_err("unable to cerate kexec_crash_fdt_size sysfs file.\n");
+ return -1;
+ }
+
out:
return ret;
}
--
2.34.1
next prev parent reply other threads:[~2022-02-21 8:51 UTC|newest]
Thread overview: 8+ 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 ` [RFC PATCH 1/5] powerpc/kdump: export functions from file_load_64.c Sourabh Jain
2022-02-21 8:46 ` [RFC PATCH 2/5] powerpc/kdump: setup kexec crash FDT 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 ` [RFC PATCH 4/5] powerpc/kdump: enable kexec_file_load system call to use kexec crash FDT Sourabh Jain
2022-02-21 8:46 ` Sourabh Jain [this message]
2022-02-22 3:50 ` [RFC PATCH 0/5] Avoid kdump service reload on CPU hotplug events Baoquan He
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-6-sourabhjain@linux.ibm.com \
--to=sourabhjain@linux.ibm.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 \
/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).