Skip to content

Commit 56e8ddf

Browse files
artkhyzharelokin
authored andcommitted
[AARCH-24571,herd] Fixes in aarch64.cat relating to FEAT_HAFDBS
This change implements AARCH-24571 as published in the Arm Architecture Reference Manual for A-profile architecture: Known issues in Issue L.b. With FEAT_HAFDBS, in the case where one PE, P0, is configured with hardware updates of Dirty state enabled (TCR_ELx.{HA, HD}={1, 1}), but another PE, P1, using the same translation tables is configured with hardware updates of Dirty state disabled ((TCR_ELx.{HA, HD}={x, 0}), the following scenario can occur: * P1 has a copy of a writable-clean translation table entry cached in a TLB. * P0 performs a hardware update of Dirty state for that translation table entry. * A store is attempted on P1, and this hits the writable-clean translation table entry cached in the TLB. The architecture permits the store on P1 to generate a Permission fault, because P1 has hardware updates of Dirty state disabled. However, the formal memory model did not permit this outcome. The changes below relax the memory model to permit this outcome, and therefore match the rules described in section D8.5.2.1 "Hardware management of the dirty state". As a result the following test is architecturally forbidden: AArch64 S.HU+dsb.sy+dsb.sy-isb Variant=vmsa TTHM=P0:HD { [TTD(x)]=(oa:PA(x), dbm:1, db:0); 0:X1=x; 0:X3=y; 1:X1=x; 1:X3=y; } P0 | P1 ; MOV W0,#1 | LDR W2,[X3] ; STR W0,[X1] | DSB SY ; DSB SY | ISB ; MOV W2,#1 | MOV W0,#2 ; STR W2,[X3] | STR W0,[X1] ; exists (1:X2=1 /\ fault(P1,x)) In addition, in the case where a PE is configured with hardware updates of Dirty state enabled (TCR_ELx.{HA, HD}={1, 1}), the architecture forbids the hardware update of Dirty state on the PE until the associated store is known to be non-speculative and, therefore, ahead of the address translation or the tag check of an instruction earlier in program order. However, the formal memory model allowed such an outcome to be observed. The changes below strengthen the memory model to forbid this outcome, and therefore match the rules described in section D8.5.2.1 "Hardware management of the dirty state". As a result, the following test is architecturally forbidden: AArch64 S.HU+dmb.st+po-ttd TTHM=P1:HD Variant=vmsa,fatal { [TTD(x)]=(oa:PA(x), dbm:1, db:0); [TTD(y)]=(oa:PA(y), valid:0); pteval_t 0:X6=(oa:PA(y), valid:1); 0:X7=TTD(y); pteval_t 0:X8=(oa:PA(x), dbm:1, db:0); 0:X9=TTD(x); 1:X1=x; 1:X3=y; } P0 | P1 ; STR X8,[X9] | L0: LDR WZR,[X3] ; DMB ST | MOV W0,#1 ; STR X6,[X7] | L1: STR W0,[X1] ; exists (not (fault(P1:L0)) /\ [TTD(x)]=(oa:PA(x), dbm:1, db:0)) and the following test is architecturally forbidden: AArch64 S.HU+dmb.st+po-tag TTHM=P1:HD Variant=vmsa,fatal,mte,sync { [TTD(x)]=(oa:PA(x), dbm:1, db:0); [TTD(y)]=(oa:PA(y), TaggedNormal); 0:X6=y:red; 0:X7=y:green; pteval_t 0:X8=(oa:PA(x), dbm:1, db:0); 0:X9=TTD(x); 1:X1=x; 1:X3=y:red; } P0 | P1 ; STR X8,[X9] | L0: LDR WZR,[X3] ; DMB ST | MOV W0,#1 ; STG X6,[X7] | L1: STR WZR,[X1] ; exists (not (fault(P1:L0)) /\ [TTD(x)]=(oa:PA(x), dbm:1, db:0)) Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
1 parent 52f25fb commit 56e8ddf

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

catalogue/aarch64-VMSA/tests/VMSA-kinds.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ D15347-2+2WExpNExp+DMBST+DSB-ISB Allowed
621621
Artem2+TLBIx-HDy+dsb.ish Forbidden
622622
2+2WNExpExp+NExpNExp+SHOW Forbidden
623623
F2.mod-with-type+BBM-DSB-ISB Forbidden
624-
2+2WNExpExp+NExpNExp+DMBST+DMBST Allowed
624+
2+2WNExpExp+NExpNExp+DMBST+DMBST Forbidden
625625
2+2WNExpExp+NExpNExp+DMBST+DMBST+SHOW Forbidden
626626
Artem2+TLBIx-TLBIy+dmb2 Forbidden
627627
Artem3+UCx-TLBIy+dsb.ish-isb+dmb.ld Forbidden

herd/libdir/aarch64.cat

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ let Tag-obs =
108108

109109
(** TTD-observed-by **)
110110

111-
(* TLBUncacheable-predecessor *)
112-
let TLBuncacheable-pred =
113-
[range([TLBUncacheable & FAULT]; tr-ib^-1)]; (ca & ~intervening(W,ca)); [Exp & W]
111+
(* TLBUncacheable-coherence-after *)
112+
let TLBuncacheable-ca =
113+
[range([TLBUncacheable & FAULT]; tr-ib^-1; [Imp & TTD & R])]; ca; [Exp & W | HU]
114114

115-
(* Hardware-update-predecessor *)
116-
let HU-pred =
117-
(ca & ~intervening(W,ca)); [HU]
115+
(* Hardware-update-coherence-after *)
116+
let HU-ca =
117+
[Exp & R]; ca; [HU]
118118

119119
(* TLBI-coherence-after *)
120120
let TLBI-ca =
@@ -123,8 +123,8 @@ let TLBI-ca =
123123
(* TTD-observed-by *)
124124
let TTD-obs =
125125
[Imp & TTD]; rf | rf; [Imp & TTD]
126-
| TLBuncacheable-pred
127-
| HU-pred
126+
| TLBuncacheable-ca
127+
| HU-ca
128128
| [HU]; ca; [W] | [W]; ca; [HU]
129129
| TLBI-ca
130130

herd/libdir/aarch64hwreqs.cat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ let dob =
9797
| addr; [Exp & M]; po; [Exp & W | HU]
9898
| addr; [Exp & M]; lmrs; [Exp & R | Imp & Tag & R]
9999
| data; [Exp & M]; lmrs; [Exp & R | Imp & Tag & R]
100-
| [Imp & TTD & R]; tr-ib; [Exp & M]; po; [Exp & W]
101-
| [Imp & Tag & R]; tc-before; [Exp & M]; po; [Exp & W]
100+
| [Imp & TTD & R]; tr-ib; [Exp & M]; po; [Exp & W | HU]
101+
| [Imp & Tag & R]; tc-before; [Exp & M]; po; [Exp & W | HU]
102102

103103
(* Fetch-ordered-before *)
104104
let f-ob =

herd/libdir/catdefinitions.tex

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -380,18 +380,12 @@
380380
\newcommand{\ob}[2]{#1 is Ordered-before #2}
381381
\newcommand{\obemph}[2]{#1 is \emph{Ordered-before} #2}
382382

383-
\newcommand{\TLBuncacheablepredname}{a TLBUncacheable-Write-Predecessor of}
384-
\newcommand{\TLBuncacheablepred}[2]{#1 is a TLBUncacheable-Write-Predecessor of #2}
385-
\newcommand{\TLBuncacheablepredemph}[2]{#1 is \emph{a TLBUncacheable-Write-Predecessor of} #2}
386-
\newcommand{\TLBuncacheablesuccname}{a TLBUncacheable-Write-Successor of}
387-
\newcommand{\TLBuncacheablesucc}[2]{#1 is a TLBUncacheable-Write-Successor of #2}
388-
\newcommand{\TLBuncacheablesuccemph}[2]{#1 is \emph{a TLBUncacheable-Write-Successor of} #2}
389-
\newcommand{\HUpredname}{a Hardware-Update-Predecessor of}
390-
\newcommand{\HUpred}[2]{#1 is a Hardware-Update-Predecessor of #2}
391-
\newcommand{\HUpredemph}[2]{#1 is \emph{a Hardware-Update-Predecessor of} #2}
392-
\newcommand{\HUsuccname}{a Hardware-Update-Successor of}
393-
\newcommand{\HUsucc}[2]{#1 is a Hardware-Update-Successor of #2}
394-
\newcommand{\HUsuccemph}[2]{#1 is \emph{a Hardware-Update-Successor of} #2}
383+
\newcommand{\TLBuncacheablecaname}{TLBUncacheable-coherence-before}
384+
\newcommand{\TLBuncacheableca}[2]{#1 is \TLBuncacheablecaname{} #2}
385+
\newcommand{\TLBuncacheablecaemph}[2]{#1 is \emph{\TLBuncacheablecaname{}} #2}
386+
\newcommand{\HUcaname}{Hardware-Update-coherence-before}
387+
\newcommand{\HUca}[2]{#1 is \HUcaname{} #2}
388+
\newcommand{\HUcaemph}[2]{#1 is \emph{\HUcaname{}} #2}
395389

396390
%
397391
\newcommand{\rangelxsx}[1]{#1 is generated by a Store-Exclusive instruction as part of \lxsx}

0 commit comments

Comments
 (0)