xref: /openbmc/qemu/tests/tcg/aarch64/Makefile.target (revision b3a34eb9)
1# -*- Mode: makefile -*-
2#
3# AArch64 specific tweaks
4
5ARM_SRC=$(SRC_PATH)/tests/tcg/arm
6VPATH 		+= $(ARM_SRC)
7
8AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64
9VPATH 		+= $(AARCH64_SRC)
10
11# Base architecture tests
12AARCH64_TESTS=fcvt pcalign-a64 lse2-fault
13AARCH64_TESTS += test-2248 test-2150
14
15fcvt: LDFLAGS+=-lm
16
17run-fcvt: fcvt
18	$(call run-test,$<,$(QEMU) $<)
19	$(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref)
20
21config-cc.mak: Makefile
22	$(quiet-@)( \
23	    fnia=`$(call cc-test,-fno-integrated-as) && echo -fno-integrated-as`; \
24	    $(call cc-option,-march=armv8.1-a+sve,          CROSS_CC_HAS_SVE); \
25	    $(call cc-option,-march=armv8.1-a+sve2,         CROSS_CC_HAS_SVE2); \
26	    $(call cc-option,-march=armv8.2-a,              CROSS_CC_HAS_ARMV8_2); \
27	    $(call cc-option,-march=armv8.3-a,              CROSS_CC_HAS_ARMV8_3); \
28	    $(call cc-option,-march=armv8.5-a,              CROSS_CC_HAS_ARMV8_5); \
29	    $(call cc-option,-mbranch-protection=standard,  CROSS_CC_HAS_ARMV8_BTI); \
30	    $(call cc-option,-march=armv8.5-a+memtag,       CROSS_CC_HAS_ARMV8_MTE); \
31	    $(call cc-option,-Wa$(COMMA)-march=armv9-a+sme $$fnia, CROSS_AS_HAS_ARMV9_SME)) 3> config-cc.mak
32-include config-cc.mak
33
34ifneq ($(CROSS_CC_HAS_ARMV8_2),)
35AARCH64_TESTS += dcpop
36dcpop: CFLAGS += $(CROSS_CC_HAS_ARMV8_2)
37endif
38ifneq ($(CROSS_CC_HAS_ARMV8_5),)
39AARCH64_TESTS += dcpodp
40dcpodp: CFLAGS += $(CROSS_CC_HAS_ARMV8_5)
41endif
42
43# Pauth Tests
44ifneq ($(CROSS_CC_HAS_ARMV8_3),)
45AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5 test-2375
46pauth-%: CFLAGS += $(CROSS_CC_HAS_ARMV8_3)
47test-2375: CFLAGS += -march=armv8.3-a
48run-pauth-1: QEMU_OPTS += -cpu max
49run-pauth-2: QEMU_OPTS += -cpu max
50# Choose a cpu with FEAT_Pauth but without FEAT_FPAC for pauth-[45].
51run-pauth-4: QEMU_OPTS += -cpu neoverse-v1
52run-pauth-5: QEMU_OPTS += -cpu neoverse-v1
53endif
54
55# BTI Tests
56# bti-1 tests the elf notes, so we require special compiler support.
57ifneq ($(CROSS_CC_HAS_ARMV8_BTI),)
58AARCH64_TESTS += bti-1 bti-3
59bti-1 bti-3: CFLAGS += -fno-stack-protector $(CROSS_CC_HAS_ARMV8_BTI)
60bti-1 bti-3: LDFLAGS += -nostdlib
61endif
62# bti-2 tests PROT_BTI, so no special compiler support required.
63AARCH64_TESTS += bti-2
64
65# MTE Tests
66ifneq ($(CROSS_CC_HAS_ARMV8_MTE),)
67AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-5 mte-6 mte-7 mte-8
68mte-%: CFLAGS += $(CROSS_CC_HAS_ARMV8_MTE)
69endif
70
71# SME Tests
72ifneq ($(CROSS_AS_HAS_ARMV9_SME),)
73SME_TESTS = sme-outprod1 sme-smopa-1 sme-smopa-2 sme-fmopa-1 sme-fmopa-2 sme-fmopa-3
74AARCH64_TESTS += $(SME_TESTS)
75$(SME_TESTS): CFLAGS += $(CROSS_AS_HAS_ARMV9_SME)
76endif
77
78# System Registers Tests
79AARCH64_TESTS += sysregs
80
81AARCH64_TESTS += test-aes
82test-aes: CFLAGS += -O -march=armv8-a+aes
83test-aes: test-aes-main.c.inc
84
85# Vector SHA1
86sha1-vector: CFLAGS=-O3
87sha1-vector: sha1.c
88	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
89run-sha1-vector: sha1-vector run-sha1
90	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<)
91	$(call diff-out, sha1-vector, sha1.out)
92
93TESTS += sha1-vector
94
95# Vector versions of sha512 (-O3 triggers vectorisation)
96sha512-vector: CFLAGS=-O3
97sha512-vector: sha512.c
98	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
99
100TESTS += sha512-vector
101
102ifneq ($(CROSS_CC_HAS_SVE),)
103# SVE ioctl test
104AARCH64_TESTS += sve-ioctls
105sve-ioctls: CFLAGS += $(CROSS_CC_HAS_SVE)
106
107sha512-sve: CFLAGS=-O3 -march=armv8.1-a+sve
108sha512-sve: sha512.c
109	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
110
111sve-str: CFLAGS=-O1 -march=armv8.1-a+sve
112sve-str: sve-str.c
113	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
114
115TESTS += sha512-sve sve-str
116
117ifneq ($(GDB),)
118GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
119
120run-gdbstub-sysregs: sysregs
121	$(call run-test, $@, $(GDB_SCRIPT) \
122		--gdb $(GDB) \
123		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
124		--bin $< --test $(AARCH64_SRC)/gdbstub/test-sve.py, \
125	basic gdbstub SVE support)
126
127run-gdbstub-sve-ioctls: sve-ioctls
128	$(call run-test, $@, $(GDB_SCRIPT) \
129		--gdb $(GDB) \
130		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
131		--bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \
132	basic gdbstub SVE ZLEN support)
133
134EXTRA_RUNS += run-gdbstub-sysregs run-gdbstub-sve-ioctls
135
136ifeq ($(GDB_HAS_MTE),y)
137run-gdbstub-mte: mte-8
138	$(call run-test, $@, $(GDB_SCRIPT) \
139		--gdb $(GDB) \
140		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
141		--bin $< --test $(AARCH64_SRC)/gdbstub/test-mte.py, \
142	gdbstub MTE support)
143
144EXTRA_RUNS += run-gdbstub-mte
145endif
146
147endif
148endif
149
150ifneq ($(CROSS_CC_HAS_SVE2),)
151AARCH64_TESTS += test-826
152test-826: CFLAGS += $(CROSS_CC_HAS_SVE2)
153endif
154
155TESTS += $(AARCH64_TESTS)
156