요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
*** NOTE ***
This document is copied from OPAL firmware
(skiboot/doc/device-tree/ibm,powerpc-cpu-features/binding.txt)
There is more complete overview and documentation of features in that
source tree. All patches and modifications should go there.
************
ibm,powerpc-cpu-features binding
================================
This device tree binding describes CPU features available to software, with
enablement, privilege, and compatibility metadata.
More general description of design and implementation of this binding is
found in design.txt, which also points to documentation of specific features.
/cpus/ibm,powerpc-cpu-features node binding
-------------------------------------------
Node: ibm,powerpc-cpu-features
Description: Container of CPU feature nodes.
The node name must be "ibm,powerpc-cpu-features".
It is implemented as a child of the node "/cpus", but this must not be
assumed by parsers.
The node is optional but should be provided by new OPAL firmware.
Properties:
- compatible
Usage: required
Value type: string
Definition: "ibm,powerpc-cpu-features"
This compatibility refers to backwards compatibility of the overall
design with parsers that behave according to these guidelines. This can
be extended in a backward compatible manner which would not warrant a
revision of the compatible property.
- isa
Usage: required
Value type: <u32>
Definition:
isa that the CPU is currently running in. This provides instruction set
compatibility, less the individual feature nodes. For example, an ISA v3.0
implementation that lacks the "transactional-memory" cpufeature node
should not use transactional memory facilities.
Value corresponds to the "Power ISA Version" multiplied by 1000.
For example, <3000> corresponds to Version 3.0, <2070> to Version 2.07.
The minor digit is available for revisions.
- display-name
Usage: optional
Value type: string
Definition:
A human readable name for the CPU.
/cpus/ibm,powerpc-cpu-features/example-feature node bindings
----------------------------------------------------------------
Each child node of cpu-features represents a CPU feature / capability.
Node: A string describing an architected CPU feature, e.g., "floating-point".
Description: A feature or capability supported by the CPUs.
The name of the node is a human readable string that forms the interface
used to describe features to software. Features are currently documented
in the code where they are implemented in skiboot/core/cpufeatures.c
Presence of the node indicates the feature is available.
Properties:
- isa
Usage: required
Value type: <u32>
Definition:
First level of the Power ISA that the feature appears in.
Software should filter out features when constraining the
environment to a particular ISA version.
Value is defined similarly to /cpus/features/isa
- usable-privilege
Usage: required
Value type: <u32> bit mask
Definition:
Bit numbers are LSB0
bit 0 - PR (problem state / user mode)
bit 1 - OS (privileged state)
bit 2 - HV (hypervisor state)
All other bits reserved and should be zero.
This property describes the privilege levels and/or software components
that can use the feature.
If bit 0 is set, then the hwcap-bit-nr property will exist.
- hv-support
Usage: optional
Value type: <u32> bit mask
Definition:
Bit numbers are LSB0
bit 0 - HFSCR
All other bits reserved and should be zero.
This property describes the HV privilege support required to enable the
feature to lesser privilege levels. If the property does not exist then no
support is required.
If no bits are set, the hypervisor must have explicit/custom support for
this feature.
If the HFSCR bit is set, then the hfscr-bit-nr property will exist and
the feature may be enabled by setting this bit in the HFSCR register.
- os-support
Usage: optional
Value type: <u32> bit mask
Definition:
Bit numbers are LSB0
bit 0 - FSCR
All other bits reserved and should be zero.
This property describes the OS privilege support required to enable the
feature to lesser privilege levels. If the property does not exist then no
support is required.
If no bits are set, the operating system must have explicit/custom support
for this feature.
If the FSCR bit is set, then the fscr-bit-nr property will exist and
the feature may be enabled by setting this bit in the FSCR register.
- hfscr-bit-nr
Usage: optional
Value type: <u32>
Definition: HFSCR bit position (LSB0)
This property exists when the hv-support property HFSCR bit is set. This
property describes the bit number in the HFSCR register that the
hypervisor must set in order to enable this feature.
This property also exists if an HFSCR bit corresponds with this feature.
This makes CPU feature parsing slightly simpler.
- fscr-bit-nr
Usage: optional
Value type: <u32>
Definition: FSCR bit position (LSB0)
This property exists when the os-support property FSCR bit is set. This
property describes the bit number in the FSCR register that the
operating system must set in order to enable this feature.
This property also exists if an FSCR bit corresponds with this feature.
This makes CPU feature parsing slightly simpler.
- hwcap-bit-nr
Usage: optional
Value type: <u32>
Definition: Linux ELF AUX vector bit position (LSB0)
This property may exist when the usable-privilege property value has PR bit set.
This property describes the bit number that should be set in the ELF AUX
hardware capability vectors in order to advertise this feature to userspace.
Bits 0-31 correspond to bits 0-31 in AT_HWCAP vector. Bits 32-63 correspond
to 0-31 in AT_HWCAP2 vector, and so on. Missing AT_HWCAPx vectors implies
that the feature is not enabled or can not be advertised. Operating systems
may provide a number of unassigned hardware capability bits to allow for new
features to be advertised.
Some properties representing features created before this binding are
advertised to userspace without a one-to-one hwcap bit number may not specify
this bit. Operating system will handle those bits specifically. All new
features usable by userspace will have a hwcap-bit-nr property.
- dependencies
Usage: optional
Value type: <prop-encoded-array>
Definition:
If this property exists then it is a list of phandles to cpu feature
nodes that must be enabled for this feature to be enabled.
Example
-------
/cpus/ibm,powerpc-cpu-features {
compatible = "ibm,powerpc-cpu-features";
isa = <3020>;
darn {
isa = <3000>;
usable-privilege = <1 | 2 | 4>;
hwcap-bit-nr = <xx>;
};
scv {
isa = <3000>;
usable-privilege = <1 | 2>;
os-support = <0>;
hwcap-bit-nr = <xx>;
};
stop {
isa = <3000>;
usable-privilege = <2 | 4>;
hv-support = <0>;
os-support = <0>;
};
vsx2 (hypothetical) {
isa = <3010>;
usable-privilege = <1 | 2 | 4>;
hv-support = <0>;
os-support = <0>;
hwcap-bit-nr = <xx>;
};
vsx2-newinsns {
isa = <3020>;
usable-privilege = <1 | 2 | 4>;
os-support = <1>;
fscr-bit-nr = <xx>;
hwcap-bit-nr = <xx>;
dependencies = <&vsx2>;
};
};
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
문서 출처와 개요
1-18이 문서는 OPAL firmware의 `skiboot/doc/device-tree/ibm,powerpc-cpu-features/binding.txt`에서 복사했습니다. 더 완전한 feature 개요와 문서는 그 source tree에 있으며 모든 patch와 수정도 그곳에 반영해야 합니다.
`ibm,powerpc-cpu-features` binding은 software가 사용할 수 있는 CPU feature를 enablement, privilege, compatibility metadata와 함께 기술합니다. 설계·구현의 일반 설명과 개별 feature 문서 링크는 `design.txt`에 있습니다.
CPU feature container
19-65`ibm,powerpc-cpu-features` node는 CPU feature node의 container이며 이름도 정확히 `ibm,powerpc-cpu-features`여야 합니다. `/cpus` child로 구현되지만 parser가 이 위치를 가정해서는 안 됩니다. Node는 선택 사항이지만 새 OPAL firmware는 제공해야 합니다.
필수 string `compatible`은 `ibm,powerpc-cpu-features`입니다. 이 값은 지침을 따르는 parser에 대한 전체 설계의 backward compatibility를 뜻하며, compatible revision 없이도 backward-compatible하게 확장할 수 있습니다.
필수 u32 `isa`는 CPU가 현재 실행 중인 ISA입니다. 개별 feature node를 제외한 instruction-set compatibility를 나타내므로 ISA v3.0 구현에 `transactional-memory` node가 없다면 transactional memory 기능을 사용해서는 안 됩니다. 값은 Power ISA Version에 1000을 곱하며 3000은 3.0, 2070은 2.07입니다. Minor digit은 revision에 쓸 수 있습니다.
선택 string `display-name`은 사람이 읽을 수 있는 CPU 이름입니다.
개별 feature와 ISA
66-93Container의 각 child node는 CPU feature 또는 capability 하나를 나타냅니다. Node 이름은 `floating-point` 같은 architected feature를 설명하는 사람이 읽을 수 있는 interface string입니다. 현재 feature 문서는 `skiboot/core/cpufeatures.c` 구현 code에 있으며 node가 존재하면 feature를 사용할 수 있습니다.
필수 u32 `isa`는 그 feature가 처음 나타난 Power ISA level입니다. 특정 ISA version으로 environment를 제한할 때 software는 이보다 새로운 feature를 걸러야 합니다. 값 정의는 container의 `isa`와 같습니다.
사용 privilege와 HV 지원
94-128필수 u32 bitmask `usable-privilege`는 feature를 사용할 수 있는 privilege level 또는 software component를 지정합니다.
| LSB0 bit | 의미 |
|---|---|
| 0 | PR: problem state 또는 user mode |
| 1 | OS: privileged state |
| 2 | HV: hypervisor state |
| 기타 | Reserved이며 0이어야 함 |
Bit 0이 설정되면 `hwcap-bit-nr` property가 존재합니다. 선택 u32 bitmask `hv-support`는 낮은 privilege level에 feature를 enable하기 위해 필요한 HV 지원을 나타냅니다.
| LSB0 bit | HV 지원 |
|---|---|
| 0 | HFSCR |
| 기타 | Reserved이며 0이어야 함 |
`hv-support`가 없으면 지원이 필요하지 않습니다. 값이 0이면 hypervisor가 이 feature를 위한 explicit/custom 지원을 가져야 합니다. HFSCR bit가 설정되면 `hfscr-bit-nr`이 존재하며 HFSCR register의 해당 bit를 설정해 feature를 enable할 수 있습니다.
OS 지원과 enable bit
129-172선택 u32 bitmask `os-support`는 낮은 privilege에 feature를 enable하기 위해 필요한 OS 지원을 나타냅니다.
| LSB0 bit | OS 지원 |
|---|---|
| 0 | FSCR |
| 기타 | Reserved이며 0이어야 함 |
`os-support`가 없으면 지원이 필요하지 않고, 값이 0이면 operating system이 explicit/custom 지원을 가져야 합니다. FSCR bit가 설정되면 `fscr-bit-nr`이 존재하며 FSCR register bit를 설정해 feature를 enable합니다.
선택 u32 `hfscr-bit-nr`은 LSB0 HFSCR bit position입니다. `hv-support`의 HFSCR bit가 설정됐을 때 존재하며 hypervisor가 feature enable을 위해 설정할 bit 번호를 지정합니다. Feature에 대응하는 HFSCR bit가 있기만 해도 parser 단순화를 위해 존재합니다.
선택 u32 `fscr-bit-nr`은 LSB0 FSCR bit position입니다. `os-support`의 FSCR bit가 설정됐을 때 존재하며 OS가 feature enable을 위해 설정할 bit 번호를 지정합니다. Feature에 대응하는 FSCR bit가 있기만 해도 존재할 수 있습니다.
HWCAP과 dependency
173-202선택 u32 `hwcap-bit-nr`은 Linux ELF AUX vector의 LSB0 bit position입니다. `usable-privilege`에 PR bit가 있으면 존재할 수 있으며 userspace에 feature를 알리기 위해 ELF AUX hardware capability vector에서 설정할 bit를 지정합니다.
0-31은 `AT_HWCAP` bit 0-31, 32-63은 `AT_HWCAP2` bit 0-31에 대응하고 이후도 같은 방식입니다. 해당 `AT_HWCAPx` vector가 없으면 feature가 enable되지 않았거나 광고할 수 없습니다. 기존 feature 중 일대일 HWCAP bit가 없던 것은 OS가 별도로 처리할 수 있지만, 새 userspace feature는 모두 `hwcap-bit-nr`을 가집니다.
선택 encoded array `dependencies`는 이 feature를 enable하기 전에 먼저 enable해야 하는 CPU feature node의 phandle 목록입니다.
CPU feature 예제
203-248예제는 ISA 3.02 container에 `darn`, `scv`, `stop`, 가상 `vsx2`, 그리고 `vsx2`에 의존하는 `vsx2-newinsns`를 배치합니다. 각 feature는 usable privilege와 필요한 HV/OS support, HWCAP·FSCR bit를 조합합니다.
/cpus/ibm,powerpc-cpu-features {
compatible = "ibm,powerpc-cpu-features";
isa = <3020>;
darn {
isa = <3000>;
usable-privilege = <1 | 2 | 4>;
hwcap-bit-nr = <xx>;
};
scv {
isa = <3000>;
usable-privilege = <1 | 2>;
os-support = <0>;
hwcap-bit-nr = <xx>;
};
stop {
isa = <3000>;
usable-privilege = <2 | 4>;
hv-support = <0>;
os-support = <0>;
};
vsx2 (hypothetical) {
isa = <3010>;
usable-privilege = <1 | 2 | 4>;
hv-support = <0>;
os-support = <0>;
hwcap-bit-nr = <xx>;
};
vsx2-newinsns {
isa = <3020>;
usable-privilege = <1 | 2 | 4>;
os-support = <1>;
fscr-bit-nr = <xx>;
hwcap-bit-nr = <xx>;
dependencies = <&vsx2>;
};
};
요약과 해설
ibm,powerpc-cpu-features.txt:1-248Feature node 존재 여부와 ISA level을 HV·OS enable method 및 userspace HWCAP 광고에 연결합니다.