From: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
ebiederm@xmission.com, akpm@linux-foundation.org,
stanislav.kinsburskii@gmail.com, corbet@lwn.net,
linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
linux-mm@kvack.org, kys@microsoft.com, jgowans@amazon.com,
wei.liu@kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org,
graf@amazon.de, pbonzini@redhat.com
Subject: [RFC PATCH v2 1/7] kexec_file: Add fdt modification callback support
Date: Mon, 25 Sep 2023 14:27:47 -0700 [thread overview]
Message-ID: <169567726766.19708.8904010689974887517.stgit@skinsburskii.> (raw)
In-Reply-To: <169567722094.19708.3583735425859054859.stgit@skinsburskii.>
From: Stanislav Kinsburskii <stanislav.kinsburskii@gmail.com>
Introduce primitives to:
- Register and unregister callbacks for flattened device tree (fdt)
modifications.
- Invoke all registered callbacks.
- Check for any registered callbacks.
These enhancements enable the use of a device tree to store kernel bits.
Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
---
include/linux/kexec.h | 7 +++++++
kernel/kexec_file.c | 24 ++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 22b5cd24f581..c9c70551796d 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -282,6 +282,13 @@ arch_kexec_apply_relocations(struct purgatory_info *pi, Elf_Shdr *section,
return -ENOEXEC;
}
#endif
+
+struct notifier_block;
+extern int register_kexec_fdt_notifier(struct notifier_block *nb);
+extern int unregister_kexec_fdt_notifier(struct notifier_block *nb);
+extern bool kexec_fdt_notify_list_empty(void);
+extern int kexec_fdt_notify(void *fdt);
+
#endif /* CONFIG_KEXEC_FILE */
#ifdef CONFIG_KEXEC_ELF
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 881ba0d1714c..f9245d5e4459 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -43,6 +43,30 @@ static int kexec_calculate_store_digests(struct kimage *image);
/* Maximum size in bytes for kernel/initrd files. */
#define KEXEC_FILE_SIZE_MAX min_t(s64, 4LL << 30, SSIZE_MAX)
+static BLOCKING_NOTIFIER_HEAD(kexec_fdt_notify_list);
+
+bool kexec_fdt_notify_list_empty(void)
+{
+ return kexec_fdt_notify_list.head == NULL;
+}
+
+int kexec_fdt_notify(void *fdt)
+{
+ return blocking_notifier_call_chain(&kexec_fdt_notify_list, 0, fdt);
+}
+
+int register_kexec_fdt_notifier(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_register(&kexec_fdt_notify_list, nb);
+}
+EXPORT_SYMBOL(register_kexec_fdt_notifier);
+
+int unregister_kexec_fdt_notifier(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_unregister(&kexec_fdt_notify_list, nb);
+}
+EXPORT_SYMBOL(unregister_kexec_fdt_notifier);
+
/*
* Currently this is the only default function that is exported as some
* architectures need it to do additional handlings.
next prev parent reply other threads:[~2023-09-25 21:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 21:27 [RFC PATCH v2 0/7] Introduce persistent memory pool Stanislav Kinsburskii
2023-09-25 21:27 ` Stanislav Kinsburskii [this message]
2023-09-25 21:27 ` [RFC PATCH v2 2/7] x86: kexec: Transfer existing fdt to the new kernel Stanislav Kinsburskii
2023-09-25 21:28 ` [RFC PATCH v2 3/7] x86: kexec: Enable fdt modification in callbacks Stanislav Kinsburskii
2023-09-25 21:28 ` [RFC PATCH v2 4/7] pmpool: Introduce persistent memory pool Stanislav Kinsburskii
2023-09-25 21:28 ` [RFC PATCH v2 5/7] pmpool: Update device tree on kexec Stanislav Kinsburskii
2023-09-25 21:28 ` [RFC PATCH v2 6/7] pmpool: Restore state from device tree post-kexec Stanislav Kinsburskii
2023-09-25 21:28 ` [RFC PATCH v2 7/7] Drivers: hv: Allocate persistent pages for root partition Stanislav Kinsburskii
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=169567726766.19708.8904010689974887517.stgit@skinsburskii. \
--to=skinsburskii@linux.microsoft.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=ebiederm@xmission.com \
--cc=graf@amazon.de \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=jgowans@amazon.com \
--cc=kexec@lists.infradead.org \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=stanislav.kinsburskii@gmail.com \
--cc=tglx@linutronix.de \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox