From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633103156681308.1614870299386; Fri, 1 Oct 2021 08:45:56 -0700 (PDT) Received: from localhost ([::1]:33638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKjT-00082d-FP for importer@patchew.org; Fri, 01 Oct 2021 11:45:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKY2-0006jP-Vt for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:07 -0400 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]:39824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXo-0007dm-3z for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:06 -0400 Received: by mail-qt1-x832.google.com with SMTP id j13so9316394qtq.6 for ; Fri, 01 Oct 2021 08:33:51 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eKs5F3DTNeKWBjaCjlRA/nvZMPsiEvhhDz2Zi1xH6yM=; b=CWuACNM3ysfACLXK6GZn3do6W6jvDkccNkOjhxjcZ8WAIPKl0wKbteTHKc86lX+TQi jPXGK1yz2KpQJzTt060QbhXqFVUMSG3HNGLobr3A9yYbCa/QApJbhvSUIxrWCN1gxAtx do3Xrx2zyj/EkMRJ4f98DaqBSstfkAwSyz+YDF++DE1qL15a3MBaQVleydMWNkXqwg9H skOrIru+ym1Ch63CmlREjlRFghvC8jrPzNqGWlLpAw7Jk+uAZzrEJqC+h+TgIZuLByBM w6XwKtamjxaRBE8lKvSafAOQWhwR5ajqYuYbBqAFvCyQMfDzecmZl1XXUkIkQOn+HBHC k00w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eKs5F3DTNeKWBjaCjlRA/nvZMPsiEvhhDz2Zi1xH6yM=; b=sKmnvkpTNGkTi2TpeqOVH3wqWXiEhly+gFGudUS1U6ukJPIDCTApcIiZaRj4x88xhT ph/5g59rD83Lf/HMD3L8wTzXoD17mm888EPU11GJhEwPpwQ/59VJhP+d5b/RISJjnY3L MyBFXiL0bZr7LJgi4SIq2m3dnS0tayFSUxfhzJCFYB9a0C7KRapQAG3rlpc14vgN52gf Zi4h8iDb++/RWqCIs0kmCOwBsDRWR6LmrwanHxXGtaWmBAzvWJw8Viy2+0d9aIBKNbZS 9AMt5G0IYw9WxZA+THLlJj2p9tNyegLtuk+ox+96xw0PjguvFHIf8k15Nzk0jlpRYnA+ Pa9w== X-Gm-Message-State: AOAM532Ng91LoZ/Il1Omg1VM2B2q/xU8lUsHUPIye0sLZ7rw/Pql+4Dj tycsd6AILbnZOzhp/DPkEPic3fZdUxTybg== X-Google-Smtp-Source: ABdhPJw8UPD44/eVJIMfVNrgVPXVG74e4WMXi5W+XJt50RIEC9THfvk+uIHqPPuamhsJz2mjajFTuw== X-Received: by 2002:ac8:6683:: with SMTP id d3mr14089339qtp.291.1633102430473; Fri, 01 Oct 2021 08:33:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/9] tests/docker: Add debian-nios2-cross image Date: Fri, 1 Oct 2021 11:33:37 -0400 Message-Id: <20211001153347.1736014-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::832; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x832.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633103157066100001 Content-Type: text/plain; charset="utf-8" Build the entire cross tool chain from source. For this reason, default to caching. Signed-off-by: Richard Henderson --- tests/docker/Makefile.include | 19 ++++ .../dockerfiles/debian-nios2-cross.docker | 34 +++++++ .../build-toolchain.sh | 97 +++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 tests/docker/dockerfiles/debian-nios2-cross.docker create mode 100755 tests/docker/dockerfiles/debian-nios2-cross.docker.d/bu= ild-toolchain.sh diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index ff5d732889..2ccd93caa4 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -168,10 +168,28 @@ docker-image-debian-hexagon-cross: $(DOCKER_FILES_DIR= )/debian-hexagon-cross.dock qemu/debian-hexagon-cross --add-current-user, \ "PREPARE", "debian-hexagon-cross")) =20 +docker-image-debian-nios2-cross: $(DOCKER_FILES_DIR)/debian-nios2-cross.do= cker + $(if $(NOCACHE), \ + $(call quiet-command, \ + $(DOCKER_SCRIPT) build -t qemu/debian-nios2-cross -f $< \ + $(if $V,,--quiet) --no-cache \ + --registry $(DOCKER_REGISTRY) --extra-files \ + $(DOCKER_FILES_DIR)/debian-nios2-cross.docker.d/build-toolchain.sh, \ + "BUILD", "debian-nios2-cross"), \ + $(call quiet-command, \ + $(DOCKER_SCRIPT) fetch $(if $V,,--quiet) \ + qemu/debian-nios2-cross $(DOCKER_REGISTRY), \ + "FETCH", "debian-nios2-cross") \ + $(call quiet-command, \ + $(DOCKER_SCRIPT) update $(if $V,,--quiet) \ + qemu/debian-nios2-cross --add-current-user, \ + "PREPARE", "debian-nios2-cross")) + # Specialist build images, sometimes very limited tools docker-image-debian-tricore-cross: docker-image-debian10 docker-image-debian-all-test-cross: docker-image-debian10 docker-image-debian-arm64-test-cross: docker-image-debian11 +docker-image-debian-nios2-cross: docker-image-debian10 docker-image-debian-powerpc-test-cross: docker-image-debian11 =20 # These images may be good enough for building tests but not for test buil= ds @@ -180,6 +198,7 @@ DOCKER_PARTIAL_IMAGES +=3D debian-arm64-test-cross DOCKER_PARTIAL_IMAGES +=3D debian-powerpc-test-cross DOCKER_PARTIAL_IMAGES +=3D debian-hppa-cross DOCKER_PARTIAL_IMAGES +=3D debian-m68k-cross debian-mips64-cross +DOCKER_PARTIAL_IMAGES +=3D debian-nios2-cross DOCKER_PARTIAL_IMAGES +=3D debian-riscv64-cross DOCKER_PARTIAL_IMAGES +=3D debian-sh4-cross debian-sparc64-cross DOCKER_PARTIAL_IMAGES +=3D debian-tricore-cross diff --git a/tests/docker/dockerfiles/debian-nios2-cross.docker b/tests/doc= ker/dockerfiles/debian-nios2-cross.docker new file mode 100644 index 0000000000..208737fc5e --- /dev/null +++ b/tests/docker/dockerfiles/debian-nios2-cross.docker @@ -0,0 +1,34 @@ +# +# Docker NIOS2 cross-compiler target +# +# This docker target is used for building tests. As it also needs to be +# able to build QEMU itself in CI we include it's build-deps. It is also +# a "stand-alone" image so as not to be triggered by re-builds on other +# base images given it takes a long time to build. +# +FROM qemu/debian10 + +# Install build utilities for building gcc and glibc. +# ??? The build-dep isn't working, missing a number of +# minimal build dependiencies, e.g. libmpc. + +RUN apt update && \ + DEBIAN_FRONTEND=3Dnoninteractive apt install -yy eatmydata && \ + DEBIAN_FRONTEND=3Dnoninteractive eatmydata \ + apt install -y --no-install-recommends \ + bison \ + flex \ + gawk \ + libmpc-dev \ + libmpfr-dev \ + rsync \ + texinfo \ + wget \ + $(apt-get -s build-dep --arch-only gcc | egrep ^Inst | fgrep '[all= ]' | cut -d\ -f2) \ + $(apt-get -s build-dep --arch-only glibc | egrep ^Inst | fgrep '[a= ll]' | cut -d\ -f2) + +ADD build-toolchain.sh /root/build-toolchain.sh + +RUN cd /root && ./build-toolchain.sh + +ENV PATH $PATH:/usr/local/bin/ diff --git a/tests/docker/dockerfiles/debian-nios2-cross.docker.d/build-too= lchain.sh b/tests/docker/dockerfiles/debian-nios2-cross.docker.d/build-tool= chain.sh new file mode 100755 index 0000000000..d8cb428dab --- /dev/null +++ b/tests/docker/dockerfiles/debian-nios2-cross.docker.d/build-toolchain.= sh @@ -0,0 +1,97 @@ +#!/bin/bash + +set -e + +TARGET=3Dnios2-linux-gnu +LINUX_ARCH=3Dnios2 + +J=3D$(expr $(nproc) / 2) +TOOLCHAIN_INSTALL=3D/usr/local +TOOLCHAIN_BIN=3D${TOOLCHAIN_INSTALL}/bin +CROSS_SYSROOT=3D${TOOLCHAIN_INSTALL}/$TARGET/sys-root + +export PATH=3D${TOOLCHAIN_BIN}:$PATH + +mkdir cross +cd cross + +# +# Grab all of the source for the toolchain bootstrap. +# + +wget https://ftp.gnu.org/gnu/binutils/binutils-2.37.tar.xz +wget https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz +wget https://ftp.gnu.org/gnu/glibc/glibc-2.34.tar.xz +wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.70.tar.xz + +tar axf binutils-2.37.tar.xz +tar axf gcc-11.2.0.tar.xz +tar axf glibc-2.34.tar.xz +tar axf linux-5.10.70.tar.xz + +mv binutils-2.37 src-binu +mv gcc-11.2.0 src-gcc +mv glibc-2.34 src-glibc +mv linux-5.10.70 src-linux + +mkdir -p bld-hdr bld-binu bld-gcc bld-glibc +mkdir -p ${CROSS_SYSROOT}/usr/include + +# +# Install kernel and glibc headers +# + +cd src-linux +make headers_install ARCH=3D${LINUX_ARCH} INSTALL_HDR_PATH=3D${CROSS_SYSRO= OT}/usr +cd .. + +cd bld-hdr +../src-glibc/configure --prefix=3D/usr --host=3D${TARGET} +make install-headers DESTDIR=3D${CROSS_SYSROOT} +touch ${CROSS_SYSROOT}/usr/include/gnu/stubs.h +cd .. + +# +# Build binutils +# + +cd bld-binu +../src-binu/configure --disable-werror \ + --prefix=3D${TOOLCHAIN_INSTALL} --with-sysroot --target=3D${TARGET} +make -j${J} +make install +cd .. + +# +# Build gcc, without shared libraries, because we do not yet +# have a shared libc against which to link. +# + +cd bld-gcc +../src-gcc/configure --disable-werror --disable-shared \ + --prefix=3D${TOOLCHAIN_INSTALL} --with-sysroot --target=3D${TARGET} \ + --enable-languages=3Dc --disable-libssp --disable-libsanitizer \ + --disable-libatomic --disable-libgomp --disable-libquadmath +make -j${J} +make install +cd .. + +# +# Build glibc +# There are a few random things that use c++ but we didn't build that +# cross-compiler. We can get away without them. Disable CXX so that +# glibc doesn't try to use the host c++ compiler. +# + +cd bld-glibc +CXX=3Dfalse ../src-glibc/configure --prefix=3D/usr --host=3D${TARGET} +make -j${j} +make install DESTDIR=3D${CROSS_SYSROOT} +cd .. + +# +# Clean up +# + +cd .. +rm -rf cross build-toolchain.sh --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633102685231711.0777444547256; Fri, 1 Oct 2021 08:38:05 -0700 (PDT) Received: from localhost ([::1]:46050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKbs-0005dr-5g for importer@patchew.org; Fri, 01 Oct 2021 11:38:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKXx-0006Tl-6B for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:01 -0400 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]:39427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXp-0007eX-CU for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:00 -0400 Received: by mail-qk1-x735.google.com with SMTP id f130so9503421qke.6 for ; Fri, 01 Oct 2021 08:33:51 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=unOqLzAPd6poy21NosqfBpvujG84W8QKJdncOwMlFts=; b=XMDSSMcTds/NDUiSONIDw+OjL8I5PWKMfrVbDQN+35fiyW1d63n+5QkTPLAGnk24lV 2G0w8GQIB5meuGSFfVOzK8Jq/q8yOR5ekWgHBjHWAdhoyUbFvnUKYv+P6RyZz+wlwMh8 OarvrZe+oeKtdOJCrKFuiTiHdBGpR/4ccvGnwGGRr9KpfenpQ2rFNvFHaex23Fq+SffK kjJ8HG81scG3QplEWgQUnem/QRBvahuuj+qFC5NoD2qkjne+mpVG78lgiOitkoac1+TX 5n04tWhDDxMSfcpEqJX16/C4Gup+d7N79ubjiQmBeaPciG1DdT5gxX1sMXVPrcqJ8+w/ +xkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=unOqLzAPd6poy21NosqfBpvujG84W8QKJdncOwMlFts=; b=qbFcJOQq0D+kUmfwXKbxhOuCxDWw/NzJ+oO+0nujIS06gFHs309TL7CG4PMVXWAqKK 33/0ctNed0emqp2tWlebCYdUx8zXsMFlaEcyol9RthNjA0v7i7+JvvNhC6EPNxGgob4+ dy45yhHIMCyWb2wJV4G3hDYi5PUeMDBy0RhO+UVOOKIvAJGA5vFbbIwm9Vou9TD34R5u 9poDkDDWNYZrsw/ijsgF9JDpOsv1B6GKnCFCjSZlzYAhtSWrF2vRvUvumXHK2L/OtJuc EdF9a7N7ZyX2UC5TsIqTvhSgBOKr4xMocSCVIowuQeM71E/Pp1nsrKfRiU7s3X5BIYzs CV0g== X-Gm-Message-State: AOAM533Cv4F2u9n0oSOIuplCj+YfHON8+CwudZKWAKP0MyA2gEBtXdfD 30EXp/tkT6eNMd74HwoP2+c7hY8b3tf0rw== X-Google-Smtp-Source: ABdhPJxf7bIpk0U68G/HNqw6MVlB+bjt1P8EpCPMhkSLHjwyGqD0+hX7YZg/Wwrt/YClbYYzjxFwaQ== X-Received: by 2002:a37:9606:: with SMTP id y6mr10103269qkd.13.1633102431417; Fri, 01 Oct 2021 08:33:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/2] tests/docker: Remove fedora-i386-cross from DOCKER_PARTIAL_IMAGES Date: Fri, 1 Oct 2021 11:33:38 -0400 Message-Id: <20211001153347.1736014-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::735; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x735.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, Thomas Huth , crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633102686435100001 The image was upgraded to a full image in ee381b7fe146. This makes it possible to use docker-test@image syntax with this container. Cc: Thomas Huth Cc: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tests/docker/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index ff5d732889..0806c6f726 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -184,7 +184,7 @@ DOCKER_PARTIAL_IMAGES +=3D debian-riscv64-cross DOCKER_PARTIAL_IMAGES +=3D debian-sh4-cross debian-sparc64-cross DOCKER_PARTIAL_IMAGES +=3D debian-tricore-cross DOCKER_PARTIAL_IMAGES +=3D debian-xtensa-cross -DOCKER_PARTIAL_IMAGES +=3D fedora-i386-cross fedora-cris-cross +DOCKER_PARTIAL_IMAGES +=3D fedora-cris-cross =20 # Rules for building linux-user powered images # --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633102556824847.6837358206092; Fri, 1 Oct 2021 08:35:56 -0700 (PDT) Received: from localhost ([::1]:38078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKZn-0000G5-QF for importer@patchew.org; Fri, 01 Oct 2021 11:35:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKXs-0006Ii-2P for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:33:56 -0400 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]:36803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXq-0007gX-7e for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:33:55 -0400 Received: by mail-qt1-x82b.google.com with SMTP id l13so9319484qtv.3 for ; Fri, 01 Oct 2021 08:33:53 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=77S8PHNNwp8gzL3C6UYKL3B8n68oD4JCUCVjCK3xRFU=; b=PxP9QKmVaDWj+uaYhx0NqN3D+jNsTE1j9dODCmn//aCuUMjSyNjpJfxGLe3S9MCvkx 2lm/HfzpWTD6h0EQdeo5xtE/BQVtpTo1NXrVGaSZt2NP4y17lcCz3c7eDFqfjU8rAhtZ 2S7pd0ubDlJD/OcuU0cWAJoqhSc1AIlkaVKHzEvBDPPoJGVNgv7Tmq8waW2eFIjGZK62 2KmOh2rJMv8itqHW3A0nMNzcdTqz7MdSGs9WCdqo45FzFLCEHSU8A0LQrW0cD3Cep+Jn o+jvlRHJM3bYBuSR/sBe8xvnlOwoQRyXepzgJDL7ILJjV75Fpio+N+Ms49a65/pvxqaQ F95w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=77S8PHNNwp8gzL3C6UYKL3B8n68oD4JCUCVjCK3xRFU=; b=B8TURckuq14xEJYwV6ssoN84V09krsAF7hHpijW8hCu74wqgwRmMPQ5MpKEenAL1+v pCddS06oSZwHG+6ApuNwzLVaDtc9ozotsCnac0iKPSl8ZGK+DFE7o9eczmskmwZ3Kelz WzA2+xv8B4KzO9qHWlomSBilI3NJ6WlT/7A7bNpZu+ioAo+EdrU2tR4UGeDocR9Rq8yO pqz+Bwk7rjBfBLls9qKWPNUuO01MKwWyQw02uFj3qm3+RVdaBOLcGPteyQc/qrn542m7 bsNOgfKQN+IQuYgpnjwPwxoUXBlZE8YX1B+zQAT/EwuRYc2bv0a5sINslVhG9xM4dcmS j2nA== X-Gm-Message-State: AOAM533t7t9cl381d5OqYM7aEMxEwcpXkGr0/+dXsIz35sHEJs7X6HWo wCVSWDE84HV929idql1jBeEoKTEQFb/DCw== X-Google-Smtp-Source: ABdhPJy61Bw1yaYn5jS79d7bStmAN2GBSHDR4U0UCLXZtSmd/jeMCxlzpURt6nZ/wVi58YUWCGe4wg== X-Received: by 2002:ac8:7769:: with SMTP id h9mr13916374qtu.156.1633102433287; Fri, 01 Oct 2021 08:33:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/2] tests/docker: Fix fedora-i386-cross Date: Fri, 1 Oct 2021 11:33:40 -0400 Message-Id: <20211001153347.1736014-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::82b; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , crwulff@gmail.com, laurent@vivier.eu, "Richard W . M . Jones" , Paolo Bonzini , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633102557684100001 By using PKG_CONFIG_PATH instead of PKG_CONFIG_LIBDIR, we were still including the 64-bit packages. Install pcre-devel.i686 to fill a missing glib2 dependency. By using --extra-cflags instead of --cpu, we incorrectly use the wrong probing during meson. Cc: Alex Benn=C3=A9e Cc: Paolo Bonzini Cc: Daniel P. Berrang=C3=A9 Cc: Richard W.M. Jones Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tests/docker/dockerfiles/fedora-i386-cross.docker | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/docker/dockerfiles/fedora-i386-cross.docker b/tests/dock= er/dockerfiles/fedora-i386-cross.docker index dbb8195eb1..820740d5be 100644 --- a/tests/docker/dockerfiles/fedora-i386-cross.docker +++ b/tests/docker/dockerfiles/fedora-i386-cross.docker @@ -17,12 +17,13 @@ ENV PACKAGES \ glibc-static.i686 \ gnutls-devel.i686 \ nettle-devel.i686 \ + pcre-devel.i686 \ perl-Test-Harness \ pixman-devel.i686 \ zlib-devel.i686 =20 -ENV QEMU_CONFIGURE_OPTS --extra-cflags=3D-m32 --disable-vhost-user -ENV PKG_CONFIG_PATH /usr/lib/pkgconfig +ENV QEMU_CONFIGURE_OPTS --cpu=3Di386 --disable-vhost-user +ENV PKG_CONFIG_LIBDIR /usr/lib/pkgconfig =20 RUN dnf install -y $PACKAGES RUN rpm -q $PACKAGES | sort > /packages.txt --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633102728846641.8048516289372; Fri, 1 Oct 2021 08:38:48 -0700 (PDT) Received: from localhost ([::1]:48056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKcZ-0006xX-TU for importer@patchew.org; Fri, 01 Oct 2021 11:38:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKXs-0006K5-Tz for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:33:56 -0400 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:35470) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXq-0007fk-EQ for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:33:56 -0400 Received: by mail-qt1-x835.google.com with SMTP id c20so9317340qtb.2 for ; Fri, 01 Oct 2021 08:33:52 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dtDTFH5wVX1LPjRcgOE5Bj/g+8fIpGjADqZ8damTkkI=; b=OzdwVhFxwg2zU8n6+Ktibox3tWoG7J0qUEki2yK7HzX545e3TpjMW+w9icuhvPwoEp XZIDp+bIFGFAXUpkUhpTIJ2jSf/E+Z9Z1LRrqw6Z4jS/We2EiLDe0sEa7ovTJLTbKbZH Oc/X+YjMlrSU39oJOoV6mn4f8C+EFyMRXR4bk/WxLehlF7n6u4Fptn2JJRVTgV2t5GkC AJyCrjkwM+zysZj+8op8IYHy1bzX2+sittMvqu2QyO0bz0V19GA8ZLkMz16FTmFW2aON bSxoiF5xq/50QbnVSCjKhiyLxuXKzls7QgxIG2tu7BME8ubI9RhE4cUp23NV4iWJZOM4 r7oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dtDTFH5wVX1LPjRcgOE5Bj/g+8fIpGjADqZ8damTkkI=; b=ad6FRhl2FlJIkxqhmPCrhHLzEu0wGW9VP1RZJ4bwEYohAAQdGb0L8Pe5Gljmw3TNXz WObX+b2B88vnjLpDaq4ec+Xc4/iTD6RGvl94fNx2+pNdJJ0arhxhU7So4IBuzQIum/Qb AUu0HYIQE6+1V9lsB8omezIDBPBfmvOt7DKSV5ipw9AkId1wI9NunQLqI0Bjv6Bhu+Y1 ENoEbXKrF/e72nU05eOX3zlPfQ9hBbx0VjODQDzS4RMao0RCK6X6aDIS0Z9sOmXsJzgF j9ynoJTmtWV3Wly4Y9LvRE2Epzggr6+lQdHCCHJ9RVsB5zn6z6CTAMVBneY6x1GXCwDc gENg== X-Gm-Message-State: AOAM531ZiBwOgg/1jusgyYSaWEjGx4SV8hkSQsoLE66mTPchd9MyRKLa zuMwTIUQQrcnMlUBpCMo4YAoMflsBSFq+A== X-Google-Smtp-Source: ABdhPJws/npuYfnAT6AC1Qng6Jn4EoSddb8tdXsapFVHqFfHXptggUUKVphJSW8edVB5kv0EjKhvnQ== X-Received: by 2002:a05:622a:1d4:: with SMTP id t20mr13338893qtw.144.1633102432373; Fri, 01 Oct 2021 08:33:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/9] linux-user/nios2: Properly emulate EXCP_TRAP Date: Fri, 1 Oct 2021 11:33:39 -0400 Message-Id: <20211001153347.1736014-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::835; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x835.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633102729503100001 Content-Type: text/plain; charset="utf-8" The real kernel has to load the instruction and extract the imm5 field; for qemu, modify the translator to do this. The use of R_AT for this in cpu_loop was a bug. Handle the other trap numbers as per the kernel's trap_table. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/nios2/cpu.h | 2 +- linux-user/nios2/cpu_loop.c | 40 ++++++++++++++++++++----------------- target/nios2/translate.c | 17 +++++++++++++++- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index a80587338a..f8c9d11f2f 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -160,9 +160,9 @@ struct CPUNios2State { =20 #if !defined(CONFIG_USER_ONLY) Nios2MMU mmu; - uint32_t irq_pending; #endif + int error_code; }; =20 /** diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index 34290fb3b5..5c3d01d22d 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -26,7 +26,6 @@ void cpu_loop(CPUNios2State *env) { CPUState *cs =3D env_cpu(env); - Nios2CPU *cpu =3D NIOS2_CPU(cs); target_siginfo_t info; int trapnr, ret; =20 @@ -39,9 +38,10 @@ void cpu_loop(CPUNios2State *env) case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; + case EXCP_TRAP: - if (env->regs[R_AT] =3D=3D 0) { - abi_long ret; + switch (env->error_code) { + case 0: qemu_log_mask(CPU_LOG_INT, "\nSyscall\n"); =20 ret =3D do_syscall(env, env->regs[2], @@ -55,26 +55,30 @@ void cpu_loop(CPUNios2State *env) =20 env->regs[2] =3D abs(ret); /* Return value is 0..4096 */ - env->regs[7] =3D (ret > 0xfffffffffffff000ULL); - env->regs[CR_ESTATUS] =3D env->regs[CR_STATUS]; - env->regs[CR_STATUS] &=3D ~0x3; - env->regs[R_EA] =3D env->regs[R_PC] + 4; + env->regs[7] =3D ret > 0xfffff000u; env->regs[R_PC] +=3D 4; break; - } else { - qemu_log_mask(CPU_LOG_INT, "\nTrap\n"); =20 - env->regs[CR_ESTATUS] =3D env->regs[CR_STATUS]; - env->regs[CR_STATUS] &=3D ~0x3; - env->regs[R_EA] =3D env->regs[R_PC] + 4; - env->regs[R_PC] =3D cpu->exception_addr; - - info.si_signo =3D TARGET_SIGTRAP; - info.si_errno =3D 0; - info.si_code =3D TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + case 1: + qemu_log_mask(CPU_LOG_INT, "\nTrap 1\n"); + force_sig_fault(TARGET_SIGUSR1, 0, env->regs[R_PC]); + break; + case 2: + qemu_log_mask(CPU_LOG_INT, "\nTrap 2\n"); + force_sig_fault(TARGET_SIGUSR2, 0, env->regs[R_PC]); + break; + case 31: + qemu_log_mask(CPU_LOG_INT, "\nTrap 31\n"); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->re= gs[R_PC]); + break; + default: + qemu_log_mask(CPU_LOG_INT, "\nTrap %d\n", env->error_code); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLTRP, + env->regs[R_PC]); break; } + break; + case EXCP_DEBUG: info.si_signo =3D TARGET_SIGTRAP; info.si_errno =3D 0; diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 08d7ac5398..a759877519 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -636,6 +636,21 @@ static void divu(DisasContext *dc, uint32_t code, uint= 32_t flags) tcg_temp_free(t0); } =20 +static void trap(DisasContext *dc, uint32_t code, uint32_t flags) +{ +#ifdef CONFIG_USER_ONLY + /* + * The imm5 field is not stored anywhere on real hw; the kernel + * has to load the insn and extract the field. But we can make + * things easier for cpu_loop if we pop this into env->error_code. + */ + R_TYPE(instr, code); + tcg_gen_st_i32(tcg_constant_i32(instr.imm5), cpu_env, + offsetof(CPUNios2State, error_code)); +#endif + t_gen_helper_raise_exception(dc, EXCP_TRAP); +} + static const Nios2Instruction r_type_instructions[] =3D { INSTRUCTION_ILLEGAL(), INSTRUCTION(eret), /* eret */ @@ -682,7 +697,7 @@ static const Nios2Instruction r_type_instructions[] =3D= { INSTRUCTION_ILLEGAL(), INSTRUCTION_ILLEGAL(), INSTRUCTION_ILLEGAL(), - INSTRUCTION_FLG(gen_excp, EXCP_TRAP), /* trap */ + INSTRUCTION(trap), /* trap */ INSTRUCTION(wrctl), /* wrctl */ INSTRUCTION_ILLEGAL(), INSTRUCTION_FLG(gen_cmpxx, TCG_COND_LTU), /* cmpltu */ --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633102572096554.6788717795964; Fri, 1 Oct 2021 08:36:12 -0700 (PDT) Received: from localhost ([::1]:38222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKa3-0000M6-4A for importer@patchew.org; Fri, 01 Oct 2021 11:36:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKXt-0006MM-WC for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:33:58 -0400 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]:33752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXr-0007gx-8d for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:33:57 -0400 Received: by mail-qt1-x833.google.com with SMTP id x9so9371250qtv.0 for ; Fri, 01 Oct 2021 08:33:54 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rbJQ1EEbZk0qe1nOE3Vk16NPZokQglkfGktmCQn6pKM=; b=tiDuFxBeJ8Y6l2XoL46Aw0KK3bziDZIBnwpCSNOzN1CVg2jzenHx+v0o45/JEdT04s Ql2hPPV5ICNSXUsgqHbMdlOEnmVMoNowctJmlaWVf/P7JaJHvrSZl+7q16gT7I4uv/SH bQ+D2291EUXvv/i58mIXjPrDGiq5O05KxwDcOE5cWs3U50jW9q8NPhQmXSSZilbC6d80 WjgfjeS7oD0qXYitmMPJUTKmhMGLd/fGtGov2AoaOpDWdddNM7YhQHKJx4CLvilIvExJ /bgLAJzyf/Byhf9g7wlVOr+WKjv8PhGgKr25vG1uTtxucH+99CmfJvx+k40nTnzbWkNc 0yVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rbJQ1EEbZk0qe1nOE3Vk16NPZokQglkfGktmCQn6pKM=; b=vl332tJx8C0oFGHqdgD1A418wVdJ6uGLWg1vVMv2NJDUbY03r0JNb4sg3CZqAw5f7K 6goASYHlqSNMHZVuR/8V60/iBpepV6CWevwCzcsgJGTcAG094fk8aoN55jKO0umwJu3+ YgJzNeU+dWEbuEFCRDy9DeaxcASN6t8hU70a2DrvyGb6iUQJt//jGjjaa8moB07pRHAV mq62yu/ReRpaJdP8zwhleZr3KkFRsgVbBTB8DX6MPAfHZ4CAyKxWemkAjvQ71o45BBag iHdTrjPQ1CH0DqLgm+ryeXebXNKifxrXxoYalh40AqW88HRMinOYqrJz5X01gnS6Ts2m k0nw== X-Gm-Message-State: AOAM531bm9DCHkjUWPRIckmMffzetQtiwzjAU7aU8ApMaljTjJmdZzzR cR4OXGsZi0Xi1zJ2z3FJL06wP70nG4Y1hw== X-Google-Smtp-Source: ABdhPJzypsJlOYFJgRjpY+HFaFj6bnuVXm0o9dE5FGwqpLL4ZPGhZ/Aqfre+cbUXlfvQ2BskK23Qbw== X-Received: by 2002:a05:622a:1886:: with SMTP id v6mr5179950qtc.244.1633102434273; Fri, 01 Oct 2021 08:33:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/9] linux-user/nios2: Fixes for signal frame setup Date: Fri, 1 Oct 2021 11:33:41 -0400 Message-Id: <20211001153347.1736014-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::833; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x833.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, Peter Maydell , crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633102573275100001 Content-Type: text/plain; charset="utf-8" Do not confuse host and guest addresses. Lock and unlock the target_rt_sigframe structure in setup_rt_sigframe. Since rt_setup_ucontext always returns 0, drop the return value entirely. This eliminates the only write to the err variable in setup_rt_sigframe. Always copy the siginfo structure. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20210924165926.752809-19-richard.henderson@linaro.org> Reviewed-by: Alex Benn=C3=A9e --- linux-user/nios2/signal.c | 49 ++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c index a77e8a40f4..adbffe32e3 100644 --- a/linux-user/nios2/signal.c +++ b/linux-user/nios2/signal.c @@ -42,7 +42,7 @@ struct target_rt_sigframe { struct target_ucontext uc; }; =20 -static int rt_setup_ucontext(struct target_ucontext *uc, CPUNios2State *en= v) +static void rt_setup_ucontext(struct target_ucontext *uc, CPUNios2State *e= nv) { unsigned long *gregs =3D uc->tuc_mcontext.gregs; =20 @@ -75,8 +75,6 @@ static int rt_setup_ucontext(struct target_ucontext *uc, = CPUNios2State *env) __put_user(env->regs[R_GP], &gregs[25]); __put_user(env->regs[R_EA], &gregs[27]); __put_user(env->regs[R_SP], &gregs[28]); - - return 0; } =20 static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext = *uc, @@ -135,8 +133,8 @@ static int rt_restore_ucontext(CPUNios2State *env, stru= ct target_ucontext *uc, return 0; } =20 -static void *get_sigframe(struct target_sigaction *ka, CPUNios2State *env, - size_t frame_size) +static abi_ptr get_sigframe(struct target_sigaction *ka, CPUNios2State *en= v, + size_t frame_size) { unsigned long usp; =20 @@ -144,7 +142,7 @@ static void *get_sigframe(struct target_sigaction *ka, = CPUNios2State *env, usp =3D target_sigsp(get_sp_from_cpustate(env), ka); =20 /* Verify, is it 32 or 64 bit aligned */ - return (void *)((usp - frame_size) & -8UL); + return (usp - frame_size) & -8; } =20 void setup_rt_frame(int sig, struct target_sigaction *ka, @@ -153,26 +151,25 @@ void setup_rt_frame(int sig, struct target_sigaction = *ka, CPUNios2State *env) { struct target_rt_sigframe *frame; - int i, err =3D 0; + abi_ptr frame_addr; + int i; =20 - frame =3D get_sigframe(ka, env, sizeof(*frame)); - - if (ka->sa_flags & SA_SIGINFO) { - tswap_siginfo(&frame->info, info); + frame_addr =3D get_sigframe(ka, env, sizeof(*frame)); + if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { + force_sigsegv(sig); + return; } =20 + tswap_siginfo(&frame->info, info); + /* Create the ucontext. */ __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); target_save_altstack(&frame->uc.tuc_stack, env); - err |=3D rt_setup_ucontext(&frame->uc, env); + rt_setup_ucontext(&frame->uc, env); for (i =3D 0; i < TARGET_NSIG_WORDS; i++) { __put_user((abi_ulong)set->sig[i], - (abi_ulong *)&frame->uc.tuc_sigmask.sig[i]); - } - - if (err) { - goto give_sigsegv; + (abi_ulong *)&frame->uc.tuc_sigmask.sig[i]); } =20 /* Set up to return from userspace; jump to fixed address sigreturn @@ -180,19 +177,13 @@ void setup_rt_frame(int sig, struct target_sigaction = *ka, env->regs[R_RA] =3D (unsigned long) (0x1044); =20 /* Set up registers for signal handler */ - env->regs[R_SP] =3D (unsigned long) frame; - env->regs[4] =3D (unsigned long) sig; - env->regs[5] =3D (unsigned long) &frame->info; - env->regs[6] =3D (unsigned long) &frame->uc; - env->regs[R_EA] =3D (unsigned long) ka->_sa_handler; - return; + env->regs[R_SP] =3D frame_addr; + env->regs[4] =3D sig; + env->regs[5] =3D frame_addr + offsetof(struct target_rt_sigframe, info= ); + env->regs[6] =3D frame_addr + offsetof(struct target_rt_sigframe, uc); + env->regs[R_EA] =3D ka->_sa_handler; =20 -give_sigsegv: - if (sig =3D=3D TARGET_SIGSEGV) { - ka->_sa_handler =3D TARGET_SIG_DFL; - } - force_sigsegv(sig); - return; + unlock_user_struct(frame, frame_addr, 1); } =20 long do_sigreturn(CPUNios2State *env) --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633102684839471.71945233124484; Fri, 1 Oct 2021 08:38:04 -0700 (PDT) Received: from localhost ([::1]:45916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKbr-0005Yh-HF for importer@patchew.org; Fri, 01 Oct 2021 11:38:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKXv-0006P2-Ds for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:33:59 -0400 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]:46761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXr-0007i5-W7 for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:33:59 -0400 Received: by mail-qt1-x830.google.com with SMTP id e16so9263484qte.13 for ; Fri, 01 Oct 2021 08:33:55 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EV1fPTa0lXnvbJma6gub7tRNpsvH6qdwOzVJWph7xd4=; b=v9bMNXM6XE5BqGoZDAZbvUG69jnAhfBlG2ZzFH4dd1ockfWFS7ToooVGvWexlPYBIM iE+oxzBBgeQtvLtPUIeTWFkVieCoDHtNltX7uZ3/xEm0kgQSvrHio/0Q2j4fZWZb5WM+ Shpg6TRcy+A5SyyTuXVTxGDrW1D2hFPe1m2O6uyRvH1S1HteHzh0YxsWm/XqUBkQVUwh 5qQGqfYKA4QMh2RFNpc7vkLJMno1ulwSXrCBdjrhTyAkN3Zg2DoyKa3kTvP3/hHtdCxf uhlsKwyMrWV4Co6SwU2nzF3xgQJ8/wDY8mf9TdaVHVTdWRUyPcEnVbS2VxA41zN2Hpuw tv1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EV1fPTa0lXnvbJma6gub7tRNpsvH6qdwOzVJWph7xd4=; b=zVs0EDLxI1i7jmx2qWG/H89Ko2XhCOz9ZUfbgK8agLkz62cQ9DuI8cy+vhTfK6mzRW UleiQlZwdSX+JOp/DQUPeIoh8+lGc8HpdaiJeJFfDy48tRCAeL2V58C04l95ehMlH/Y9 /j8jAqJDRtsaW2V1JYPWErj8vVcDHnV7QBWC18i8nXEGAOCh39l37T4bQB/DltxiElzQ HDG5LS33DXXdwEHXpegJjgkfaQwj0WjY5dNEc+G3H8ArRB2Aas3pJBvWEzRARPTyupZ1 Wf4SZLdNWiQk8mZ6Q2UgleOUvHY4zNE+ZiIJVOei1mUrYl6Srq4sPSwUh6DnaV0mYY4+ yzEg== X-Gm-Message-State: AOAM530cuaDowLBrr8r9f2lezm0+z5fTeNY7wE2DAIhRPdoLtK+B9L+S mjopuql5b62Bb1NNjqlRdQj+gfG8xdPVEg== X-Google-Smtp-Source: ABdhPJywvAtcsEKHSgyfRdFEcEUWpnK0PWOHFF0iqgirPCfyiCDCPuGSbwwKJLQF+VO2a+/FcM1NaQ== X-Received: by 2002:ac8:6e8f:: with SMTP id c15mr13715605qtv.179.1633102435078; Fri, 01 Oct 2021 08:33:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 4/9] linux-user/elfload: Rename ARM_COMMPAGE to HI_COMMPAGE Date: Fri, 1 Oct 2021 11:33:42 -0400 Message-Id: <20211001153347.1736014-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::830; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x830.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633102686448100002 Content-Type: text/plain; charset="utf-8" Arm will no longer be the only target requiring a commpage, but it will continue to be the only target placing the page at the high end of the address space. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/elfload.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 5f9e2141ad..dc4ababedd 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -388,11 +388,11 @@ enum { =20 /* The commpage only exists for 32 bit kernels */ =20 -#define ARM_COMMPAGE (intptr_t)0xffff0f00u +#define HI_COMMPAGE (intptr_t)0xffff0f00u =20 static bool init_guest_commpage(void) { - void *want =3D g2h_untagged(ARM_COMMPAGE & -qemu_host_page_size); + void *want =3D g2h_untagged(HI_COMMPAGE & -qemu_host_page_size); void *addr =3D mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); =20 @@ -2160,8 +2160,8 @@ static abi_ulong create_elf_tables(abi_ulong p, int a= rgc, int envc, return sp; } =20 -#ifndef ARM_COMMPAGE -#define ARM_COMMPAGE 0 +#ifndef HI_COMMPAGE +#define HI_COMMPAGE 0 #define init_guest_commpage() true #endif =20 @@ -2361,7 +2361,7 @@ static void pgb_static(const char *image_name, abi_ul= ong orig_loaddr, } =20 loaddr &=3D -align; - if (ARM_COMMPAGE) { + if (HI_COMMPAGE) { /* * Extend the allocation to include the commpage. * For a 64-bit host, this is just 4GiB; for a 32-bit host we @@ -2372,14 +2372,14 @@ static void pgb_static(const char *image_name, abi_= ulong orig_loaddr, if (sizeof(uintptr_t) =3D=3D 8 || loaddr >=3D 0x80000000u) { hiaddr =3D (uintptr_t) 4 << 30; } else { - offset =3D -(ARM_COMMPAGE & -align); + offset =3D -(HI_COMMPAGE & -align); } } =20 addr =3D pgb_find_hole(loaddr, hiaddr - loaddr, align, offset); if (addr =3D=3D -1) { /* - * If ARM_COMMPAGE, there *might* be a non-consecutive allocation + * If HI_COMMPAGE, there *might* be a non-consecutive allocation * that can satisfy both. But as the normal arm32 link base addre= ss * is ~32k, and we extend down to include the commpage, making the * overhead only ~96k, this is unlikely. @@ -2400,7 +2400,7 @@ static void pgb_dynamic(const char *image_name, long = align) * All we need is a commpage that satisfies align. * If we do not need a commpage, leave guest_base =3D=3D 0. */ - if (ARM_COMMPAGE) { + if (HI_COMMPAGE) { uintptr_t addr, commpage; =20 /* 64-bit hosts should have used reserved_va. */ @@ -2410,7 +2410,7 @@ static void pgb_dynamic(const char *image_name, long = align) * By putting the commpage at the first hole, that puts guest_base * just above that, and maximises the positive guest addresses. */ - commpage =3D ARM_COMMPAGE & -align; + commpage =3D HI_COMMPAGE & -align; addr =3D pgb_find_hole(commpage, -commpage, align, 0); assert(addr !=3D -1); guest_base =3D addr; --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633102738548527.294253471948; Fri, 1 Oct 2021 08:38:58 -0700 (PDT) Received: from localhost ([::1]:48548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKcj-0007Hv-HA for importer@patchew.org; Fri, 01 Oct 2021 11:38:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKXx-0006UM-RQ for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:02 -0400 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]:35465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXs-0007ip-UD for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:00 -0400 Received: by mail-qt1-x82f.google.com with SMTP id c20so9317586qtb.2 for ; Fri, 01 Oct 2021 08:33:56 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UkwyzfCxusU0W+ltEdkm6R5Th1JFOdsQsNyNBLHWyyc=; b=vr3ItEn25M6gtHY7D/iM6n7389A+DWuBtFMcujxVv37R+q8U9hUmB8uSmfTrHPX3Nn 4w3lD+g6v21z08YBZiw4FeC+XOceJvZxdoj/g7A1zzUCUp2JAvTHEsuqtwdxvLmun0vA 1TzY0YOR5wvLwclzkW4MyC6/8KHJ8KMftRSdbHlgGR4y6pPw0KCRd7ZxtH1prJqKf5D1 Zb+hNin9A8PwpZj7Fz83r/ovjh3W6GTFRF97WRYPi9aqqBHX7MG4RNmZzOBxW7jT4e2W B+7piMPclWj6itkMrn82sO2QvacjJD5jtMpbOqjVQHyBHUPOFjn+aJcgLo6sjFMWrE2G 93kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UkwyzfCxusU0W+ltEdkm6R5Th1JFOdsQsNyNBLHWyyc=; b=aluNbyyCg6jaDaa4yscVngDDcGINDP6fatsGA2gFLmZAi45adqNwljbLqxAFDFwOdl Ecmy6fhePvOqV2Pkd6Qv5FSMiZWjy/3pzLHBaQ+8NM7Aky98kjY0eXCOKwMnhWMOY3RY FDn7RhngkxxVtsO1aTATatexs0saXdHC3/9Im5eMusyu/Mn3SCr5LXsa6k1F3ZapGwMT Ydq9TM3uulfxwtbTqnK17BfcSE9ScMs40rc3t/PISpXjQf0AK8+gycMRna6YMMlvFp1B dCAI8wyEiv5D7FYAUJrIz45hmeLMylsNP/+VrhIIxNxD56SRNKn8x0ozuNUf118w4Xw2 7xxg== X-Gm-Message-State: AOAM532rz4TGaTkYqF1VVoWyzU4g9zvh6Wuw2nnVCmcOxnPNRIuoeUAx QNZRVmGEvcUG9XhqAFF4+OxYAVn81cUozA== X-Google-Smtp-Source: ABdhPJxVYNFaR7/JbuQUAOz+g7p6pfsBMM8l9hrV8U+ESSMjr1zr1/Itrc0lP/2UL88eb1zElyH0Jg== X-Received: by 2002:ac8:4c99:: with SMTP id j25mr13878237qtv.191.1633102435972; Fri, 01 Oct 2021 08:33:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 5/9] linux-user/nios2: Map a real kuser page Date: Fri, 1 Oct 2021 11:33:43 -0400 Message-Id: <20211001153347.1736014-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::82f; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633102739010100001 Content-Type: text/plain; charset="utf-8" The first word of page1 is data, so the whole thing can't be implemented with emulation of addresses. Use init_guest_commpage for the allocation. Hijack trap number 16 to implement cmpxchg. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 50 ++++++++++++++++++++++++++++++++++++- linux-user/nios2/cpu_loop.c | 50 ++++++++++++++++++++----------------- target/nios2/translate.c | 9 ------- 3 files changed, 76 insertions(+), 33 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index dc4ababedd..206f7d511e 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1099,6 +1099,47 @@ static void init_thread(struct target_pt_regs *regs,= struct image_info *infop) regs->estatus =3D 0x3; } =20 +#define LO_COMMPAGE TARGET_PAGE_SIZE + +static bool init_guest_commpage(void) +{ + static const uint8_t kuser_page[4 + 2 * 64] =3D { + /* __kuser_helper_version */ + [0x00] =3D 0x02, 0x00, 0x00, 0x00, + + /* __kuser_cmpxchg */ + [0x04] =3D 0x3a, 0x6c, 0x3b, 0x00, /* trap 31 */ + 0x3a, 0x28, 0x00, 0xf8, /* ret */ + + /* __kuser_sigtramp */ + [0x44] =3D 0xc4, 0x22, 0x80, 0x00, /* movi r2, __NR_rt_sigreturn = */ + 0x3a, 0x68, 0x3b, 0x00, /* trap 0 */ + }; + + void *want =3D g2h_untagged(LO_COMMPAGE & -qemu_host_page_size); + void *addr =3D mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); + + if (addr =3D=3D MAP_FAILED) { + perror("Allocating guest commpage"); + exit(EXIT_FAILURE); + } + if (addr !=3D want) { + return false; + } + + memcpy(addr, kuser_page, sizeof(kuser_page)); + + if (mprotect(addr, qemu_host_page_size, PROT_READ)) { + perror("Protecting guest commpage"); + exit(EXIT_FAILURE); + } + + page_set_flags(LO_COMMPAGE, LO_COMMPAGE + TARGET_PAGE_SIZE, + PAGE_READ | PAGE_EXEC | PAGE_VALID); + return true; +} + #define ELF_EXEC_PAGESIZE 4096 =20 #define USE_ELF_CORE_DUMP @@ -2160,8 +2201,13 @@ static abi_ulong create_elf_tables(abi_ulong p, int = argc, int envc, return sp; } =20 -#ifndef HI_COMMPAGE +#if defined(HI_COMMPAGE) +#define LO_COMMPAGE 0 +#elif defined(LO_COMMPAGE) #define HI_COMMPAGE 0 +#else +#define HI_COMMPAGE 0 +#define LO_COMMPAGE 0 #define init_guest_commpage() true #endif =20 @@ -2374,6 +2420,8 @@ static void pgb_static(const char *image_name, abi_ul= ong orig_loaddr, } else { offset =3D -(HI_COMMPAGE & -align); } + } else if (LO_COMMPAGE) { + loaddr =3D MIN(loaddr, LO_COMMPAGE & -align); } =20 addr =3D pgb_find_hole(loaddr, hiaddr - loaddr, align, offset); diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index 5c3d01d22d..de0fc63e21 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -76,6 +76,32 @@ void cpu_loop(CPUNios2State *env) force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLTRP, env->regs[R_PC]); break; + + case 16: /* QEMU specific, for __kuser_cmpxchg */ + { + abi_ptr g =3D env->regs[4]; + uint32_t *h, n, o; + + if (g & 0x3) { + force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN, = g); + break; + } + ret =3D page_get_flags(g); + if (!(ret & PAGE_VALID)) { + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR= , g); + break; + } + if (!(ret & PAGE_READ) || !(ret & PAGE_WRITE)) { + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_ACCERR= , g); + break; + } + h =3D g2h(cs, g); + o =3D env->regs[5]; + n =3D env->regs[6]; + env->regs[2] =3D qatomic_cmpxchg(h, o, n) - o; + env->regs[R_PC] +=3D 4; + } + break; } break; =20 @@ -86,29 +112,7 @@ void cpu_loop(CPUNios2State *env) queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); break; case 0xaa: - switch (env->regs[R_PC]) { - /*case 0x1000:*/ /* TODO:__kuser_helper_version */ - case 0x1004: /* __kuser_cmpxchg */ - start_exclusive(); - if (env->regs[4] & 0x3) { - goto kuser_fail; - } - ret =3D get_user_u32(env->regs[2], env->regs[4]); - if (ret) { - end_exclusive(); - goto kuser_fail; - } - env->regs[2] -=3D env->regs[5]; - if (env->regs[2] =3D=3D 0) { - put_user_u32(env->regs[6], env->regs[4]); - } - end_exclusive(); - env->regs[R_PC] =3D env->regs[R_RA]; - break; - /*case 0x1040:*/ /* TODO:__kuser_sigtramp */ - default: - ; -kuser_fail: + { info.si_signo =3D TARGET_SIGSEGV; info.si_errno =3D 0; /* TODO: check env->error_code */ diff --git a/target/nios2/translate.c b/target/nios2/translate.c index a759877519..f9abc2fdd2 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -795,15 +795,6 @@ static void nios2_tr_translate_insn(DisasContextBase *= dcbase, CPUState *cs) dc->base.pc_next =3D pc + 4; =20 /* Decode an instruction */ - -#if defined(CONFIG_USER_ONLY) - /* FIXME: Is this needed ? */ - if (pc >=3D 0x1000 && pc < 0x2000) { - t_gen_helper_raise_exception(dc, 0xaa); - return; - } -#endif - code =3D cpu_ldl_code(env, pc); op =3D get_opcode(code); =20 --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633102988329388.6072896428633; Fri, 1 Oct 2021 08:43:08 -0700 (PDT) Received: from localhost ([::1]:55320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKgl-0003YD-4h for importer@patchew.org; Fri, 01 Oct 2021 11:43:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKY1-0006fM-LT for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:05 -0400 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]:41945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXt-0007k7-Lu for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:05 -0400 Received: by mail-qk1-x72a.google.com with SMTP id m7so9492388qke.8 for ; Fri, 01 Oct 2021 08:33:57 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F9yEwPrmR9xpxjbUMZcvWlIm4BrVKkXnEjUbM9qs6VM=; b=o5YqmOZ8FQBpCsn3z4vAOehwAN/laf9MPTJhYFBaERaLSGNW5YWCYzLnKFmjDVJBpY nhDH4Pu1UY+3kJS8mpObw5e8sfY9wSKtnW+Nilgr+M7wVFAqjXhaaoLgnN+gV703rkPw uaSDs9KpDJ1b8X4dkMUnhB9snJKW4Z7NPgvb4cjUfr6UgvcfxZ5vJhS6lqA8bI/iVzLw BJGTkZt2tHPkYoW2Iupse/ws8qDhQKvkBz9MLwXp1abzRblh44nwp1RpI3rBnQVidhAf 0RSM/OJ4+qWhN9zLTEJcrTblQry22ni/xKp/jdZfMXTuFeaz6r4CQxQBywU9R5RzrS82 gjRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F9yEwPrmR9xpxjbUMZcvWlIm4BrVKkXnEjUbM9qs6VM=; b=NSO9LaACfSIX2rYiq+BZXVR+4BI8O5gYfUF/zfysxdiEdEY8L+KIAIjctTXTmqeDdf 1MSoC1Zrq7DxcfLTQcl5y9SU0zCCSId/jxhPFjXIrxPRvB1vrYIh6adNKKsZPUeS4nP2 refU1DAzTy992inZd4vbdYTZOiJAoaOJVsY+yf8rxva0s4I3Z/ETLax3ssrzvYwYWwi2 evoEGnkIw5piNwg45OBnO8u0W6aU5F4Qwf373a8UpG/knCFihvR+N6pi5odlMrk95RWX dFnbWEnqYrz7sSjQSXiBmPlShEWK5DIh0xe9FYu5UE4wcrJiOzXKupdF9c52I8orTj0N coiw== X-Gm-Message-State: AOAM530Fkti5a5nBgaiTGimFYlLIcaptz90NK4VE34zTChSunCDhGWOg zlLbyuCQ+vKwGjsfZ0AN9YSWkBUo9hxXlw== X-Google-Smtp-Source: ABdhPJxYw4bSnJgXYt85lBdeJRJG+eS/taTfbQ/fs1kNtm98tHgwebwcy5tSox0tR+IflpdZidIABA== X-Received: by 2002:a37:a20a:: with SMTP id l10mr10193543qke.273.1633102436730; Fri, 01 Oct 2021 08:33:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 6/9] linux-user/nios2: Fix EA vs PC confusion Date: Fri, 1 Oct 2021 11:33:44 -0400 Message-Id: <20211001153347.1736014-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::72a; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633102989469100001 Content-Type: text/plain; charset="utf-8" The real kernel will talk about the user PC as EA, because that's where the hardware will have copied it, and where it expects to put it to then use ERET. But qemu does not emulate all of the exception stuff while emulating user-only. Manipulate PC directly. This fixes signal entry and return, and eliminates some slight confusion from target_cpu_copy_regs. Signed-off-by: Richard Henderson --- linux-user/nios2/cpu_loop.c | 5 +---- linux-user/nios2/signal.c | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index de0fc63e21..1e93ef34e6 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -155,9 +155,6 @@ void target_cpu_copy_regs(CPUArchState *env, struct tar= get_pt_regs *regs) env->regs[R_SP] =3D regs->sp; env->regs[R_GP] =3D regs->gp; env->regs[CR_ESTATUS] =3D regs->estatus; - env->regs[R_EA] =3D regs->ea; - /* TODO: unsigned long orig_r7; */ - - /* Emulate eret when starting thread. */ env->regs[R_PC] =3D regs->ea; + /* TODO: unsigned long orig_r7; */ } diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c index adbffe32e3..20b65aa06e 100644 --- a/linux-user/nios2/signal.c +++ b/linux-user/nios2/signal.c @@ -73,7 +73,7 @@ static void rt_setup_ucontext(struct target_ucontext *uc,= CPUNios2State *env) __put_user(env->regs[R_RA], &gregs[23]); __put_user(env->regs[R_FP], &gregs[24]); __put_user(env->regs[R_GP], &gregs[25]); - __put_user(env->regs[R_EA], &gregs[27]); + __put_user(env->regs[R_PC], &gregs[27]); __put_user(env->regs[R_SP], &gregs[28]); } =20 @@ -122,7 +122,7 @@ static int rt_restore_ucontext(CPUNios2State *env, stru= ct target_ucontext *uc, __get_user(env->regs[R_GP], &gregs[25]); /* Not really necessary no user settable bits */ __get_user(temp, &gregs[26]); - __get_user(env->regs[R_EA], &gregs[27]); + __get_user(env->regs[R_PC], &gregs[27]); =20 __get_user(env->regs[R_RA], &gregs[23]); __get_user(env->regs[R_SP], &gregs[28]); @@ -181,7 +181,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, env->regs[4] =3D sig; env->regs[5] =3D frame_addr + offsetof(struct target_rt_sigframe, info= ); env->regs[6] =3D frame_addr + offsetof(struct target_rt_sigframe, uc); - env->regs[R_EA] =3D ka->_sa_handler; + env->regs[R_PC] =3D ka->_sa_handler; =20 unlock_user_struct(frame, frame_addr, 1); } --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633103162828969.7314244569214; Fri, 1 Oct 2021 08:46:02 -0700 (PDT) Received: from localhost ([::1]:33986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKjZ-0008HN-SH for importer@patchew.org; Fri, 01 Oct 2021 11:46:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKY4-0006pv-N1 for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:08 -0400 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]:42888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXu-0007kZ-Kv for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:08 -0400 Received: by mail-qt1-x830.google.com with SMTP id f15so9302057qtv.9 for ; Fri, 01 Oct 2021 08:33:58 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k/SnMn3cz6aHPIbcUbwKN2ElGsSac37gMdkQcSMJ6WQ=; b=Wn6xzyjBTdCRQX4O4ZN+01a/+yBTD9I06VQ/C7SBr4Lb/pdaHgPbMkl/cT2EgaS1TJ uTMnwQIt7CGmRYN2oEiWQOHz7bCWIHDDvc8MMyUUGVBPYs3aIJv3TxHA0w4o80wTQLBG U+Wcbmm3L31gsLjGH/rdpFCAD/dKDcar2BAlMBY7ExNkOgwPjd+NB7Wk0/cb0hp1Uw6n rk8KiJvWwYmkl9NA66ya3/ghK6dzwY6pDaIHCVDZ1TrN9KH2WjeyIPs4Dd3xCUwUcP4R MHeoXdPN2w1uKvkTZfHa6tFBL74rneVAvVA9+HvaLlKgoM/jhrJBlUrgj+tDbd3YaroO bzMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k/SnMn3cz6aHPIbcUbwKN2ElGsSac37gMdkQcSMJ6WQ=; b=NqoCYUuX2qGmyHj1k7dx8z4vJswYRBP0u3IANskUPcPvfPK6pZxrxtzoicKMR3TrNg cUjRUbZdmQdB/EfcEVDKvon9Kix+RtfX2TJ8oA4wCiJvIqZei1AEWBZM7duz+LQi56W+ d34ITNJB91Ez99ZHVgjmZz+6yfDT9BV6M7gUoKjfoO8Yt3qreSrsL5gGmmcQmGLbxjgB SFY+PGiYdKT4CK5Rz+2Fy3E1hyYM7WeY3ElEZ1Ojj5TyaED9kTB9z2TOobhdzIwS1SWF VlkSoxajFIYJ2N1KHBsKn5P44dj3P3l85BJOrWudCjCB5+74dSwPnzfZYU55W++UjL1t MYoA== X-Gm-Message-State: AOAM532dFpGGj5mTZMaYFv2u/nTqQbpGi/v1xwi5B/EDTeHUx3v+O25A LiuJYifOG+5u19afccLNFt407KFtr52W0A== X-Google-Smtp-Source: ABdhPJwp6A6yIKiXbsO9FZgDRdRWtS/85/abE7rMoSlI3Y+ed3cTLAHnICgk309vHm5BYEL5PIdCDA== X-Received: by 2002:ac8:138c:: with SMTP id h12mr13236328qtj.357.1633102437778; Fri, 01 Oct 2021 08:33:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 7/9] linux-user/nios2: Fix sigmask in setup_rt_frame Date: Fri, 1 Oct 2021 11:33:45 -0400 Message-Id: <20211001153347.1736014-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::830; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x830.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633103163786100001 Content-Type: text/plain; charset="utf-8" Do not cast the signal mask elements; trust __put_user. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/nios2/signal.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c index 20b65aa06e..80e3d42fc9 100644 --- a/linux-user/nios2/signal.c +++ b/linux-user/nios2/signal.c @@ -168,8 +168,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, target_save_altstack(&frame->uc.tuc_stack, env); rt_setup_ucontext(&frame->uc, env); for (i =3D 0; i < TARGET_NSIG_WORDS; i++) { - __put_user((abi_ulong)set->sig[i], - (abi_ulong *)&frame->uc.tuc_sigmask.sig[i]); + __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); } =20 /* Set up to return from userspace; jump to fixed address sigreturn --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16331028984382.3171872626744516; Fri, 1 Oct 2021 08:41:38 -0700 (PDT) Received: from localhost ([::1]:53500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKfG-0002EN-0y for importer@patchew.org; Fri, 01 Oct 2021 11:41:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKY3-0006jb-11 for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:07 -0400 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]:41817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXv-0007lY-Ng for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:06 -0400 Received: by mail-qt1-x834.google.com with SMTP id t2so9291266qtx.8 for ; Fri, 01 Oct 2021 08:33:59 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gXXC2XsHwTZReF8hOMB+sB2b5Bdxnek1fsOyxb7DiMI=; b=IDiXIR43FotQVnwcSqS87BOBZGCrbx9CkNdw9LmgnMXfbptOwA5D477gSaARsPrHxU +/h/1HR6S7P6d3T0F70+0/Zg3XB6GyMAg3iIgMusaRSrjs0RoHNOrXSGTR8SBqBlnv/I M+2Jz8DycyY0O6nTowEoNTQclxd/eJjuq6rOgjzkTontiP9a6lKnZpekX/CSjeMFwsmK Cib2briqVnPuLAAqDcYrJPzAAPrdDHT0T6moG9b3MwPyf1lTPeJEZOwjkZ3hHIyFByAo zdbe2GFhu/IQ1VNn0e80riXZJmWZjtvs6yhbX6W5sAfrW/9eJcEamWXAOv2aQF0IRehZ /lNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gXXC2XsHwTZReF8hOMB+sB2b5Bdxnek1fsOyxb7DiMI=; b=zeS6gezIb6ggJ1dPzKsIxdIf85QXy2rcnVHxVat8w3SfJq7y5OTjkLmpKarjFg0erG h5gOKqRq9M341jz0m8IN/QOpNeNbhXxg6w5M0iZGgP+ArZvzYrXKMvPANCnT0wkMbaEM 4RaNli6pRWIPHXaZK8zceuFgNgE4NtiMrabW711oJKz9SkS1QBODoe7ANnEdQpu8R8ho PM7uowGcR2bhbH3Ie//oe1ksJE8Kx3FKFrri5eCXhJ2u6npYLkIOTutxktPOhWNivcj8 HSXwQSm0Zv6X0xLi25jqM/esiUxkD0hiJ2MZnC6rW+LlQVZOlSafdrF1gex1Gf0Fgeod wrGg== X-Gm-Message-State: AOAM531z5yU37MFdJ9xOT9MsqNR1QV1+cOswYpBhAliOrWv3ey/NCEsK 7RN6JfrelFmS2xT1hcrtL2gVjuX52ZRIbw== X-Google-Smtp-Source: ABdhPJzfGCTgGduUDcOwFaEsad8ef2PvIrp3JbTHmN5sA6KotPvror0l+19+vtNLXUBu7OVFjwYoZg== X-Received: by 2002:ac8:4d8b:: with SMTP id a11mr13338151qtw.51.1633102438762; Fri, 01 Oct 2021 08:33:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 8/9] linux-user/nios2: Use set_sigmask in do_rt_sigreturn Date: Fri, 1 Oct 2021 11:33:46 -0400 Message-Id: <20211001153347.1736014-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::834; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x834.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633102899541100001 Content-Type: text/plain; charset="utf-8" Using do_sigprocmask directly was incorrect, as it will leave the signal blocked by the outer layers of linux-user. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/nios2/signal.c | 2 +- linux-user/signal.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c index 80e3d42fc9..517cd39270 100644 --- a/linux-user/nios2/signal.c +++ b/linux-user/nios2/signal.c @@ -205,7 +205,7 @@ long do_rt_sigreturn(CPUNios2State *env) } =20 target_to_host_sigset(&set, &frame->uc.tuc_sigmask); - do_sigprocmask(SIG_SETMASK, &set, NULL); + set_sigmask(&set); =20 if (rt_restore_ucontext(env, &frame->uc, &rval)) { goto badframe; diff --git a/linux-user/signal.c b/linux-user/signal.c index 2038216455..5ec63cd092 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -252,7 +252,6 @@ int do_sigprocmask(int how, const sigset_t *set, sigset= _t *oldset) return 0; } =20 -#if !defined(TARGET_NIOS2) /* Just set the guest's signal mask to the specified value; the * caller is assumed to have called block_signals() already. */ @@ -262,7 +261,6 @@ void set_sigmask(const sigset_t *set) =20 ts->signal_mask =3D *set; } -#endif =20 /* sigaltstack management */ =20 --=20 2.25.1 From nobody Mon Feb 9 14:59:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1633102998436773.4397427681553; Fri, 1 Oct 2021 08:43:18 -0700 (PDT) Received: from localhost ([::1]:55730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKgv-0003rm-EX for importer@patchew.org; Fri, 01 Oct 2021 11:43:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKY4-0006pE-J9 for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:08 -0400 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:43831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWKXw-0007mW-K8 for qemu-devel@nongnu.org; Fri, 01 Oct 2021 11:34:08 -0400 Received: by mail-qk1-x72f.google.com with SMTP id 138so9479688qko.10 for ; Fri, 01 Oct 2021 08:34:00 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id x8sm3484823qtv.5.2021.10.01.08.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ty9oWbKVOJOBomZhBTDMFXJ5kVE2f+VzbHAS7qTOPJk=; b=tVpl60him62RPDaU2zi63+ORUV+IjjTy9W5qc37q7vK7jH8NuwiVhYX0QWp6HyuVJm 6iph14sfd9e9iFvCl07TUGislyUAuFijWPMoi68/OK2Cj9x4o8tJXk6jcl16bkHyYMwo UDyNjgTo6jn0aaiXc+SPWuRUnwY3YMCTfL9JmVfaSBjAuTiWy+FUblOzGu6uZvwMmIEL v0YoJrQEePhOvDFiqr+EbQxw6QaWBK3dHWntTOIBkwPaayZoG15ttb5kq7liYTsU2zUC 3QVRe4L9WMBus9pO8XThpDO9OaVF6pUc0r+31E5bKeJda5/l5N/x57u4H19LESkhgfPr Np1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ty9oWbKVOJOBomZhBTDMFXJ5kVE2f+VzbHAS7qTOPJk=; b=IqRFGKhuyEyN1ybM4PJklmoVUkpf3u+sXGs99756brSvVgR3Sw3b8i+ch4BHynrX9x FvCm8ZRsiO1oIMJtsEUpidfJ3eDGLDD37f6kNkHV7B+WJEK/kF9iCWqKnBeJ1sAF0GnC Lz6CdxyKlCXqOd74FY6EaVfAdMf7qM2zXb8hEcRqJbps58Vc0ZBNzgTr+DQx9ZWqIGH/ Ylit5yyy5+xBqXKuK0EDbvD75mdafr/rNdo0xiX0spcebNJLp3v3R71TcgNfqsaB7iXJ 1ePWYnsXRaHCtqBeujEMIRBo4WZivGiSKwj4FLm+wpKFIRbH42Sn4wzUMXspruwPJhi6 o5iw== X-Gm-Message-State: AOAM533sVbXnV2C+LEIK5nNaUrwVH4zJlLV0Jx5wgqOugDg5tX3U2ycQ pCjX2Rf6QRxP2sqlFHCLKIIe7y0AdmjyQQ== X-Google-Smtp-Source: ABdhPJyagLvSLGGnkXjGZhWKPFRjU6Oq0V8FjrAixn1+wtB1ryaoFmIQzP3b8h+IoG6XzW12sy/Hcw== X-Received: by 2002:a37:6350:: with SMTP id x77mr10162330qkb.356.1633102439674; Fri, 01 Oct 2021 08:33:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 9/9] tests/tcg: Enable container_cross_cc for nios2 Date: Fri, 1 Oct 2021 11:33:47 -0400 Message-Id: <20211001153347.1736014-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001153347.1736014-1-richard.henderson@linaro.org> References: <20211001153347.1736014-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::72f; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, crwulff@gmail.com, alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1633102999012100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tests/tcg/configure.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh index 1f985ccfc0..62ca1e2cae 100755 --- a/tests/tcg/configure.sh +++ b/tests/tcg/configure.sh @@ -59,6 +59,7 @@ fi : $(cross_cc_mips64=3D"mips64-linux-gnuabi64-gcc") : $(cross_cc_mipsel=3D"mipsel-linux-gnu-gcc") : $(cross_cc_mips=3D"mips-linux-gnu-gcc") +: $(cross_cc_nios2=3D"nios2-linux-gnu-gcc") : ${cross_cc_ppc=3D"powerpc-linux-gnu-gcc"} : ${cross_cc_cflags_ppc=3D"-m32"} : ${cross_cc_ppc64=3D"powerpc64-linux-gnu-gcc"} @@ -153,6 +154,11 @@ for target in $target_list; do container_image=3Ddebian-mips-cross container_cross_cc=3Dmips-linux-gnu-gcc ;; + nios2-*) + container_hosts=3Dx86_64 + container_image=3Ddebian-nios2-cross + container_cross_cc=3Dnios2-linux-gnu-gcc + ;; ppc-*|ppc64abi32-*) container_hosts=3Dx86_64 container_image=3Ddebian-powerpc-test-cross --=20 2.25.1