diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/devicetree/bindings/crypto/fsl-sec4.txt | 12 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/powerpc/fsl/guts.txt | 13 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/powerpc/fsl/pamu.txt | 140 | ||||
-rw-r--r-- | Documentation/powerpc/cpu_features.txt | 10 | ||||
-rw-r--r-- | Documentation/powerpc/transactional_memory.txt | 175 |
5 files changed, 341 insertions, 9 deletions
diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt index fc9ce6f1688c..6d21c0288e9e 100644 --- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt +++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt | |||
@@ -54,8 +54,13 @@ PROPERTIES | |||
54 | - compatible | 54 | - compatible |
55 | Usage: required | 55 | Usage: required |
56 | Value type: <string> | 56 | Value type: <string> |
57 | Definition: Must include "fsl,sec-v4.0". Also includes SEC | 57 | Definition: Must include "fsl,sec-v4.0" |
58 | ERA versions (optional) with which the device is compatible. | 58 | |
59 | - fsl,sec-era | ||
60 | Usage: optional | ||
61 | Value type: <u32> | ||
62 | Definition: A standard property. Define the 'ERA' of the SEC | ||
63 | device. | ||
59 | 64 | ||
60 | - #address-cells | 65 | - #address-cells |
61 | Usage: required | 66 | Usage: required |
@@ -107,7 +112,8 @@ PROPERTIES | |||
107 | 112 | ||
108 | EXAMPLE | 113 | EXAMPLE |
109 | crypto@300000 { | 114 | crypto@300000 { |
110 | compatible = "fsl,sec-v4.0", "fsl,sec-era-v2.0"; | 115 | compatible = "fsl,sec-v4.0"; |
116 | fsl,sec-era = <0x2>; | ||
111 | #address-cells = <1>; | 117 | #address-cells = <1>; |
112 | #size-cells = <1>; | 118 | #size-cells = <1>; |
113 | reg = <0x300000 0x10000>; | 119 | reg = <0x300000 0x10000>; |
diff --git a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt index 9e7a2417dac5..7f150b5012cc 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt +++ b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt | |||
@@ -17,9 +17,20 @@ Recommended properties: | |||
17 | contains a functioning "reset control register" (i.e. the board | 17 | contains a functioning "reset control register" (i.e. the board |
18 | is wired to reset upon setting the HRESET_REQ bit in this register). | 18 | is wired to reset upon setting the HRESET_REQ bit in this register). |
19 | 19 | ||
20 | Example: | 20 | - fsl,liodn-bits : Indicates the number of defined bits in the LIODN |
21 | registers, for those SOCs that have a PAMU device. | ||
22 | |||
23 | Examples: | ||
21 | global-utilities@e0000 { /* global utilities block */ | 24 | global-utilities@e0000 { /* global utilities block */ |
22 | compatible = "fsl,mpc8548-guts"; | 25 | compatible = "fsl,mpc8548-guts"; |
23 | reg = <e0000 1000>; | 26 | reg = <e0000 1000>; |
24 | fsl,has-rstcr; | 27 | fsl,has-rstcr; |
25 | }; | 28 | }; |
29 | |||
30 | guts: global-utilities@e0000 { | ||
31 | compatible = "fsl,qoriq-device-config-1.0"; | ||
32 | reg = <0xe0000 0xe00>; | ||
33 | fsl,has-rstcr; | ||
34 | #sleep-cells = <1>; | ||
35 | fsl,liodn-bits = <12>; | ||
36 | }; | ||
diff --git a/Documentation/devicetree/bindings/powerpc/fsl/pamu.txt b/Documentation/devicetree/bindings/powerpc/fsl/pamu.txt new file mode 100644 index 000000000000..1f5e329f756c --- /dev/null +++ b/Documentation/devicetree/bindings/powerpc/fsl/pamu.txt | |||
@@ -0,0 +1,140 @@ | |||
1 | Freescale Peripheral Management Access Unit (PAMU) Device Tree Binding | ||
2 | |||
3 | DESCRIPTION | ||
4 | |||
5 | The PAMU is an I/O MMU that provides device-to-memory access control and | ||
6 | address translation capabilities. | ||
7 | |||
8 | Required properties: | ||
9 | |||
10 | - compatible : <string> | ||
11 | First entry is a version-specific string, such as | ||
12 | "fsl,pamu-v1.0". The second is "fsl,pamu". | ||
13 | - ranges : <prop-encoded-array> | ||
14 | A standard property. Utilized to describe the memory mapped | ||
15 | I/O space utilized by the controller. The size should | ||
16 | be set to the total size of the register space of all | ||
17 | physically present PAMU controllers. For example, for | ||
18 | PAMU v1.0, on an SOC that has five PAMU devices, the size | ||
19 | is 0x5000. | ||
20 | - interrupts : <prop-encoded-array> | ||
21 | Interrupt mappings. The first tuple is the normal PAMU | ||
22 | interrupt, used for reporting access violations. The second | ||
23 | is for PAMU hardware errors, such as PAMU operation errors | ||
24 | and ECC errors. | ||
25 | - #address-cells: <u32> | ||
26 | A standard property. | ||
27 | - #size-cells : <u32> | ||
28 | A standard property. | ||
29 | |||
30 | Optional properties: | ||
31 | - reg : <prop-encoded-array> | ||
32 | A standard property. It represents the CCSR registers of | ||
33 | all child PAMUs combined. Include it to provide support | ||
34 | for legacy drivers. | ||
35 | - interrupt-parent : <phandle> | ||
36 | Phandle to interrupt controller | ||
37 | |||
38 | Child nodes: | ||
39 | |||
40 | Each child node represents one PAMU controller. Each SOC device that is | ||
41 | connected to a specific PAMU device should have a "fsl,pamu-phandle" property | ||
42 | that links to the corresponding specific child PAMU controller. | ||
43 | |||
44 | - reg : <prop-encoded-array> | ||
45 | A standard property. Specifies the physical address and | ||
46 | length (relative to the parent 'ranges' property) of this | ||
47 | PAMU controller's configuration registers. The size should | ||
48 | be set to the size of this PAMU controllers's register space. | ||
49 | For PAMU v1.0, this size is 0x1000. | ||
50 | - fsl,primary-cache-geometry | ||
51 | : <prop-encoded-array> | ||
52 | Two cells that specify the geometry of the primary PAMU | ||
53 | cache. The first is the number of cache lines, and the | ||
54 | second is the number of "ways". For direct-mapped caches, | ||
55 | specify a value of 1. | ||
56 | - fsl,secondary-cache-geometry | ||
57 | : <prop-encoded-array> | ||
58 | Two cells that specify the geometry of the secondary PAMU | ||
59 | cache. The first is the number of cache lines, and the | ||
60 | second is the number of "ways". For direct-mapped caches, | ||
61 | specify a value of 1. | ||
62 | |||
63 | Device nodes: | ||
64 | |||
65 | Devices that have LIODNs need to specify links to the parent PAMU controller | ||
66 | (the actual PAMU controller that this device is connected to) and a pointer to | ||
67 | the LIODN register, if applicable. | ||
68 | |||
69 | - fsl,iommu-parent | ||
70 | : <phandle> | ||
71 | Phandle to the single, specific PAMU controller node to which | ||
72 | this device is connect. The PAMU topology is represented in | ||
73 | the device tree to assist code that dynamically determines the | ||
74 | best LIODN values to minimize PAMU cache thrashing. | ||
75 | |||
76 | - fsl,liodn-reg : <prop-encoded-array> | ||
77 | Two cells that specify the location of the LIODN register | ||
78 | for this device. Required for devices that have a single | ||
79 | LIODN. The first cell is a phandle to a node that contains | ||
80 | the registers where the LIODN is to be set. The second is | ||
81 | the offset from the first "reg" resource of the node where | ||
82 | the specific LIODN register is located. | ||
83 | |||
84 | |||
85 | Example: | ||
86 | |||
87 | iommu@20000 { | ||
88 | compatible = "fsl,pamu-v1.0", "fsl,pamu"; | ||
89 | reg = <0x20000 0x5000>; | ||
90 | ranges = <0 0x20000 0x5000>; | ||
91 | #address-cells = <1>; | ||
92 | #size-cells = <1>; | ||
93 | interrupts = < | ||
94 | 24 2 0 0 | ||
95 | 16 2 1 30>; | ||
96 | |||
97 | pamu0: pamu@0 { | ||
98 | reg = <0 0x1000>; | ||
99 | fsl,primary-cache-geometry = <32 1>; | ||
100 | fsl,secondary-cache-geometry = <128 2>; | ||
101 | }; | ||
102 | |||
103 | pamu1: pamu@1000 { | ||
104 | reg = <0x1000 0x1000>; | ||
105 | fsl,primary-cache-geometry = <32 1>; | ||
106 | fsl,secondary-cache-geometry = <128 2>; | ||
107 | }; | ||
108 | |||
109 | pamu2: pamu@2000 { | ||
110 | reg = <0x2000 0x1000>; | ||
111 | fsl,primary-cache-geometry = <32 1>; | ||
112 | fsl,secondary-cache-geometry = <128 2>; | ||
113 | }; | ||
114 | |||
115 | pamu3: pamu@3000 { | ||
116 | reg = <0x3000 0x1000>; | ||
117 | fsl,primary-cache-geometry = <32 1>; | ||
118 | fsl,secondary-cache-geometry = <128 2>; | ||
119 | }; | ||
120 | |||
121 | pamu4: pamu@4000 { | ||
122 | reg = <0x4000 0x1000>; | ||
123 | fsl,primary-cache-geometry = <32 1>; | ||
124 | fsl,secondary-cache-geometry = <128 2>; | ||
125 | }; | ||
126 | }; | ||
127 | |||
128 | guts: global-utilities@e0000 { | ||
129 | compatible = "fsl,qoriq-device-config-1.0"; | ||
130 | reg = <0xe0000 0xe00>; | ||
131 | fsl,has-rstcr; | ||
132 | #sleep-cells = <1>; | ||
133 | fsl,liodn-bits = <12>; | ||
134 | }; | ||
135 | |||
136 | /include/ "qoriq-dma-0.dtsi" | ||
137 | dma@100300 { | ||
138 | fsl,iommu-parent = <&pamu0>; | ||
139 | fsl,liodn-reg = <&guts 0x584>; /* DMA2LIODNR */ | ||
140 | }; | ||
diff --git a/Documentation/powerpc/cpu_features.txt b/Documentation/powerpc/cpu_features.txt index ffa4183fdb8b..ae09df8722c8 100644 --- a/Documentation/powerpc/cpu_features.txt +++ b/Documentation/powerpc/cpu_features.txt | |||
@@ -11,10 +11,10 @@ split instruction and data caches, and if the CPU supports the DOZE and NAP | |||
11 | sleep modes. | 11 | sleep modes. |
12 | 12 | ||
13 | Detection of the feature set is simple. A list of processors can be found in | 13 | Detection of the feature set is simple. A list of processors can be found in |
14 | arch/ppc/kernel/cputable.c. The PVR register is masked and compared with each | 14 | arch/powerpc/kernel/cputable.c. The PVR register is masked and compared with |
15 | value in the list. If a match is found, the cpu_features of cur_cpu_spec is | 15 | each value in the list. If a match is found, the cpu_features of cur_cpu_spec |
16 | assigned to the feature bitmask for this processor and a __setup_cpu function | 16 | is assigned to the feature bitmask for this processor and a __setup_cpu |
17 | is called. | 17 | function is called. |
18 | 18 | ||
19 | C code may test 'cur_cpu_spec[smp_processor_id()]->cpu_features' for a | 19 | C code may test 'cur_cpu_spec[smp_processor_id()]->cpu_features' for a |
20 | particular feature bit. This is done in quite a few places, for example | 20 | particular feature bit. This is done in quite a few places, for example |
@@ -51,6 +51,6 @@ should be used in the majority of cases. | |||
51 | 51 | ||
52 | The END_FTR_SECTION macros are implemented by storing information about this | 52 | The END_FTR_SECTION macros are implemented by storing information about this |
53 | code in the '__ftr_fixup' ELF section. When do_cpu_ftr_fixups | 53 | code in the '__ftr_fixup' ELF section. When do_cpu_ftr_fixups |
54 | (arch/ppc/kernel/misc.S) is invoked, it will iterate over the records in | 54 | (arch/powerpc/kernel/misc.S) is invoked, it will iterate over the records in |
55 | __ftr_fixup, and if the required feature is not present it will loop writing | 55 | __ftr_fixup, and if the required feature is not present it will loop writing |
56 | nop's from each BEGIN_FTR_SECTION to END_FTR_SECTION. | 56 | nop's from each BEGIN_FTR_SECTION to END_FTR_SECTION. |
diff --git a/Documentation/powerpc/transactional_memory.txt b/Documentation/powerpc/transactional_memory.txt new file mode 100644 index 000000000000..c907be41d60f --- /dev/null +++ b/Documentation/powerpc/transactional_memory.txt | |||
@@ -0,0 +1,175 @@ | |||
1 | Transactional Memory support | ||
2 | ============================ | ||
3 | |||
4 | POWER kernel support for this feature is currently limited to supporting | ||
5 | its use by user programs. It is not currently used by the kernel itself. | ||
6 | |||
7 | This file aims to sum up how it is supported by Linux and what behaviour you | ||
8 | can expect from your user programs. | ||
9 | |||
10 | |||
11 | Basic overview | ||
12 | ============== | ||
13 | |||
14 | Hardware Transactional Memory is supported on POWER8 processors, and is a | ||
15 | feature that enables a different form of atomic memory access. Several new | ||
16 | instructions are presented to delimit transactions; transactions are | ||
17 | guaranteed to either complete atomically or roll back and undo any partial | ||
18 | changes. | ||
19 | |||
20 | A simple transaction looks like this: | ||
21 | |||
22 | begin_move_money: | ||
23 | tbegin | ||
24 | beq abort_handler | ||
25 | |||
26 | ld r4, SAVINGS_ACCT(r3) | ||
27 | ld r5, CURRENT_ACCT(r3) | ||
28 | subi r5, r5, 1 | ||
29 | addi r4, r4, 1 | ||
30 | std r4, SAVINGS_ACCT(r3) | ||
31 | std r5, CURRENT_ACCT(r3) | ||
32 | |||
33 | tend | ||
34 | |||
35 | b continue | ||
36 | |||
37 | abort_handler: | ||
38 | ... test for odd failures ... | ||
39 | |||
40 | /* Retry the transaction if it failed because it conflicted with | ||
41 | * someone else: */ | ||
42 | b begin_move_money | ||
43 | |||
44 | |||
45 | The 'tbegin' instruction denotes the start point, and 'tend' the end point. | ||
46 | Between these points the processor is in 'Transactional' state; any memory | ||
47 | references will complete in one go if there are no conflicts with other | ||
48 | transactional or non-transactional accesses within the system. In this | ||
49 | example, the transaction completes as though it were normal straight-line code | ||
50 | IF no other processor has touched SAVINGS_ACCT(r3) or CURRENT_ACCT(r3); an | ||
51 | atomic move of money from the current account to the savings account has been | ||
52 | performed. Even though the normal ld/std instructions are used (note no | ||
53 | lwarx/stwcx), either *both* SAVINGS_ACCT(r3) and CURRENT_ACCT(r3) will be | ||
54 | updated, or neither will be updated. | ||
55 | |||
56 | If, in the meantime, there is a conflict with the locations accessed by the | ||
57 | transaction, the transaction will be aborted by the CPU. Register and memory | ||
58 | state will roll back to that at the 'tbegin', and control will continue from | ||
59 | 'tbegin+4'. The branch to abort_handler will be taken this second time; the | ||
60 | abort handler can check the cause of the failure, and retry. | ||
61 | |||
62 | Checkpointed registers include all GPRs, FPRs, VRs/VSRs, LR, CCR/CR, CTR, FPCSR | ||
63 | and a few other status/flag regs; see the ISA for details. | ||
64 | |||
65 | Causes of transaction aborts | ||
66 | ============================ | ||
67 | |||
68 | - Conflicts with cache lines used by other processors | ||
69 | - Signals | ||
70 | - Context switches | ||
71 | - See the ISA for full documentation of everything that will abort transactions. | ||
72 | |||
73 | |||
74 | Syscalls | ||
75 | ======== | ||
76 | |||
77 | Performing syscalls from within transaction is not recommended, and can lead | ||
78 | to unpredictable results. | ||
79 | |||
80 | Syscalls do not by design abort transactions, but beware: The kernel code will | ||
81 | not be running in transactional state. The effect of syscalls will always | ||
82 | remain visible, but depending on the call they may abort your transaction as a | ||
83 | side-effect, read soon-to-be-aborted transactional data that should not remain | ||
84 | invisible, etc. If you constantly retry a transaction that constantly aborts | ||
85 | itself by calling a syscall, you'll have a livelock & make no progress. | ||
86 | |||
87 | Simple syscalls (e.g. sigprocmask()) "could" be OK. Even things like write() | ||
88 | from, say, printf() should be OK as long as the kernel does not access any | ||
89 | memory that was accessed transactionally. | ||
90 | |||
91 | Consider any syscalls that happen to work as debug-only -- not recommended for | ||
92 | production use. Best to queue them up till after the transaction is over. | ||
93 | |||
94 | |||
95 | Signals | ||
96 | ======= | ||
97 | |||
98 | Delivery of signals (both sync and async) during transactions provides a second | ||
99 | thread state (ucontext/mcontext) to represent the second transactional register | ||
100 | state. Signal delivery 'treclaim's to capture both register states, so signals | ||
101 | abort transactions. The usual ucontext_t passed to the signal handler | ||
102 | represents the checkpointed/original register state; the signal appears to have | ||
103 | arisen at 'tbegin+4'. | ||
104 | |||
105 | If the sighandler ucontext has uc_link set, a second ucontext has been | ||
106 | delivered. For future compatibility the MSR.TS field should be checked to | ||
107 | determine the transactional state -- if so, the second ucontext in uc->uc_link | ||
108 | represents the active transactional registers at the point of the signal. | ||
109 | |||
110 | For 64-bit processes, uc->uc_mcontext.regs->msr is a full 64-bit MSR and its TS | ||
111 | field shows the transactional mode. | ||
112 | |||
113 | For 32-bit processes, the mcontext's MSR register is only 32 bits; the top 32 | ||
114 | bits are stored in the MSR of the second ucontext, i.e. in | ||
115 | uc->uc_link->uc_mcontext.regs->msr. The top word contains the transactional | ||
116 | state TS. | ||
117 | |||
118 | However, basic signal handlers don't need to be aware of transactions | ||
119 | and simply returning from the handler will deal with things correctly: | ||
120 | |||
121 | Transaction-aware signal handlers can read the transactional register state | ||
122 | from the second ucontext. This will be necessary for crash handlers to | ||
123 | determine, for example, the address of the instruction causing the SIGSEGV. | ||
124 | |||
125 | Example signal handler: | ||
126 | |||
127 | void crash_handler(int sig, siginfo_t *si, void *uc) | ||
128 | { | ||
129 | ucontext_t *ucp = uc; | ||
130 | ucontext_t *transactional_ucp = ucp->uc_link; | ||
131 | |||
132 | if (ucp_link) { | ||
133 | u64 msr = ucp->uc_mcontext.regs->msr; | ||
134 | /* May have transactional ucontext! */ | ||
135 | #ifndef __powerpc64__ | ||
136 | msr |= ((u64)transactional_ucp->uc_mcontext.regs->msr) << 32; | ||
137 | #endif | ||
138 | if (MSR_TM_ACTIVE(msr)) { | ||
139 | /* Yes, we crashed during a transaction. Oops. */ | ||
140 | fprintf(stderr, "Transaction to be restarted at 0x%llx, but " | ||
141 | "crashy instruction was at 0x%llx\n", | ||
142 | ucp->uc_mcontext.regs->nip, | ||
143 | transactional_ucp->uc_mcontext.regs->nip); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | fix_the_problem(ucp->dar); | ||
148 | } | ||
149 | |||
150 | |||
151 | Failure cause codes used by kernel | ||
152 | ================================== | ||
153 | |||
154 | These are defined in <asm/reg.h>, and distinguish different reasons why the | ||
155 | kernel aborted a transaction: | ||
156 | |||
157 | TM_CAUSE_RESCHED Thread was rescheduled. | ||
158 | TM_CAUSE_FAC_UNAV FP/VEC/VSX unavailable trap. | ||
159 | TM_CAUSE_SYSCALL Currently unused; future syscalls that must abort | ||
160 | transactions for consistency will use this. | ||
161 | TM_CAUSE_SIGNAL Signal delivered. | ||
162 | TM_CAUSE_MISC Currently unused. | ||
163 | |||
164 | These can be checked by the user program's abort handler as TEXASR[0:7]. | ||
165 | |||
166 | |||
167 | GDB | ||
168 | === | ||
169 | |||
170 | GDB and ptrace are not currently TM-aware. If one stops during a transaction, | ||
171 | it looks like the transaction has just started (the checkpointed state is | ||
172 | presented). The transaction cannot then be continued and will take the failure | ||
173 | handler route. Furthermore, the transactional 2nd register state will be | ||
174 | inaccessible. GDB can currently be used on programs using TM, but not sensibly | ||
175 | in parts within transactions. | ||