[RFC PATCH 3/4] kho: Add support for multiple versions to debugfs
From: Logan Odell
Date: Fri Jul 31 2026 - 17:57:46 EST
Update kho_in_debugfs_init to search for versioned subnodes
(depth 2) and expose them as name-version in the input debugfs.
This ensures versioned subtrees are visible to userspace for debugging,
matching the behavior of the output side.
Signed-off-by: Logan Odell <loganodell@xxxxxxxxxx>
---
kernel/liveupdate/kexec_handover_debugfs.c | 57 +++++++++++++++++-----
1 file changed, 44 insertions(+), 13 deletions(-)
diff --git a/kernel/liveupdate/kexec_handover_debugfs.c b/kernel/liveupdate/kexec_handover_debugfs.c
index 2f93939168ab..2ca055219900 100644
--- a/kernel/liveupdate/kexec_handover_debugfs.c
+++ b/kernel/liveupdate/kexec_handover_debugfs.c
@@ -13,6 +13,7 @@
#include <linux/io.h>
#include <linux/libfdt.h>
#include <linux/mm.h>
+#include <linux/unaligned.h>
#include "kexec_handover_internal.h"
static struct dentry *debugfs_root;
@@ -140,19 +141,49 @@ __init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt)
const u64 *fdt_phys;
fdt_phys = fdt_getprop(fdt, child, "fdt", &len);
- if (!fdt_phys)
- continue;
- if (len != sizeof(*fdt_phys)) {
- pr_warn("node %s prop fdt has invalid length: %d\n",
- name, len);
- continue;
- }
- err = __kho_debugfs_fdt_add(&dbg->fdt_list, sub_fdt_dir, name,
- phys_to_virt(*fdt_phys));
- if (err) {
- pr_warn("failed to add fdt %s to debugfs: %pe\n", name,
- ERR_PTR(err));
- continue;
+ if (fdt_phys) {
+ if (len != sizeof(*fdt_phys)) {
+ pr_warn("node %s prop fdt has invalid length: %d\n",
+ name, len);
+ continue;
+ }
+ err = __kho_debugfs_fdt_add(&dbg->fdt_list, sub_fdt_dir, name,
+ phys_to_virt(get_unaligned(fdt_phys)));
+ if (err) {
+ pr_warn("failed to add fdt %s to debugfs: %pe\n", name,
+ ERR_PTR(err));
+ }
+ } else {
+ int grandchild;
+
+ fdt_for_each_subnode(grandchild, fdt, child) {
+ const char *gc_name = fdt_get_name(fdt, grandchild, NULL);
+ const u64 *gc_fdt_phys;
+ char *combined_name;
+
+ gc_fdt_phys = fdt_getprop(fdt, grandchild, "fdt", &len);
+ if (!gc_fdt_phys)
+ continue;
+
+ if (len != sizeof(*gc_fdt_phys)) {
+ pr_warn("node %s/%s prop fdt has invalid length: %d\n",
+ name, gc_name, len);
+ continue;
+ }
+
+ combined_name = kasprintf(GFP_KERNEL, "%s-%s", name, gc_name);
+ if (!combined_name)
+ continue;
+
+ err = __kho_debugfs_fdt_add(&dbg->fdt_list, sub_fdt_dir,
+ combined_name,
+ phys_to_virt(get_unaligned(gc_fdt_phys)));
+ kfree(combined_name);
+ if (err) {
+ pr_warn("failed to add fdt %s-%s to debugfs: %pe\n",
+ name, gc_name, ERR_PTR(err));
+ }
+ }
}
}
--
2.55.0.508.g3f0d502094-goog