mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-28 08:59:50 +00:00

With KHO in place, let's add documentation that describes what it is and how to use it. Link: https://lkml.kernel.org/r/20250509074635.3187114-17-changyuanl@google.com Signed-off-by: Alexander Graf <graf@amazon.com> Co-developed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Co-developed-by: Changyuan Lyu <changyuanl@google.com> Signed-off-by: Changyuan Lyu <changyuanl@google.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Anthony Yznaga <anthony.yznaga@oracle.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Ashish Kalra <ashish.kalra@amd.com> Cc: Ben Herrenschmidt <benh@kernel.crashing.org> Cc: Borislav Betkov <bp@alien8.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Eric Biederman <ebiederm@xmission.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Gowans <jgowans@amazon.com> Cc: Jason Gunthorpe <jgg@nvidia.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Krzysztof Kozlowski <krzk@kernel.org> Cc: Marc Rutland <mark.rutland@arm.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Pasha Tatashin <pasha.tatashin@soleen.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Pratyush Yadav <ptyadav@amazon.de> Cc: Rob Herring <robh@kernel.org> Cc: Saravana Kannan <saravanak@google.com> Cc: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleinxer <tglx@linutronix.de> Cc: Thomas Lendacky <thomas.lendacky@amd.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
81 lines
2.1 KiB
ReStructuredText
81 lines
2.1 KiB
ReStructuredText
.. SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
=======
|
|
KHO FDT
|
|
=======
|
|
|
|
KHO uses the flattened device tree (FDT) container format and libfdt
|
|
library to create and parse the data that is passed between the
|
|
kernels. The properties in KHO FDT are stored in native format.
|
|
It includes the physical address of an in-memory structure describing
|
|
all preserved memory regions, as well as physical addresses of KHO users'
|
|
own FDTs. Interpreting those sub FDTs is the responsibility of KHO users.
|
|
|
|
KHO nodes and properties
|
|
========================
|
|
|
|
Property ``preserved-memory-map``
|
|
---------------------------------
|
|
|
|
KHO saves a special property named ``preserved-memory-map`` under the root node.
|
|
This node contains the physical address of an in-memory structure for KHO to
|
|
preserve memory regions across kexec.
|
|
|
|
Property ``compatible``
|
|
-----------------------
|
|
|
|
The ``compatible`` property determines compatibility between the kernel
|
|
that created the KHO FDT and the kernel that attempts to load it.
|
|
If the kernel that loads the KHO FDT is not compatible with it, the entire
|
|
KHO process will be bypassed.
|
|
|
|
Property ``fdt``
|
|
----------------
|
|
|
|
Generally, a KHO user serialize its state into its own FDT and instructs
|
|
KHO to preserve the underlying memory, such that after kexec, the new kernel
|
|
can recover its state from the preserved FDT.
|
|
|
|
A KHO user thus can create a node in KHO root tree and save the physical address
|
|
of its own FDT in that node's property ``fdt`` .
|
|
|
|
Examples
|
|
========
|
|
|
|
The following example demonstrates KHO FDT that preserves two memory
|
|
regions created with ``reserve_mem`` kernel command line parameter::
|
|
|
|
/dts-v1/;
|
|
|
|
/ {
|
|
compatible = "kho-v1";
|
|
|
|
preserved-memory-map = <0x40be16 0x1000000>;
|
|
|
|
memblock {
|
|
fdt = <0x1517 0x1000000>;
|
|
};
|
|
};
|
|
|
|
where the ``memblock`` node contains an FDT that is requested by the
|
|
subsystem memblock for preservation. The FDT contains the following
|
|
serialized data::
|
|
|
|
/dts-v1/;
|
|
|
|
/ {
|
|
compatible = "memblock-v1";
|
|
|
|
n1 {
|
|
compatible = "reserve-mem-v1";
|
|
start = <0xc06b 0x4000000>;
|
|
size = <0x04 0x00>;
|
|
};
|
|
|
|
n2 {
|
|
compatible = "reserve-mem-v1";
|
|
start = <0xc067 0x4000000>;
|
|
size = <0x04 0x00>;
|
|
};
|
|
};
|