Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kho: rename fdt parameter to blob in kho_add/remove_subtree()

Since kho_add_subtree() now accepts arbitrary data blobs (not just FDTs),
rename the parameter from 'fdt' to 'blob' to better reflect its purpose.
Apply the same rename to kho_remove_subtree() for consistency.

Also rename kho_debugfs_fdt_add() and kho_debugfs_fdt_remove() to
kho_debugfs_blob_add() and kho_debugfs_blob_remove() respectively, with
the same parameter rename from 'fdt' to 'blob'.

Link: https://lore.kernel.org/20260316-kho-v9-2-ed6dcd951988@debian.org
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Cc: Alexander Graf <graf@amazon.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Breno Leitao and committed by
Andrew Morton
4916ae38 d9e4142e

+43 -41
+1 -1
Documentation/admin-guide/mm/kho.rst
··· 80 80 it finished to interpret their metadata. 81 81 82 82 ``/sys/kernel/debug/kho/in/sub_fdts/`` 83 - Similar to ``kho/out/sub_fdts/``, but contains sub FDT blobs 83 + Similar to ``kho/out/sub_fdts/``, but contains sub blobs 84 84 of KHO producers passed from the old kernel.
+4 -4
include/linux/kexec_handover.h
··· 32 32 struct folio *kho_restore_folio(phys_addr_t phys); 33 33 struct page *kho_restore_pages(phys_addr_t phys, unsigned long nr_pages); 34 34 void *kho_restore_vmalloc(const struct kho_vmalloc *preservation); 35 - int kho_add_subtree(const char *name, void *fdt, size_t size); 36 - void kho_remove_subtree(void *fdt); 35 + int kho_add_subtree(const char *name, void *blob, size_t size); 36 + void kho_remove_subtree(void *blob); 37 37 int kho_retrieve_subtree(const char *name, phys_addr_t *phys); 38 38 39 39 void kho_memory_init(void); ··· 97 97 return NULL; 98 98 } 99 99 100 - static inline int kho_add_subtree(const char *name, void *fdt, size_t size) 100 + static inline int kho_add_subtree(const char *name, void *blob, size_t size) 101 101 { 102 102 return -EOPNOTSUPP; 103 103 } 104 104 105 - static inline void kho_remove_subtree(void *fdt) { } 105 + static inline void kho_remove_subtree(void *blob) { } 106 106 107 107 static inline int kho_retrieve_subtree(const char *name, phys_addr_t *phys) 108 108 {
+17 -16
kernel/liveupdate/kexec_handover.c
··· 724 724 } 725 725 726 726 /** 727 - * kho_add_subtree - record the physical address of a sub FDT in KHO root tree. 727 + * kho_add_subtree - record the physical address of a sub blob in KHO root tree. 728 728 * @name: name of the sub tree. 729 - * @fdt: the sub tree blob. 729 + * @blob: the sub tree blob. 730 730 * @size: size of the blob in bytes. 731 731 * 732 732 * Creates a new child node named @name in KHO root FDT and records 733 - * the physical address of @fdt. The pages of @fdt must also be preserved 733 + * the physical address of @blob. The pages of @blob must also be preserved 734 734 * by KHO for the new kernel to retrieve it after kexec. 735 735 * 736 736 * A debugfs blob entry is also created at ··· 739 739 * 740 740 * Return: 0 on success, error code on failure 741 741 */ 742 - int kho_add_subtree(const char *name, void *fdt, size_t size) 742 + int kho_add_subtree(const char *name, void *blob, size_t size) 743 743 { 744 - phys_addr_t phys = virt_to_phys(fdt); 744 + phys_addr_t phys = virt_to_phys(blob); 745 745 void *root_fdt = kho_out.fdt; 746 746 int err = -ENOMEM; 747 747 int off, fdt_err; ··· 764 764 if (err < 0) 765 765 goto out_pack; 766 766 767 - WARN_ON_ONCE(kho_debugfs_fdt_add(&kho_out.dbg, name, fdt, size, false)); 767 + WARN_ON_ONCE(kho_debugfs_blob_add(&kho_out.dbg, name, blob, 768 + size, false)); 768 769 769 770 out_pack: 770 771 fdt_pack(root_fdt); ··· 774 773 } 775 774 EXPORT_SYMBOL_GPL(kho_add_subtree); 776 775 777 - void kho_remove_subtree(void *fdt) 776 + void kho_remove_subtree(void *blob) 778 777 { 779 - phys_addr_t target_phys = virt_to_phys(fdt); 778 + phys_addr_t target_phys = virt_to_phys(blob); 780 779 void *root_fdt = kho_out.fdt; 781 780 int off; 782 781 int err; ··· 798 797 799 798 if ((phys_addr_t)*val == target_phys) { 800 799 fdt_del_node(root_fdt, off); 801 - kho_debugfs_fdt_remove(&kho_out.dbg, fdt); 800 + kho_debugfs_blob_remove(&kho_out.dbg, blob); 802 801 break; 803 802 } 804 803 } ··· 1294 1293 EXPORT_SYMBOL_GPL(is_kho_boot); 1295 1294 1296 1295 /** 1297 - * kho_retrieve_subtree - retrieve a preserved sub FDT by its name. 1298 - * @name: the name of the sub FDT passed to kho_add_subtree(). 1299 - * @phys: if found, the physical address of the sub FDT is stored in @phys. 1296 + * kho_retrieve_subtree - retrieve a preserved sub blob by its name. 1297 + * @name: the name of the sub blob passed to kho_add_subtree(). 1298 + * @phys: if found, the physical address of the sub blob is stored in @phys. 1300 1299 * 1301 - * Retrieve a preserved sub FDT named @name and store its physical 1300 + * Retrieve a preserved sub blob named @name and store its physical 1302 1301 * address in @phys. 1303 1302 * 1304 1303 * Return: 0 on success, error code on failure ··· 1432 1431 init_cma_reserved_pageblock(pfn_to_page(pfn)); 1433 1432 } 1434 1433 1435 - WARN_ON_ONCE(kho_debugfs_fdt_add(&kho_out.dbg, "fdt", 1436 - kho_out.fdt, 1437 - fdt_totalsize(kho_out.fdt), true)); 1434 + WARN_ON_ONCE(kho_debugfs_blob_add(&kho_out.dbg, "fdt", 1435 + kho_out.fdt, 1436 + fdt_totalsize(kho_out.fdt), true)); 1438 1437 1439 1438 return 0; 1440 1439
+13 -12
kernel/liveupdate/kexec_handover_debugfs.c
··· 24 24 struct dentry *file; 25 25 }; 26 26 27 - static int __kho_debugfs_fdt_add(struct list_head *list, struct dentry *dir, 28 - const char *name, const void *fdt, size_t size) 27 + static int __kho_debugfs_blob_add(struct list_head *list, struct dentry *dir, 28 + const char *name, const void *blob, 29 + size_t size) 29 30 { 30 31 struct fdt_debugfs *f; 31 32 struct dentry *file; ··· 35 34 if (!f) 36 35 return -ENOMEM; 37 36 38 - f->wrapper.data = (void *)fdt; 37 + f->wrapper.data = (void *)blob; 39 38 f->wrapper.size = size; 40 39 41 40 file = debugfs_create_blob(name, 0400, dir, &f->wrapper); ··· 50 49 return 0; 51 50 } 52 51 53 - int kho_debugfs_fdt_add(struct kho_debugfs *dbg, const char *name, 54 - const void *fdt, size_t size, bool root) 52 + int kho_debugfs_blob_add(struct kho_debugfs *dbg, const char *name, 53 + const void *blob, size_t size, bool root) 55 54 { 56 55 struct dentry *dir; 57 56 ··· 60 59 else 61 60 dir = dbg->sub_fdt_dir; 62 61 63 - return __kho_debugfs_fdt_add(&dbg->fdt_list, dir, name, fdt, size); 62 + return __kho_debugfs_blob_add(&dbg->fdt_list, dir, name, blob, size); 64 63 } 65 64 66 - void kho_debugfs_fdt_remove(struct kho_debugfs *dbg, void *fdt) 65 + void kho_debugfs_blob_remove(struct kho_debugfs *dbg, void *blob) 67 66 { 68 67 struct fdt_debugfs *ff; 69 68 70 69 list_for_each_entry(ff, &dbg->fdt_list, list) { 71 - if (ff->wrapper.data == fdt) { 70 + if (ff->wrapper.data == blob) { 72 71 debugfs_remove(ff->file); 73 72 list_del(&ff->list); 74 73 kfree(ff); ··· 114 113 goto err_rmdir; 115 114 } 116 115 117 - err = __kho_debugfs_fdt_add(&dbg->fdt_list, dir, "fdt", fdt, 118 - fdt_totalsize(fdt)); 116 + err = __kho_debugfs_blob_add(&dbg->fdt_list, dir, "fdt", fdt, 117 + fdt_totalsize(fdt)); 119 118 if (err) 120 119 goto err_rmdir; 121 120 ··· 134 133 continue; 135 134 } 136 135 sub_fdt = phys_to_virt(*fdt_phys); 137 - err = __kho_debugfs_fdt_add(&dbg->fdt_list, sub_fdt_dir, name, 138 - sub_fdt, fdt_totalsize(sub_fdt)); 136 + err = __kho_debugfs_blob_add(&dbg->fdt_list, sub_fdt_dir, name, 137 + sub_fdt, fdt_totalsize(sub_fdt)); 139 138 if (err) { 140 139 pr_warn("failed to add fdt %s to debugfs: %pe\n", name, 141 140 ERR_PTR(err));
+8 -8
kernel/liveupdate/kexec_handover_internal.h
··· 26 26 int kho_debugfs_init(void); 27 27 void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt); 28 28 int kho_out_debugfs_init(struct kho_debugfs *dbg); 29 - int kho_debugfs_fdt_add(struct kho_debugfs *dbg, const char *name, 30 - const void *fdt, size_t size, bool root); 31 - void kho_debugfs_fdt_remove(struct kho_debugfs *dbg, void *fdt); 29 + int kho_debugfs_blob_add(struct kho_debugfs *dbg, const char *name, 30 + const void *blob, size_t size, bool root); 31 + void kho_debugfs_blob_remove(struct kho_debugfs *dbg, void *blob); 32 32 #else 33 33 static inline int kho_debugfs_init(void) { return 0; } 34 34 static inline void kho_in_debugfs_init(struct kho_debugfs *dbg, 35 35 const void *fdt) { } 36 36 static inline int kho_out_debugfs_init(struct kho_debugfs *dbg) { return 0; } 37 - static inline int kho_debugfs_fdt_add(struct kho_debugfs *dbg, const char *name, 38 - const void *fdt, size_t size, 39 - bool root) { return 0; } 40 - static inline void kho_debugfs_fdt_remove(struct kho_debugfs *dbg, 41 - void *fdt) { } 37 + static inline int kho_debugfs_blob_add(struct kho_debugfs *dbg, 38 + const char *name, const void *blob, 39 + size_t size, bool root) { return 0; } 40 + static inline void kho_debugfs_blob_remove(struct kho_debugfs *dbg, 41 + void *blob) { } 42 42 #endif /* CONFIG_KEXEC_HANDOVER_DEBUGFS */ 43 43 44 44 #ifdef CONFIG_KEXEC_HANDOVER_DEBUG