Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Makefile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,30 @@ litmus-aarch64-run:: litmus-cata-aarch64-ifetch-test-kvm

litmus-cata-aarch64-ifetch-test-kvm: litmus-aarch64-dep
mkdir $(KUT_DIR_AARCH64)/kvm-unit-tests/t
if $(RUN_TESTS); then NORUN=UDF+2FH; else NORUN=NO; fi ; \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't you just do something along the lines of:

Suggested change
if $(RUN_TESTS); then NORUN=UDF+2FH; else NORUN=NO; fi ; \
if $(RUN_TESTS); then \
NORUN=UDF+2FH \
TESTS=catalogue/aarch64-ifetch/tests/@dic0-idc0 \
else \
NORUN=NP \
TESTS=catalogue/aarch64-ifetch/tests/@all \
fi \

and then leave the recipe common for both?

Copy link
Copy Markdown
Contributor Author

@diaolo01 diaolo01 Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would result in the DIC1/IDC1 tests not being compiled when RUN_TESTS=TRUE, which I don't think is acceptable.

$(LITMUS) \
-set-libdir $(LITMUS_LIB_DIR) \
-o $(KUT_DIR_AARCH64)/kvm-unit-tests/t \
-mach kvm-armv8.1 -variant self -a 4 -s 10 -r 10 \
-nonames $${NORUN} \
-driver C -ascall true \
-outnames $(KUT_NAMES) \
catalogue/aarch64-ifetch/tests/@all
cd $(KUT_DIR_AARCH64)/kvm-unit-tests/t; make $(SILENTOPT) -j $(J)
if $(RUN_TESTS); then \
( cd $(KUT_DIR_AARCH64)/kvm-unit-tests && sh t/run.sh ) | \
$(CHECK_OBS) -verbose $(KUT_NAMES) ; \
mkdir $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run ; \
NORUN=UDF+2FH ; \
$(LITMUS) \
-set-libdir $(LITMUS_LIB_DIR) \
-o $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run \
-mach kvm-armv8.1 -variant self -a 4 -s 10 -r 10 \
-nonames $${NORUN} \
-driver C -ascall true \
-outnames $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run/names.txt \
catalogue/aarch64-ifetch/tests/@dic0-idc0 ; \
( cd $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run && make $(SILENTOPT) -j $(J) ) ; \
( cd $(KUT_DIR_AARCH64)/kvm-unit-tests && sh t-ifetch-run/run.sh ) | \
$(CHECK_OBS) -verbose $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run/names.txt ; \
fi
$(RM) -r $(KUT_DIR_AARCH64)/kvm-unit-tests/t-ifetch-run
$(RM) -r $(KUT_DIR_AARCH64)/kvm-unit-tests/t
@ echo "litmus7 in -mode kvm catalogue aarch64-ifetch tests: OK"

Expand Down
8 changes: 8 additions & 0 deletions catalogue/aarch64-ifetch/tests/@dic0-idc0
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DIC0-IDC0/@all
MP+rel+blr.litmus
MP.FF+dc.cvau-dmb.ish+dsb.ish-ic.ivau-dsb.ish-rfiINSTNOP.litmus
MP.FF+dc.cvau-dsb.ish-ic.ivau-dsb.ish+dmb.ish+rfiINST.litmus
MP.FF+dc.cvau-dsb.ish-ic.ivau-dsb.ish+po.litmus
MP.RF+dc.cvau-dmb.ish+dsb.ish.ic.ivau.dsb-rfiINSTRISB.litmus
SM.udf+dc.cvau+dsb.ish-ic.vau-dsb.ish-isb.litmus
mytest2.litmus
9 changes: 5 additions & 4 deletions litmus/libdir/_aarch64/self.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ inline static void isync(void) {
asm __volatile__ ("isb" ::: "memory");
}

inline static void check_dic_idc(int need_dic, int need_idc) {
inline static int check_dic_idc(int need_dic, int need_idc) {
uint64_t ctr_el0;
asm volatile ("mrs %0, ctr_el0" : "=r" (ctr_el0));
int idc = (ctr_el0 >> 28) & 1;
int dic = (ctr_el0 >> 29) & 1;
if ((need_dic && !dic) || (need_idc && !idc)) {
fprintf(stderr, "Fatal error: hardware does not support the CacheType "
"feature IDC=%d, DIC=%d\n", need_idc, need_dic);
exit(0);
printf("Required hardware features not available on this system: "
"IDC=%d, DIC=%d\n", idc, dic);
return 0;
}
return 1;
}
16 changes: 16 additions & 0 deletions litmus/preSi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2432,6 +2432,22 @@ module Make
end ;
if Cfg.variant Variant_litmus.ConstPacField then
O.fi "if (!check_const_pac_field_variant(%S)) return 0;" doc.Name.name;
if do_self then begin
let cache_type = CacheType.get test.T.info in
let needs_dic, needs_idc =
let open CacheType in
match cache_type with
| None -> (fun _ -> false), (fun _ -> false)
| Some cache_type -> cache_type.dic, cache_type.idc in
(* Arm ARM: CTR_EL0.DIC/IDC are common within an Inner Shareable domain. *)
begin match forall_procs test needs_dic, forall_procs test needs_idc with
| Some dic, Some idc ->
O.fi "if (!check_dic_idc(%d, %d)) return 0;"
(if dic then 1 else 0)
(if idc then 1 else 0)
| _ -> ()
end
end ;
if Cfg.is_kvm then begin
match db with
| None ->
Expand Down
2 changes: 1 addition & 1 deletion litmus/skel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ module Make
(fun _ -> false), (fun _ -> false)
| Some cache_type ->
cache_type.dic, cache_type.idc in
O.fi "check_dic_idc(%d, %d);"
O.fi "if (!check_dic_idc(%d, %d)) return NULL;"
(if needs_dic proc then 1 else 0)
(if needs_idc proc then 1 else 0)
end ;
Expand Down
Loading