18c2ecf20Sopenharmony_ci*** NOTE *** 28c2ecf20Sopenharmony_ciThis document is copied from OPAL firmware 38c2ecf20Sopenharmony_ci(skiboot/doc/device-tree/ibm,powerpc-cpu-features/binding.txt) 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciThere is more complete overview and documentation of features in that 68c2ecf20Sopenharmony_cisource tree. All patches and modifications should go there. 78c2ecf20Sopenharmony_ci************ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciibm,powerpc-cpu-features binding 108c2ecf20Sopenharmony_ci================================ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciThis device tree binding describes CPU features available to software, with 138c2ecf20Sopenharmony_cienablement, privilege, and compatibility metadata. 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciMore general description of design and implementation of this binding is 168c2ecf20Sopenharmony_cifound in design.txt, which also points to documentation of specific features. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/cpus/ibm,powerpc-cpu-features node binding 208c2ecf20Sopenharmony_ci------------------------------------------- 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciNode: ibm,powerpc-cpu-features 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciDescription: Container of CPU feature nodes. 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciThe node name must be "ibm,powerpc-cpu-features". 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ciIt is implemented as a child of the node "/cpus", but this must not be 298c2ecf20Sopenharmony_ciassumed by parsers. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciThe node is optional but should be provided by new OPAL firmware. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciProperties: 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci- compatible 368c2ecf20Sopenharmony_ci Usage: required 378c2ecf20Sopenharmony_ci Value type: string 388c2ecf20Sopenharmony_ci Definition: "ibm,powerpc-cpu-features" 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci This compatibility refers to backwards compatibility of the overall 418c2ecf20Sopenharmony_ci design with parsers that behave according to these guidelines. This can 428c2ecf20Sopenharmony_ci be extended in a backward compatible manner which would not warrant a 438c2ecf20Sopenharmony_ci revision of the compatible property. 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci- isa 468c2ecf20Sopenharmony_ci Usage: required 478c2ecf20Sopenharmony_ci Value type: <u32> 488c2ecf20Sopenharmony_ci Definition: 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci isa that the CPU is currently running in. This provides instruction set 518c2ecf20Sopenharmony_ci compatibility, less the individual feature nodes. For example, an ISA v3.0 528c2ecf20Sopenharmony_ci implementation that lacks the "transactional-memory" cpufeature node 538c2ecf20Sopenharmony_ci should not use transactional memory facilities. 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci Value corresponds to the "Power ISA Version" multiplied by 1000. 568c2ecf20Sopenharmony_ci For example, <3000> corresponds to Version 3.0, <2070> to Version 2.07. 578c2ecf20Sopenharmony_ci The minor digit is available for revisions. 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci- display-name 608c2ecf20Sopenharmony_ci Usage: optional 618c2ecf20Sopenharmony_ci Value type: string 628c2ecf20Sopenharmony_ci Definition: 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci A human readable name for the CPU. 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci/cpus/ibm,powerpc-cpu-features/example-feature node bindings 678c2ecf20Sopenharmony_ci---------------------------------------------------------------- 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ciEach child node of cpu-features represents a CPU feature / capability. 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ciNode: A string describing an architected CPU feature, e.g., "floating-point". 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciDescription: A feature or capability supported by the CPUs. 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ciThe name of the node is a human readable string that forms the interface 768c2ecf20Sopenharmony_ciused to describe features to software. Features are currently documented 778c2ecf20Sopenharmony_ciin the code where they are implemented in skiboot/core/cpufeatures.c 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ciPresence of the node indicates the feature is available. 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ciProperties: 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci- isa 848c2ecf20Sopenharmony_ci Usage: required 858c2ecf20Sopenharmony_ci Value type: <u32> 868c2ecf20Sopenharmony_ci Definition: 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci First level of the Power ISA that the feature appears in. 898c2ecf20Sopenharmony_ci Software should filter out features when constraining the 908c2ecf20Sopenharmony_ci environment to a particular ISA version. 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci Value is defined similarly to /cpus/features/isa 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci- usable-privilege 958c2ecf20Sopenharmony_ci Usage: required 968c2ecf20Sopenharmony_ci Value type: <u32> bit mask 978c2ecf20Sopenharmony_ci Definition: 988c2ecf20Sopenharmony_ci Bit numbers are LSB0 998c2ecf20Sopenharmony_ci bit 0 - PR (problem state / user mode) 1008c2ecf20Sopenharmony_ci bit 1 - OS (privileged state) 1018c2ecf20Sopenharmony_ci bit 2 - HV (hypervisor state) 1028c2ecf20Sopenharmony_ci All other bits reserved and should be zero. 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci This property describes the privilege levels and/or software components 1058c2ecf20Sopenharmony_ci that can use the feature. 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci If bit 0 is set, then the hwcap-bit-nr property will exist. 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci- hv-support 1118c2ecf20Sopenharmony_ci Usage: optional 1128c2ecf20Sopenharmony_ci Value type: <u32> bit mask 1138c2ecf20Sopenharmony_ci Definition: 1148c2ecf20Sopenharmony_ci Bit numbers are LSB0 1158c2ecf20Sopenharmony_ci bit 0 - HFSCR 1168c2ecf20Sopenharmony_ci All other bits reserved and should be zero. 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci This property describes the HV privilege support required to enable the 1198c2ecf20Sopenharmony_ci feature to lesser privilege levels. If the property does not exist then no 1208c2ecf20Sopenharmony_ci support is required. 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci If no bits are set, the hypervisor must have explicit/custom support for 1238c2ecf20Sopenharmony_ci this feature. 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci If the HFSCR bit is set, then the hfscr-bit-nr property will exist and 1268c2ecf20Sopenharmony_ci the feature may be enabled by setting this bit in the HFSCR register. 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci- os-support 1308c2ecf20Sopenharmony_ci Usage: optional 1318c2ecf20Sopenharmony_ci Value type: <u32> bit mask 1328c2ecf20Sopenharmony_ci Definition: 1338c2ecf20Sopenharmony_ci Bit numbers are LSB0 1348c2ecf20Sopenharmony_ci bit 0 - FSCR 1358c2ecf20Sopenharmony_ci All other bits reserved and should be zero. 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci This property describes the OS privilege support required to enable the 1388c2ecf20Sopenharmony_ci feature to lesser privilege levels. If the property does not exist then no 1398c2ecf20Sopenharmony_ci support is required. 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci If no bits are set, the operating system must have explicit/custom support 1428c2ecf20Sopenharmony_ci for this feature. 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci If the FSCR bit is set, then the fscr-bit-nr property will exist and 1458c2ecf20Sopenharmony_ci the feature may be enabled by setting this bit in the FSCR register. 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci- hfscr-bit-nr 1498c2ecf20Sopenharmony_ci Usage: optional 1508c2ecf20Sopenharmony_ci Value type: <u32> 1518c2ecf20Sopenharmony_ci Definition: HFSCR bit position (LSB0) 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci This property exists when the hv-support property HFSCR bit is set. This 1548c2ecf20Sopenharmony_ci property describes the bit number in the HFSCR register that the 1558c2ecf20Sopenharmony_ci hypervisor must set in order to enable this feature. 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci This property also exists if an HFSCR bit corresponds with this feature. 1588c2ecf20Sopenharmony_ci This makes CPU feature parsing slightly simpler. 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci- fscr-bit-nr 1628c2ecf20Sopenharmony_ci Usage: optional 1638c2ecf20Sopenharmony_ci Value type: <u32> 1648c2ecf20Sopenharmony_ci Definition: FSCR bit position (LSB0) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci This property exists when the os-support property FSCR bit is set. This 1678c2ecf20Sopenharmony_ci property describes the bit number in the FSCR register that the 1688c2ecf20Sopenharmony_ci operating system must set in order to enable this feature. 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci This property also exists if an FSCR bit corresponds with this feature. 1718c2ecf20Sopenharmony_ci This makes CPU feature parsing slightly simpler. 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci- hwcap-bit-nr 1758c2ecf20Sopenharmony_ci Usage: optional 1768c2ecf20Sopenharmony_ci Value type: <u32> 1778c2ecf20Sopenharmony_ci Definition: Linux ELF AUX vector bit position (LSB0) 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci This property may exist when the usable-privilege property value has PR bit set. 1808c2ecf20Sopenharmony_ci This property describes the bit number that should be set in the ELF AUX 1818c2ecf20Sopenharmony_ci hardware capability vectors in order to advertise this feature to userspace. 1828c2ecf20Sopenharmony_ci Bits 0-31 correspond to bits 0-31 in AT_HWCAP vector. Bits 32-63 correspond 1838c2ecf20Sopenharmony_ci to 0-31 in AT_HWCAP2 vector, and so on. Missing AT_HWCAPx vectors implies 1848c2ecf20Sopenharmony_ci that the feature is not enabled or can not be advertised. Operating systems 1858c2ecf20Sopenharmony_ci may provide a number of unassigned hardware capability bits to allow for new 1868c2ecf20Sopenharmony_ci features to be advertised. 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci Some properties representing features created before this binding are 1898c2ecf20Sopenharmony_ci advertised to userspace without a one-to-one hwcap bit number may not specify 1908c2ecf20Sopenharmony_ci this bit. Operating system will handle those bits specifically. All new 1918c2ecf20Sopenharmony_ci features usable by userspace will have a hwcap-bit-nr property. 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci- dependencies 1958c2ecf20Sopenharmony_ci Usage: optional 1968c2ecf20Sopenharmony_ci Value type: <prop-encoded-array> 1978c2ecf20Sopenharmony_ci Definition: 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci If this property exists then it is a list of phandles to cpu feature 2008c2ecf20Sopenharmony_ci nodes that must be enabled for this feature to be enabled. 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ciExample 2048c2ecf20Sopenharmony_ci------- 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci /cpus/ibm,powerpc-cpu-features { 2078c2ecf20Sopenharmony_ci compatible = "ibm,powerpc-cpu-features"; 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci isa = <3020>; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci darn { 2128c2ecf20Sopenharmony_ci isa = <3000>; 2138c2ecf20Sopenharmony_ci usable-privilege = <1 | 2 | 4>; 2148c2ecf20Sopenharmony_ci hwcap-bit-nr = <xx>; 2158c2ecf20Sopenharmony_ci }; 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci scv { 2188c2ecf20Sopenharmony_ci isa = <3000>; 2198c2ecf20Sopenharmony_ci usable-privilege = <1 | 2>; 2208c2ecf20Sopenharmony_ci os-support = <0>; 2218c2ecf20Sopenharmony_ci hwcap-bit-nr = <xx>; 2228c2ecf20Sopenharmony_ci }; 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci stop { 2258c2ecf20Sopenharmony_ci isa = <3000>; 2268c2ecf20Sopenharmony_ci usable-privilege = <2 | 4>; 2278c2ecf20Sopenharmony_ci hv-support = <0>; 2288c2ecf20Sopenharmony_ci os-support = <0>; 2298c2ecf20Sopenharmony_ci }; 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci vsx2 (hypothetical) { 2328c2ecf20Sopenharmony_ci isa = <3010>; 2338c2ecf20Sopenharmony_ci usable-privilege = <1 | 2 | 4>; 2348c2ecf20Sopenharmony_ci hv-support = <0>; 2358c2ecf20Sopenharmony_ci os-support = <0>; 2368c2ecf20Sopenharmony_ci hwcap-bit-nr = <xx>; 2378c2ecf20Sopenharmony_ci }; 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci vsx2-newinsns { 2408c2ecf20Sopenharmony_ci isa = <3020>; 2418c2ecf20Sopenharmony_ci usable-privilege = <1 | 2 | 4>; 2428c2ecf20Sopenharmony_ci os-support = <1>; 2438c2ecf20Sopenharmony_ci fscr-bit-nr = <xx>; 2448c2ecf20Sopenharmony_ci hwcap-bit-nr = <xx>; 2458c2ecf20Sopenharmony_ci dependencies = <&vsx2>; 2468c2ecf20Sopenharmony_ci }; 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci }; 249