From patchwork Wed Oct 23 15:00:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 177311 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp893675ill; Wed, 23 Oct 2019 08:36:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvn5zLmHnsPDN37Kc6Vr7/Ms80XWWtWzWYVsdWd9E9ctwo89uoP9u3bxsPWoAk7qgejq0u X-Received: by 2002:a50:8a90:: with SMTP id j16mr38847382edj.283.1571845019102; Wed, 23 Oct 2019 08:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571845019; cv=none; d=google.com; s=arc-20160816; b=lqreShOQF4PC8hRqEpibm2r3ACNumoW7LRlJqOIxGRO+aTcgrIBanKQAeppHz9yZgU UiEkDY7RW4nz62Jt8kQkWlMkVmkLcn303g+XemUE0ma/fIRkt2xEzE7xsIz/z0Zkbcnv 4KGO6LgW+Vw6qp99XEPRLqbqNwhbG5L6XFkBnSIf8ocB8bKwAk9mifekz8VaIcPb5xuI roKnYAi7oxmeMp8WMf6SW31P11n4EgKmTpQ47LJRCYy4e2DAWF+AO5tZls9Hc14wDS4x FY3kjDpmDx1V3CN6R7Nbqm64ZZnOqh/BHpkFd/AIcxFOTKLwUwghwEnBjJsk7LWZLuju CRtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=O5qTDR4/yunqOnDsae4ZjoUIG4TsLVXzaOK/t5hnYkI=; b=jGmF9oKYJ0pvBTdgVYu8YF0ry0rm7JpdEpdSl29MJOvlNqtGZxPYrWHT+Kjg97ZUAk 3/d8IOLrb1OM9QZL4i2aMgcYfhzCOcAzxKd4prKIrLd9ol7Fv/tqsjCGoFnxW0PhWKca /tHfCZy8g4ytIWDY66zSGLWZh3r367kf95///PV2O9Qa8L6Cs3y6FkmWwE8H7vdImm39 CUODMf/QM1rtFEzG4QoCvJ2TWXBhH/va18N77FksNHyvLOM6DznCQS7BVdHPjp2nxl74 rxj15EJn7+zZGCAVhPXrmKI2gOGonX8TT3Yod2f4bYZElifK18xfDydg8CT9ufht/gli pj8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pet1fu4e; 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 nl6si13110220ejb.207.2019.10.23.08.36.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Oct 2019 08:36:59 -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=Pet1fu4e; 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]:39628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIgz-0004f6-55 for patch@linaro.org; Wed, 23 Oct 2019 11:36:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35524) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8z-0008IR-A8 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001Gr-PE for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:49 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:46548) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-00013m-Kx for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x841.google.com with SMTP id u22so32677817qtq.13 for ; Wed, 23 Oct 2019 08:01:12 -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=O5qTDR4/yunqOnDsae4ZjoUIG4TsLVXzaOK/t5hnYkI=; b=Pet1fu4e7LakqP3u68K6uZ+/Iyt//Fgw/D84p3kOucDpKrfxCMc6K6Ei7qH/Rd3ndI IzFfX3iilQ1P34GmmOeaHEYgFTJSnpE3sZ9chPuAgzbp3DE/POVFkGni955VtV4VcsZc UnndodFZ9UZ6YNzsJ7fWr2bKHC6yi6RIHH6W+j68aQwzLHGYIN3pnPXQ1f9PQkNHgLJI 760t9YTGtvDWeoCpeBJmTrMCz6cjslMIfiuVOBG7QqjIOd1ml8R/zjf56XDOMIQH/8fl 7OFEu0heiQV+lDYbvg1Un4UzVooGs9sEFYUdKM814h8piOv7prGL2uopxkbQI8KzOPJO QlPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O5qTDR4/yunqOnDsae4ZjoUIG4TsLVXzaOK/t5hnYkI=; b=H4cEDnsjbkJtsOIdHIUI9CNVA9+6fmZujgbICzKkjAjVF3aDFcA7xEPw9Csuec5ZWa aSoRk10nst+QrmD1sMxipwTj/ihScw9Tp+Q6e1khehroZ3nZcY2s3eXzzsKiASXRFTXD cIMF4xtjt7Z1eXSQieEbt7eUJlni8jVnv3YDq8KOIq3ahfAhsl0RwvZPIVOiFrALQ1zW K715wGxx6MhGoKhH5IZ+rWqjT9pvhGw9ETSjcfzNmJOSI63PjNbBlcMjFxATj+K0RMOG 5q6qQaCsHeMRnaZY3EpG48IpfIWhvk1yh7tNFUM+O9Yf2XLqYRi2y0Ia/AKpkv2OErMB gfeA== X-Gm-Message-State: APjAAAXZLHc7yP9mcE1GlirOdvdjMQ0zITA4Kn9x9MJN7U+qjKD3ZYwm REHKcjAZUItmjzw3dGqpI3ctBmcmQtY= X-Received: by 2002:ac8:6c9:: with SMTP id j9mr9311096qth.81.1571842870635; Wed, 23 Oct 2019 08:01:10 -0700 (PDT) Received: from localhost.localdomain (198-4-20-64.static.cosmoweb.net. [64.20.4.198]) by smtp.gmail.com with ESMTPSA id l189sm11030168qke.69.2019.10.23.08.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 06/24] target/arm: Reduce tests vs M-profile in cpu_get_tb_cpu_state Date: Wed, 23 Oct 2019 11:00:39 -0400 Message-Id: <20191023150057.25731-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023150057.25731-1-richard.henderson@linaro.org> References: <20191023150057.25731-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::841 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: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- target/arm/helper.c | 49 +++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 26 deletions(-) -- 2.17.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index d4303420da..296a4b2232 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);