162306a36Sopenharmony_ci*** NOTE ***
262306a36Sopenharmony_ciThis document is copied from OPAL firmware
362306a36Sopenharmony_ci(skiboot/doc/device-tree/ibm,powerpc-cpu-features/binding.txt)
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciThere is more complete overview and documentation of features in that
662306a36Sopenharmony_cisource tree.  All patches and modifications should go there.
762306a36Sopenharmony_ci************
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciibm,powerpc-cpu-features binding
1062306a36Sopenharmony_ci================================
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciThis device tree binding describes CPU features available to software, with
1362306a36Sopenharmony_cienablement, privilege, and compatibility metadata.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciMore general description of design and implementation of this binding is
1662306a36Sopenharmony_cifound in design.txt, which also points to documentation of specific features.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/cpus/ibm,powerpc-cpu-features node binding
2062306a36Sopenharmony_ci-------------------------------------------
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciNode: ibm,powerpc-cpu-features
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ciDescription: Container of CPU feature nodes.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciThe node name must be "ibm,powerpc-cpu-features".
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciIt is implemented as a child of the node "/cpus", but this must not be
2962306a36Sopenharmony_ciassumed by parsers.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciThe node is optional but should be provided by new OPAL firmware.
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciProperties:
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci- compatible
3662306a36Sopenharmony_ci  Usage: required
3762306a36Sopenharmony_ci  Value type: string
3862306a36Sopenharmony_ci  Definition: "ibm,powerpc-cpu-features"
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci  This compatibility refers to backwards compatibility of the overall
4162306a36Sopenharmony_ci  design with parsers that behave according to these guidelines. This can
4262306a36Sopenharmony_ci  be extended in a backward compatible manner which would not warrant a
4362306a36Sopenharmony_ci  revision of the compatible property.
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci- isa
4662306a36Sopenharmony_ci  Usage: required
4762306a36Sopenharmony_ci  Value type: <u32>
4862306a36Sopenharmony_ci  Definition:
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci  isa that the CPU is currently running in. This provides instruction set
5162306a36Sopenharmony_ci  compatibility, less the individual feature nodes. For example, an ISA v3.0
5262306a36Sopenharmony_ci  implementation that lacks the "transactional-memory" cpufeature node
5362306a36Sopenharmony_ci  should not use transactional memory facilities.
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci  Value corresponds to the "Power ISA Version" multiplied by 1000.
5662306a36Sopenharmony_ci  For example, <3000> corresponds to Version 3.0, <2070> to Version 2.07.
5762306a36Sopenharmony_ci  The minor digit is available for revisions.
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci- display-name
6062306a36Sopenharmony_ci  Usage: optional
6162306a36Sopenharmony_ci  Value type: string
6262306a36Sopenharmony_ci  Definition:
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci  A human readable name for the CPU.
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/cpus/ibm,powerpc-cpu-features/example-feature node bindings
6762306a36Sopenharmony_ci----------------------------------------------------------------
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ciEach child node of cpu-features represents a CPU feature / capability.
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ciNode: A string describing an architected CPU feature, e.g., "floating-point".
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ciDescription: A feature or capability supported by the CPUs.
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciThe name of the node is a human readable string that forms the interface
7662306a36Sopenharmony_ciused to describe features to software. Features are currently documented
7762306a36Sopenharmony_ciin the code where they are implemented in skiboot/core/cpufeatures.c
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ciPresence of the node indicates the feature is available.
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ciProperties:
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci- isa
8462306a36Sopenharmony_ci  Usage: required
8562306a36Sopenharmony_ci  Value type: <u32>
8662306a36Sopenharmony_ci  Definition:
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci  First level of the Power ISA that the feature appears in.
8962306a36Sopenharmony_ci  Software should filter out features when constraining the
9062306a36Sopenharmony_ci  environment to a particular ISA version.
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci  Value is defined similarly to /cpus/features/isa
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci- usable-privilege
9562306a36Sopenharmony_ci  Usage: required
9662306a36Sopenharmony_ci  Value type: <u32> bit mask
9762306a36Sopenharmony_ci  Definition:
9862306a36Sopenharmony_ci              Bit numbers are LSB0
9962306a36Sopenharmony_ci              bit 0 - PR (problem state / user mode)
10062306a36Sopenharmony_ci              bit 1 - OS (privileged state)
10162306a36Sopenharmony_ci              bit 2 - HV (hypervisor state)
10262306a36Sopenharmony_ci              All other bits reserved and should be zero.
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci  This property describes the privilege levels and/or software components
10562306a36Sopenharmony_ci  that can use the feature.
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci  If bit 0 is set, then the hwcap-bit-nr property will exist.
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci- hv-support
11162306a36Sopenharmony_ci  Usage: optional
11262306a36Sopenharmony_ci  Value type: <u32> bit mask
11362306a36Sopenharmony_ci  Definition:
11462306a36Sopenharmony_ci              Bit numbers are LSB0
11562306a36Sopenharmony_ci              bit 0 -  HFSCR
11662306a36Sopenharmony_ci              All other bits reserved and should be zero.
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci  This property describes the HV privilege support required to enable the
11962306a36Sopenharmony_ci  feature to lesser privilege levels. If the property does not exist then no
12062306a36Sopenharmony_ci  support is required.
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci  If no bits are set, the hypervisor must have explicit/custom support for
12362306a36Sopenharmony_ci  this feature.
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci  If the HFSCR bit is set, then the hfscr-bit-nr property will exist and
12662306a36Sopenharmony_ci  the feature may be enabled by setting this bit in the HFSCR register.
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci- os-support
13062306a36Sopenharmony_ci  Usage: optional
13162306a36Sopenharmony_ci  Value type: <u32> bit mask
13262306a36Sopenharmony_ci  Definition:
13362306a36Sopenharmony_ci              Bit numbers are LSB0
13462306a36Sopenharmony_ci              bit 0 -  FSCR
13562306a36Sopenharmony_ci              All other bits reserved and should be zero.
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci  This property describes the OS privilege support required to enable the
13862306a36Sopenharmony_ci  feature to lesser privilege levels. If the property does not exist then no
13962306a36Sopenharmony_ci  support is required.
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci  If no bits are set, the operating system must have explicit/custom support
14262306a36Sopenharmony_ci  for this feature.
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci  If the FSCR bit is set, then the fscr-bit-nr property will exist and
14562306a36Sopenharmony_ci  the feature may be enabled by setting this bit in the FSCR register.
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci- hfscr-bit-nr
14962306a36Sopenharmony_ci  Usage: optional
15062306a36Sopenharmony_ci  Value type: <u32>
15162306a36Sopenharmony_ci  Definition: HFSCR bit position (LSB0)
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci  This property exists when the hv-support property HFSCR bit is set. This
15462306a36Sopenharmony_ci  property describes the bit number in the HFSCR register that the
15562306a36Sopenharmony_ci  hypervisor must set in order to enable this feature.
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci  This property also exists if an HFSCR bit corresponds with this feature.
15862306a36Sopenharmony_ci  This makes CPU feature parsing slightly simpler.
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci- fscr-bit-nr
16262306a36Sopenharmony_ci  Usage: optional
16362306a36Sopenharmony_ci  Value type: <u32>
16462306a36Sopenharmony_ci  Definition: FSCR bit position (LSB0)
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci  This property exists when the os-support property FSCR bit is set. This
16762306a36Sopenharmony_ci  property describes the bit number in the FSCR register that the
16862306a36Sopenharmony_ci  operating system must set in order to enable this feature.
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci  This property also exists if an FSCR bit corresponds with this feature.
17162306a36Sopenharmony_ci  This makes CPU feature parsing slightly simpler.
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci- hwcap-bit-nr
17562306a36Sopenharmony_ci  Usage: optional
17662306a36Sopenharmony_ci  Value type: <u32>
17762306a36Sopenharmony_ci  Definition: Linux ELF AUX vector bit position (LSB0)
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci  This property may exist when the usable-privilege property value has PR bit set.
18062306a36Sopenharmony_ci  This property describes the bit number that should be set in the ELF AUX
18162306a36Sopenharmony_ci  hardware capability vectors in order to advertise this feature to userspace.
18262306a36Sopenharmony_ci  Bits 0-31 correspond to bits 0-31 in AT_HWCAP vector. Bits 32-63 correspond
18362306a36Sopenharmony_ci  to 0-31 in AT_HWCAP2 vector, and so on.  Missing AT_HWCAPx vectors implies
18462306a36Sopenharmony_ci  that the feature is not enabled or can not be advertised. Operating systems
18562306a36Sopenharmony_ci  may provide a number of unassigned hardware capability bits to allow for new
18662306a36Sopenharmony_ci  features to be advertised.
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci  Some properties representing features created before this binding are
18962306a36Sopenharmony_ci  advertised to userspace without a one-to-one hwcap bit number may not specify
19062306a36Sopenharmony_ci  this bit. Operating system will handle those bits specifically.  All new
19162306a36Sopenharmony_ci  features usable by userspace will have a hwcap-bit-nr property.
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci- dependencies
19562306a36Sopenharmony_ci  Usage: optional
19662306a36Sopenharmony_ci  Value type: <prop-encoded-array>
19762306a36Sopenharmony_ci  Definition:
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci  If this property exists then it is a list of phandles to cpu feature
20062306a36Sopenharmony_ci  nodes that must be enabled for this feature to be enabled.
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ciExample
20462306a36Sopenharmony_ci-------
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci	/cpus/ibm,powerpc-cpu-features {
20762306a36Sopenharmony_ci		compatible = "ibm,powerpc-cpu-features";
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci		isa = <3020>;
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci		darn {
21262306a36Sopenharmony_ci			isa = <3000>;
21362306a36Sopenharmony_ci			usable-privilege = <1 | 2 | 4>;
21462306a36Sopenharmony_ci			hwcap-bit-nr = <xx>;
21562306a36Sopenharmony_ci		};
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci		scv {
21862306a36Sopenharmony_ci			isa = <3000>;
21962306a36Sopenharmony_ci			usable-privilege = <1 | 2>;
22062306a36Sopenharmony_ci			os-support = <0>;
22162306a36Sopenharmony_ci			hwcap-bit-nr = <xx>;
22262306a36Sopenharmony_ci		};
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci		stop {
22562306a36Sopenharmony_ci			isa = <3000>;
22662306a36Sopenharmony_ci			usable-privilege = <2 | 4>;
22762306a36Sopenharmony_ci			hv-support = <0>;
22862306a36Sopenharmony_ci			os-support = <0>;
22962306a36Sopenharmony_ci		};
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci		vsx2 (hypothetical) {
23262306a36Sopenharmony_ci			isa = <3010>;
23362306a36Sopenharmony_ci			usable-privilege = <1 | 2 | 4>;
23462306a36Sopenharmony_ci			hv-support = <0>;
23562306a36Sopenharmony_ci			os-support = <0>;
23662306a36Sopenharmony_ci			hwcap-bit-nr = <xx>;
23762306a36Sopenharmony_ci		};
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci		vsx2-newinsns {
24062306a36Sopenharmony_ci			isa = <3020>;
24162306a36Sopenharmony_ci			usable-privilege = <1 | 2 | 4>;
24262306a36Sopenharmony_ci			os-support = <1>;
24362306a36Sopenharmony_ci			fscr-bit-nr = <xx>;
24462306a36Sopenharmony_ci			hwcap-bit-nr = <xx>;
24562306a36Sopenharmony_ci			dependencies = <&vsx2>;
24662306a36Sopenharmony_ci		};
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci	};
249