From nobody Tue Feb 10 11:17:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1648741331458350.1885367314942; Thu, 31 Mar 2022 08:42:11 -0700 (PDT) Received: from localhost ([::1]:46420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZww6-0008VE-Cg for importer@patchew.org; Thu, 31 Mar 2022 11:42:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZwfX-0003SV-9X; Thu, 31 Mar 2022 11:25:03 -0400 Received: from [187.72.171.209] (port=51585 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZwfR-0004ne-Go; Thu, 31 Mar 2022 11:25:02 -0400 Received: from p9ibm ([10.10.71.235]) by outlook.eldorado.org.br over TLS secured channel with Microsoft SMTPSVC(8.5.9600.16384); Thu, 31 Mar 2022 12:24:02 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by p9ibm (Postfix) with ESMTP id 3ACE88014EA; Thu, 31 Mar 2022 11:58:44 -0300 (-03) From: Leandro Lupori To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [RFC PATCH v2 5/5] tests/tcg/ppc64: build PowerNV and LE tests Date: Thu, 31 Mar 2022 11:58:13 -0300 Message-Id: <20220331145813.21719-6-leandro.lupori@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220331145813.21719-1-leandro.lupori@eldorado.org.br> References: <20220331145813.21719-1-leandro.lupori@eldorado.org.br> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 31 Mar 2022 15:24:02.0484 (UTC) FILETIME=[5A0BAF40:01D84513] X-Host-Lookup-Failed: Reverse DNS lookup failed for 187.72.171.209 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=187.72.171.209; envelope-from=leandro.lupori@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, PDS_HP_HELO_NORDNS=0.659, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UPPERCASE_50_75=0.008 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leandro Lupori , danielhb413@gmail.com, richard.henderson@linaro.org, groug@kaod.org, clg@kaod.org, pbonzini@redhat.com, alex.bennee@linaro.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1648741332556100001 Content-Type: text/plain; charset="utf-8" Each Microwatt/PowerNV test use its own head.S file and thus needs different build rules. Also add rules to build and run all tests in LE mode. Signed-off-by: Leandro Lupori --- tests/tcg/ppc64/Makefile.softmmu-rules | 34 +++++++ tests/tcg/ppc64/Makefile.softmmu-target | 119 ++++++++++++++++++------ 2 files changed, 126 insertions(+), 27 deletions(-) create mode 100644 tests/tcg/ppc64/Makefile.softmmu-rules diff --git a/tests/tcg/ppc64/Makefile.softmmu-rules b/tests/tcg/ppc64/Makef= ile.softmmu-rules new file mode 100644 index 0000000000..abe0de0a7f --- /dev/null +++ b/tests/tcg/ppc64/Makefile.softmmu-rules @@ -0,0 +1,34 @@ +# +# Rules to build PowerPC64 softmmu tests, for both BE and LE +# + +# Build CRT and test objects +%$(LE_SUFFIX).o: $(CRT_PATH)/%.S + $(CC) $(PPC64_CFLAGS) -x assembler-with-cpp -c $< -o $@ + +%$(LE_SUFFIX).o: %.S + $(CC) $(PPC64_CFLAGS) -x assembler-with-cpp -c $< -o $@ + +%$(LE_SUFFIX).o: $(CRT_PATH)/%.c + $(CC) $(PPC64_CFLAGS) -c $< -o $@ + +%$(LE_SUFFIX).o: %.c + $(CC) $(PPC64_CFLAGS) -c $< -o $@ + +# Build .elf files for debugging +%$(LE_SUFFIX).elf: %$(LE_SUFFIX).o $(LINK_SCRIPT) $(CRT_DEPS) $(MINILIB_DE= PS) + $(CC) $(PPC64_CFLAGS) -o $@ $< $(LDFLAGS) + +$(PPC64_PNV_ELFS): %$(LE_SUFFIX).elf: %-head$(LE_SUFFIX).o %$(LE_SUFFIX).o= \ + $(LINK_SCRIPT) $(CRT_DEPS) $(MINILIB_DEPS) + $(CC) $(PPC64_CFLAGS) -o $@ $< $*$(LE_SUFFIX).o $(LDFLAGS) + +# Build test binaries +%$(LE_SUFFIX): %$(LE_SUFFIX).o $(LINK_SCRIPT) $(CRT_DEPS) $(MINILIB_DEPS) \ + %$(LE_SUFFIX).elf + $(CC) $(PPC64_CFLAGS) -o $@ $< $(LDFLAGS) -Wl,--oformat=3Dbinary + +$(PPC64_PNV_TESTS): %$(LE_SUFFIX): %-head$(LE_SUFFIX).o %$(LE_SUFFIX).o \ + $(LINK_SCRIPT) $(CRT_DEPS) $(MINILIB_DEPS) %$(LE_SUFFI= X).elf + $(CC) $(PPC64_CFLAGS) -o $@ $< $*$(LE_SUFFIX).o $(LDFLAGS) \ + -Wl,--oformat=3Dbinary diff --git a/tests/tcg/ppc64/Makefile.softmmu-target b/tests/tcg/ppc64/Make= file.softmmu-target index 8f9925ca5a..03d5d3e426 100644 --- a/tests/tcg/ppc64/Makefile.softmmu-target +++ b/tests/tcg/ppc64/Makefile.softmmu-target @@ -5,25 +5,52 @@ # For now, disable tests that are failing DISABLED_TESTS :=3D memory DISABLED_EXTRA_RUNS :=3D run-gdbstub-memory +# Disable LE tests too +DISABLED_TESTS +=3D $(addsuffix -le, $(DISABLED_TESTS)) +DISABLED_EXTRA_RUNS +=3D $(addsuffix -le, $(DISABLED_EXTRA_RUNS)) =20 -PPC64_SYSTEM_SRC=3D$(SRC_PATH)/tests/tcg/ppc64/system -VPATH+=3D$(PPC64_SYSTEM_SRC) +PPC64_SRC :=3D $(SRC_PATH)/tests/tcg/ppc64 +PPC64_SYSTEM_SRC :=3D $(PPC64_SRC)/system +VPATH +=3D $(PPC64_SYSTEM_SRC) =20 # These objects provide the basic boot code and helper functions for all t= ests -CRT_PATH=3D$(PPC64_SYSTEM_SRC)/lib -CRT_OBJS=3Dboot.o console.o +CRT_PATH :=3D $(PPC64_SYSTEM_SRC)/lib +CRT_OBJS_BE :=3D boot.o console.o +CRT_OBJS_LE :=3D $(patsubst %.o, %-le.o, $(CRT_OBJS_BE)) +# NOTE: %-head.o replaces boot.o on PowerNV tests +PNV_CRT_OBJS_BE :=3D $(filter-out boot.o, $(CRT_OBJS_BE)) +PNV_CRT_OBJS_LE :=3D $(filter-out boot-le.o, $(CRT_OBJS_LE)) =20 -PPC64_TEST_SRCS=3D$(wildcard $(PPC64_SYSTEM_SRC)/*.c) -PPC64_TESTS=3D$(patsubst $(PPC64_SYSTEM_SRC)/%.c, %, $(PPC64_TEST_SRCS)) +MINILIB_OBJS_BE :=3D $(MINILIB_OBJS) +MINILIB_OBJS_LE :=3D $(patsubst %.o, %-le.o, $(MINILIB_OBJS)) =20 -LINK_SCRIPT=3D$(CRT_PATH)/powerpc.lds -# NOTE: --build-id is stored before the first code section in the linked -# binary, which causes problems for most tests, that expect to -# begin at address 0. -LDFLAGS=3D-Wl,-T$(LINK_SCRIPT) -Wl,--build-id=3Dnone -static -nostdlib \ - $(CRT_OBJS) $(MINILIB_OBJS) -lgcc -TESTS +=3D $(filter-out $(DISABLED_TESTS),$(PPC64_TESTS) $(MULTIARCH_TESTS= )) -EXTRA_RUNS +=3D $(filter-out $(DISABLED_EXTRA_RUNS),$(MULTIARCH_RUNS)) +# Add BE and LE tests + +# Each Microwatt/PowerNV test use its own head.S file and thus needs +# different rules. +PPC64BE_PNV_TESTS :=3D mmu +PPC64BE_PNV_ELFS :=3D $(addsuffix .elf, $(PPC64BE_PNV_TESTS)) +PPC64LE_PNV_TESTS :=3D $(addsuffix -le, $(PPC64BE_PNV_TESTS)) +PPC64LE_PNV_ELFS :=3D $(addsuffix .elf, $(PPC64LE_PNV_TESTS)) + +# Remaining test sources are assumed to be non-PowerNV tests +PPC64_TEST_SRCS :=3D $(wildcard $(PPC64_SYSTEM_SRC)/*.c) +PPC64BE_TESTS :=3D $(MULTIARCH_TESTS) +PPC64BE_TESTS +=3D $(filter-out $(PPC64BE_PNV_TESTS),\ + $(patsubst $(PPC64_SYSTEM_SRC)/%.c, %, $(PPC64_TEST_SRCS)= )) +PPC64BE_ELFS :=3D $(addsuffix .elf,$(PPC64BE_TESTS)) +PPC64LE_TESTS :=3D $(addsuffix -le, $(PPC64BE_TESTS)) +PPC64LE_ELFS :=3D $(addsuffix .elf,$(PPC64LE_TESTS)) + +TESTS +=3D $(filter-out $(DISABLED_TESTS), $(PPC64BE_TESTS) $(PPC64LE_TEST= S)) +TESTS +=3D $(PPC64BE_PNV_TESTS) $(PPC64LE_PNV_TESTS) + +MULTIARCH_RUNS_BE :=3D $(MULTIARCH_RUNS) +MULTIARCH_RUNS_LE :=3D $(addsuffix -le, $(MULTIARCH_RUNS)) +EXTRA_RUNS +=3D $(filter-out $(DISABLED_EXTRA_RUNS), \ + $(MULTIARCH_RUNS_BE) $(MULTIARCH_RUNS_LE)) + +LINK_SCRIPT :=3D $(CRT_PATH)/powerpc.lds =20 # NOTE: -Os doesn't work well with -Wl,--oformat=3Dbinary # Some linker generated functions, such as savegpr*/restgpr*, @@ -33,26 +60,64 @@ CFLAGS =3D -O -g -Wall -std=3Dc99 -msoft-float -mno-vsx= -mno-altivec \ -I $(PPC64_SYSTEM_SRC)/include $(MINILIB_INC) \ -mcpu=3Dpower8 =20 +# NOTE: --build-id is stored before the first code section in the linked +# binary, which causes problems for most tests, that expect to +# begin at address 0. +LDFLAGS =3D -Wl,-T$(LINK_SCRIPT) -Wl,--build-id=3Dnone -static -nostdlib \ + $(CRT_OBJS) $(MINILIB_OBJS) -lgcc + +memory memory-le: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 + +# PowerNV tests build outputs +PPC64BE_PNV_OUTPUTS :=3D $(PPC64BE_PNV_TESTS) $(PPC64BE_PNV_ELFS) +PPC64LE_PNV_OUTPUTS :=3D $(PPC64LE_PNV_TESTS) $(PPC64LE_PNV_ELFS) +# Non-PowerNV tests build outputs +PPC64BE_OUTPUTS :=3D $(PPC64BE_TESTS) $(PPC64BE_ELFS) +PPC64LE_OUTPUTS :=3D $(PPC64LE_TESTS) $(PPC64LE_ELFS) +# Outputs of all tests +PPC64BE_ALL_OUTPUTS :=3D $(PPC64BE_OUTPUTS) $(PPC64BE_PNV_OUTPUTS) +PPC64LE_ALL_OUTPUTS :=3D $(PPC64LE_OUTPUTS) $(PPC64LE_PNV_OUTPUTS) + +PPC64_CFLAGS =3D $(CFLAGS) $(EXTRA_CFLAGS) $(PPC64LE_CFLAGS) + # Leave the .elf files, to make debugging easier -.PRECIOUS: $(CRT_OBJS) $(addsuffix .elf,$(TESTS)) +.PRECIOUS: $(CRT_OBJS_BE) $(CRT_OBJS_LE) $(addsuffix .elf,$(TESTS)) + +# BE rules + +LE_SUFFIX :=3D +CRT_DEPS :=3D $(CRT_OBJS_BE) +MINILIB_DEPS :=3D $(MINILIB_OBJS_BE) +PPC64_PNV_ELFS :=3D $(PPC64BE_PNV_ELFS) +PPC64_PNV_TESTS :=3D $(PPC64BE_PNV_TESTS) + +$(PPC64BE_ALL_OUTPUTS): LE_SUFFIX =3D +$(PPC64BE_ALL_OUTPUTS): PPC64LE_CFLAGS =3D +$(PPC64BE_OUTPUTS): CRT_OBJS =3D $(CRT_OBJS_BE) +$(PPC64BE_PNV_OUTPUTS): CRT_OBJS =3D $(PNV_CRT_OBJS_BE) +$(PPC64BE_ALL_OUTPUTS): MINILIB_OBJS =3D $(MINILIB_OBJS_BE) =20 -# Build CRT objects -%.o: $(CRT_PATH)/%.S - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ +include $(PPC64_SRC)/Makefile.softmmu-rules =20 -%.o: $(CRT_PATH)/%.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ +# LE rules =20 -# Build and link the tests +LE_SUFFIX :=3D -le +CRT_DEPS :=3D $(CRT_OBJS_LE) +MINILIB_DEPS :=3D $(MINILIB_OBJS_LE) +PPC64_PNV_ELFS :=3D $(PPC64LE_PNV_ELFS) +PPC64_PNV_TESTS :=3D $(PPC64LE_PNV_TESTS) =20 -# The .elf files are just for debugging -%.elf: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) +$(PPC64LE_ALL_OUTPUTS): LE_SUFFIX =3D -le +$(PPC64LE_ALL_OUTPUTS): PPC64LE_CFLAGS =3D -mlittle-endian -mabi=3Delfv2 +$(PPC64LE_OUTPUTS): CRT_OBJS =3D $(CRT_OBJS_LE) +$(PPC64LE_PNV_OUTPUTS): CRT_OBJS =3D $(PNV_CRT_OBJS_LE) +$(PPC64LE_ALL_OUTPUTS): MINILIB_OBJS =3D $(MINILIB_OBJS_LE) =20 -%: %.c %.elf $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) -Wl,--oformat=3Dbinary +include $(PPC64_SRC)/Makefile.softmmu-rules =20 -memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 +# Build LE Minilib objs +%-le.o: $(SYSTEM_MINILIB_SRC)/%.c + $(CC) $(PPC64_CFLAGS) -c $< -o $@ =20 # Running QEMU_BASE_MACHINE=3D-cpu power9 -M powernv9 -m 1G -vga none -nographic --=20 2.25.1