Skip to content

Commit befdf4f

Browse files
committed
[herd] Save snapshot of aarch64.cat that corresponds to Arm ARM issue M.a
Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
1 parent 2b7921a commit befdf4f

16 files changed

+1606
-0
lines changed
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
(*
2+
* The Armv8 Application Level Memory Model.
3+
*
4+
* This is a machine-readable, executable and formal artefact, which aims to be
5+
* the latest stable version of the Armv8 memory model.
6+
* If you have comments on the content of this file, please send an email to
7+
* memory-model@arm.com
8+
* For a textual version of the model, see section B2.3 of the Armv8 ARM:
9+
* https://developer.arm.com/documentation/ddi0487/
10+
*
11+
* Authors:
12+
* Will Deacon <will.deacon@arm.com>
13+
* Jade Alglave <jade.alglave@arm.com>
14+
* Nikos Nikoleris <nikos.nikoleris@arm.com>
15+
* Artem Khyzha <artem.khyzha@arm.com>
16+
*
17+
* Copyright (C) 2016-present, Arm Ltd.
18+
* All rights reserved.
19+
*
20+
* Redistribution and use in source and binary forms, with or without
21+
* modification, are permitted provided that the following conditions are
22+
* met:
23+
*
24+
* * Redistributions of source code must retain the above copyright
25+
* notice, this list of conditions and the following disclaimer.
26+
* * Redistributions in binary form must reproduce the above copyright
27+
* notice, this list of conditions and the following disclaimer in
28+
* the documentation and/or other materials provided with the
29+
* distribution.
30+
* * Neither the name of ARM nor the names of its contributors may be
31+
* used to endorse or promote products derived from this software
32+
* without specific prior written permission.
33+
*
34+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
35+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
36+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
37+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
38+
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
39+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
40+
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45+
*)
46+
47+
catdep (* This option says that the cat file computes dependencies *)
48+
49+
include "aarch64hwreqs.cat"
50+
51+
(*** Coherence-after ***)
52+
let ca = fr | co
53+
54+
(*** TLBI-after, DC-after, IC-after ***)
55+
include "enumerations.cat"
56+
with TLBI-after from (all-TLBI-Imp_TTD_R-enums local-hw-reqs)
57+
with DC-after from (all-DC-Exp_W-enums local-hw-reqs)
58+
with IC-after from (all-IC-Imp_Instr_R-enums local-hw-reqs)
59+
60+
(*** Hazard-ordered-before ***)
61+
62+
(** Explicitly-hazard-ordered-before **)
63+
let Exp-haz-ob =
64+
[Exp & R]; (po & same-loc); [Exp & R]; sca-class?; [Exp & R]; (ca & ext); [Exp & W]; sca-class?; [Exp & W]
65+
66+
(** TLBI-ordered-before **)
67+
68+
(* TTD-read-ordered-before *)
69+
let TTD-read-ordered-before =
70+
TLBI-after; [TLBI]; po; [dsb.full]; po; [~(Imp & M)]
71+
| TLBI-after; [TLBI]; po; [dsb.full]; po; [IFB]; po; [Imp & M]
72+
| (if "ETS2" || "ETS3" then TLBI-after; [TLBI]; po; [dsb.full]; po; [Imp & TTD & M] else 0)
73+
74+
(* TLBI-ordered-before *)
75+
let TLBI-ob =
76+
TTD-read-ordered-before
77+
| tr-ib^-1; TTD-read-ordered-before & ext
78+
| po-va-loc; TTD-read-ordered-before & ext
79+
80+
(** IC-ordered-before **)
81+
82+
(* Instr-read-ordered-before *)
83+
let Instr-read-ordered-before =
84+
IC-after; [IC]; po; [dsb.full]; po; [~(Imp & M)]
85+
| (if "DIC" then ca else 0)
86+
87+
(* IC-ordered-before *)
88+
let IC-ob = [Imp & Instr & R]; po; [Imp & Instr & R]; Instr-read-ordered-before
89+
90+
(* Hazard-ordered-before *)
91+
let haz-ob =
92+
Exp-haz-ob | TLBI-ob | IC-ob
93+
94+
(*** Hardware-required-ordered-before ***)
95+
let hw-reqs = local-hw-reqs | haz-ob
96+
97+
(*** Observed-by ***)
98+
99+
(** Explicitly-observed-by **)
100+
let Exp-obs =
101+
[Exp & M]; rf & ext; [Exp & M]
102+
| [Exp & M]; ca & ext; [Exp & M]
103+
104+
(** Tag-observed-by **)
105+
let Tag-obs =
106+
[Exp & W]; rf & ext; [Imp & Tag & R]
107+
| [Imp & Tag & R]; ca & ext; [Exp & W]
108+
109+
(** TTD-observed-by **)
110+
111+
(* TLBUncacheable-coherence-after *)
112+
let TLBuncacheable-ca =
113+
[range([TLBUncacheable & FAULT]; tr-ib^-1; [Imp & TTD & R])]; ca; [Exp & W | HU]
114+
115+
(* Hardware-update-coherence-after *)
116+
let HU-ca =
117+
[Exp & R]; ca; [HU]
118+
119+
(* TLBI-coherence-after *)
120+
let TLBI-ca =
121+
[TLBI]; TLBI-after; [Imp & TTD & R]; ca; [W]
122+
123+
(* TTD-observed-by *)
124+
let TTD-obs =
125+
[Imp & TTD]; rf | rf; [Imp & TTD]
126+
| TLBuncacheable-ca
127+
| HU-ca
128+
| [HU]; ca; [W] | [W]; ca; [HU]
129+
| TLBI-ca
130+
131+
(** Instr-observed-by **)
132+
133+
(* IC-coherence-after *)
134+
let IC-ca =
135+
(if not "DIC" && not "IDC" then [IC]; IC-after; [Imp & Instr & R]; ca; [W]; DC-after; [DC.CVAU] else 0)
136+
| (if not "DIC" && "IDC" then [IC]; IC-after; [Imp & Instr & R]; ca; [W] else 0)
137+
| (if "DIC" && "IDC" then [Imp & Instr & R]; ca; [W] else 0)
138+
139+
(* Instr-observed-by *)
140+
let Instr-obs =
141+
rf; [Imp & Instr & R]
142+
| IC-after
143+
| [DC.CVAU]; DC-after; [W] | [W]; DC-after; [DC.CVAU]
144+
| IC-ca
145+
146+
(** Observed-by **)
147+
let obs =
148+
Exp-obs; sca-class?
149+
| Tag-obs; sca-class?
150+
| TTD-obs
151+
| Instr-obs
152+
153+
(*** Ordered-before ***)
154+
let rec ob =
155+
hw-reqs
156+
| obs
157+
| ob; ob
158+
159+
(*** External visibility requirement ***)
160+
irreflexive ob as external
161+
162+
(*** Internal visibility requirements ***)
163+
irreflexive [Exp & R]; ((po & same-loc) | rmw); [Exp & W]; rfi; [Exp & R] as coRW1-Exp
164+
irreflexive [Imp & Tag & R]; (po & same-loc); [Exp & Tag & W]; rfi; [Imp & Tag & R] as coRW1-MTE
165+
irreflexive [Exp & W]; (po & same-loc); [Exp & W]; (ca & int); [Exp & W] as coWW-Exp
166+
irreflexive [Exp & W]; (po & same-loc); [Exp & R]; (ca & int); [Exp & W] as coWR-Exp
167+
irreflexive [Exp & Tag & W]; (po & same-loc); [Imp & Tag & R]; (ca & int) as coWR-MTE
168+
169+
(*** Atomic: LDXR/STXR, AMO and HU constraint to forbid intervening writes. ***)
170+
empty (rmw & (fr; co)) \ (([Exp]; rmw; [Exp]) & (fri ; [Exp & W]; coi)) as atomic
171+
172+
(*** Break Before Make ***)
173+
let BBM = ([TTDV]; ca; [TTDINV]; co; [TTDV])
174+
flag ~empty (TTD-update-needsBBM & ~BBM) as requires-BBM
175+
176+
(*** Additional synchronisation requirements for CMODX ***)
177+
let CMODX-conflicts = same-loc & (
178+
(Imp & Instr & R & Within-CMODX-List) * W
179+
| (Imp & Instr & R) * (Within-CMODX-List & W)
180+
| W * (Within-CMODX-List & Imp & Instr & R)
181+
| (Within-CMODX-List & W) * (Imp & Instr & R)
182+
)
183+
184+
let CMODX-ordering =
185+
[Imp & Instr & R]; ob; [W]
186+
| [W]; ob; [Imp & Instr & R]
187+
188+
let CMODX-unordered-conflicts =
189+
CMODX-conflicts \ (CMODX-ordering | CMODX-ordering^-1)
190+
191+
flag ~empty CMODX-unordered-conflicts as violates-CMODX-requirements
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
(*
2+
* The Armv8 Application Level Memory Model.
3+
*
4+
* This is a machine-readable, executable and formal artefact, which aims to be
5+
* the latest stable version of the Armv8 memory model.
6+
* If you have comments on the content of this file, please send an email to
7+
* jade.alglave@arm.com
8+
* For a textual version of the model, see section B2.3 of the Armv8 ARM:
9+
* https://developer.arm.com/documentation/ddi0487/
10+
*
11+
* Authors:
12+
* Nikos Nikoleris <nikos.nikoleris@arm.com>
13+
*
14+
* Copyright (C) 2016-present, Arm Ltd.
15+
* All rights reserved.
16+
*
17+
* Redistribution and use in source and binary forms, with or without
18+
* modification, are permitted provided that the following conditions are
19+
* met:
20+
*
21+
* * Redistributions of source code must retain the above copyright
22+
* notice, this list of conditions and the following disclaimer.
23+
* * Redistributions in binary form must reproduce the above copyright
24+
* notice, this list of conditions and the following disclaimer in
25+
* the documentation and/or other materials provided with the
26+
* distribution.
27+
* * Neither the name of ARM nor the names of its contributors may be
28+
* used to endorse or promote products derived from this software
29+
* without specific prior written permission.
30+
*
31+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
32+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
33+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
34+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35+
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
37+
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
38+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42+
*)
43+
44+
(*
45+
* Include aarch64memattrs.cat to define relations on Memory Attributes.
46+
*)
47+
include "aarch64memattrs.cat"
48+
49+
(* Can we move this to stdlib? *)
50+
(* Coherence-after *)
51+
let ca = fr | co
52+
53+
let PTE-MT-update =
54+
[Normal]; ca; [Device]
55+
| [Device]; ca; [Normal]
56+
57+
let PTE-SH-update =
58+
[NSH]; ca; [ISH | OSH]
59+
| [ISH]; ca; [OSH | NSH]
60+
| [OSH]; ca; [NSH | ISH]
61+
62+
let PTE-ICH-update =
63+
[iNC]; ca; [iWT | iWB]
64+
| [iWT]; ca; [iWB | iNC]
65+
| [iWB]; ca; [iNC | iWT]
66+
67+
let PTE-OCH-update =
68+
[oNC]; ca; [oWT | oWB]
69+
| [oWT]; ca; [oWB | oNC]
70+
| [oWB]; ca; [oNC | oWT]
71+
72+
let PTE-DT-update =
73+
[Device-GRE]; ca; [Device-nGRE | Device-nGnRE | Device-nGnRnE]
74+
| [Device-nGRE]; ca; [Device-GRE | Device-nGnRE | Device-nGnRnE]
75+
| [Device-nGnRE]; ca; [Device-GRE | Device-nGRE | Device-nGnRnE]
76+
| [Device-nGnRnE]; ca; [Device-GRE | Device-nGRE | Device-nGnRE]
77+
78+
let PTE-OA-update = ([PTE]; ca; [PTE & oa-changes(PTE, ca^-1)])
79+
let PTE-OA-update-writable = PTE-OA-update &
80+
([PTE]; ca; [PTE & at-least-one-writable(PTE, ca^-1)])
81+
82+
let PTE-update-needsBBM = ([PTEV]; ca \ (ca; [PTEV]; ca); [PTEV]) &
83+
(PTE-MT-update | PTE-SH-update | PTE-ICH-update | PTE-OCH-update | PTE-DT-update
84+
| PTE-OA-update)
85+
86+
let TTDV = PTEV
87+
let TTDINV = PTEINV
88+
let TTD-update-needsBBM = PTE-update-needsBBM
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
(*
2+
* The Armv8 Application Level Memory Model.
3+
*
4+
* This is a machine-readable, executable and formal artefact, which aims to be
5+
* the latest stable version of the Armv8 memory model.
6+
* If you have comments on the content of this file, please send an email to
7+
* memory-model@arm.com
8+
* For a textual version of the model, see section B2.3 of the Armv8 ARM:
9+
* https://developer.arm.com/docs/ddi0487/
10+
*
11+
* Authors:
12+
* Jade Alglave <jade.alglave@arm.com>
13+
* Artem Khyzha <artem.khyzha@arm.com>
14+
*
15+
* Copyright (C) 2016-present, Arm Ltd.
16+
* All rights reserved.
17+
*
18+
* Redistribution and use in source and binary forms, with or without
19+
* modification, are permitted provided that the following conditions are
20+
* met:
21+
*
22+
* * Redistributions of source code must retain the above copyright
23+
* notice, this list of conditions and the following disclaimer.
24+
* * Redistributions in binary form must reproduce the above copyright
25+
* notice, this list of conditions and the following disclaimer in
26+
* the documentation and/or other materials provided with the
27+
* distribution.
28+
* * Neither the name of ARM nor the names of its contributors may be
29+
* used to endorse or promote products derived from this software
30+
* without specific prior written permission.
31+
*
32+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
33+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
34+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
35+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36+
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
38+
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43+
*)
44+
catdep (* This option tells that the cat file computes dependencies *)
45+
46+
include "aarch64util.cat"
47+
48+
(* Local register read successor *)
49+
let lrrs =
50+
[Wreg]; (po & same-gpr & ~(intervening(Wreg,(po & same-gpr)))); [Rreg]
51+
52+
(* Local memory write successor *)
53+
let lmws =
54+
[Exp & M | Imp & Tag & R]; (po & same-loc); [Exp & W]
55+
| [Imp & TTD & R]; (po & same-loc); [Exp & W | HU]
56+
57+
(* Local MMU Fault successor *)
58+
let lfs =
59+
[Exp & M]; (po & same-loc); [MMU & FAULT]
60+
61+
(* Local memory read successor *)
62+
let lmrs = [W]; ((po & same-loc) & ~(intervening(W,(po & same-loc)))); [R]
63+
64+
(* Dependency through registers and memory *)
65+
let rec dtrm =
66+
[~range(lxsx)]; lrrs
67+
| lmrs
68+
| iico_data
69+
| dtrm; dtrm
70+
71+
(** Data, Address and Control dependencies *)
72+
73+
let data = [Exp & R]; dtrm & po; [Rreg]; iico_data & ii_data; [Exp & W]
74+
let addr = [Exp & R]; dtrm & po; [Rreg]; iico_data & ii_addr; [Exp & M | Imp & Tag & R | Imp & TTD & R | HU | TLBI | DC.CVAU | IC.IVAU]
75+
let ctrl = [Exp & R]; dtrm & po; [Rreg]; iico_data; [BCC]; po
76+
77+
(** Pick dependencies *)
78+
let rec pick-dtrm =
79+
dtrm
80+
| iico_ctrl
81+
| pick-dtrm; pick-dtrm
82+
83+
let pick-basic-dep =
84+
[Exp & R | Rreg]; pick-dtrm?
85+
86+
let pick-addr-dep =
87+
[Exp & R]; pick-dtrm & po; [Rreg]; iico_data & ii_addr; [Exp & M | Imp & Tag & R | Imp & TTD & R | HU | TLBI | DC.CVAU | IC.IVAU]
88+
let pick-data-dep =
89+
[Exp & R]; pick-dtrm & po; [Rreg]; (iico_data | (iico_data; iico_ctrl)) & ii_data; [Exp & W]
90+
let pick-ctrl-dep =
91+
[Exp & R]; pick-dtrm & po; [Rreg]; iico_data; [BCC]; po
92+
93+
let pick-dep =
94+
( pick-basic-dep
95+
| pick-addr-dep
96+
| pick-data-dep
97+
| pick-ctrl-dep
98+
) & ~same-instance
99+
100+
include "aarch64show.cat"
101+

0 commit comments

Comments
 (0)