From patchwork Tue Oct 22 13:31:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 177167 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp4881016ill; Tue, 22 Oct 2019 06:40:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3B3GVQ0SwiNZBBtBI6vd7pLV3wSNeMyFXJs14tDI7W2ertXqcqMgjTopy9zDI7M1qLhAM X-Received: by 2002:a37:7e05:: with SMTP id z5mr3123064qkc.296.1571751649339; Tue, 22 Oct 2019 06:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571751649; cv=none; d=google.com; s=arc-20160816; b=qdjk65l5P7hjX0m/nzWrYltRo9Zpu/KvxhM+83BDk2BMidszz8CNwC51WZGk2yh4V8 LVKq0NnUjh5wG82OzHKfzao7mtZwJhCYBAS5lIcLlX0OAUyDNchCyUhBnZl3KAALbZf6 nqU+4P0QTeEhojoCWaatpXSgD3n/FLHDGQLSUkn/yzu6tXjp/kvwa2ks15vr8gSu9Z6R APRK3iovnPe6V2naJgx0e7YipiR/WGFato02BX7Ia1Gsf8nsL3eL8pOKUZ5JUTHo85Ev 9EFqjWyWRpdFmwAq63cOIHVKV0TCS5MO8wLdMT2YKByVQkA8vI36EDQ9cYbmV4QA0Jx9 bKGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=uSJ06sfOg2LD5tGvl0x+KI5+jg4UPMjf+ZwawjasdT0=; b=myUK21aZPxCABE2nYu/hNGzXStqxMiUzw3+suM9o1Q0hxNPmTI0+mGsZauJZWqEMbg aEvvMM2+WoOMgtYtVAt7kI+e4ozhKoBpcDoe4wmhWrDz9Ih4UlhL96howLTN9or19rJI 4nsKJHtLob4ib1JNn6Qw5sG308tSU4lpra+EbhBB/1ZqoIiRCwC5kpQsl7eAvOh21neI PuMxxa/BnTGRkwsEISHsdw5tPWeRrvU1rRXGtw1cjdbvwEVEeVWAlTWJmWExVKyPaW0t J44Jcxbhd8QGrFSMgGEX/XGNMjN04QuIdoF4maXLtKVDihpjmYb/V3Oz6Ysu1IKaa8+L e/ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sG1Tj2K3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b68si15720282qkf.341.2019.10.22.06.40.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Oct 2019 06:40:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sG1Tj2K3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuP2-0005Uh-KU for patch@linaro.org; Tue, 22 Oct 2019 09:40:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36799) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuGp-0002i2-Pg for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMuGo-0001IS-NO for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:19 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:39129) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMuGo-0001II-HB for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:18 -0400 Received: by mail-wm1-x344.google.com with SMTP id r141so6598583wme.4 for ; Tue, 22 Oct 2019 06:32:18 -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=uSJ06sfOg2LD5tGvl0x+KI5+jg4UPMjf+ZwawjasdT0=; b=sG1Tj2K3Z0U0smDrPql2aVvvhimWKskYnLlNYMzizlizCtY5URkLZCrGdKGN0vMdDw a9riujeJmnuMGmYvKDZTvtIUqvia7QBe0ji9HC6hB2ursIaihMaju8vMmM6Ntiq6IJnu wLPB6fq5Aw8gEGFRuyV4KvhbSqYmvaEN9zI8CSm2OOS3HoYFy1rV5vQK64PyaFG5EoNm VlIqZZGG/+DxBEJQu+AMTXvwhbm/js6zeK2k+d3DKiND675ctlUrUMbFdKoBbnnXfddm +oR21mwjMjYVWYrfvKe3HuNPWepqMuuEL3ZIPAh4qJPqnyrjQo9IEvJ2Q1WSYuxluQkH 4l7Q== 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=uSJ06sfOg2LD5tGvl0x+KI5+jg4UPMjf+ZwawjasdT0=; b=YwLW+hxXWKdCTUG8tOOXF3sYJzApRQ/jOWKKBzrYB2kvCZVSC5taI3fonM1z2BgWyQ mhKf+5maqMCpVs58G7slwzFJpeiT7sydh59vZpFQGzhDeXnJuCFFynOjRGXhaxWw6Cv1 AoLecCZongSjiEeD0HyIUFJ+dt3/6KDrvDlO/Q3pW1qriQhil5lqQVDBb0r8lrjJY6ri ZNATU2oz1f47u8Q/1CDPsV5HvHPp6psyoCzT42Hd9azPf6PQw0gBLOy77O7FGg2gNHwO bVNjj8ATpQNQICaDSwix9yHvNo14wH03E91tOf1y6xmgefyxAk/W+8Lc73G/6XYlaTpJ 8oLQ== X-Gm-Message-State: APjAAAVXzNbuiDhsttNfEg8MicKQcoJ3zUAh1mUedSaBnrLDNgxCoduJ +I9lNlBaTntOkb+wFNMmZDB6A61T72I= X-Received: by 2002:a1c:a9cb:: with SMTP id s194mr3308396wme.92.1571751137017; Tue, 22 Oct 2019 06:32:17 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id r2sm20263856wma.1.2019.10.22.06.32.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 06:32:15 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/41] target/arm: Reduce tests vs M-profile in cpu_get_tb_cpu_state Date: Tue, 22 Oct 2019 14:31:09 +0100 Message-Id: <20191022133134.14487-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191022133134.14487-1-peter.maydell@linaro.org> References: <20191022133134.14487-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Hoist the computation of some TBFLAG_A32 bits that only apply to M-profile under a single test for ARM_FEATURE_M. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-id: 20191018174431.1784-7-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 49 +++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 26 deletions(-) -- 2.20.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index d4303420daf..296a4b2232c 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11194,6 +11194,29 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, if (arm_feature(env, ARM_FEATURE_M)) { flags = rebuild_hflags_m32(env, fp_el, mmu_idx); + + if (arm_feature(env, ARM_FEATURE_M_SECURITY) && + FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) + != env->v7m.secure) { + flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1); + } + + if ((env->v7m.fpccr[env->v7m.secure] & R_V7M_FPCCR_ASPEN_MASK) && + (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) || + (env->v7m.secure && + !(env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)))) { + /* + * ASPEN is set, but FPCA/SFPA indicate that there is no + * active FP context; we must create a new FP context before + * executing any FP insn. + */ + flags = FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED, 1); + } + + bool is_secure = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; + if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) { + flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); + } } else { flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); } @@ -11233,32 +11256,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } } - if (arm_feature(env, ARM_FEATURE_M_SECURITY) && - FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) != env->v7m.secure) { - flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1); - } - - if (arm_feature(env, ARM_FEATURE_M) && - (env->v7m.fpccr[env->v7m.secure] & R_V7M_FPCCR_ASPEN_MASK) && - (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) || - (env->v7m.secure && - !(env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)))) { - /* - * ASPEN is set, but FPCA/SFPA indicate that there is no active - * FP context; we must create a new FP context before executing - * any FP insn. - */ - flags = FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED, 1); - } - - if (arm_feature(env, ARM_FEATURE_M)) { - bool is_secure = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; - - if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) { - flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); - } - } - if (!arm_feature(env, ARM_FEATURE_M)) { int target_el = arm_debug_target_el(env);