요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. 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>;
};
};
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
KHO FDT 개요
1-13SPDX 라이선스 식별자: GPL-2.0-or-later
KHO FDT
KHO는 kernel 사이에 전달하는 data를 생성하고 해석하기 위해 FDT(flattened device tree) container format과 `libfdt` library를 사용합니다. KHO FDT의 property는 native format으로 저장됩니다.
KHO FDT에는 보존된 모든 메모리 영역을 기술하는 in-memory structure의 physical address와 KHO user가 소유한 FDT의 physical address가 들어 있습니다. 이러한 sub FDT를 해석하는 일은 각 KHO user(KHO users)의 책임입니다.
KHO node와 preserved-memory-map property
14-23KHO node와 property (KHO nodes and properties)
`preserved-memory-map` property
KHO는 root node 아래에 `preserved-memory-map`이라는 특별한 property를 저장합니다. 이 property에는 KHO가 `kexec` 사이에서 메모리 영역을 보존하는 데 사용하는 in-memory structure의 physical address가 들어 있습니다.
compatible property
24-31`compatible` property
`compatible` property는 KHO FDT를 생성한 kernel과 이를 load하려는 kernel 사이의 compatibility를 결정합니다. KHO FDT를 load하는 kernel이 호환되지 않으면 전체 KHO process를 우회합니다.
fdt property
32-41`fdt` property
일반적으로 KHO user는 자신의 상태를 자체 FDT에 serialize하고 그 FDT가 놓인 메모리를 보존하도록 KHO에 지시합니다. 그러면 `kexec` 이후 새 kernel이 보존된 FDT에서 상태를 복구할 수 있습니다.
따라서 KHO user는 KHO root tree에 node를 만들고 그 node의 `fdt` property에 자체 FDT의 physical address를 저장할 수 있습니다.
KHO root FDT 예제
42-59예제 (Examples)
다음은 `reserve_mem` kernel command line parameter로 만든 두 메모리 영역을 보존하는 KHO FDT 예제입니다.
/dts-v1/;
/ {
compatible = "kho-v1";
preserved-memory-map = <0x40be16 0x1000000>;
memblock {
fdt = <0x1517 0x1000000>;
};
};
memblock subsystem FDT 예제
60-80`memblock` node에는 memblock subsystem이 보존을 요청한 FDT가 들어 있습니다. 이 FDT에는 아래와 같이 serialize된 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>;
};
};
요약과 해설
fdt.rst:1-80KHO FDT는 device tree의 container format을 상태 인계용으로 활용합니다. Root의 `preserved-memory-map`은 보존 영역을 관리하는 구조체를 가리키고, KHO user별 node의 `fdt`는 해당 subsystem이 직렬화한 별도 FDT를 가리킵니다.
`compatible` 값은 이전 kernel이 작성한 인계 형식을 새 kernel이 읽을 수 있는지 판단하는 version gate입니다. 호환되지 않으면 일부만 복원하지 않고 KHO process 전체를 건너뜁니다.
예제에서는 root KHO FDT가 memblock용 sub FDT의 physical address를 전달하고, 그 sub FDT가 `reserve_mem`으로 확보한 두 영역의 `start`와 `size`를 기록합니다. 주소와 property 값은 KHO 규칙에 따라 native format으로 저장됩니다.