On 7/8/26 9:08 AM, Mukesh Ojha wrote: > From: Eugen Hristev <[email protected]> > > With this driver, the registered regions are copied to a shared memory > zone at register time. The shared memory zone is supplied via OF. This > driver will select only regions that are of interest, and keep only > addresses. The format of the list is Kinfo compatible, with devices like > Google Pixel phone. The firmware is only interested in some symbols' > addresses. > > Signed-off-by: Eugen Hristev <[email protected]> > Signed-off-by: Mukesh Ojha <[email protected]> > --- [...] > diff --git a/kernel/meminspect/kinfo.c b/kernel/meminspect/kinfo.c > new file mode 100644 > index 000000000000..7451c13bc316 > --- /dev/null > +++ b/kernel/meminspect/kinfo.c > @@ -0,0 +1,257 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * > + * Copyright 2002 Rusty Russell <[email protected]> IBM Corporation > + * Copyright 2021 Google LLC > + * Copyright 2025 Linaro Ltd. Eugen Hristev <[email protected]> > + */ > +#include <linux/container_of.h> > +#include <linux/kallsyms.h> > +#include <linux/meminspect.h> > +#include <linux/module.h> > +#include <linux/of.h> > +#include <linux/of_reserved_mem.h> > +#include <linux/platform_device.h> > +#include <linux/utsname.h> > + > +#define BUILD_INFO_LEN 256 > +#define DEBUG_KINFO_MAGIC 0xcceeddff > + > +/* > + * Header structure must be byte-packed, since the table is provided to > + * bootloader. > + */ > +struct kernel_info { > + /* For kallsyms */ > + u8 enabled_all; > + u8 enabled_base_relative; > + u8 enabled_absolute_percpu; > + u8 enabled_cfi_clang; > + u32 num_syms; > + u16 name_len; > + u16 bit_per_long; > + u16 module_name_len; > + u16 symbol_len; > + u64 _relative_pa; > + u64 _text_pa; > + u64 _stext_pa; > + u64 _etext_pa; > + u64 _sinittext_pa; > + u64 _einittext_pa; > + u64 _end_pa; > + u64 _offsets_pa; > + u64 _names_pa; > + u64 _token_table_pa; > + u64 _token_index_pa; > + u64 _markers_pa; > + u64 _seqs_of_names_pa; > + > + /* For frame pointer */ > + u32 thread_size; > + > + /* For virt_to_phys */ > + u64 swapper_pg_dir_pa; > + > + /* For linux banner */ > + u8 last_uts_release[__NEW_UTS_LEN]; > + > + /* For module kallsyms */ > + u32 enabled_modules_tree_lookup; > + u32 mod_mem_offset; > + u32 mod_kallsyms_offset; > +} __packed;
Is this kinfo format documented anywhere? I was only able to find a reference to the equivalent downstream Android driver [1] in the cover letter. However, I don't quite understand what it is or what the associated bootloader component does with this information. In particular, I'm unclear about the purpose of the following module-related fields: module_name_len enabled_modules_tree_lookup mod_mem_offset mod_kallsyms_offset These appear to be exposed for reading the internals of the module loader. Be aware that this data is not stable. [1] https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/drivers/android/debug_kinfo.c -- Thanks, Petr

