Skip to content

Commit 9f69bfd

Browse files
committed
[litmus] Enable check_dic_idc for presi and kvm modes
1 parent 01e990d commit 9f69bfd

5 files changed

Lines changed: 38 additions & 7 deletions

File tree

Makefile.aarch64

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,21 @@ litmus-aarch64-run:: litmus-cata-aarch64-ifetch-test-kvm
149149

150150
litmus-cata-aarch64-ifetch-test-kvm: litmus-aarch64-dep
151151
mkdir $(KUT_DIR_AARCH64)/kvm-unit-tests/t
152-
if $(RUN_TESTS); then NORUN=UDF+2FH; else NORUN=NO; fi ; \
152+
if $(RUN_TESTS); then \
153+
NORUN=UDF+2FH ; \
154+
TESTS=catalogue/aarch64-ifetch/tests/@dic0-idc0 ; \
155+
else \
156+
NORUN=NO ; \
157+
TESTS=catalogue/aarch64-ifetch/tests/@all ; \
158+
fi ; \
153159
$(LITMUS) \
154160
-set-libdir $(LITMUS_LIB_DIR) \
155161
-o $(KUT_DIR_AARCH64)/kvm-unit-tests/t \
156162
-mach kvm-armv8.1 -variant self -a 4 -s 10 -r 10 \
157163
-nonames $${NORUN} \
158164
-driver C -ascall true \
159165
-outnames $(KUT_NAMES) \
160-
catalogue/aarch64-ifetch/tests/@all
166+
$${TESTS}
161167
cd $(KUT_DIR_AARCH64)/kvm-unit-tests/t; make $(SILENTOPT) -j $(J)
162168
if $(RUN_TESTS); then \
163169
( cd $(KUT_DIR_AARCH64)/kvm-unit-tests && sh t/run.sh ) | \
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DIC0-IDC0/@all
2+
MP+rel+blr.litmus
3+
MP.FF+dc.cvau-dmb.ish+dsb.ish-ic.ivau-dsb.ish-rfiINSTNOP.litmus
4+
MP.FF+dc.cvau-dsb.ish-ic.ivau-dsb.ish+dmb.ish+rfiINST.litmus
5+
MP.FF+dc.cvau-dsb.ish-ic.ivau-dsb.ish+po.litmus
6+
MP.RF+dc.cvau-dmb.ish+dsb.ish.ic.ivau.dsb-rfiINSTRISB.litmus
7+
SM.udf+dc.cvau+dsb.ish-ic.vau-dsb.ish-isb.litmus
8+
mytest2.litmus

litmus/libdir/_aarch64/self.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ inline static void isync(void) {
4444
asm __volatile__ ("isb" ::: "memory");
4545
}
4646

47-
inline static void check_dic_idc(int need_dic, int need_idc) {
47+
inline static int check_dic_idc(int need_dic, int need_idc) {
4848
uint64_t ctr_el0;
4949
asm volatile ("mrs %0, ctr_el0" : "=r" (ctr_el0));
5050
int idc = (ctr_el0 >> 28) & 1;
5151
int dic = (ctr_el0 >> 29) & 1;
5252
if ((need_dic && !dic) || (need_idc && !idc)) {
53-
fprintf(stderr, "Fatal error: hardware does not support the CacheType "
54-
"feature IDC=%d, DIC=%d\n", need_idc, need_dic);
55-
exit(0);
53+
printf("Required hardware features not available on this system: "
54+
"IDC=%d, DIC=%d\n", idc, dic);
55+
return 0;
5656
}
57+
return 1;
5758
}

litmus/preSi.ml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,6 +2451,22 @@ module Make
24512451
O.fi "if (!check_const_pac_field_variant(%S)) return 0;" doc.Name.name;
24522452
if Cfg.is_kvm && Cfg.variant Variant_litmus.ExS then
24532453
O.fi "if (!check_exs(%S)) return 0;" doc.Name.name ;
2454+
if do_self then begin
2455+
let cache_type = CacheType.get test.T.info in
2456+
let needs_dic, needs_idc =
2457+
let open CacheType in
2458+
match cache_type with
2459+
| None -> (fun _ -> false), (fun _ -> false)
2460+
| Some cache_type -> cache_type.dic, cache_type.idc in
2461+
(* Arm ARM: CTR_EL0.DIC/IDC are common within an Inner Shareable domain. *)
2462+
begin match forall_procs test needs_dic, forall_procs test needs_idc with
2463+
| Some dic, Some idc ->
2464+
O.fi "if (!check_dic_idc(%d, %d)) return 0;"
2465+
(if dic then 1 else 0)
2466+
(if idc then 1 else 0)
2467+
| _ -> ()
2468+
end
2469+
end ;
24542470
if Cfg.is_kvm then begin
24552471
match db with
24562472
| None ->

litmus/skel.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ module Make
17741774
(fun _ -> false), (fun _ -> false)
17751775
| Some cache_type ->
17761776
cache_type.dic, cache_type.idc in
1777-
O.fi "check_dic_idc(%d, %d);"
1777+
O.fi "if (!check_dic_idc(%d, %d)) return NULL;"
17781778
(if needs_dic proc then 1 else 0)
17791779
(if needs_idc proc then 1 else 0)
17801780
end ;

0 commit comments

Comments
 (0)