From nobody Fri Mar 29 09:21:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1631621458; cv=none; d=zohomail.com; s=zohoarc; b=WkM3Ojv+I9PkBnXNGXCrNxwBdEqBuKkQriI2D7ekfMIpC7DZU3leTwH5+OUP/P/dd7V4d4BuLXc1BI705wZwUKYPN5rlA18wRphafN/BfIiTJUvGbLI4Dw3LBe3141LZ2+WhQe7Zb5MHXRtBBWufYiFTCoyHPTcl7IlRwNzEl6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631621458; h=Content-Transfer-Encoding:Cc: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; bh=/ZjtokmHY6o9GT+MByl1Znj62SUPnzI2WW/LyA2oZFU=; b=jyRuoHKnoMIu6TI/L1P/SrxVgFKd1sf9dRGqcxc69jOkEtBqiF3Iea3tX7OXMucQ3vO2+9FzD+6xUQ4wpdkiSizxkfyGYZFTDJgtEiUrCylIFFTEWBp3NkKLFHwo/KVpgEiVE4/pJVADs3cLYWqwETAeUDXkTfilDm1yo2P0Xd8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631621457994712.6108746363395; Tue, 14 Sep 2021 05:10:57 -0700 (PDT) Received: from localhost ([::1]:49174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQ7H6-0004c6-NT for importer@patchew.org; Tue, 14 Sep 2021 08:10:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQ7Do-0000fj-KC for qemu-devel@nongnu.org; Tue, 14 Sep 2021 08:07:32 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:46749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQ7Dm-0001IE-Lz for qemu-devel@nongnu.org; Tue, 14 Sep 2021 08:07:32 -0400 Received: by mail-wm1-x333.google.com with SMTP id d207-20020a1c1dd8000000b00307e2d1ec1aso2334147wmd.5 for ; Tue, 14 Sep 2021 05:07:30 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o10sm11472466wrc.16.2021.09.14.05.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 05:07:28 -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=/ZjtokmHY6o9GT+MByl1Znj62SUPnzI2WW/LyA2oZFU=; b=JjvceNK1WEKHsntIddF7zRL/X46gtby/InJOoOyub7rGuYABJBmBdL5paVtlSOS9Rp 3nSX9GFnEbwYfyzE1e8vxdwgJwp7aMiLjNKy0wQddcBZ+X2pot5eIj8xx0O3Ljj1qlRU C+HfftMwCaH4dPTkexRI3g9LR1HO3v8UVLkh4tEr74Ho/lwVKRnd2c9iomLJyW7jhSV2 iG1Zus+h2sc8U1tYEnky5C/r0LLZvtL1f7hhMKaquqXnApyRnsNEBPEgfxtWoChvpd9F WjH8Etg1lGziPezNkysf1dc69fzBplJ5mo3REa5IX663FjLIWVz0TLNgzOqMw6j44ksM qUkg== 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=/ZjtokmHY6o9GT+MByl1Znj62SUPnzI2WW/LyA2oZFU=; b=VXHW4O40rrgf5fXW6ULEdcJkcn/8ZHmr4qpTenj675RPAyHJSjBiq+tYqTLuS66sTP +Et1sY52oDqw7FLU9H294Yb9CLK+PRMgBS/LcBmxLyZJ8+7uhlRUKabGdZfSEg1qmEwk tYHOPedfqazm2sAazPQJPU2Yvlcvo/D3zy1GSB9jJ8607SiV6ln3itnhi23b82H/xDQt Iyr3a/xXn48klKC0HyrKrZ+/yEJR5VsUSewCdmkJaem1Xa1H2beKfBuvcMiBvDrwvGJ6 Xu8EhtnT5Fm/zm1XlLBAxkKL75ivd05eOrvbjJaNbuYAXyTHehkmEQqOmlpKgLjDogZl z79Q== X-Gm-Message-State: AOAM533s096ZaUE2w28zea1/v+64EVBwnbRZ4bsCd83lF2i5od9Dfqsp vxO3BEuxaZSbL5QzRpaXY3MLh5VCbYHFfw== X-Google-Smtp-Source: ABdhPJwQ/NJJaJ8yvwOBLMsozaD8IAkGqbtRZvPLJzF9iyCJmlgcY0GqOeRWFKrcHi5YmYOmvMhvUA== X-Received: by 2002:a1c:1cc:: with SMTP id 195mr1813254wmb.188.1631621248305; Tue, 14 Sep 2021 05:07:28 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 1/3] target/arm: Don't skip M-profile reset entirely in user mode Date: Tue, 14 Sep 2021 13:07:23 +0100 Message-Id: <20210914120725.24992-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210914120725.24992-1-peter.maydell@linaro.org> References: <20210914120725.24992-1-peter.maydell@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=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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: Christophe Lyon Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631621458527100003 Content-Type: text/plain; charset="utf-8" Currently all of the M-profile specific code in arm_cpu_reset() is inside a !defined(CONFIG_USER_ONLY) ifdef block. This is unintentional: it happened because originally the only M-profile-specific handling was the setup of the initial SP and PC from the vector table, which is system-emulation only. But then we added a lot of other M-profile setup to the same "if (ARM_FEATURE_M)" code block without noticing that it was all inside a not-user-mode ifdef. This has generally been harmless, but with the addition of v8.1M low-overhead-loop support we ran into a problem: the reset of FPSCR.LTPSIZE to 4 was only being done for system emulation mode, so if a user-mode guest tried to execute the LE instruction it would incorrectly take a UsageFault. Adjust the ifdefs so only the really system-emulation specific parts are covered. Because this means we now run some reset code that sets up initial values in the FPCCR and similar FPU related registers, explicitly set up the registers controlling FPU context handling in user-emulation mode so that the FPU works by design and not by chance. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/613 Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index d631c4683c4..98eed6c6d31 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -265,12 +265,15 @@ static void arm_cpu_reset(DeviceState *dev) env->uncached_cpsr =3D ARM_CPU_MODE_SVC; } env->daif =3D PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F; +#endif =20 if (arm_feature(env, ARM_FEATURE_M)) { +#ifndef CONFIG_USER_ONLY uint32_t initial_msp; /* Loaded from 0x0 */ uint32_t initial_pc; /* Loaded from 0x4 */ uint8_t *rom; uint32_t vecbase; +#endif =20 if (cpu_isar_feature(aa32_lob, cpu)) { /* @@ -324,6 +327,8 @@ static void arm_cpu_reset(DeviceState *dev) env->v7m.fpccr[M_REG_S] =3D R_V7M_FPCCR_ASPEN_MASK | R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK; } + +#ifndef CONFIG_USER_ONLY /* Unlike A/R profile, M profile defines the reset LR value */ env->regs[14] =3D 0xffffffff; =20 @@ -352,8 +357,22 @@ static void arm_cpu_reset(DeviceState *dev) env->regs[13] =3D initial_msp & 0xFFFFFFFC; env->regs[15] =3D initial_pc & ~1; env->thumb =3D initial_pc & 1; +#else + /* + * For user mode we run non-secure and with access to the FPU. + * The FPU context is active (ie does not need further setup) + * and is owned by non-secure. + */ + env->v7m.secure =3D false; + env->v7m.nsacr =3D 0xcff; + env->v7m.cpacr[M_REG_NS] =3D 0xf0ffff; + env->v7m.fpccr[M_REG_S] &=3D + ~(R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK); + env->v7m.control[M_REG_S] |=3D R_V7M_CONTROL_FPCA_MASK; +#endif } =20 +#ifndef CONFIG_USER_ONLY /* AArch32 has a hard highvec setting of 0xFFFF0000. If we are curren= tly * executing as AArch32 then check if highvecs are enabled and * adjust the PC accordingly. --=20 2.20.1 From nobody Fri Mar 29 09:21:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1631621646; cv=none; d=zohomail.com; s=zohoarc; b=CdKhMTGslV2bwNrPO/4V087xlV/5ff81KMy/GsZWFXRdox9gD6W6tgCes4gPXhaHehjx54McCMDL+zIkeOPyDbXmV6v4zO+tm9S4ZxITNAgjeVyiPK9w8cVtjBqrjxTmyITSb9lhqOBWyrKq/r5Db13dCYGmIqaoHaF1G/HJj+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631621646; h=Content-Transfer-Encoding:Cc: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; bh=xKwGyJmZxOms/ByF0kDC33B+Wu0QPCZS/ddqiwTaY04=; b=YEG3efxMHqLFZfk38lG+yjVldl2Labxzt63AprcjFEZhQ+tstyDMa/D1g1brfy5R3y7TpMCQERWLUJ02I7E/49FJBEXbbdmfaQiSotCApFJBC7AFyPGh1Kw10V45yN3Z3HNJ2PxqRxCMSozNNnDDAOzLAceAqFjhUUDGh/Fe7SE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631621646717894.439270459981; Tue, 14 Sep 2021 05:14:06 -0700 (PDT) Received: from localhost ([::1]:54830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQ7K9-0008Uq-LI for importer@patchew.org; Tue, 14 Sep 2021 08:14:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQ7Dt-0000n2-1B for qemu-devel@nongnu.org; Tue, 14 Sep 2021 08:07:37 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:52960) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQ7Dq-0001MB-D8 for qemu-devel@nongnu.org; Tue, 14 Sep 2021 08:07:36 -0400 Received: by mail-wm1-x32d.google.com with SMTP id e26so9065944wmk.2 for ; Tue, 14 Sep 2021 05:07:33 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o10sm11472466wrc.16.2021.09.14.05.07.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 05:07:29 -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=xKwGyJmZxOms/ByF0kDC33B+Wu0QPCZS/ddqiwTaY04=; b=gbEO4MdaJGu1/l2b26BchYmIGdHWFP+8LM76ril7xaV4buTJSNg12cngXRL/pPQvPw r/WREqi5k0i69Dldpv5HkfMV+FCc3wP4V7EWypQAvNHCgT9lxuSnFnAFZgK2E6IOMJ1e yI39Yd4nRwXCtHI494wFlggr4r76V892isFD4ZZAi9oUCqg+o71NngPqVBbObOYRtLVt CwIjI0Zr2C2J4dztPGw3vhdUKM4A8uJzfCnr09x9+l9XWntlCJ7NfPwinTrn/51HUmmF Ks99C3DuoSPmp4rHIS3/teNN/aiSpF7sux1+uzb68wvbqfuolcUXZVrmx22nRvF+PVwQ DwuQ== 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=xKwGyJmZxOms/ByF0kDC33B+Wu0QPCZS/ddqiwTaY04=; b=1z5qdQEbXwhH5OQS2o2Bi59HX5YAblktY1UJ0BFjt/ruUFn1GDu6FhDjgtbfm/MaWl K7El5b5gfmYY6a8c6aHEmrMUCWvAGJ5BLbzykenpozCFTzB8hhQ2waFZS8ZyyuDq8w4A q3M+cVOhljyVzKj1+IudkOWnixx/DK8h3rZkG9Fg0mHb/1i8Uve6+v0kXs1xbm2v8EKk UTj+TU/Axt/Jnnb6x95F+jCpVAwVc4iwO7suDmpVsomdYaf0DWre0phnefk8v7C636zF kPvM9fvA9U31jbdbeKSYlzjXN7r6sOJdUtR4YxRGYv0b9JcIGLkAFrUIpCpuaBMBLytd 1NDQ== X-Gm-Message-State: AOAM533n3i3lkQkEC8d9T96JcmPMN0xGsKD16oNe5FPWaNrGJ4weYa1a 3JxARSXWiSZlWMGTxS19AQrYSA== X-Google-Smtp-Source: ABdhPJwomtUOA3FQYouxTy1/mk/ODpKqOEUjv8Krze2Ya8GvwjCwd6/1rayMt44byBcSOXJQh1dANg== X-Received: by 2002:a1c:4384:: with SMTP id q126mr1778571wma.155.1631621249849; Tue, 14 Sep 2021 05:07:29 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 2/3] target/arm: Always clear exclusive monitor on reset Date: Tue, 14 Sep 2021 13:07:24 +0100 Message-Id: <20210914120725.24992-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210914120725.24992-1-peter.maydell@linaro.org> References: <20210914120725.24992-1-peter.maydell@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=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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=unavailable 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: Christophe Lyon Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631621648642100003 Content-Type: text/plain; charset="utf-8" There's no particular reason why the exclusive monitor should be only cleared on reset in system emulation mode. It doesn't hurt if it isn't cleared in user mode, but we might as well reduce the amount of code we have that's inside an ifdef. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 98eed6c6d31..7b1665a1d0c 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -381,15 +381,15 @@ static void arm_cpu_reset(DeviceState *dev) env->regs[15] =3D 0xFFFF0000; } =20 + env->vfp.xregs[ARM_VFP_FPEXC] =3D 0; +#endif + /* M profile requires that reset clears the exclusive monitor; * A profile does not, but clearing it makes more sense than having it * set with an exclusive access on address zero. */ arm_clear_exclusive(env); =20 - env->vfp.xregs[ARM_VFP_FPEXC] =3D 0; -#endif - if (arm_feature(env, ARM_FEATURE_PMSA)) { if (cpu->pmsav7_dregion > 0) { if (arm_feature(env, ARM_FEATURE_V8)) { --=20 2.20.1 From nobody Fri Mar 29 09:21:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1631621399; cv=none; d=zohomail.com; s=zohoarc; b=fT+EziAsReILpqSPDCpaSqNdWGKDPHE85a0hslLFt2psjc417FNGjSLsCi86ZEs1WFM5rC43HtierJjkzWDqYvdInyaxmY84kuZaWafWVbaMDczGLwIcHFBffTqHPuImYtFY8VXU+S3kG2f2qP7IlUc/sj14FTObP7kPL6oep3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631621399; h=Content-Transfer-Encoding:Cc: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; bh=5NG/bEPeZZZYUBGom19uHW6+Md+Pky64ng33saUOhoU=; b=hvTVEus7RIxa4D3WpzvzD0qAVrCaYZF07cFmJLRVSgHl+g2FeCtOogDNqG7Au4rdSNRcEeME8O7d2aeT6urK/ImDr/zWRO52m0XdI/eD4qYMcOKGVVcGpL8+/SfIyPU+PrdN/eLNP8YDeJfj3bFhu9Llsj18N0QtDZnMoLD8e2g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163162139936452.009738528958565; Tue, 14 Sep 2021 05:09:59 -0700 (PDT) Received: from localhost ([::1]:47006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQ7GA-00039X-AE for importer@patchew.org; Tue, 14 Sep 2021 08:09:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQ7Dw-0000xb-On for qemu-devel@nongnu.org; Tue, 14 Sep 2021 08:07:40 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:46838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQ7Dq-0001Mf-OT for qemu-devel@nongnu.org; Tue, 14 Sep 2021 08:07:40 -0400 Received: by mail-wr1-x429.google.com with SMTP id x6so19780157wrv.13 for ; Tue, 14 Sep 2021 05:07:34 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o10sm11472466wrc.16.2021.09.14.05.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 05:07:33 -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=5NG/bEPeZZZYUBGom19uHW6+Md+Pky64ng33saUOhoU=; b=dhySKRbMRNhJ0qrcxbAxG47zc/KOarmhCYoAymZst9Z7Nv5g1qrjJe2BpFHm+o25SV LWulp4kUXUaTpy5fn5AI4uZ/WpyZJnt93wfbicR0uj8yuf83A/3IHsyQ0aBiP/h22RiF TCP9kSEL8PHAl3iSRoB0qbUhYYLSPTGV0OLQSxO1wfMUELO5PNwXmpWi3XNVlSatHqgu HfQrNknJyZ81nfxVR1PeGyZu9d91+du3JYRJ9j0CYdIX5FeiI5pPuCEPAFa9MeDrcSIq zabijm+CFcPWqgAOc2wwc/OWkclXD6Hy8OAkrMmKfocYHPeGCgROP5eNSgcR0+mdVvnD P9pg== 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=5NG/bEPeZZZYUBGom19uHW6+Md+Pky64ng33saUOhoU=; b=vWSes2Z8xurc+rI1rDn0s8qybEOLoQyIJdfUympYrXVpKou2h7Rj4MAaJvSMPjatUt E7MxPTU9J7dcjke9DVNLerrxlOnTFHq2mEoXMNCS6Nqs1tzuJLwVRj5cg06kK/8v0/ed j0NC9GLkl18fytWCqSWJBXX4nTzznvy+1AgWzW6pEuq6rNgqy3lGIhb/YTnKSiNLGd2K bBMhZPd5gVe5UYLgPuNgM6EIbWddLYXnxsTg8IM9ZYUqffZlysZaX/3G2zfzJ3RufX3v xpWn4fWkBjHHxW1wewyZk8zM9w/r6T7cHHnleadFfVGtdBz+6TK4BIeunCR4KKwV9ydE kZ2Q== X-Gm-Message-State: AOAM5316rM+CLGQOT9rLEeMS/OA0GIQujBHBiUKTmlRODB00GrMVwBPT tjhW0KSp2wzzO1A0fOOjqaLceA== X-Google-Smtp-Source: ABdhPJz0d8ImB3eSRQ17Zp8TOwzzJ63A4EG+kobVPSl7LbnNnKN3Oee9oJ8BOG92Kmf2h0oZMmLhoQ== X-Received: by 2002:adf:cd92:: with SMTP id q18mr18403041wrj.211.1631621253418; Tue, 14 Sep 2021 05:07:33 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 3/3] target/arm: Consolidate ifdef blocks in reset Date: Tue, 14 Sep 2021 13:07:25 +0100 Message-Id: <20210914120725.24992-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210914120725.24992-1-peter.maydell@linaro.org> References: <20210914120725.24992-1-peter.maydell@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=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: Christophe Lyon Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1631621399874100001 Content-Type: text/plain; charset="utf-8" Move an ifndef CONFIG_USER_ONLY code block up in arm_cpu_reset() so it can be merged with another earlier one. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 7b1665a1d0c..4df640b9974 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -265,6 +265,16 @@ static void arm_cpu_reset(DeviceState *dev) env->uncached_cpsr =3D ARM_CPU_MODE_SVC; } env->daif =3D PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F; + + /* AArch32 has a hard highvec setting of 0xFFFF0000. If we are curren= tly + * executing as AArch32 then check if highvecs are enabled and + * adjust the PC accordingly. + */ + if (A32_BANKED_CURRENT_REG_GET(env, sctlr) & SCTLR_V) { + env->regs[15] =3D 0xFFFF0000; + } + + env->vfp.xregs[ARM_VFP_FPEXC] =3D 0; #endif =20 if (arm_feature(env, ARM_FEATURE_M)) { @@ -372,18 +382,6 @@ static void arm_cpu_reset(DeviceState *dev) #endif } =20 -#ifndef CONFIG_USER_ONLY - /* AArch32 has a hard highvec setting of 0xFFFF0000. If we are curren= tly - * executing as AArch32 then check if highvecs are enabled and - * adjust the PC accordingly. - */ - if (A32_BANKED_CURRENT_REG_GET(env, sctlr) & SCTLR_V) { - env->regs[15] =3D 0xFFFF0000; - } - - env->vfp.xregs[ARM_VFP_FPEXC] =3D 0; -#endif - /* M profile requires that reset clears the exclusive monitor; * A profile does not, but clearing it makes more sense than having it * set with an exclusive access on address zero. --=20 2.20.1