Skip to content

Commit ff89561

Browse files
committed
[litmus] Enable check_dic_idc for presi and kvm modes
1 parent 2d1712a commit ff89561

File tree

5 files changed

+45
-9
lines changed

5 files changed

+45
-9
lines changed

Makefile.aarch64

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,30 @@ 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 ; \
153152
$(LITMUS) \
154153
-set-libdir $(LITMUS_LIB_DIR) \
155154
-o $(KUT_DIR_AARCH64)/kvm-unit-tests/t \
156155
-mach kvm-armv8.1 -variant self -a 4 -s 10 -r 10 \
157-
-nonames $${NORUN} \
158156
-driver C -ascall true \
159157
-outnames $(KUT_NAMES) \
160158
catalogue/aarch64-ifetch/tests/@all
161159
cd $(KUT_DIR_AARCH64)/kvm-unit-tests/t; make $(SILENTOPT) -j $(J)
162160
if $(RUN_TESTS); then \
163-
( cd $(KUT_DIR_AARCH64)/kvm-unit-tests && sh t/run.sh ) | \
164-
$(CHECK_OBS) -verbose $(KUT_NAMES) ; \
161+
mkdir $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run ; \
162+
NORUN=UDF+2FH ; \
163+
$(LITMUS) \
164+
-set-libdir $(LITMUS_LIB_DIR) \
165+
-o $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run \
166+
-mach kvm-armv8.1 -variant self -a 4 -s 10 -r 10 \
167+
-nonames $${NORUN} \
168+
-driver C -ascall true \
169+
-outnames $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run/names.txt \
170+
catalogue/aarch64-ifetch/tests/@dic0-idc0 ; \
171+
cd $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run; make $(SILENTOPT) -j $(J) ; \
172+
( cd $(KUT_DIR_AARCH64)/kvm-unit-tests && sh t-ifetch-run/run.sh ) | \
173+
$(CHECK_OBS) -verbose $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run/names.txt ; \
165174
fi
175+
$(RM) -r $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run
166176
$(RM) -r $(KUT_DIR_AARCH64)/kvm-unit-tests/t
167177
@ echo "litmus7 in -mode kvm catalogue aarch64-ifetch tests: OK"
168178

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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.FF+dc.cvau-dsb.ish-ic.vau-dsb.ish+dmb.ish+rfiINST.litmus
7+
MP.RF+dc.cvau-dmb.ish+dsb.ish.ic.ivau.dsb-rfiINSTRISB.litmus
8+
SM.udf+dc.cvau+dsb.ish-ic.vau-dsb.ish-isb.litmus
9+
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
@@ -2424,6 +2424,22 @@ module Make
24242424
end ;
24252425
if Cfg.variant Variant_litmus.ConstPacField then
24262426
O.fi "if (!check_const_pac_field_variant(%S)) return 0;" doc.Name.name;
2427+
if do_self then begin
2428+
let cache_type = CacheType.get test.T.info in
2429+
let needs_dic, needs_idc =
2430+
let open CacheType in
2431+
match cache_type with
2432+
| None -> (fun _ -> false), (fun _ -> false)
2433+
| Some cache_type -> cache_type.dic, cache_type.idc in
2434+
(* Arm ARM: CTR_EL0.DIC/IDC are common within an Inner Shareable domain. *)
2435+
begin match forall_procs test needs_dic, forall_procs test needs_idc with
2436+
| Some dic, Some idc ->
2437+
O.fi "if (!check_dic_idc(%d, %d)) return 0;"
2438+
(if dic then 1 else 0)
2439+
(if idc then 1 else 0)
2440+
| _ -> ()
2441+
end
2442+
end ;
24272443
if Cfg.is_kvm then begin
24282444
match db with
24292445
| 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)