From nobody Thu Dec 18 22:21:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1569603133; cv=none; d=zoho.com; s=zohoarc; b=Qj33occV0lhtjfvYXc+MgcxDxpVQP3N+OvkBvI7g8jk917Dc5xPmqgFeH3pWTYs/X5caOSzoDkSdK5S6wif9SF88Oe00YMWfO4axUWkhZK/UtvCyVhYaEugd0SdDuckJKXSvywFrBv2OX3Yv/a5k+wS9qb/jaJo34nbiMq74hmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569603133; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=dG6U5xvfHaHpDk3CXCVLs61xrDsnr9EUS5qAtKh629M=; b=RCcFC0HJFeTWhlqdLTJsfvOa/5lkfkY9OGHxHUyCzvYIDMJ7RN/4pIwcwP+SKohmLI9QT0B0Vf2gjSbgBJlTDBcacQn18wRob2PI+hWGxRtoLjziPyZ3dmGuAbsdglUfbEX+7+tUh9kw0pWwb0n89/tKSnl6m+tzuHQNhaetfRw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569603133297845.49015568041; Fri, 27 Sep 2019 09:52:13 -0700 (PDT) Received: from localhost ([::1]:53600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDtTW-0006zM-Ug for importer@patchew.org; Fri, 27 Sep 2019 12:52:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51145) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrSU-0002Pz-PI for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDrSQ-00086W-IJ for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:42:57 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:36706) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDrSQ-000863-6u for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:42:54 -0400 Received: by mail-wr1-x444.google.com with SMTP id y19so3150280wrd.3 for ; Fri, 27 Sep 2019 07:42:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y12sm2874539wrn.74.2019.09.27.07.42.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 07:42:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dG6U5xvfHaHpDk3CXCVLs61xrDsnr9EUS5qAtKh629M=; b=ZWHHWkoNl/6QmjUJ5PiVhzRxbuGU6F1cPKqH10z13Oy6O17oR+JMfUgcJpqb9xAa7p j+L/NXINfDMEnRdbdcB/EdpFClrlYkLIjOdXLFWdMD+goxcsuHXaHwC8cDTb4goDfPRZ yHLrKhU+g2njFYBd4sxZUcch2Uf1u2dJPUJw1MzIliOxsNg9ECPB6RBibb1OmZROnN6/ 0S8nSpO3YNRNADxhkPTJTR9MhytPVbgcXaO6/OAKWKmuFd5iyc7gVma1Tll+NMDlvlrN gfImr7MqnhDpdueOp0ObJFKuXy5Nbhsc8lNZoraS517+JFo7utTjEPzPqyXnunCg47ts garA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dG6U5xvfHaHpDk3CXCVLs61xrDsnr9EUS5qAtKh629M=; b=RsEns9J+vfBJG5PmYxacLIQri7LXXmNc9XWy5bvghKd6O93qo5BOjyQIu2wNFfRE8o E/hVrVCh9NnhhILa54NGXXCRSya1s39YbEz3gzL4l5uNMIXSLhnMOnmbxIlOgF4nA17H rptl8ShDTeprkkXiw262R/X30jWRdL/Dwimz3O98Rx1IsSi9VVMwG4gG8qYhCl+NOWNk wNt6RNyqishsZR4mc6/PEZNL3bpb6CgODK7g6Fifm1l9TU0JOvuUYJriuHtEQkgvWcsV /DbiMqYtDnTBQnZSRjUtzXXNUg5RWvz3v3hPoXVsF7lf9bLtjjnAIHZtdtejYwMHdBPw eAIQ== X-Gm-Message-State: APjAAAWU+b+Mk7VD2vUHYhcfRFyil1iqVgxPT9niEXuIgUZsuSKx+VrR 7+R9/EKKDB8yzkpxQkS13fWfecaDkX/++A== X-Google-Smtp-Source: APXvYqyEnG2Rx8or0d9M/cKOrQdUUEyVpoqGGBnFaYLawQFAqj1vTxdhXt4H1sWnWb7HRpak2jADYw== X-Received: by 2002:a7b:c3c6:: with SMTP id t6mr7468216wmj.5.1569595372629; Fri, 27 Sep 2019 07:42:52 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 1/9] target/arm: fix CBAR register for AArch64 CPUs Date: Fri, 27 Sep 2019 15:42:41 +0100 Message-Id: <20190927144249.29999-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927144249.29999-1-peter.maydell@linaro.org> References: <20190927144249.29999-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Luc Michel For AArch64 CPUs with a CBAR register, we have two views for it: - in AArch64 state, the CBAR_EL1 register (S3_1_C15_C3_0), returns the full 64 bits CBAR value - in AArch32 state, the CBAR register (cp15, opc1=3D1, CRn=3D15, CRm=3D3,= opc2=3D0) returns a 32 bits view such that: CBAR =3D CBAR_EL1[31:18] 0..0 CBAR_EL1[43:32] This commit fixes the current implementation where: - CBAR_EL1 was returning the 32 bits view instead of the full 64 bits value, - CBAR was returning a truncated 32 bits version of the full 64 bits one, instead of the 32 bits view - CBAR was declared as cp15, opc1=3D4, CRn=3D15, CRm=3D0, opc2=3D0, which= is the CBAR register found in the ARMv7 Cortex-Ax CPUs, but not in ARMv8 CPUs. Signed-off-by: Luc Michel Message-id: 20190912110103.1417887-1-luc.michel@greensocs.com [PMM: Added a comment about the two different kinds of CBAR] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 507026c9154..bc1130d989d 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6733,6 +6733,19 @@ void register_cp_regs_for_features(ARMCPU *cpu) } =20 if (arm_feature(env, ARM_FEATURE_CBAR)) { + /* + * CBAR is IMPDEF, but common on Arm Cortex-A implementations. + * There are two flavours: + * (1) older 32-bit only cores have a simple 32-bit CBAR + * (2) 64-bit cores have a 64-bit CBAR visible to AArch64, plus a + * 32-bit register visible to AArch32 at a different encoding + * to the "flavour 1" register and with the bits rearranged to + * be able to squash a 64-bit address into the 32-bit view. + * We distinguish the two via the ARM_FEATURE_AARCH64 flag, but + * in future if we support AArch32-only configs of some of the + * AArch64 cores we might need to add a specific feature flag + * to indicate cores with "flavour 2" CBAR. + */ if (arm_feature(env, ARM_FEATURE_AARCH64)) { /* 32 bit view is [31:18] 0...0 [43:32]. */ uint32_t cbar32 =3D (extract64(cpu->reset_cbar, 18, 14) << 18) @@ -6740,12 +6753,12 @@ void register_cp_regs_for_features(ARMCPU *cpu) ARMCPRegInfo cbar_reginfo[] =3D { { .name =3D "CBAR", .type =3D ARM_CP_CONST, - .cp =3D 15, .crn =3D 15, .crm =3D 0, .opc1 =3D 4, .opc2 = =3D 0, - .access =3D PL1_R, .resetvalue =3D cpu->reset_cbar }, + .cp =3D 15, .crn =3D 15, .crm =3D 3, .opc1 =3D 1, .opc2 = =3D 0, + .access =3D PL1_R, .resetvalue =3D cbar32 }, { .name =3D "CBAR_EL1", .state =3D ARM_CP_STATE_AA64, .type =3D ARM_CP_CONST, .opc0 =3D 3, .opc1 =3D 1, .crn =3D 15, .crm =3D 3, .opc2= =3D 0, - .access =3D PL1_R, .resetvalue =3D cbar32 }, + .access =3D PL1_R, .resetvalue =3D cpu->reset_cbar }, REGINFO_SENTINEL }; /* We don't implement a r/w 64 bit CBAR currently */ --=20 2.20.1 From nobody Thu Dec 18 22:21:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1569603645; cv=none; d=zoho.com; s=zohoarc; b=JpuM/RRcBoTEy0dr/Pgka4kT8TXLlTCiqm3CrA/4X2yAAkby8MyPfPqF1sgG8Y+h+d98mTXoEWn8C59ASEU8DFzi0QiFPfxkf373Pb6QFyoBR+MwRDShSDdxhXsmrvEPNP5nC015TZVm4V08rD+tEopap8HkVIBz0g2UhCEmTpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569603645; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=JFBxNhwZUB6CHbayrqGeU/qxAXPua6XejRKVwrJmAkw=; b=UIrwLY9DqOxcIXeDsNE96q8tSoxVbzNy2DU7/OPzffumK7V40tnu5pS9CI6T8frYLcI/tsA0ZKwcL0jXxzOxFfCBgqIkl+rB9zdRkTCFn2e2FJGPv+dCGXLUPa2h1s8XSuv+mGGTGI7Ol+6GRKBD2H0QGfNgreGhy5Fdpjydqg0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569603645087720.1188596550618; Fri, 27 Sep 2019 10:00:45 -0700 (PDT) Received: from localhost ([::1]:53758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDtbn-00072F-NM for importer@patchew.org; Fri, 27 Sep 2019 13:00:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51144) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrSU-0002Py-Om for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:42:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDrSR-00086m-BA for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:42:57 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:32831) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDrSQ-00086S-U5 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:42:55 -0400 Received: by mail-wr1-x430.google.com with SMTP id b9so3162130wrs.0 for ; Fri, 27 Sep 2019 07:42:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y12sm2874539wrn.74.2019.09.27.07.42.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 07:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JFBxNhwZUB6CHbayrqGeU/qxAXPua6XejRKVwrJmAkw=; b=k0ujSz4T+r/9rGFRU7tZqyhrrySKGbhZ8oDmdjtuxzhbKP6qhsEwbDnCxIUBgTCkNd EXf6xiVNWPb+0/Z8g8r/uPZ61xnsWcmnbNQcv0RKLKd0wUO32+1RsxP62/ykQCmU6f26 eIllnl37/+eZ9wwSvLgcBSnXkzfT+12Y5HmuPJ/NRzpD+KixBWxc0Ofz6nAH9QhAWlVI J1cRmteFAFTSgO6gQL9ujHDszuPZl/7TCeRjKXewmYAz3G2XBI95b3vhXnObk4qXrYdV uM2IZGI3MWqnCKRE6V6/nciv+0y94HzIFXsfJOeUqmf/cbPCWRHsytCE8RPWm6SJVahV C+EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JFBxNhwZUB6CHbayrqGeU/qxAXPua6XejRKVwrJmAkw=; b=FbGM+qIU+53V8A5nC7u8r6J/H/5rpq4+6W9eZECSi56LrxwwamYEua+NcW15wnBga7 0yJHlMSXzwhuwVApQXrqk0P1m0iaqHkpOCinBhT052oqtm21eI7iQOuW2lLoDAyKhuHQ yt/xqAPJzEVJSjR9N112RAjakOUTJzuNTRsBJhsQkAwgihK5dTmabVb4MfkIOfejHWDb p4mRfl0u7VYzLNfi5ZDTbasqmfeO4elICDdQwJ20q5JpcV+95FZ2OlWoeqHVk2Md//vY ofNM3uAhLkasvP7tFGdcS/tK2mwh5VQSX6w1oDJh67kBTzOmkp3JhV/c2GeqSzHLxjlA BXHQ== X-Gm-Message-State: APjAAAUX1PR0kKVHpOF32YyCFCc8FSo34uR6Hp8b0RN0nuMvzY3UK0xu /OsBNM5o67rgDi8V+4Maraeo0vBidGBLCA== X-Google-Smtp-Source: APXvYqx1MxnrW+Pn8pMVLQKqbxClMNAbvimSKg6SgDhUx/cGHLmFhDfCFYMfuY6kE8xL9t4bY6qeAg== X-Received: by 2002:a1c:9c96:: with SMTP id f144mr7757161wme.96.1569595373669; Fri, 27 Sep 2019 07:42:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/9] tests/tcg: clean-up some comments after the de-tangling Date: Fri, 27 Sep 2019 15:42:42 +0100 Message-Id: <20190927144249.29999-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927144249.29999-1-peter.maydell@linaro.org> References: <20190927144249.29999-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Alex Benn=C3=A9e These were missed in the recent de-tangling so have been updated to be more actuate. I've also built up ARM_TESTS in a manner similar to AARCH64_TESTS for better consistency. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Peter Maydell Message-id: 20190913151845.12582-2-alex.bennee@linaro.org Signed-off-by: Peter Maydell --- tests/tcg/Makefile.target | 7 +++++-- tests/tcg/aarch64/Makefile.target | 3 ++- tests/tcg/arm/Makefile.target | 15 ++++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 8808beaf74b..679eb56bd37 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -74,8 +74,11 @@ TIMEOUT=3D15 endif =20 ifdef CONFIG_USER_ONLY -# The order we include is important. We include multiarch, base arch -# and finally arch if it's not the same as base arch. +# The order we include is important. We include multiarch first and +# then the target. If there are common tests shared between +# sub-targets (e.g. ARM & AArch64) then it is up to +# $(TARGET_NAME)/Makefile.target to include the common parent +# architecture in its VPATH. -include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target =20 diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index e763dd9da37..9758f89f905 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -8,7 +8,7 @@ VPATH +=3D $(ARM_SRC) AARCH64_SRC=3D$(SRC_PATH)/tests/tcg/aarch64 VPATH +=3D $(AARCH64_SRC) =20 -# we don't build any other ARM test +# Float-convert Tests AARCH64_TESTS=3Dfcvt =20 fcvt: LDFLAGS+=3D-lm @@ -17,6 +17,7 @@ run-fcvt: fcvt $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)") $(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref) =20 +# Pauth Tests AARCH64_TESTS +=3D pauth-1 pauth-2 run-pauth-%: QEMU_OPTS +=3D -cpu max =20 diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index aa4e4e3782c..7347d3d0adb 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -8,25 +8,26 @@ ARM_SRC=3D$(SRC_PATH)/tests/tcg/arm # Set search path for all sources VPATH +=3D $(ARM_SRC) =20 -ARM_TESTS=3Dhello-arm test-arm-iwmmxt - -TESTS +=3D $(ARM_TESTS) fcvt - +# Basic Hello World +ARM_TESTS =3D hello-arm hello-arm: CFLAGS+=3D-marm -ffreestanding hello-arm: LDFLAGS+=3D-nostdlib =20 +# IWMXT floating point extensions +ARM_TESTS +=3D test-arm-iwmmxt test-arm-iwmmxt: CFLAGS+=3D-marm -march=3Diwmmxt -mabi=3Daapcs -mfpu=3Dfpv= 4-sp-d16 test-arm-iwmmxt: test-arm-iwmmxt.S $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) =20 -ifeq ($(TARGET_NAME), arm) +# Float-convert Tests +ARM_TESTS +=3D fcvt fcvt: LDFLAGS+=3D-lm # fcvt: CFLAGS+=3D-march=3Darmv8.2-a+fp16 -mfpu=3Dneon-fp-armv8 - run-fcvt: fcvt $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)") $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref) -endif + +TESTS +=3D $(ARM_TESTS) =20 # On ARM Linux only supports 4k pages EXTRA_RUNS+=3Drun-test-mmap-4096 --=20 2.20.1 From nobody Thu Dec 18 22:21:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1569603354; cv=none; d=zoho.com; s=zohoarc; b=M/yTra3SDQsu6fw5kVjGmbtaC1+LvnhkEXD0sV0a2yiCHU93Kgl4O/6t/k9hofnHdhQmCmiSbZoONB0NPcvC7upDnCfcGTDgqxpogIh0YEIKHnRYPzcm0TKw12Coz62d1mOcDMZTxp2g2sSuGQHgm04jGyea9HcYf5E9k42myZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569603354; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lMzpaWj77iIcNxSlT3zcE/i8ZeOFrgVR+n/jrGwxbAY=; b=F+wCBxTMNWUsMKuiJQnljd7CYCeu+yUazu2XV8wlkPenRKGsXeNbPXmmSRTSYfp4ARSAKPezExkjN1sTd+9jRgBX12h930To1kRhmvEDDweZLrQ3Lubjjn0y08AHKFHZowWPruwswV42rub7sl0l4FJUwes8Y7vYr0BJdx6pOjw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156960335454891.17282192749929; Fri, 27 Sep 2019 09:55:54 -0700 (PDT) Received: from localhost ([::1]:53654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDtX6-0002C6-E1 for importer@patchew.org; Fri, 27 Sep 2019 12:55:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51177) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrSY-0002Rb-Lu for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDrSW-00087o-42 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:01 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:37221) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDrST-00086e-V1 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:42:59 -0400 Received: by mail-wr1-x430.google.com with SMTP id i1so3141963wro.4 for ; Fri, 27 Sep 2019 07:42:55 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y12sm2874539wrn.74.2019.09.27.07.42.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 07:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=lMzpaWj77iIcNxSlT3zcE/i8ZeOFrgVR+n/jrGwxbAY=; b=urSb5JvZE57DJPDUJFtehYkhAeRWzsC5ugRfpWdJbCpXKUiC45onVBfx228WsbHhDO bvBSFGmy9hSvhewBlvl/zRNbtMT3NcQ5lJLdzBx4kgRhRLiLutoJnHVtPibIzPoPdwHH oSRqWRdALo9w1LnQ6RY1Q2UaMmKnap81mE3BYjpKNnhAM+Wkt0CMog2x0VwKVIAGtQWu 6tDME4zoaCZF+6BMTNaufJ17ELll4fTXXfiC1dyHAALmw4MAh08WI/Qct5B5+9RYr9nb tcYah8/nYFhsqhZ79BneFVjUMT10t8Qn7ifQz377oRPJ9XLygH/L6vvrNB2ABjP1goCG Q9Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lMzpaWj77iIcNxSlT3zcE/i8ZeOFrgVR+n/jrGwxbAY=; b=lorHfcC0AmTZ4PScgXMTMNTV4WAP+J0yeXc6R2NTN0TPbpzzO2ZaRAmwx0ai0YCSjT AmAvUzcqCuLn1POccP4PDnqWPeDCunuEB6nlUfrVvGZkQt+XoD4OSFYVNJpgTJ9Rc9kn /PqDgRWWuGl8EfushhK/x+xHboFOR6d6NLwrZqkxtFUR6K0ugKiNqikeJWQtiesFIeJm iJJROwMe5ovFtg/uE5HBRAGYa8/tbAsMH/kSOtBXOIpFcMXN8EG01o1++wYL8DoOxlmb JFgIgA5na1YJulf4yGUGu6JLa6DKkV2LlAbUfnXJ3/dpB9pXxEfiMxvDYBwcxYDpHy0c oXvA== X-Gm-Message-State: APjAAAWZDHDksSDXjiaqF6JFh3/zPGIsePrXJtBbkcMMEBquN5lX/Rij QzV+rUE1fxOAdazwX5PoP9+YvOs093swOA== X-Google-Smtp-Source: APXvYqzWj9GInlnHDa5/cnRfNjePLHBKOUGa+f0sh5AGNzGlzROKAwW7311zTCVlv2ThFvOtyEQySA== X-Received: by 2002:a1c:cbcc:: with SMTP id b195mr8033109wmg.80.1569595374584; Fri, 27 Sep 2019 07:42:54 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 3/9] target/arm: handle M-profile semihosting at translate time Date: Fri, 27 Sep 2019 15:42:43 +0100 Message-Id: <20190927144249.29999-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927144249.29999-1-peter.maydell@linaro.org> References: <20190927144249.29999-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Alex Benn=C3=A9e We do this for other semihosting calls so we might as well do it for M-profile as well. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-id: 20190913151845.12582-3-alex.bennee@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/m_helper.c | 18 ++++++------------ target/arm/translate.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index 884d35d2b02..27cd2f3f964 100644 --- a/target/arm/m_helper.c +++ b/target/arm/m_helper.c @@ -2114,19 +2114,13 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) break; } break; + case EXCP_SEMIHOST: + qemu_log_mask(CPU_LOG_INT, + "...handling as semihosting call 0x%x\n", + env->regs[0]); + env->regs[0] =3D do_arm_semihosting(env); + return; case EXCP_BKPT: - if (semihosting_enabled()) { - int nr; - nr =3D arm_lduw_code(env, env->regs[15], arm_sctlr_b(env)) & 0= xff; - if (nr =3D=3D 0xab) { - env->regs[15] +=3D 2; - qemu_log_mask(CPU_LOG_INT, - "...handling as semihosting call 0x%x\n", - env->regs[0]); - env->regs[0] =3D do_arm_semihosting(env); - return; - } - } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_DEBUG, false); break; case EXCP_IRQ: diff --git a/target/arm/translate.c b/target/arm/translate.c index 34bb280e3da..b5272119330 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8424,7 +8424,16 @@ static bool trans_BKPT(DisasContext *s, arg_BKPT *a) if (!ENABLE_ARCH_5) { return false; } - gen_exception_bkpt_insn(s, syn_aa32_bkpt(a->imm, false)); + if (arm_dc_feature(s, ARM_FEATURE_M) && + semihosting_enabled() && +#ifndef CONFIG_USER_ONLY + !IS_USER(s) && +#endif + (a->imm =3D=3D 0xab)) { + gen_exception_internal_insn(s, s->base.pc_next, EXCP_SEMIHOST); + } else { + gen_exception_bkpt_insn(s, syn_aa32_bkpt(a->imm, false)); + } return true; } =20 --=20 2.20.1 From nobody Thu Dec 18 22:21:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1569601491; cv=none; d=zoho.com; s=zohoarc; b=KhuC1widFnr+V0U5vGCV3uPgnUDBKyNb/4G73cXI/vIsIfD+u5Us9PY59rejAmozzdRokUFL2I76wlIQjvWVjmI02VABfV4V0mhamauutj+gqGriPP42wlQFu+D80rNY3sRl3VgJjMMJ+9Z6mHedmtNDysWYsVBTL6rWv2/ICyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569601491; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1Vii/oE4Oe++plZNXT8pOaZce8x1F9AjQIS0PE1aPcU=; b=FWRiCu25W6sOE0P9eRYLFoaqWSJRqd0e5pNePiA71n2hXV0QPZJ7eO57/UIcsOqr4wPezPBHxj1+aYXM0avqRfOkkbP/KQxUNjFyCocngs81S3c0tl07mGLEPL6QUNh+V+xe4ghZ2gt/Fmc+8NddoScUe7Pb7+8IycQG1KG36yM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569601491833279.48401595234077; Fri, 27 Sep 2019 09:24:51 -0700 (PDT) Received: from localhost ([::1]:53174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDt33-0001DR-O1 for importer@patchew.org; Fri, 27 Sep 2019 12:24:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51251) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrSd-0002UZ-9l for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDrSa-00089B-Ov for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:07 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:42397) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDrSa-000873-9P for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:04 -0400 Received: by mail-wr1-x42c.google.com with SMTP id n14so3112337wrw.9 for ; Fri, 27 Sep 2019 07:42:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y12sm2874539wrn.74.2019.09.27.07.42.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 07:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1Vii/oE4Oe++plZNXT8pOaZce8x1F9AjQIS0PE1aPcU=; b=I6Dz2CbqeEu28PPZIr2cgE1cMjhbqcUFC3UoOObAdsK6JEKK2JoMZKCNNGXue3j2Ba p/h4aNcgMBHhyOvJyWW2lYizE56Rw3yhJC8P+S7JTXV2JOfO5nx3XoWuHC4RhCoDZZGY meP8x1fCEs/yAwHFRC9vRMo+BFVv5MjSfcAFPmU689SP2CqGkUyfNdh7IC7BhRE7tUIA iHz2tzRfPOeRrl59gCy8PZUffrYbm42LJ2y2IcBywiaEuuRuLdAuZ/xQ5CaoEh4/Woy9 xsY6mbCBcvPfJsJaR0pbU7KvBT07Np3JIuI/U1Oq+rk6DwJ/V12Tg7Wky6ZbhDCzYLHQ SnAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1Vii/oE4Oe++plZNXT8pOaZce8x1F9AjQIS0PE1aPcU=; b=X5DoAJn7A0cy6ltAYC/a1ETV/BvcQ8ZTnhBik/HLIAUl3exLJUGGcDRkGCi5RnrsIe 94da13Gjs+wvE3sxAWvbYtDgneFTmsK2Z58yMSmEC4Urdil4331H20ivP/dRK2CuncvE v0H8ezPHqMW2SNHGxexO4omnsbhlRW3ZDyoDOhEYIGTWSJj7bkkF6L3qe/m1hU0m0k6Q MPZVLJyuS7G9wfWKQzRn90E0YuVKZjsRA+2rftNpFe0Rh8RkzmTZHJSMF7MskvQ3lvPo dip72eeQOfRwQ2cScjtQbtMJ7wDSlDRbvRj9gKjmBf/ivf6RUwTtcIF7ayCQXJt3Zv8w ZhZQ== X-Gm-Message-State: APjAAAWPtNEhQ/h+feoyUwxZ51qpZ+KRkdXTw3itX7MeDim7yqT6siqP MFDbLZL3rwqZ4mokiMter0rcdlftzdEbug== X-Google-Smtp-Source: APXvYqwhJI60UrD2bC8ap2blNTj2fVqFK4h53f+lmKf9rF8/loZKQi7F+Ugb1fZcSL1/nhomKE/oLA== X-Received: by 2002:adf:ce04:: with SMTP id p4mr3182047wrn.130.1569595375488; Fri, 27 Sep 2019 07:42:55 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 4/9] target/arm: handle A-profile semihosting at translate time Date: Fri, 27 Sep 2019 15:42:44 +0100 Message-Id: <20190927144249.29999-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927144249.29999-1-peter.maydell@linaro.org> References: <20190927144249.29999-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Alex Benn=C3=A9e As for the other semihosting calls we can resolve this at translate time. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Peter Maydell Message-id: 20190913151845.12582-4-alex.bennee@linaro.org Signed-off-by: Peter Maydell --- target/arm/translate.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index b5272119330..698c594e8ce 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -10222,14 +10222,25 @@ static bool trans_CBZ(DisasContext *s, arg_CBZ *a) } =20 /* - * Supervisor call + * Supervisor call - both T32 & A32 come here so we need to check + * which mode we are in when checking for semihosting. */ =20 static bool trans_SVC(DisasContext *s, arg_SVC *a) { - gen_set_pc_im(s, s->base.pc_next); - s->svc_imm =3D a->imm; - s->base.is_jmp =3D DISAS_SWI; + const uint32_t semihost_imm =3D s->thumb ? 0xab : 0x123456; + + if (!arm_dc_feature(s, ARM_FEATURE_M) && semihosting_enabled() && +#ifndef CONFIG_USER_ONLY + !IS_USER(s) && +#endif + (a->imm =3D=3D semihost_imm)) { + gen_exception_internal_insn(s, s->base.pc_next, EXCP_SEMIHOST); + } else { + gen_set_pc_im(s, s->base.pc_next); + s->svc_imm =3D a->imm; + s->base.is_jmp =3D DISAS_SWI; + } return true; } =20 --=20 2.20.1 From nobody Thu Dec 18 22:21:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1569601221; cv=none; d=zoho.com; s=zohoarc; b=juvPzumwLrUYmFAoZGk9URXMEWVTrfiqyZzWzV612v92mm9FPTb7mwVqZKTf91m4RpJG512Ak/DwlqMI+64kyA1A5/NjjDgEwJGbAG0pTlQL9PDxIfULJk0opzF+8NJ5qdOPT5hhltK1jvWJm67csjFQ4bGnV8C0yssXKEp1N78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569601221; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=JKlJ3zQyg/agT15Rk69c8I3/U6JgvjvxcZfaHQAKKCs=; b=TGd64RvocIQuaGWfxcuTDGrwtUuFWa1POmKD1V/sveZ/+DLO6rc2mZui951Nh8nRfKXtc2Cc7VQwS05HqLwJxepdCb0SY5gXw4a+cjNuaPmSllKKN/bEPn8DhoQz7LsIuwW+ts5nPh6taJoaDFlA+lq72QV8s6I8hO2uwjHR3M4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569601221238866.478081473525; Fri, 27 Sep 2019 09:20:21 -0700 (PDT) Received: from localhost ([::1]:53104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDsyh-0004wU-9T for importer@patchew.org; Fri, 27 Sep 2019 12:20:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51196) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrSb-0002SA-3Q for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDrSY-00088L-LC for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:03 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:36022) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDrSW-000878-3r for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:01 -0400 Received: by mail-wr1-x42a.google.com with SMTP id y19so3150692wrd.3 for ; Fri, 27 Sep 2019 07:42:57 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y12sm2874539wrn.74.2019.09.27.07.42.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 07:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JKlJ3zQyg/agT15Rk69c8I3/U6JgvjvxcZfaHQAKKCs=; b=w2fzxg1K4jgq/Ta3in1K3PNzRbFh1hqXkVaGI4H5r5JyyQdmhmNkmVr8Sf5lG7eqMD e2O89+NemKk1PxSA3TLREsBeRrPRkPOcwikB0faJC+BVl0qtXw5kXA14z+MpTCSyQWRu 7r3dWIx4udXaJ9gw15OE6XTkyksTT1jkt6i+ZfcVy0BkXyoypkn/lDwCQh2kx95WwQg3 8zDPCSG3vl0idVZRg4CO2VeDb20V6NkxOXXykQXMtfgelPR8pAEPIw2ir3S0N82jmnha pq7gu7TFCsJXPpNF6uiaTr0sMsgmoMY57pMimb/NF8cQ2I6H9CKunSzq8JXODMhlJDf5 Oq0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JKlJ3zQyg/agT15Rk69c8I3/U6JgvjvxcZfaHQAKKCs=; b=Ktnx7rzkA1aYvmS98DayI49v2/U4nLgS2JGBQc94zw4TzzcPr0krv8LWonWNgYoAYy MUvrF3oXgXRaErGjwZTRbxb7gdw+JcDrrMwoYmNWZsEABL6dWyXL8MNk0rnuM5k2eiM0 eh413i81mY4GetGXAcYhAsGC/grvXyik+i7+pAqJFwyiBSb37tb0QOYUvVrLeAd/jg1V nIqBCxXQyrRcwzzYg62FxJmM+C5TeHG1X9n6bzxJRZ40z0Pb4vU4FveWxdSDqbrXNzSr PYvXArijobPzbyNszhK+5wtdMasVALmcanpVYvHDX66UExawnAoEWh4Dqbis5u3n7QIW QyWQ== X-Gm-Message-State: APjAAAX1F1gnA7Oa4H7L1m0ApMbdg/emblNuVDbHtisjMFwYprOlo/f4 YPv5AeeAw77RXbbKaUM1yJDm2Loz9xrwcw== X-Google-Smtp-Source: APXvYqzLU4RCs8p6erASAEMyPqlVlThuOCXW3SjVQnb8Z3Quqmaivo3qM9eYbAGWhUMtTcov0/z4zg== X-Received: by 2002:adf:f649:: with SMTP id x9mr3226235wrp.163.1569595376573; Fri, 27 Sep 2019 07:42:56 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 5/9] target/arm: remove run time semihosting checks Date: Fri, 27 Sep 2019 15:42:45 +0100 Message-Id: <20190927144249.29999-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927144249.29999-1-peter.maydell@linaro.org> References: <20190927144249.29999-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Alex Benn=C3=A9e Now we do all our checking and use a common EXCP_SEMIHOST for semihosting operations we can make helper code a lot simpler. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-id: 20190913151845.12582-5-alex.bennee@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 96 +++++++++++---------------------------------- 1 file changed, 22 insertions(+), 74 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index bc1130d989d..0d9a2d2ab74 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8352,88 +8352,32 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *= cs) new_el, env->pc, pstate_read(env)); } =20 -static inline bool check_for_semihosting(CPUState *cs) -{ +/* + * Do semihosting call and set the appropriate return value. All the + * permission and validity checks have been done at translate time. + * + * We only see semihosting exceptions in TCG only as they are not + * trapped to the hypervisor in KVM. + */ #ifdef CONFIG_TCG - /* Check whether this exception is a semihosting call; if so - * then handle it and return true; otherwise return false. - */ +static void handle_semihosting(CPUState *cs) +{ ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; =20 if (is_a64(env)) { - if (cs->exception_index =3D=3D EXCP_SEMIHOST) { - /* This is always the 64-bit semihosting exception. - * The "is this usermode" and "is semihosting enabled" - * checks have been done at translate time. - */ - qemu_log_mask(CPU_LOG_INT, - "...handling as semihosting call 0x%" PRIx64 "\n= ", - env->xregs[0]); - env->xregs[0] =3D do_arm_semihosting(env); - return true; - } - return false; + qemu_log_mask(CPU_LOG_INT, + "...handling as semihosting call 0x%" PRIx64 "\n", + env->xregs[0]); + env->xregs[0] =3D do_arm_semihosting(env); } else { - uint32_t imm; - - /* Only intercept calls from privileged modes, to provide some - * semblance of security. - */ - if (cs->exception_index !=3D EXCP_SEMIHOST && - (!semihosting_enabled() || - ((env->uncached_cpsr & CPSR_M) =3D=3D ARM_CPU_MODE_USR))) { - return false; - } - - switch (cs->exception_index) { - case EXCP_SEMIHOST: - /* This is always a semihosting call; the "is this usermode" - * and "is semihosting enabled" checks have been done at - * translate time. - */ - break; - case EXCP_SWI: - /* Check for semihosting interrupt. */ - if (env->thumb) { - imm =3D arm_lduw_code(env, env->regs[15] - 2, arm_sctlr_b(= env)) - & 0xff; - if (imm =3D=3D 0xab) { - break; - } - } else { - imm =3D arm_ldl_code(env, env->regs[15] - 4, arm_sctlr_b(e= nv)) - & 0xffffff; - if (imm =3D=3D 0x123456) { - break; - } - } - return false; - case EXCP_BKPT: - /* See if this is a semihosting syscall. */ - if (env->thumb) { - imm =3D arm_lduw_code(env, env->regs[15], arm_sctlr_b(env)) - & 0xff; - if (imm =3D=3D 0xab) { - env->regs[15] +=3D 2; - break; - } - } - return false; - default: - return false; - } - qemu_log_mask(CPU_LOG_INT, "...handling as semihosting call 0x%x\n", env->regs[0]); env->regs[0] =3D do_arm_semihosting(env); - return true; } -#else - return false; -#endif } +#endif =20 /* Handle a CPU exception for A and R profile CPUs. * Do any appropriate logging, handle PSCI calls, and then hand off @@ -8464,13 +8408,17 @@ void arm_cpu_do_interrupt(CPUState *cs) return; } =20 - /* Semihosting semantics depend on the register width of the - * code that caused the exception, not the target exception level, - * so must be handled here. + /* + * Semihosting semantics depend on the register width of the code + * that caused the exception, not the target exception level, so + * must be handled here. */ - if (check_for_semihosting(cs)) { +#ifdef CONFIG_TCG + if (cs->exception_index =3D=3D EXCP_SEMIHOST) { + handle_semihosting(cs); return; } +#endif =20 /* Hooks may change global state so BQL should be held, also the * BQL needs to be held for any modification of --=20 2.20.1 From nobody Thu Dec 18 22:21:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1569601753; cv=none; d=zoho.com; s=zohoarc; b=EULBBDbyNro71z+3O0bafj1dzZyVGcouHmyaGJsLmL4Lafw+qACrJHVkKXMtO2YdDYWOZRn9Aoz2E0pBd+1Tw/915BtRpmgG3xNRJedrLhsIxoa70vJ+DlQnO6xO5jWeescC2vC/wFBiMNP4zeukGuFIl0c8/mv5vAt4idO8x9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569601753; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=K5D482SdubcI8oAEapAROne6mJkYVKrkCojoFwsjKIQ=; b=A4CiDnmvYY2PFLl1mySZUch/MN4IgjFPiUXelWc2jNTx9lTIqj2eHQdVfeRGdOYi87a6aR+0Wtlb2Sdrc0JQKQhsssMCoH/zTnTSi2J3fCiZi1G4OtQ0dtibwzMSTNd3qHZsnKdhmDqz55poyn08sAhQYT1cqJ8KStgvs2fEUhY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569601752995732.7540347984839; Fri, 27 Sep 2019 09:29:12 -0700 (PDT) Received: from localhost ([::1]:53230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDt7H-0005Km-7X for importer@patchew.org; Fri, 27 Sep 2019 12:29:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51253) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrSd-0002Ua-A5 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDrSb-00089R-EN for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:07 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:35316) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDrSZ-00087M-Sj for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:05 -0400 Received: by mail-wr1-x432.google.com with SMTP id v8so3153654wrt.2 for ; Fri, 27 Sep 2019 07:42:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y12sm2874539wrn.74.2019.09.27.07.42.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 07:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=K5D482SdubcI8oAEapAROne6mJkYVKrkCojoFwsjKIQ=; b=GcPNAYMIcc68un/BPgssz275ihFb1S4y3xo6CG+/9b6QwnPnKHG3PnR67AO/cOYw5Z jj+IGKcZwkeFPQzY7mCQS+zZowezahb7u9dwFcpAuSAOsrH9zt0xeqMUMsDzF6KcevdN VMfnbm7L16srkp+p1sQLXf6fLa8zvInMqe1m/veA+5Ih/4qoINtCNimYDE/BGN1hhJW4 uv7ClzSEdgClegQMf3u2AgNTymwrrKqHmr0huJpxUcGJ+qpbk0YpOoa/+Yj+okDxLgC9 ACM6XTH4tRoHDJZKwEinAN6c1cOaXQyyXKuu14VitgH+1c0NTg6aDrNzAfMnJnQVH8l4 fGNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K5D482SdubcI8oAEapAROne6mJkYVKrkCojoFwsjKIQ=; b=oEy2oI8vbFrq6lCLAvHsztU+t4vi02ePZWxIBemhB+YEUbywpsJH0rcxNxE8pfBb8I jVkgfb0cB+OU81CMcxjGo9lITrejb46uU97xVwEq1JQkHT3BxejJXhqjapi1t910wGv/ fCYkfQqZNircmaG6HBiLNgWb/i60GGHwuDkyBln3Ba/a3NGbwnL8ELZVpoAc/fBjoNkM bYCi0jVyMYsKu2tE4pOtrzEkPwECvayKTUk8B95juFDHCKsqtcY7pyrs2fhokuGrG/D6 iMZIf2L8IVvoBQ46+kdcq2+qRYgEf5C/dz7PoGmuI1kYarLzH3/ua7RVgNpAlWFQo+Yj 4Ggw== X-Gm-Message-State: APjAAAUK/9Uv6zDtcaYCqCGhTiLHgxsDXe2k6pGFDn4lOZptFkJYea2n DtKBGAO+vMwrrjXa+gj3NVBl5YKvOWlwEg== X-Google-Smtp-Source: APXvYqx4MTSQoFQz1dWiSZTkjxA0Xwg9M/MjcY6X6T6v5GGdmHpCmdW0TPpZi5FAqSOnYIt/Vh+a2A== X-Received: by 2002:a1c:7704:: with SMTP id t4mr7586741wmi.133.1569595377601; Fri, 27 Sep 2019 07:42:57 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 6/9] target/arm: remove run-time semihosting checks for linux-user Date: Fri, 27 Sep 2019 15:42:46 +0100 Message-Id: <20190927144249.29999-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927144249.29999-1-peter.maydell@linaro.org> References: <20190927144249.29999-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::432 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Alex Benn=C3=A9e Now we do all our checking at translate time we can make cpu_loop a little bit simpler. We also introduce a simple linux-user semihosting test case to defend the functionality. The out-of-tree softmmu based semihosting tests are still more comprehensive. Signed-off-by: Alex Benn=C3=A9e Message-id: 20190913151845.12582-6-alex.bennee@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- linux-user/arm/target_syscall.h | 3 --- linux-user/arm/cpu_loop.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/linux-user/arm/target_syscall.h b/linux-user/arm/target_syscal= l.h index afc0772e194..f85cbdaf56f 100644 --- a/linux-user/arm/target_syscall.h +++ b/linux-user/arm/target_syscall.h @@ -18,9 +18,6 @@ struct target_pt_regs { #define ARM_NR_set_tls (ARM_NR_BASE + 5) #define ARM_NR_get_tls (ARM_NR_BASE + 6) =20 -#define ARM_NR_semihosting 0x123456 -#define ARM_NR_thumb_semihosting 0xAB - #if defined(TARGET_WORDS_BIGENDIAN) #define UNAME_MACHINE "armv5teb" #else diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 8d65de5b9f4..e28c45cd4ab 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -325,9 +325,6 @@ void cpu_loop(CPUARMState *env) =20 if (n =3D=3D ARM_NR_cacheflush) { /* nop */ - } else if (n =3D=3D ARM_NR_semihosting - || n =3D=3D ARM_NR_thumb_semihosting) { - env->regs[0] =3D do_arm_semihosting (env); } else if (n =3D=3D 0 || n >=3D ARM_SYSCALL_BASE || env->t= humb) { /* linux syscall */ if (env->thumb || n =3D=3D 0) { --=20 2.20.1 From nobody Thu Dec 18 22:21:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1569603901; cv=none; d=zoho.com; s=zohoarc; b=Jal6VHiEuLBIwFYhR1zu2JaDT4Lc9fIvwD4WPZZWVXMFNzZq+6/eNzoXTJ2Zcv6EtjVqM7LHJ6/YWETHpyS0Jvhq/DVRcQhcVI3Ro2NMfRH3+AzPgAo7bmQ9BdPtI78b7Wl3wquhhNZ7kBcx7Wt+U8oQdjyUjpTg6n5+jdI/Yyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569603901; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BR1l/kb7RCqMIzZS6liikc0EeB/atePwZNIFCHsVMo4=; b=PC+kZ1tdCbIGNZVKqHgHB/cFE9DdH4ffDaD+C/iVrPp7TncJ6XsJByuGufkngOdL7K/qAdfG1htPoGRLoI22XJN3FQi3do8nlg7kcyG+mhV15w8E87lWNzLD7a7w7yv+zaeSs0JBuvl2yrctCb2FzB/ZWNFpaacmQ99watvJIj8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569603901820455.90349888272044; Fri, 27 Sep 2019 10:05:01 -0700 (PDT) Received: from localhost ([::1]:53814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDtfv-0002BM-II for importer@patchew.org; Fri, 27 Sep 2019 13:04:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51234) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrSb-0002UT-VN for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDrSZ-00088g-VS for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:05 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:46292) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDrSX-00087a-Tg for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:03 -0400 Received: by mail-wr1-x433.google.com with SMTP id o18so3092039wrv.13 for ; Fri, 27 Sep 2019 07:42:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y12sm2874539wrn.74.2019.09.27.07.42.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 07:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BR1l/kb7RCqMIzZS6liikc0EeB/atePwZNIFCHsVMo4=; b=IDfRd8tdXDE/PeflYl46dK3AJGVjDZrcZdPI4PZpSy80Qt3uLq+lILw1xVh95CIV3p yuwtp+GoLSdCSEl1oud8sfqvPgPqfYKHWjMnZY3ZrSp3rOWOO14Q6H++sW5gZA2vI/K8 MQZOjgq7zXD7Dwjj5QhXCudYzn1jaDRYjP14RUzzCEcB69jCznMpbVtaOnWwEt6sRNyn XPfhMpt/tMzhk41eau0w7a0Mi9WgaKSBa2n8fHlgOBfjttV5NQaHC/7m/uVnx9iPP0tx TlnI771jRB5ce14K+RuvAZ6baNFJIRq9uHWxObieo+qD5qVY1/Znse8KvCvi5lAxriJ/ n4kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BR1l/kb7RCqMIzZS6liikc0EeB/atePwZNIFCHsVMo4=; b=H82vr6/0dDQqZ+DkCp94TYKzBLfQDQcglXvcEhF72hrTAjtvlufiRurClmUavTpkmC s834R1R65qsv62uhHVOpsV0zOkEoU3Yrfz41OC3wE6Gl0NIsDAfluUbniQ4OucswM4ht SKV7xog4wAr66nTFWsTav6QcT2BtjeFfclhWa5zfxUJx5X9Fuh8CgwpIvsF4ToFDDKuk bBISaPvyFM4efyiMDcHkGPRfqEJMQZC4VNzwKo3wLcz6xgLi5zu7Blbu/y5560udenZf p0cJcJYd54JGltvIqwv0rmrNEpAnD5OxYYAIX32QBkVOnwNZxjBO9m4aMhGWVy21viy8 BMGg== X-Gm-Message-State: APjAAAV3A3dZWFlh2+Ko8a9/9S88o8Vqndycoz5nYGi5o/yYyf80HVIn NH8T/hvXsv31xJXS3tpNYDTRgeoVgvf1lA== X-Google-Smtp-Source: APXvYqwjE4lrmU2e9aIAKjYtEPcxW+q7o6NZzz2CHbi3MU0+Cx/lQYthuwSOmqNwcFVKRG/gkb/Uxg== X-Received: by 2002:a7b:cb91:: with SMTP id m17mr7469172wmi.151.1569595378567; Fri, 27 Sep 2019 07:42:58 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 7/9] tests/tcg: add linux-user semihosting smoke test for ARM Date: Fri, 27 Sep 2019 15:42:47 +0100 Message-Id: <20190927144249.29999-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927144249.29999-1-peter.maydell@linaro.org> References: <20190927144249.29999-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Alex Benn=C3=A9e We already use semihosting for the system stuff so this is a simple smoke test to ensure we are working OK on linux-user. Signed-off-by: Alex Benn=C3=A9e Message-id: 20190913151845.12582-7-alex.bennee@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- tests/tcg/aarch64/Makefile.target | 5 ++++ tests/tcg/arm/Makefile.target | 5 ++++ tests/tcg/arm/semihosting.c | 45 +++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 tests/tcg/arm/semihosting.c diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index 9758f89f905..509f1afa93d 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -21,4 +21,9 @@ run-fcvt: fcvt AARCH64_TESTS +=3D pauth-1 pauth-2 run-pauth-%: QEMU_OPTS +=3D -cpu max =20 +# Semihosting smoke test for linux-user +AARCH64_TESTS +=3D semihosting +run-semihosting: semihosting + $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") + TESTS +=3D $(AARCH64_TESTS) diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index 7347d3d0adb..3b7fc9a64be 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -27,6 +27,11 @@ run-fcvt: fcvt $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)") $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref) =20 +# Semihosting smoke test for linux-user +ARM_TESTS +=3D semihosting +run-semihosting: semihosting + $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") + TESTS +=3D $(ARM_TESTS) =20 # On ARM Linux only supports 4k pages diff --git a/tests/tcg/arm/semihosting.c b/tests/tcg/arm/semihosting.c new file mode 100644 index 00000000000..09c89cb481a --- /dev/null +++ b/tests/tcg/arm/semihosting.c @@ -0,0 +1,45 @@ +/* + * linux-user semihosting checks + * + * Copyright (c) 2019 + * Written by Alex Benn=C3=A9e + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include + +#define SYS_WRITE0 0x04 +#define SYS_REPORTEXC 0x18 + +void __semi_call(uintptr_t type, uintptr_t arg0) +{ +#if defined(__arm__) + register uintptr_t t asm("r0") =3D type; + register uintptr_t a0 asm("r1") =3D arg0; + asm("svc 0xab" + : /* no return */ + : "r" (t), "r" (a0)); +#else + register uintptr_t t asm("x0") =3D type; + register uintptr_t a0 asm("x1") =3D arg0; + asm("hlt 0xf000" + : /* no return */ + : "r" (t), "r" (a0)); +#endif +} + +int main(int argc, char *argv[argc]) +{ +#if defined(__arm__) + uintptr_t exit_code =3D 0x20026; +#else + uintptr_t exit_block[2] =3D {0x20026, 0}; + uintptr_t exit_code =3D (uintptr_t) &exit_block; +#endif + + __semi_call(SYS_WRITE0, (uintptr_t) "Hello World"); + __semi_call(SYS_REPORTEXC, exit_code); + /* if we get here we failed */ + return -1; +} --=20 2.20.1 From nobody Thu Dec 18 22:21:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1569602236; cv=none; d=zoho.com; s=zohoarc; b=Z/kVNc2R572kRjkQx7fqlsQvEWZdmyFdHXDA+x8y9zQTyzpvLwdg5VbMWFZNAn2nunFTbqC7JETXwO6rbOimJMd+pRgPQAGzieuQ+kw8ekx6xNJLK42NixquxK93WZK/gG7rm32+8iiXADSMu+W2o5DzlFiZl67wHswry6581qA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569602236; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=tg04vn7yvauAGcqWHSm/m+dscKKQD3PSH2AqCWQBvX8=; b=eAwC9CMYygyTos4bUJr7Ssth+kcoGwxoBr90j96jK+7Q1SXKLpI1DNYHAM9yTo22RLDE3UaVOsbHBRqI0y12oTd1cknPkiHowK7wRg3CLBY0xO1ocC8b5a/Ox05QILRgWY8wW5eGe2X5ALYF3k/ajxmHoSGRqoTkSnS6ufQURu8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569602236681774.213467341279; Fri, 27 Sep 2019 09:37:16 -0700 (PDT) Received: from localhost ([::1]:53388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDtF4-0002lu-1v for importer@patchew.org; Fri, 27 Sep 2019 12:37:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51250) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrSd-0002UY-9A for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDrSa-00088z-Hl for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:07 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:45045) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDrSa-00087m-26 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:04 -0400 Received: by mail-wr1-x442.google.com with SMTP id i18so3101968wru.11 for ; Fri, 27 Sep 2019 07:43:00 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y12sm2874539wrn.74.2019.09.27.07.42.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 07:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=tg04vn7yvauAGcqWHSm/m+dscKKQD3PSH2AqCWQBvX8=; b=HywYgJiQU4R1DCM9kzSzmmqXMqRNIyzh+W3kSs/gCx5uj1QAyhTbRwcwXyBViPsLN2 qZUurYOorCRYUnpcfrvjgF0iYsOzy1kI3NCDqpOBDxYhSicGKmHOD4j65/FqEAvgQUGo gHOw1daUEFtj1wdEdJxLsctUmk7veccf4fOX4W5VpAVct1zKcCh6CfA/9WDNesfmpi9k W/mLPGu7QYitK+cCHClqEkrGJH0KMfZcg7agjUJ1N7ykokUAuIQkvd+Y6ADMCBqxd4Lu VDD7RKvL8JdQvNAHN2V8lfD4wAJxVykViQKGQMBgtqfsvrXrPFVCqIRbc0+NYe9ovI+s 9qXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tg04vn7yvauAGcqWHSm/m+dscKKQD3PSH2AqCWQBvX8=; b=GygqKyIoDiEh0IEjxhaQx7z7/mjjRpDsyYVDB1WRq4ZczJ4bApfSltLT3bs76NpZ+v rSivXlotUfZb79j19fTFlbUviZZ2vxcEmiF+WwpY/COGXBZAb2iWZ4gKYfktMI22CuoL SuAUWbxg28y2jKvK9y/t8/9H50Seexp4My+mFXhqYPwBWWXOVAL0ZWeDM448olySyA7z /XYj3LRMBIsW/f4hpz7FrO3gjDE0hoxRMxaL+4Xiq0ST39H5sARLStsaO6SI/Qtmidpl Iw//N3+8/jVtz7xVuGRmFOtMtEuAxfXutsPCM+hf+C+vKrTU7wbstJKrxn9o0niiM5hz vx0Q== X-Gm-Message-State: APjAAAULJvwaXHpKKLMzXeRWXVH+SQ3tfw1dYF40R05+bZCPU8L/U273 gWdmIviwL9N8k1apwhmURb3voBwaUbf1Vw== X-Google-Smtp-Source: APXvYqzUDauMZEpML/GWZVmvoUg480iInGvKebe3WOgjhsK+UnJUHMs6T1/1b12ZLq4Vhn8k4y9y/Q== X-Received: by 2002:a1c:9d0b:: with SMTP id g11mr7161069wme.22.1569595379455; Fri, 27 Sep 2019 07:42:59 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 8/9] hw/arm/boot.c: Set NSACR.{CP11,CP10} for NS kernel boots Date: Fri, 27 Sep 2019 15:42:48 +0100 Message-Id: <20190927144249.29999-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927144249.29999-1-peter.maydell@linaro.org> References: <20190927144249.29999-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" If we're booting a Linux kernel directly into Non-Secure state on a CPU which has Secure state, then make sure we set the NSACR CP11 and CP10 bits, so that Non-Secure is allowed to access the FPU. Otherwise an AArch32 kernel will UNDEF as soon as it tries to use the FPU. It used to not matter that we didn't do this until commit fc1120a7f5f2d4b6, where we implemented actually honouring these NSACR bits. The problem only exists for CPUs where EL3 is AArch32; the equivalent AArch64 trap bits are in CPTR_EL3 and are "0 to not trap, 1 to trap", so the reset value of the register permits NS access, unlike NSACR. Fixes: fc1120a7f5 Fixes: https://bugs.launchpad.net/qemu/+bug/1844597 Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20190920174039.3916-1-peter.maydell@linaro.org --- hw/arm/boot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index bf97ef3e339..25422660545 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -754,6 +754,8 @@ static void do_cpu_reset(void *opaque) (cs !=3D first_cpu || !info->secure_board_setup)) { /* Linux expects non-secure state */ env->cp15.scr_el3 |=3D SCR_NS; + /* Set NSACR.{CP11,CP10} so NS can access the FPU */ + env->cp15.nsacr |=3D 3 << 10; } } =20 --=20 2.20.1 From nobody Thu Dec 18 22:21:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1569602498; cv=none; d=zoho.com; s=zohoarc; b=ThxJKPjk0B+Wdy5wF3+LkEO672JpRiV2wIuCqHtL2imid9m1rIlw+dJype7bKbJfOgAwMHnS1YsqJZEJCsdBFT22zHMcAQlV7iaqq/b3wTHI/D6ytUovCyF4jasLJA/tsWkYbTiRp7tpMlVydJ9AS9fzlxyf/CnxKh6Pawp4DFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569602498; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Nfr1PbQT0Jo9Bvco8Z/MdDyJj7lbe3iyjg+htmYoZyk=; b=C66IdkvI2bY939Ap7dn3ycSFFUu865kGv9DKSJr/D3RHU1nfRk6yt39fhSf0iNCKl54L7PVqPH882FptWF6QpFzw6P6NznKs4yFY8uMOLMZ58We7arOws3Xipf3X5T43OfoMGkwtxLH6eeXwXJtBK++rE3brLfxIuTi1FfqONmM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569602498390797.3542214902453; Fri, 27 Sep 2019 09:41:38 -0700 (PDT) Received: from localhost ([::1]:53464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDtJH-0006vb-Mt for importer@patchew.org; Fri, 27 Sep 2019 12:41:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51277) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDrSg-0002Wy-Os for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDrSd-00089u-7P for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:09 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35097) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDrSb-00087x-5j for qemu-devel@nongnu.org; Fri, 27 Sep 2019 10:43:05 -0400 Received: by mail-wr1-x442.google.com with SMTP id v8so3153945wrt.2 for ; Fri, 27 Sep 2019 07:43:01 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y12sm2874539wrn.74.2019.09.27.07.42.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 07:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Nfr1PbQT0Jo9Bvco8Z/MdDyJj7lbe3iyjg+htmYoZyk=; b=lvZ7kUgPYDeisfp8Kul6oDEt308mX3gDVEeShL3OAvE0ikqkAM78ZqzEOwcS8/2q1V H3/UuVhse+sKqC+yTesLgflqc5LaZAqxufUUoUJXiOCOb3QCuDC9SZIx8LLGcInOIv+J Gj96fSNInS+C96wNiBLHOFgSm5wdaUZmKbTDmsr2eXmgbnSPErKL86fJtigojUkXQHJg GCAxW9HgiD2jVeDV/BJCkFv2BLDjHxYSiaXx2/nwRovyKU1Yh1C1F4EiPu8RvR7Ly1AR se98U++rYmN/OcikJVbGTYsohB8JdhNJ91bhrtdT8bp6RYw6OY0IcRRgKoPiYyUY2C1J DDhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Nfr1PbQT0Jo9Bvco8Z/MdDyJj7lbe3iyjg+htmYoZyk=; b=eGVVZlqFz0Qi/EV20wTzX3i9knh0II3o2kuwsHAVNjZf2Xfaw/I0acDX33vbo7SrSg jfSoIW3iUw2+ofls+p2paKZSu2vyN5gZG03+iGem/trmuGiFhQJ6Py8gTuldzyjVIK8L fn2aIiw7DkLCyA1yO2b9m0pl3BUYlpjoO/3RmAL36AlOHzUtvLM1LpSmfU/TFnXl1sTi iLZp+P3WG2UIbiYPKRziV7vye8e6WQPlanLkpod2Hxj4SaGcHZ/fvqFWLh6Avz27NkhN hFd9kORhxJi4FS1KXe3KHDcy80AdZ+Sy8fVF/rQjNFJzv+U9nN+IzeqfruJcLcwH5Wfx 4H1g== X-Gm-Message-State: APjAAAWhY4/cxBjBefcosu8Drv8lBJ+jAYXBzu1xft3y7UshJziOyP+o rF/beBHgNXR8sNHJcdW5GvJr9MTX1GwAKw== X-Google-Smtp-Source: APXvYqzOSanJqfFoC3rXuZ4CzXmYdQ7qNdQZaqAo32D33UouQyfeVUaCrsKTr/UWYld91qNTo14BwA== X-Received: by 2002:a1c:2144:: with SMTP id h65mr7924062wmh.114.1569595380311; Fri, 27 Sep 2019 07:43:00 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 9/9] hw/arm/boot: Use the IEC binary prefix definitions Date: Fri, 27 Sep 2019 15:42:49 +0100 Message-Id: <20190927144249.29999-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927144249.29999-1-peter.maydell@linaro.org> References: <20190927144249.29999-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 IEC binary prefixes ease code review: the unit is explicit. Reviewed-by: Richard Henderson Reviewed-by: Stefano Garzarella Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20190923131108.21459-1-philmd@redhat.com Signed-off-by: Peter Maydell --- hw/arm/boot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 25422660545..c264864c11d 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -575,7 +575,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_inf= o *binfo, goto fail; } =20 - if (scells < 2 && binfo->ram_size >=3D (1ULL << 32)) { + if (scells < 2 && binfo->ram_size >=3D 4 * GiB) { /* This is user error so deserves a friendlier error message * than the failure of setprop_sized_cells would provide */ @@ -1097,7 +1097,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, * we might still make a bad choice here. */ info->initrd_start =3D info->loader_start + - MIN(info->ram_size / 2, 128 * 1024 * 1024); + MIN(info->ram_size / 2, 128 * MiB); if (image_high_addr) { info->initrd_start =3D MAX(info->initrd_start, image_high_addr); } @@ -1157,13 +1157,13 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cp= u, * * Let's play safe and prealign it to 2MB to give us some = space. */ - align =3D 2 * 1024 * 1024; + align =3D 2 * MiB; } else { /* * Some 32bit kernels will trash anything in the 4K page t= he * initrd ends in, so make sure the DTB isn't caught up in= that. */ - align =3D 4096; + align =3D 4 * KiB; } =20 /* Place the DTB after the initrd in memory with alignment. */ @@ -1180,7 +1180,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, info->loader_start + KERNEL_ARGS_ADDR; fixupcontext[FIXUP_ARGPTR_HI] =3D (info->loader_start + KERNEL_ARGS_ADDR) >> 32; - if (info->ram_size >=3D (1ULL << 32)) { + if (info->ram_size >=3D 4 * GiB) { error_report("RAM size must be less than 4GB to boot" " Linux kernel using ATAGS (try passing a dev= ice tree" " using -dtb)"); --=20 2.20.1