From patchwork Tue Jun 22 13:55:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12337459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F8F0C49EA2 for ; Tue, 22 Jun 2021 13:55:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3889261357 for ; Tue, 22 Jun 2021 13:55:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231563AbhFVN5u (ORCPT ); Tue, 22 Jun 2021 09:57:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23821 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231478AbhFVN5r (ORCPT ); Tue, 22 Jun 2021 09:57:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624370130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hbAdT4bM0mou8sDcn/BLX3RjewSuzcGuFIqDTa43aKo=; b=Y63e5qr3S6ql/xwiFTXq+tlMFsveb5QAyWDjTsB67Ok+Zw8dgFOUjKbWRYqk6+07yO9hEY TQlP6uAAmSG5lbitX7xygJ3VPhKm7lVj3KwK6I2JZjS4zd87AxLkz/12NCem5qCzr9LPZg tES7HiWweKG3URTeqxTuL1gImqUitpk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-273-EoVkHFfVO0yP28defOzNcw-1; Tue, 22 Jun 2021 09:55:27 -0400 X-MC-Unique: EoVkHFfVO0yP28defOzNcw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38BEB101F7A1; Tue, 22 Jun 2021 13:55:26 +0000 (UTC) Received: from thuth.com (ovpn-112-107.ams2.redhat.com [10.36.112.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59BAF1899A; Tue, 22 Jun 2021 13:55:24 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini Cc: Laurent Vivier , Janosch Frank , Cornelia Huck , Claudio Imbrenda , David Hildenbrand Subject: [kvm-unit-tests PATCH 1/4] configure: Add the possibility to specify additional cflags Date: Tue, 22 Jun 2021 15:55:14 +0200 Message-Id: <20210622135517.234801-2-thuth@redhat.com> In-Reply-To: <20210622135517.234801-1-thuth@redhat.com> References: <20210622135517.234801-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org For certain compilers or experiments, it might be necessary to specify additional CFLAGS for the build. Let's add an option to the configure script to specify such additional compiler flags. Signed-off-by: Thomas Huth --- Makefile | 3 --- configure | 10 ++++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 1afa90e..f7b9f28 100644 --- a/Makefile +++ b/Makefile @@ -22,9 +22,6 @@ DESTDIR := $(PREFIX)/share/kvm-unit-tests/ cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) -#make sure env CFLAGS variable is not used -CFLAGS = - libcflat := lib/libcflat.a cflatobjs := \ lib/argv.o \ diff --git a/configure b/configure index d21601f..c48ab3d 100755 --- a/configure +++ b/configure @@ -8,6 +8,7 @@ fi srcdir=$(cd "$(dirname "$0")"; pwd) prefix=/usr/local cc=gcc +cflags= ld=ld objcopy=objcopy objdump=objdump @@ -38,8 +39,9 @@ usage() { --target=TARGET target platform that the tests will be running on (qemu or kvmtool, default is qemu) (arm/arm64 only) --cross-prefix=PREFIX cross compiler prefix - --cc=CC c compiler to use ($cc) - --ld=LD ld linker to use ($ld) + --cc=CC c compiler to use ($cc) + --cflags=FLAGS extra options to be passed to the c compiler + --ld=LD ld linker to use ($ld) --prefix=PREFIX where to install things ($prefix) --endian=ENDIAN endianness to compile for (little or big, ppc64 only) --[enable|disable]-pretty-print-stacks @@ -100,6 +102,9 @@ while [[ "$1" = -* ]]; do --cc) cc="$arg" ;; + --cflags) + cflags="$arg" + ;; --ld) ld="$arg" ;; @@ -316,6 +321,7 @@ ARCH=$arch ARCH_NAME=$arch_name PROCESSOR=$processor CC=$cross_prefix$cc +CFLAGS=$cflags LD=$cross_prefix$ld OBJCOPY=$cross_prefix$objcopy OBJDUMP=$cross_prefix$objdump From patchwork Tue Jun 22 13:55:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12337457 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 315DCC48BDF for ; Tue, 22 Jun 2021 13:55:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1468F61369 for ; Tue, 22 Jun 2021 13:55:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231561AbhFVN5t (ORCPT ); Tue, 22 Jun 2021 09:57:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40289 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231492AbhFVN5r (ORCPT ); Tue, 22 Jun 2021 09:57:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624370131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4iGTabNP1Yd0Y27SUqRUQZyMTdtA5xyHE9vKfDmgaI0=; b=EWW5kshWlrGPxwTTU8MPXRmEQm22ZsL4+JBRiNMtyN+6GtYubNKamX5GusELk1mcikkWvR yAl75+nTXFhvta9b2+9rycBnMTjAOB353Bs0G+UfgRVnfDugZ29mGjF5T5VhvwnBeNOtss Bxon8yoPwDBom8aB5o86m46ZMTtGaWM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-sJA19gtEOIGPYKip5XiAXg-1; Tue, 22 Jun 2021 09:55:29 -0400 X-MC-Unique: sJA19gtEOIGPYKip5XiAXg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B7CB10C1ADC; Tue, 22 Jun 2021 13:55:28 +0000 (UTC) Received: from thuth.com (ovpn-112-107.ams2.redhat.com [10.36.112.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9786A69CB4; Tue, 22 Jun 2021 13:55:26 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini Cc: Laurent Vivier , Janosch Frank , Cornelia Huck , Claudio Imbrenda , David Hildenbrand Subject: [kvm-unit-tests PATCH 2/4] powerpc: Probe whether the compiler understands -mabi=no-altivec Date: Tue, 22 Jun 2021 15:55:15 +0200 Message-Id: <20210622135517.234801-3-thuth@redhat.com> In-Reply-To: <20210622135517.234801-1-thuth@redhat.com> References: <20210622135517.234801-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Clang does not support "-mabi=no-altivec", so let's check whether this option is supported before using it. Signed-off-by: Thomas Huth --- powerpc/Makefile.common | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common index 4c3121a..12c280c 100644 --- a/powerpc/Makefile.common +++ b/powerpc/Makefile.common @@ -17,9 +17,11 @@ all: directories $(TEST_DIR)/boot_rom.bin $(tests-all) ################################################################## +mabi_no_altivec := $(call cc-option,-mabi=no-altivec,"") + CFLAGS += -std=gnu99 CFLAGS += -ffreestanding -CFLAGS += -O2 -msoft-float -mabi=no-altivec -mno-altivec +CFLAGS += -O2 -msoft-float -mno-altivec $(mabi_no_altivec) CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt -I lib CFLAGS += -Wa,-mregnames From patchwork Tue Jun 22 13:55:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12337461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D463C49EA5 for ; Tue, 22 Jun 2021 13:55:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7AB5361357 for ; Tue, 22 Jun 2021 13:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231529AbhFVN5v (ORCPT ); Tue, 22 Jun 2021 09:57:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28203 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231517AbhFVN5t (ORCPT ); Tue, 22 Jun 2021 09:57:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624370133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0vbnrv+ql87RxObwI8g+u0AJ73UbGfiSxFvVFRy2BCE=; b=BuJLo6DuCl5RGvd/A4pbTASWNrfsfXYmk1logvi+nv69Ay5658Y/+Lo/GoHu+ECNQNnJgO 6N4iCZlnqUq0lW4yV7WFCeTaw9FZiLSVqoxKjIipmY2JUAKdp32zqdsZaKGIPLIIt2umiw LOhaM7FzXrmmn/Dajmdka932BBJelNA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-9-oNkcgZldPBSc2kHu_lDHZg-1; Tue, 22 Jun 2021 09:55:31 -0400 X-MC-Unique: oNkcgZldPBSc2kHu_lDHZg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA22E101F7A4; Tue, 22 Jun 2021 13:55:30 +0000 (UTC) Received: from thuth.com (ovpn-112-107.ams2.redhat.com [10.36.112.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4FF469CB4; Tue, 22 Jun 2021 13:55:28 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini Cc: Laurent Vivier , Janosch Frank , Cornelia Huck , Claudio Imbrenda , David Hildenbrand Subject: [kvm-unit-tests PATCH 3/4] lib/s390x: Fix the epsw inline assembly Date: Tue, 22 Jun 2021 15:55:16 +0200 Message-Id: <20210622135517.234801-4-thuth@redhat.com> In-Reply-To: <20210622135517.234801-1-thuth@redhat.com> References: <20210622135517.234801-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org According to the Principles of Operation, the epsw instruction does not touch the second register if it is r0. With GCC we were lucky so far that it never tried to use r0 here, but when compiling the kvm-unit-tests with Clang, this indeed happens and leads to very weird crashes. Thus let's make sure to never use r0 for the second operand of the epsw instruction. Signed-off-by: Thomas Huth Reviewed-by: Claudio Imbrenda Acked-by: Janosch Frank --- lib/s390x/asm/arch_def.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 3aa5da9..15cf7d4 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -265,7 +265,7 @@ static inline uint64_t extract_psw_mask(void) asm volatile( " epsw %0,%1\n" - : "+r" (mask_upper), "+r" (mask_lower) : : ); + : "=r" (mask_upper), "=a" (mask_lower)); return (uint64_t) mask_upper << 32 | mask_lower; } From patchwork Tue Jun 22 13:55:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12337463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE18C48BDF for ; Tue, 22 Jun 2021 13:55:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 043F36138C for ; Tue, 22 Jun 2021 13:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231651AbhFVN5y (ORCPT ); Tue, 22 Jun 2021 09:57:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21411 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231592AbhFVN5v (ORCPT ); Tue, 22 Jun 2021 09:57:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624370135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+19rfEAmw4Y61QHDVPEka2P/8irM/Zf8XAvS8aqKjoQ=; b=Pjn4Smm/f8Vll2Lf6iMlpi4AqlzuuReSoYUx1eGsHIPe21N9BeDNeobkr5UPs5vKUWS5dM DSPyNsDnaG88VeXGqzeNW9G3fDCR1oYPC5e5DZ+dexup7uafv1tkRWUwUsoPys/goNw0D7 woEOyEjWEnUDNzLhbmHnUR9zrheAmeI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-caw47PQWPz-y2k9rwRAXDQ-1; Tue, 22 Jun 2021 09:55:33 -0400 X-MC-Unique: caw47PQWPz-y2k9rwRAXDQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F1189101C8A8; Tue, 22 Jun 2021 13:55:32 +0000 (UTC) Received: from thuth.com (ovpn-112-107.ams2.redhat.com [10.36.112.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1468669CB4; Tue, 22 Jun 2021 13:55:30 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini Cc: Laurent Vivier , Janosch Frank , Cornelia Huck , Claudio Imbrenda , David Hildenbrand Subject: [kvm-unit-tests PATCH 4/4] Test compilation with Clang on aarch64, ppc64le and s390x in Travis-CI Date: Tue, 22 Jun 2021 15:55:17 +0200 Message-Id: <20210622135517.234801-5-thuth@redhat.com> In-Reply-To: <20210622135517.234801-1-thuth@redhat.com> References: <20210622135517.234801-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Travis-CI recently changed their policy so that builds on the non-x86 build machines are possible without consuming any credits again. We can use these systems to test compilation of the non-x86 code with Clang. Unfortunately, the qemu-system-s390x of Ubuntu 20.04 seems to be buggy, so that the s390x binaries cause that QEMU to crash. Thus we can only run the TCG tests for ppc64le and aarch64. Signed-off-by: Thomas Huth --- .travis.yml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4fcb687 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,44 @@ +dist: focal +language: c +cache: ccache +compiler: clang +git: + submodules: false + +jobs: + include: + + - arch: arm64 + addons: + apt_packages: qemu-system-aarch64 + env: + - CONFIG="--arch=arm64 --cc=clang" + - TESTS="cache gicv2-active gicv2-ipi gicv2-mmio gicv3-active gicv3-ipi + pci-test pmu-cycle-counter pmu-event-counter-config pmu-sw-incr + selftest-setup selftest-smp selftest-vectors-kernel + selftest-vectors-user timer" + + - arch: ppc64le + addons: + apt_packages: clang-11 qemu-system-ppc + env: + - CONFIG="--arch=ppc64 --endian=little --cc=clang-11 --cflags=-no-integrated-as" + - TESTS="emulator rtas-get-time-of-day rtas-get-time-of-day-base + rtas-set-time-of-day selftest-setup spapr_hcall" + + - arch: s390x + addons: + apt_packages: clang-11 qemu-system-s390x + env: + - CONFIG="--arch=s390x --cc=clang-11 --cflags=-no-integrated-as" + - TESTS="" + +before_script: + - mkdir -p build && cd build + - $TRAVIS_BUILD_DIR/configure $CONFIG +script: + - make -j3 + - if [ -n "$TESTS" ]; then + ACCEL="${ACCEL:-tcg}" ./run_tests.sh -v $TESTS | tee results.txt && + grep -q PASS results.txt && ! grep -q FAIL results.txt ; + fi