diff options
| author | Nicholas Piggin <npiggin@gmail.com> | 2017-05-08 23:16:52 -0400 |
|---|---|---|
| committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-05-09 09:42:55 -0400 |
| commit | 5a61ef74f269f2573f48fa53607a8911216c3326 (patch) | |
| tree | 5282bc7ceb24c4864d1060bfe59688e72027b1cb | |
| parent | 75bda95048a4d2c5ff04036bd0181bc84085d8b2 (diff) | |
powerpc/64s: Support new device tree binding for discovering CPU features
The ibm,powerpc-cpu-features device tree binding describes CPU features with
ASCII names and extensible compatibility, privilege, and enablement metadata
that allows improved flexibility and compatibility with new hardware.
The interface is described in detail in ibm,powerpc-cpu-features.txt in this
patch.
Currently this code is not enabled by default, and there are no released
firmwares that provide the binding.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
| -rw-r--r-- | Documentation/devicetree/bindings/powerpc/ibm,powerpc-cpu-features.txt | 248 | ||||
| -rw-r--r-- | arch/powerpc/Kconfig | 16 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/cpu_has_feature.h | 6 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/cputable.h | 2 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/dt_cpu_ftrs.h | 26 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/reg.h | 1 | ||||
| -rw-r--r-- | arch/powerpc/include/uapi/asm/cputable.h | 7 | ||||
| -rw-r--r-- | arch/powerpc/kernel/Makefile | 1 | ||||
| -rw-r--r-- | arch/powerpc/kernel/cputable.c | 37 | ||||
| -rw-r--r-- | arch/powerpc/kernel/dt_cpu_ftrs.c | 1031 | ||||
| -rw-r--r-- | arch/powerpc/kernel/prom.c | 29 | ||||
| -rw-r--r-- | arch/powerpc/kernel/setup_64.c | 10 |
12 files changed, 1398 insertions, 16 deletions
diff --git a/Documentation/devicetree/bindings/powerpc/ibm,powerpc-cpu-features.txt b/Documentation/devicetree/bindings/powerpc/ibm,powerpc-cpu-features.txt new file mode 100644 index 000000000000..5af426e13334 --- /dev/null +++ b/Documentation/devicetree/bindings/powerpc/ibm,powerpc-cpu-features.txt | |||
| @@ -0,0 +1,248 @@ | |||
| 1 | *** NOTE *** | ||
| 2 | This document is copied from OPAL firmware | ||
| 3 | (skiboot/doc/device-tree/ibm,powerpc-cpu-features/binding.txt) | ||
| 4 | |||
| 5 | There is more complete overview and documentation of features in that | ||
| 6 | source tree. All patches and modifications should go there. | ||
| 7 | ************ | ||
| 8 | |||
| 9 | ibm,powerpc-cpu-features binding | ||
| 10 | ================================ | ||
| 11 | |||
| 12 | This device tree binding describes CPU features available to software, with | ||
| 13 | enablement, privilege, and compatibility metadata. | ||
| 14 | |||
| 15 | More general description of design and implementation of this binding is | ||
| 16 | found in design.txt, which also points to documentation of specific features. | ||
| 17 | |||
| 18 | |||
| 19 | /cpus/ibm,powerpc-cpu-features node binding | ||
| 20 | ------------------------------------------- | ||
| 21 | |||
| 22 | Node: ibm,powerpc-cpu-features | ||
| 23 | |||
| 24 | Description: Container of CPU feature nodes. | ||
| 25 | |||
| 26 | The node name must be "ibm,powerpc-cpu-features". | ||
| 27 | |||
| 28 | It is implemented as a child of the node "/cpus", but this must not be | ||
| 29 | assumed by parsers. | ||
| 30 | |||
| 31 | The node is optional but should be provided by new OPAL firmware. | ||
| 32 | |||
| 33 | Properties: | ||
| 34 | |||
| 35 | - compatible | ||
| 36 | Usage: required | ||
| 37 | Value type: string | ||
| 38 | Definition: "ibm,powerpc-cpu-features" | ||
| 39 | |||
| 40 | This compatibility refers to backwards compatibility of the overall | ||
| 41 | design with parsers that behave according to these guidelines. This can | ||
| 42 | be extended in a backward compatible manner which would not warrant a | ||
| 43 | revision of the compatible property. | ||
| 44 | |||
| 45 | - isa | ||
| 46 | Usage: required | ||
| 47 | Value type: <u32> | ||
| 48 | Definition: | ||
| 49 | |||
| 50 | isa that the CPU is currently running in. This provides instruction set | ||
| 51 | compatibility, less the individual feature nodes. For example, an ISA v3.0 | ||
| 52 | implementation that lacks the "transactional-memory" cpufeature node | ||
| 53 | should not use transactional memory facilities. | ||
| 54 | |||
| 55 | Value corresponds to the "Power ISA Version" multiplied by 1000. | ||
| 56 | For example, <3000> corresponds to Version 3.0, <2070> to Version 2.07. | ||
| 57 | The minor digit is available for revisions. | ||
| 58 | |||
| 59 | - display-name | ||
| 60 | Usage: optional | ||
| 61 | Value type: string | ||
| 62 | Definition: | ||
| 63 | |||
| 64 | A human readable name for the CPU. | ||
| 65 | |||
| 66 | /cpus/ibm,powerpc-cpu-features/example-feature node bindings | ||
| 67 | ---------------------------------------------------------------- | ||
| 68 | |||
| 69 | Each child node of cpu-features represents a CPU feature / capability. | ||
| 70 | |||
| 71 | Node: A string describing an architected CPU feature, e.g., "floating-point". | ||
| 72 | |||
| 73 | Description: A feature or capability supported by the CPUs. | ||
| 74 | |||
| 75 | The name of the node is a human readable string that forms the interface | ||
| 76 | used to describe features to software. Features are currently documented | ||
| 77 | in the code where they are implemented in skiboot/core/cpufeatures.c | ||
| 78 | |||
| 79 | Presence of the node indicates the feature is available. | ||
| 80 | |||
| 81 | Properties: | ||
| 82 | |||
| 83 | - isa | ||
| 84 | Usage: required | ||
| 85 | Value type: <u32> | ||
| 86 | Definition: | ||
| 87 | |||
| 88 | First level of the Power ISA that the feature appears in. | ||
| 89 | Software should filter out features when constraining the | ||
| 90 | environment to a particular ISA version. | ||
| 91 | |||
| 92 | Value is defined similarly to /cpus/features/isa | ||
| 93 | |||
| 94 | - usable-privilege | ||
| 95 | Usage: required | ||
| 96 | Value type: <u32> bit mask | ||
| 97 | Definition: | ||
| 98 | Bit numbers are LSB0 | ||
| 99 | bit 0 - PR (problem state / user mode) | ||
| 100 | bit 1 - OS (privileged state) | ||
| 101 | bit 2 - HV (hypervisor state) | ||
| 102 | All other bits reserved and should be zero. | ||
| 103 | |||
| 104 | This property describes the privilege levels and/or software components | ||
| 105 | that can use the feature. | ||
| 106 | |||
| 107 | If bit 0 is set, then the hwcap-bit-nr property will exist. | ||
| 108 | |||
| 109 | |||
| 110 | - hv-support | ||
| 111 | Usage: optional | ||
| 112 | Value type: <u32> bit mask | ||
| 113 | Definition: | ||
| 114 | Bit numbers are LSB0 | ||
| 115 | bit 0 - HFSCR | ||
| 116 | All other bits reserved and should be zero. | ||
| 117 | |||
| 118 | This property describes the HV privilege support required to enable the | ||
| 119 | feature to lesser privilege levels. If the property does not exist then no | ||
| 120 | support is required. | ||
| 121 | |||
| 122 | If no bits are set, the hypervisor must have explicit/custom support for | ||
| 123 | this feature. | ||
| 124 | |||
| 125 | If the HFSCR bit is set, then the hfscr-bit-nr property will exist and | ||
| 126 | the feature may be enabled by setting this bit in the HFSCR register. | ||
| 127 | |||
| 128 | |||
| 129 | - os-support | ||
| 130 | Usage: optional | ||
| 131 | Value type: <u32> bit mask | ||
| 132 | Definition: | ||
| 133 | Bit numbers are LSB0 | ||
| 134 | bit 0 - FSCR | ||
| 135 | All other bits reserved and should be zero. | ||
| 136 | |||
| 137 | This property describes the OS privilege support required to enable the | ||
| 138 | feature to lesser privilege levels. If the property does not exist then no | ||
| 139 | support is required. | ||
| 140 | |||
| 141 | If no bits are set, the operating system must have explicit/custom support | ||
| 142 | for this feature. | ||
| 143 | |||
| 144 | If the FSCR bit is set, then the fscr-bit-nr property will exist and | ||
| 145 | the feature may be enabled by setting this bit in the FSCR register. | ||
| 146 | |||
| 147 | |||
| 148 | - hfscr-bit-nr | ||
| 149 | Usage: optional | ||
| 150 | Value type: <u32> | ||
| 151 | Definition: HFSCR bit position (LSB0) | ||
| 152 | |||
| 153 | This property exists when the hv-support property HFSCR bit is set. This | ||
| 154 | property describes the bit number in the HFSCR register that the | ||
| 155 | hypervisor must set in order to enable this feature. | ||
| 156 | |||
| 157 | This property also exists if an HFSCR bit corresponds with this feature. | ||
| 158 | This makes CPU feature parsing slightly simpler. | ||
| 159 | |||
| 160 | |||
| 161 | - fscr-bit-nr | ||
| 162 | Usage: optional | ||
| 163 | Value type: <u32> | ||
| 164 | Definition: FSCR bit position (LSB0) | ||
| 165 | |||
| 166 | This property exists when the os-support property FSCR bit is set. This | ||
| 167 | property describes the bit number in the FSCR register that the | ||
