From nobody Thu May 2 00:18:08 2024 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=1571844807; cv=none; d=zoho.com; s=zohoarc; b=dZLyiGd4VyrlIu/VC5kIWZTNS4dafPrVeAUtG96zeFXFf/+Xdz+yjfEgKNPTX8cCTu23tr2fkHt22ckUofAng77kASsKYLhGO45qzq12/x6VYUTHwfWfTpCqhjy7253HP0xA6fZtMy/kce7y59n/uVOA/zjrZ1g/MJpw5PueEfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844807; h=Content-Type: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=/TI4mK10x/uGohRoaKTTXXODiX4sOLe+8x03viKmFL4=; b=CUE7Mbjxnj8EV7SujDLXdDqCZW7KuT0FSABbaar/YrdL2ZYI2n4ph27oXP5RPe6nWOHVoa38SpqF3lM2MkPWE153swcWtCFPFpeSCq4MoVC46+2LsIqM0RcjlEBnOI3qnFUUu43ZoS/g7mEmoVp3KtIJkUfhM24VjI7YIvlQVxw= 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 1571844807679559.5271548881886; Wed, 23 Oct 2019 08:33:27 -0700 (PDT) Received: from localhost ([::1]:39582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIda-0001Im-HV for importer@patchew.org; Wed, 23 Oct 2019 11:33:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35267) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-00089i-FZ for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001Fy-Gh for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:44 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:37771) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-0000zG-B1 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x843.google.com with SMTP id g50so18581399qtb.4 for ; Wed, 23 Oct 2019 08:01:05 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:02 -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=/TI4mK10x/uGohRoaKTTXXODiX4sOLe+8x03viKmFL4=; b=jVI3tStENkvrA0RTOIuhunlVcBItLkEW8bl7Ub8R+s1Syd5MrrOssSNqo4Mj3jJIIt MR6EE2acY7++XYPZkd+mno+WKZCPen95AYSPSIfiy4/IZA2qiOZupE+37VQDDEWhv8fh amkEzk+Bce30G0Pd4bc0YF5QsHD/Pvr+de19yM7y/uv0cV6NVLi3eOonPm5j0B3zpCXR M7RKRV0viLcaROuIestq8Eh6X+H8IwtkmVPZbshoddECWVcFUNruRgdgDzjyBUjuuyXF ul6Ewg4U2CUk9Up+ohpZgilLRwnlQgVtEuayHcNZOrWypgDQJC2Ip0t+PSr9IbK3PXKw P/EA== 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=/TI4mK10x/uGohRoaKTTXXODiX4sOLe+8x03viKmFL4=; b=fc01zF96ImoKxi5L8eqE/lRKFt6s2G4y8Mk592fQVUt5cZ4r7tkogqLxDokSjnm2dR AMvIPr3u/KHVN2xMeToemhPem2P81/v0q8BOsshvabdcRFxO84DiRw+HKJCdQNSXRZ3H Pb9v1hI//zoTBVEkAy0tWlWfxWb/4YOhRyB5AA8SmBaxuGyTyzYYxZw+VHVp0tF4pUv+ hrmY9aU5imjO+2ULxAw4r/8bNfldFKaw9DdTSUx8ciluqcshQiUGAt9GeUYIldmU32K0 A1lKr9PbzT9SKX9W5k4qsoXm0IAuwVg859VWlyScO0RJVjuoVZ0H0DqZNTuSn4txjFOt 54uA== X-Gm-Message-State: APjAAAWHwsLacCi1JdZDndro9SFFLbci8zPAXTE8Fy0gUwmuc+nnnmyf xQ1ugWu0B1RSdVq30u72LH4ozUSzhVg= X-Google-Smtp-Source: APXvYqw/A5BllI3YBRY9sEyxITjCAkdggMoBwZisnTDN/QGZi0YFXs43B0codiI1A6LEHawCaRz0wA== X-Received: by 2002:ac8:51c9:: with SMTP id d9mr9823200qtn.48.1571842862867; Wed, 23 Oct 2019 08:01:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 01/24] target/arm: Split out rebuild_hflags_common Date: Wed, 23 Oct 2019 11:00:34 -0400 Message-Id: <20191023150057.25731-2-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 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: 2607:f8b0:4864:20::843 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create a function to compute the values of the TBFLAG_ANY bits that will be cached. For now, the env->hflags variable is not used, and the results are fed back to cpu_get_tb_cpu_state. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/cpu.h | 29 ++++++++++++++++++----------- target/arm/helper.c | 26 +++++++++++++++++++------- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 297ad5e47a..ad79a6153b 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -231,6 +231,9 @@ typedef struct CPUARMState { uint32_t pstate; uint32_t aarch64; /* 1 if CPU is in aarch64 state; inverse of PSTATE.n= RW */ =20 + /* Cached TBFLAGS state. See below for which bits are included. */ + uint32_t hflags; + /* Frequently accessed CPSR bits are stored separately for efficiency. This contains all the other bits. Use cpsr_{read,write} to access the whole CPSR. */ @@ -3140,15 +3143,18 @@ typedef ARMCPU ArchCPU; =20 #include "exec/cpu-all.h" =20 -/* Bit usage in the TB flags field: bit 31 indicates whether we are +/* + * Bit usage in the TB flags field: bit 31 indicates whether we are * in 32 or 64 bit mode. The meaning of the other bits depends on that. * We put flags which are shared between 32 and 64 bit mode at the top * of the word, and flags which apply to only one mode at the bottom. + * + * Unless otherwise noted, these bits are cached in env->hflags. */ FIELD(TBFLAG_ANY, AARCH64_STATE, 31, 1) FIELD(TBFLAG_ANY, MMUIDX, 28, 3) FIELD(TBFLAG_ANY, SS_ACTIVE, 27, 1) -FIELD(TBFLAG_ANY, PSTATE_SS, 26, 1) +FIELD(TBFLAG_ANY, PSTATE_SS, 26, 1) /* Not cached. */ /* Target EL if we take a floating-point-disabled exception */ FIELD(TBFLAG_ANY, FPEXC_EL, 24, 2) FIELD(TBFLAG_ANY, BE_DATA, 23, 1) @@ -3159,13 +3165,14 @@ FIELD(TBFLAG_ANY, BE_DATA, 23, 1) FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 21, 2) =20 /* Bit usage when in AArch32 state: */ -FIELD(TBFLAG_A32, THUMB, 0, 1) -FIELD(TBFLAG_A32, VECLEN, 1, 3) -FIELD(TBFLAG_A32, VECSTRIDE, 4, 2) +FIELD(TBFLAG_A32, THUMB, 0, 1) /* Not cached. */ +FIELD(TBFLAG_A32, VECLEN, 1, 3) /* Not cached. */ +FIELD(TBFLAG_A32, VECSTRIDE, 4, 2) /* Not cached. */ /* * We store the bottom two bits of the CPAR as TB flags and handle * checks on the other bits at runtime. This shares the same bits as * VECSTRIDE, which is OK as no XScale CPU has VFP. + * Not cached, because VECLEN+VECSTRIDE are not cached. */ FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2) /* @@ -3174,15 +3181,15 @@ FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2) * the same thing as the current security state of the processor! */ FIELD(TBFLAG_A32, NS, 6, 1) -FIELD(TBFLAG_A32, VFPEN, 7, 1) -FIELD(TBFLAG_A32, CONDEXEC, 8, 8) +FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Not cached. */ +FIELD(TBFLAG_A32, CONDEXEC, 8, 8) /* Not cached. */ FIELD(TBFLAG_A32, SCTLR_B, 16, 1) /* For M profile only, set if FPCCR.LSPACT is set */ -FIELD(TBFLAG_A32, LSPACT, 18, 1) +FIELD(TBFLAG_A32, LSPACT, 18, 1) /* Not cached. */ /* For M profile only, set if we must create a new FP context */ -FIELD(TBFLAG_A32, NEW_FP_CTXT_NEEDED, 19, 1) +FIELD(TBFLAG_A32, NEW_FP_CTXT_NEEDED, 19, 1) /* Not cached. */ /* For M profile only, set if FPCCR.S does not match current security stat= e */ -FIELD(TBFLAG_A32, FPCCR_S_WRONG, 20, 1) +FIELD(TBFLAG_A32, FPCCR_S_WRONG, 20, 1) /* Not cached. */ /* For M profile only, Handler (ie not Thread) mode */ FIELD(TBFLAG_A32, HANDLER, 21, 1) /* For M profile only, whether we should generate stack-limit checks */ @@ -3194,7 +3201,7 @@ FIELD(TBFLAG_A64, SVEEXC_EL, 2, 2) FIELD(TBFLAG_A64, ZCR_LEN, 4, 4) FIELD(TBFLAG_A64, PAUTH_ACTIVE, 8, 1) FIELD(TBFLAG_A64, BT, 9, 1) -FIELD(TBFLAG_A64, BTYPE, 10, 2) +FIELD(TBFLAG_A64, BTYPE, 10, 2) /* Not cached. */ FIELD(TBFLAG_A64, TBID, 12, 2) =20 static inline bool bswap_code(bool sctlr_b) diff --git a/target/arm/helper.c b/target/arm/helper.c index 0d9a2d2ab7..8829d91ae1 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11054,6 +11054,22 @@ ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env) } #endif =20 +static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, + ARMMMUIdx mmu_idx, uint32_t flags) +{ + flags =3D FIELD_DP32(flags, TBFLAG_ANY, FPEXC_EL, fp_el); + flags =3D FIELD_DP32(flags, TBFLAG_ANY, MMUIDX, + arm_to_core_mmu_idx(mmu_idx)); + + if (arm_cpu_data_is_big_endian(env)) { + flags =3D FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); + } + if (arm_singlestep_active(env)) { + flags =3D FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1); + } + return flags; +} + void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { @@ -11145,7 +11161,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, } } =20 - flags =3D FIELD_DP32(flags, TBFLAG_ANY, MMUIDX, arm_to_core_mmu_idx(mm= u_idx)); + flags =3D rebuild_hflags_common(env, fp_el, mmu_idx, flags); =20 /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine * states defined in the ARM ARM for software singlestep: @@ -11153,9 +11169,9 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, * 0 x Inactive (the TB flag for SS is always 0) * 1 0 Active-pending * 1 1 Active-not-pending + * SS_ACTIVE is set in hflags; PSTATE_SS is computed every TB. */ - if (arm_singlestep_active(env)) { - flags =3D FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1); + if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE)) { if (is_a64(env)) { if (env->pstate & PSTATE_SS) { flags =3D FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1); @@ -11166,10 +11182,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, } } } - if (arm_cpu_data_is_big_endian(env)) { - flags =3D FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); - } - flags =3D FIELD_DP32(flags, TBFLAG_ANY, FPEXC_EL, fp_el); =20 if (arm_v7m_is_handler_mode(env)) { flags =3D FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845649; cv=none; d=zoho.com; s=zohoarc; b=jWoT567KeYfnmuWBIsDTzilDPILGMs2zYlTiJdGCjyJUL+9uRDY96bZnU8t3L5r4Z3H7eT3ZFPeix5NmJplHIngXrXVbXddQ+kA9+yLSDodq+/W9Yjt1xtydSyyDChQuPV3ExSDrVVCRftqwoeH3B5MuLQS5VPncZvyxqr2tqT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845649; h=Content-Type: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=qxe5WkTH2gH9OxzrQymT8yteWQToRtaNSxbFtmMzahk=; b=WNJ6zI79MJaGf2/M7yf+FtjyIh+8YAvdMj+ddO7c5U9iQwdronG8Mn2qz5aQLlqoNAlpcBxe5xI8iTWopivZpmrshodQcW8KT3Edzy+1BzACQcY6Wp3I726MR4tidVFY/aOwVgCHHEEJCJGiFtnV2QR4i4VE/haS1MV3VW4Lw+o= 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 1571845649013913.1760443631157; Wed, 23 Oct 2019 08:47:29 -0700 (PDT) Received: from localhost ([::1]:39903 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIr8-0005MO-Br for importer@patchew.org; Wed, 23 Oct 2019 11:47:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35422) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8x-0008FR-9f 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 1iNI8q-0001E9-RO for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:46 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:46546) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8q-0000zc-KZ for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:40 -0400 Received: by mail-qt1-x842.google.com with SMTP id u22so32677173qtq.13 for ; Wed, 23 Oct 2019 08:01:06 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:03 -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=qxe5WkTH2gH9OxzrQymT8yteWQToRtaNSxbFtmMzahk=; b=SU1JrHFr7k1kmhDhIJjaVmbpu850wRRaC9NGaYOyxFWi712AROvpFjL55boVXtSq8/ hOLu1pCT3DAPAC3DgondPj8aRGK1Y919fMNqcwgMgETJgLT2h+QMDuyRl47RzyEeaz// b1kyG9sA3sKOdCTY9mwTrcGIM10kq4+3bljqGRm4O2ChzXeO4rB5wDrodvOPQkDJI+jg zq96aDdOO0XKzo9+EWWKybYWY+DspwWBvxuvU+Y2U00WuWXjsyHib71GDcxI3jtS4L3R wCSpO0oglseT+djDXNZOSreX8lTPNfzATUgaG7iO27/l8UwmdNhSRgrENSDdZuMXdxtB EoDQ== 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=qxe5WkTH2gH9OxzrQymT8yteWQToRtaNSxbFtmMzahk=; b=U+xiaZ8sXmhcmm8UrgPRCjCcKsAcUsweQwzDdkkfhQIrNmsbh4qsi44C+aX0qGMDy2 X0jnZs4833Q0e+ZTVtQv92p9Hqzn2ilAjjaDFu1uIucQ0VM8IwzYaWCchOXJ9mv/Wh1n eQtZy6Gp3l9jFERsoEsCaxe1Z+JmkGLDiVvxMRmGbbB1jd+BSdCDuv3dwWC/jOprp/23 DAtxNFh4JnTcvgR6eoA2DSwCsoOvhSOyjV7eePVP6cHgPQkxyHrIdwbQTs8mY9ucdmjA 8VhDCv/igS8eRRsENRYdHl6Mk/93Bm6VR6h5I19jdWDKSQT2akYHeXdSLKNbdesHl6jW Oaig== X-Gm-Message-State: APjAAAXYdEnYTwhk9bi9IzjGrp3KoRvRT47344IyNQdGdpK1L9TJyEw3 T1wbbOC2UwninHLKKjPTP2jYVU8kIDo= X-Google-Smtp-Source: APXvYqy/7XXR5O9040JZjM+WrurgrHndWgBWfHmIAhdLK3QNvauz9sxaeu6RkB84sShOVdpeBjXRsQ== X-Received: by 2002:ac8:7a97:: with SMTP id x23mr9729232qtr.38.1571842864257; Wed, 23 Oct 2019 08:01:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 02/24] target/arm: Split out rebuild_hflags_a64 Date: Wed, 23 Oct 2019 11:00:35 -0400 Message-Id: <20191023150057.25731-3-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 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: 2607:f8b0:4864:20::842 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create a function to compute the values of the TBFLAG_A64 bits that will be cached. For now, the env->hflags variable is not used, and the results are fed back to cpu_get_tb_cpu_state. Note that not all BTI related flags are cached, so we have to test the BTI feature twice -- once for those bits moved out to rebuild_hflags_a64 and once for those bits that remain in cpu_get_tb_cpu_state. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.c | 131 +++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 62 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 8829d91ae1..69da04786e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11070,6 +11070,71 @@ static uint32_t rebuild_hflags_common(CPUARMState = *env, int fp_el, return flags; } =20 +static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, + ARMMMUIdx mmu_idx) +{ + ARMMMUIdx stage1 =3D stage_1_mmu_idx(mmu_idx); + ARMVAParameters p0 =3D aa64_va_parameters_both(env, 0, stage1); + uint32_t flags =3D 0; + uint64_t sctlr; + int tbii, tbid; + + flags =3D FIELD_DP32(flags, TBFLAG_ANY, AARCH64_STATE, 1); + + /* FIXME: ARMv8.1-VHE S2 translation regime. */ + if (regime_el(env, stage1) < 2) { + ARMVAParameters p1 =3D aa64_va_parameters_both(env, -1, stage1); + tbid =3D (p1.tbi << 1) | p0.tbi; + tbii =3D tbid & ~((p1.tbid << 1) | p0.tbid); + } else { + tbid =3D p0.tbi; + tbii =3D tbid & !p0.tbid; + } + + flags =3D FIELD_DP32(flags, TBFLAG_A64, TBII, tbii); + flags =3D FIELD_DP32(flags, TBFLAG_A64, TBID, tbid); + + if (cpu_isar_feature(aa64_sve, env_archcpu(env))) { + int sve_el =3D sve_exception_el(env, el); + uint32_t zcr_len; + + /* + * If SVE is disabled, but FP is enabled, + * then the effective len is 0. + */ + if (sve_el !=3D 0 && fp_el =3D=3D 0) { + zcr_len =3D 0; + } else { + zcr_len =3D sve_zcr_len_for_el(env, el); + } + flags =3D FIELD_DP32(flags, TBFLAG_A64, SVEEXC_EL, sve_el); + flags =3D FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len); + } + + sctlr =3D arm_sctlr(env, el); + + if (cpu_isar_feature(aa64_pauth, env_archcpu(env))) { + /* + * In order to save space in flags, we record only whether + * pauth is "inactive", meaning all insns are implemented as + * a nop, or "active" when some action must be performed. + * The decision of which action to take is left to a helper. + */ + if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) { + flags =3D FIELD_DP32(flags, TBFLAG_A64, PAUTH_ACTIVE, 1); + } + } + + if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { + /* Note that SCTLR_EL[23].BT =3D=3D SCTLR_BT1. */ + if (sctlr & (el =3D=3D 0 ? SCTLR_BT0 : SCTLR_BT1)) { + flags =3D FIELD_DP32(flags, TBFLAG_A64, BT, 1); + } + } + + return rebuild_hflags_common(env, fp_el, mmu_idx, flags); +} + void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { @@ -11079,67 +11144,9 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, uint32_t flags =3D 0; =20 if (is_a64(env)) { - ARMCPU *cpu =3D env_archcpu(env); - uint64_t sctlr; - *pc =3D env->pc; - flags =3D FIELD_DP32(flags, TBFLAG_ANY, AARCH64_STATE, 1); - - /* Get control bits for tagged addresses. */ - { - ARMMMUIdx stage1 =3D stage_1_mmu_idx(mmu_idx); - ARMVAParameters p0 =3D aa64_va_parameters_both(env, 0, stage1); - int tbii, tbid; - - /* FIXME: ARMv8.1-VHE S2 translation regime. */ - if (regime_el(env, stage1) < 2) { - ARMVAParameters p1 =3D aa64_va_parameters_both(env, -1, st= age1); - tbid =3D (p1.tbi << 1) | p0.tbi; - tbii =3D tbid & ~((p1.tbid << 1) | p0.tbid); - } else { - tbid =3D p0.tbi; - tbii =3D tbid & !p0.tbid; - } - - flags =3D FIELD_DP32(flags, TBFLAG_A64, TBII, tbii); - flags =3D FIELD_DP32(flags, TBFLAG_A64, TBID, tbid); - } - - if (cpu_isar_feature(aa64_sve, cpu)) { - int sve_el =3D sve_exception_el(env, current_el); - uint32_t zcr_len; - - /* If SVE is disabled, but FP is enabled, - * then the effective len is 0. - */ - if (sve_el !=3D 0 && fp_el =3D=3D 0) { - zcr_len =3D 0; - } else { - zcr_len =3D sve_zcr_len_for_el(env, current_el); - } - flags =3D FIELD_DP32(flags, TBFLAG_A64, SVEEXC_EL, sve_el); - flags =3D FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len); - } - - sctlr =3D arm_sctlr(env, current_el); - - if (cpu_isar_feature(aa64_pauth, cpu)) { - /* - * In order to save space in flags, we record only whether - * pauth is "inactive", meaning all insns are implemented as - * a nop, or "active" when some action must be performed. - * The decision of which action to take is left to a helper. - */ - if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB= )) { - flags =3D FIELD_DP32(flags, TBFLAG_A64, PAUTH_ACTIVE, 1); - } - } - - if (cpu_isar_feature(aa64_bti, cpu)) { - /* Note that SCTLR_EL[23].BT =3D=3D SCTLR_BT1. */ - if (sctlr & (current_el =3D=3D 0 ? SCTLR_BT0 : SCTLR_BT1)) { - flags =3D FIELD_DP32(flags, TBFLAG_A64, BT, 1); - } + flags =3D rebuild_hflags_a64(env, current_el, fp_el, mmu_idx); + if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { flags =3D FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); } } else { @@ -11159,9 +11166,9 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, flags =3D FIELD_DP32(flags, TBFLAG_A32, XSCALE_CPAR, env->cp15.c15_cpar); } - } =20 - flags =3D rebuild_hflags_common(env, fp_el, mmu_idx, flags); + flags =3D rebuild_hflags_common(env, fp_el, mmu_idx, flags); + } =20 /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine * states defined in the ARM ARM for software singlestep: --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845111; cv=none; d=zoho.com; s=zohoarc; b=lNGaWB+sU3ExTy7X8AgqR6337Zp3rP+hWmW50jYlkLu9wp+eZSvFtlu78w1X2laqaBryV678/0crfoFgGKXzPw3tolq7nSsXVMoWsC2+JcuDhSIYbH070/M33eglyNcpJ4qoOvHlBLt/C1IRFMquRV6gKherOnQHr8iXlfUKjzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845111; h=Content-Type: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=+UgAJ6EhcwGdb7pezBRTrZ79eaC+NjRs0dqrTWfzTFo=; b=HhqBPUSHv4KENit9vWkSlg0Gyepuu6xRFTlvAYU7Q7ylwjtJU2L9mhlUROgtGjKpV5w/4wi18PPZc8GbCUZGpdFGIEyRr7n5MB/UYFjHZZNJ0xvSN/a7HVHA+mncTjv/UlkjomNsdFBXdjPhDMmdl5zgN9R/2u4BhYK8Nt5dv9o= 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 1571845111882841.9244608616278; Wed, 23 Oct 2019 08:38:31 -0700 (PDT) Received: from localhost ([::1]:39640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIiU-0005gN-6H for importer@patchew.org; Wed, 23 Oct 2019 11:38:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35407) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8w-0008F8-Sj for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8s-0001In-CY for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:46 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:34018) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-0000zn-Ux for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:42 -0400 Received: by mail-qk1-x741.google.com with SMTP id f18so19439027qkm.1 for ; Wed, 23 Oct 2019 08:01:06 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:05 -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=+UgAJ6EhcwGdb7pezBRTrZ79eaC+NjRs0dqrTWfzTFo=; b=PgnrO0uPpTiYTYsbXPpY87h8Z0eBFe3G++ZOjFoT6Wu3rV+AblsG3Jrtl/PhuHdYq8 DplElLgxVtc81TN7i+dBHdKGP/hcZZqP64CmIX8TqdP7rV4V6p3Begod0zD7ceggmlQC RXxeCK1syyeLApzjg17+yPc0D6vOcJnCflqlR7YeboQbls0QJJVCp/wFtvBH2ReJ6lM+ vkJ67izP6YTWzKKXwtbPIEDPZRc5gTjKxs9u0ngb2+02A9KASpBkc5b09ZRH6/APzcAV QmrLUlVbmej/KoVE3QWUJ2vlWNiAljtW5ZoPOkJjdg+JDgwjC8Y096KCS1VTDONvpVqy 2D5g== 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=+UgAJ6EhcwGdb7pezBRTrZ79eaC+NjRs0dqrTWfzTFo=; b=gD8wRZ6h4mP4TRABoH1RNfLpM92goPq/5r1v2td4koFg1lQVmeaEoiItOQDMWxTH5c VdL4psg8mzmHoUSD7ZjL/7sq7rAgTYrB2kQI9OXDYZGzi0jlN17ySQoU2O9EcPNahC9f 0fqnKEzqGgH6UEM220skpSAWmsWoSebG2i1s8sP7JgdV2mDJU/shWkJT+9c+S9g5lV4h bWGgYQsfaYxD+DT6lyMlatLCvYL0Hid2hFK/AfOUVsEorEVxX+o++VZiScdPUzaTvOhu Xf9Kjrfc+7615mzV9AlLQlQSZo1bdDmIHOtnuziTmyptBDZpeUcSTdb3+CmfIkYQhjVO mEDg== X-Gm-Message-State: APjAAAXg+ZefMM1FPaLc5+wR3hk1L3nl061TIPLW2N9570ZddM2TRYEv qerEzA0cYDNCTUULshWvuNl1CZrhudg= X-Google-Smtp-Source: APXvYqxwajp22hz9pigHcDSFodqeZVJKfpWySpzLn/4csgkugNTic0oO3Kt4fpKn18wLg3v8s8/63w== X-Received: by 2002:a37:4dca:: with SMTP id a193mr8751748qkb.292.1571842865717; Wed, 23 Oct 2019 08:01:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 03/24] target/arm: Split out rebuild_hflags_common_32 Date: Wed, 23 Oct 2019 11:00:36 -0400 Message-Id: <20191023150057.25731-4-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 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: 2607:f8b0:4864:20::741 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create a function to compute the values of the TBFLAG_A32 bits that will be cached, and are used by all profiles. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 69da04786e..f05d042474 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11070,6 +11070,15 @@ static uint32_t rebuild_hflags_common(CPUARMState = *env, int fp_el, return flags; } =20 +static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, + ARMMMUIdx mmu_idx, uint32_t flags) +{ + flags =3D FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env)); + flags =3D FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env)); + + return rebuild_hflags_common(env, fp_el, mmu_idx, flags); +} + static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, ARMMMUIdx mmu_idx) { @@ -11141,7 +11150,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, ARMMMUIdx mmu_idx =3D arm_mmu_idx(env); int current_el =3D arm_current_el(env); int fp_el =3D fp_exception_el(env, current_el); - uint32_t flags =3D 0; + uint32_t flags; =20 if (is_a64(env)) { *pc =3D env->pc; @@ -11151,12 +11160,11 @@ void cpu_get_tb_cpu_state(CPUARMState *env, targe= t_ulong *pc, } } else { *pc =3D env->regs[15]; + flags =3D rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); flags =3D FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); flags =3D FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len); flags =3D FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_st= ride); flags =3D FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bi= ts); - flags =3D FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env)); - flags =3D FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env= )); if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { flags =3D FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); @@ -11166,8 +11174,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, flags =3D FIELD_DP32(flags, TBFLAG_A32, XSCALE_CPAR, env->cp15.c15_cpar); } - - flags =3D rebuild_hflags_common(env, fp_el, mmu_idx, flags); } =20 /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845079; cv=none; d=zoho.com; s=zohoarc; b=nYJT+A22jxVhfErWDyXvrUUXqHl28HUJI+PbUBTbTA/JNheKqYiRGNs0Ll2wr05SLmCIknFf1Ol8pZbSNpK7b6dvsJwD0tUh0i6s+MfrN+vjbRzh0+NfDBhEUlk+5Fm7NjE92cjeJJBLRhZBw2CDyh6loYafU0569OQx7mdt7z4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845079; h=Content-Type: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=wk2rFtSmeyIzF6QnNFgZDZnR49h41R/PQfqDCLolPT8=; b=BziOqNzZcvQI6O3EdJM2hfZBJVD0s6ymjMKGpM8WtGu4D+Ogk0kUSTOthrck3UvNwos2F8eLiTuXjbrQpdURoxkvU50vvZKFQ7j7BFivJWipnvmx5QQIM+SLHzIgjuMfPfZE9Ah9f6+F4+DsdaJoeSWhfpGBnkiuoKp9j9Bkmx8= 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 1571845079158655.7238548300768; Wed, 23 Oct 2019 08:37:59 -0700 (PDT) Received: from localhost ([::1]:39636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIht-00053G-Ob for importer@patchew.org; Wed, 23 Oct 2019 11:37:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35431) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8x-0008FZ-95 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8s-0001It-DO for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:47 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:39952) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8s-00010k-1Y for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:42 -0400 Received: by mail-qk1-x742.google.com with SMTP id y81so16141632qkb.7 for ; Wed, 23 Oct 2019 08:01:08 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:07 -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=wk2rFtSmeyIzF6QnNFgZDZnR49h41R/PQfqDCLolPT8=; b=m1Xi4wHUB/rzh8DpWQCx77XUam/NZg86g5fXAVetykgByxXTBaAFPeQ1uAMWCy4Hmd /OZppLkfuU0wTbUAXtwcsbfhXndK6buDKQ5bRcH4xM7SRB2p0lfMdnjVJ5aUPY8novNs 6OsJAGTfu+X1KkUYf11KhXS4LkTWU6baMUESKtzszMJVLT4CHnTZex/TmF7EQoRpbdmi sx5vCXuCndE2PWMfRXBJOwpnaqJti4Z3Ij7tGnvNn9HXdhKzaBDtTQTNWI23xhaJA4CP GQ6wbDn4avRbHN/tfGsXUqX/fcQp2jKnLG5BLQAi2fZ4lszGdkCUjZ3BbW4s6LIS39j5 FtcA== 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=wk2rFtSmeyIzF6QnNFgZDZnR49h41R/PQfqDCLolPT8=; b=msshhGLtlPcs9UFI258bjDnAuyTNJ0WuFZ9qbNXn6GJmn1mF5lkMHAKqRrZhdmu01a ZBwrJa6VeX22MYGI8S2eRXQEXBXW3OkZhuf/FvnVy/p8B9N/ejG8TN5lHzqj2lBQqn5L Rt9i/jrCPGNv2t5WVNmYIbdSQXfnwNc0rknielNEHiaA4qcsxBixOtGspSfl8svLqoTW o/gT93LSxmHfTlV9oN2HLwl8u+zzztgocbbo3pCQCpW7IPiWh+SEA+TPsD/PGmguo+AL REyf2WANgREbE8ScHDN2zbA+GDai+wh6iQ2iNoTuno/Qkk9XOcikzVcjXKUdAQzQRk4L 2f+g== X-Gm-Message-State: APjAAAU+UCgffhFCU8KKqAJgT/PDfE/ivvOIPj+pmH4thPM2QF64B4Ga Cfw/5c7TtOa9csUIYGjcJDCTDSJeoMo= X-Google-Smtp-Source: APXvYqwr+wzFrhvS+T8g5inbOTFRc932keyo8BgxS41VtRlSxXeQiRKwig7qW3Kri2NYQlwUsR3uOg== X-Received: by 2002:a37:93c4:: with SMTP id v187mr9021367qkd.490.1571842867655; Wed, 23 Oct 2019 08:01:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 04/24] target/arm: Split arm_cpu_data_is_big_endian Date: Wed, 23 Oct 2019 11:00:37 -0400 Message-Id: <20191023150057.25731-5-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 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: 2607:f8b0:4864:20::742 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Set TBFLAG_ANY.BE_DATA in rebuild_hflags_common_32 and rebuild_hflags_a64 instead of rebuild_hflags_common, where we do not need to re-test is_a64() nor re-compute the various inputs. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/cpu.h | 49 +++++++++++++++++++++++++++------------------ target/arm/helper.c | 16 +++++++++++---- 2 files changed, 42 insertions(+), 23 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index ad79a6153b..4d961474ce 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3108,33 +3108,44 @@ static inline uint64_t arm_sctlr(CPUARMState *env, = int el) } } =20 +static inline bool arm_cpu_data_is_big_endian_a32(CPUARMState *env, + bool sctlr_b) +{ +#ifdef CONFIG_USER_ONLY + /* + * In system mode, BE32 is modelled in line with the + * architecture (as word-invariant big-endianness), where loads + * and stores are done little endian but from addresses which + * are adjusted by XORing with the appropriate constant. So the + * endianness to use for the raw data access is not affected by + * SCTLR.B. + * In user mode, however, we model BE32 as byte-invariant + * big-endianness (because user-only code cannot tell the + * difference), and so we need to use a data access endianness + * that depends on SCTLR.B. + */ + if (sctlr_b) { + return true; + } +#endif + /* In 32bit endianness is determined by looking at CPSR's E bit */ + return env->uncached_cpsr & CPSR_E; +} + +static inline bool arm_cpu_data_is_big_endian_a64(int el, uint64_t sctlr) +{ + return sctlr & (el ? SCTLR_EE : SCTLR_E0E); +} =20 /* Return true if the processor is in big-endian mode. */ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) { - /* In 32bit endianness is determined by looking at CPSR's E bit */ if (!is_a64(env)) { - return -#ifdef CONFIG_USER_ONLY - /* In system mode, BE32 is modelled in line with the - * architecture (as word-invariant big-endianness), where loads - * and stores are done little endian but from addresses which - * are adjusted by XORing with the appropriate constant. So the - * endianness to use for the raw data access is not affected by - * SCTLR.B. - * In user mode, however, we model BE32 as byte-invariant - * big-endianness (because user-only code cannot tell the - * difference), and so we need to use a data access endianness - * that depends on SCTLR.B. - */ - arm_sctlr_b(env) || -#endif - ((env->uncached_cpsr & CPSR_E) ? 1 : 0); + return arm_cpu_data_is_big_endian_a32(env, arm_sctlr_b(env)); } else { int cur_el =3D arm_current_el(env); uint64_t sctlr =3D arm_sctlr(env, cur_el); - - return (sctlr & (cur_el ? SCTLR_EE : SCTLR_E0E)) !=3D 0; + return arm_cpu_data_is_big_endian_a64(cur_el, sctlr); } } =20 diff --git a/target/arm/helper.c b/target/arm/helper.c index f05d042474..4c65476d93 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11061,9 +11061,6 @@ static uint32_t rebuild_hflags_common(CPUARMState *= env, int fp_el, flags =3D FIELD_DP32(flags, TBFLAG_ANY, MMUIDX, arm_to_core_mmu_idx(mmu_idx)); =20 - if (arm_cpu_data_is_big_endian(env)) { - flags =3D FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); - } if (arm_singlestep_active(env)) { flags =3D FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1); } @@ -11073,7 +11070,14 @@ static uint32_t rebuild_hflags_common(CPUARMState = *env, int fp_el, static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, ARMMMUIdx mmu_idx, uint32_t flags) { - flags =3D FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env)); + bool sctlr_b =3D arm_sctlr_b(env); + + if (sctlr_b) { + flags =3D FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, 1); + } + if (arm_cpu_data_is_big_endian_a32(env, sctlr_b)) { + flags =3D FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); + } flags =3D FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env)); =20 return rebuild_hflags_common(env, fp_el, mmu_idx, flags); @@ -11122,6 +11126,10 @@ static uint32_t rebuild_hflags_a64(CPUARMState *en= v, int el, int fp_el, =20 sctlr =3D arm_sctlr(env, el); =20 + if (arm_cpu_data_is_big_endian_a64(el, sctlr)) { + flags =3D FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); + } + if (cpu_isar_feature(aa64_pauth, env_archcpu(env))) { /* * In order to save space in flags, we record only whether --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845341; cv=none; d=zoho.com; s=zohoarc; b=LcGc803izfg6Dpwc+7mXBSeKBY+VPhrsfygIJgx4hSWlMZm9CqI9K70BzXDXUvY2EUa4b1Y++W3s20G9gTVFbVHyyeNvbkdTTJwGou3sd2R+o/nVLt4JCbrdbezhWpkntxyiVIEFfPVrsPnaOIbSLjwxaNVfgCtkukX/DIzv5es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845341; h=Content-Type: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=mDaUYtXyoxKyQ6YIW+CzLKUl72EI9Ve9jhEUulKMydM=; b=ImjyUvVXDfTMSNBpAwYOPxODYvu2uY/cEwivW7FE45nepBe3PmD1UuZAWYZzdbfHcHCgTjwlsEmr/JTCrnDvz01n1VtIGDOKQJ/s8svXrouGb1dRXfypz1/PZ2mKVq51cjCsclRa9eAxhc4AEqTEoWwJBKZcrFr5sIH6phRerFY= 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 15718453414111.046600797741803; Wed, 23 Oct 2019 08:42:21 -0700 (PDT) Received: from localhost ([::1]:39716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNImC-00018F-De for importer@patchew.org; Wed, 23 Oct 2019 11:42:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35478) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8y-0008Gr-5j 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-0001GN-Ma for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:47 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:34703) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-000114-FR for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x843.google.com with SMTP id e14so12964116qto.1 for ; 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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:08 -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=mDaUYtXyoxKyQ6YIW+CzLKUl72EI9Ve9jhEUulKMydM=; b=Gg4OUCU0+YuFSqTxloUy7xv2L7XQ97PXUiiSXzc3OEJN69plKDFY10+lNGtEh/JgPh 2gmFn56lZzKeCyS4HAQycasM59zb1a6NxSRcubR8fqEHDm8F7sgbUtucEhIWaWQ1cREK mbgfkVLrGz6CW3a24YoMkuFJlYIBldjwFt9iuI8u5mPONaSl9QLHwN3H3dFwuaUqVrxL nXa2tlQ+h6wh9JrHlGX1dpnvCma4z4lsyr1vr1MpMaBssLlWX512qydTq0QD30cc5X+S qMnzKA+fnXAhu+OX4xs8gxUFzlzOhtevyK4NnhzOE71A2tK4DR9fm2nRQNZMKFja+tSw 3Jag== 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=mDaUYtXyoxKyQ6YIW+CzLKUl72EI9Ve9jhEUulKMydM=; b=gP21xiRv+OmRei96pqjO851HIKDb8TE0MOQ3+3WFqUeGUA7nz20BGyneCuMD98Oy8u XsDD/WzJijAOZmifLqTTlSBTWt1MQeMQtoS5EysaMe9vwubxo/IUWGyq3a/H8jvONh3P ZOSt3C/XRK10dfH2v59kI05r8iBkZmlz1SiZV8hARdY7KbiqOnz+29eKyZfFvw36AD9J EOGaVzoXuBII8/mleibOjHYGY2B57wzESbpqg9bil711/RA3yXDeJSqDv5MTMDQPigN/ me3jMQxCH+DaERMp6hpPkWr/IQFnCzxW8C3b0dvYWPZiTqxdw4o60vgvsN3o3slvoRN/ /zLA== X-Gm-Message-State: APjAAAX4cvKa6d6XZebpmVNPXdD9MlxbIUa07bKYCEAkTraoVq9zGHVD 04MZoHgvk/bsFZwKvz37R3iRULVvQqU= X-Google-Smtp-Source: APXvYqys8wHbq7bxQaP9EGhwpGtkYN0t1ZVGiyLNue4oAW5g+nfQyJ1gU4XubMIS4hLPOAIFyCWOdg== X-Received: by 2002:ad4:51cb:: with SMTP id p11mr5186448qvq.81.1571842869476; Wed, 23 Oct 2019 08:01:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 05/24] target/arm: Split out rebuild_hflags_m32 Date: Wed, 23 Oct 2019 11:00:38 -0400 Message-Id: <20191023150057.25731-6-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 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: 2607:f8b0:4864:20::843 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create a function to compute the values of the TBFLAG_A32 bits that will be cached, and are used by M-profile. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 4c65476d93..d4303420da 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11083,6 +11083,29 @@ static uint32_t rebuild_hflags_common_32(CPUARMSta= te *env, int fp_el, return rebuild_hflags_common(env, fp_el, mmu_idx, flags); } =20 +static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, + ARMMMUIdx mmu_idx) +{ + uint32_t flags =3D 0; + + if (arm_v7m_is_handler_mode(env)) { + flags =3D FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); + } + + /* + * v8M always applies stack limit checks unless CCR.STKOFHFNMIGN + * is suppressing them because the requested execution priority + * is less than 0. + */ + if (arm_feature(env, ARM_FEATURE_V8) && + !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) && + (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) { + flags =3D FIELD_DP32(flags, TBFLAG_A32, STACKCHECK, 1); + } + + return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); +} + static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, ARMMMUIdx mmu_idx) { @@ -11168,7 +11191,13 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, } } else { *pc =3D env->regs[15]; - flags =3D rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); + + if (arm_feature(env, ARM_FEATURE_M)) { + flags =3D rebuild_hflags_m32(env, fp_el, mmu_idx); + } else { + flags =3D rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); + } + flags =3D FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); flags =3D FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len); flags =3D FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_st= ride); @@ -11204,20 +11233,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, } } =20 - if (arm_v7m_is_handler_mode(env)) { - flags =3D FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); - } - - /* v8M always applies stack limit checks unless CCR.STKOFHFNMIGN is - * suppressing them because the requested execution priority is less t= han 0. - */ - if (arm_feature(env, ARM_FEATURE_V8) && - arm_feature(env, ARM_FEATURE_M) && - !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) && - (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) { - flags =3D FIELD_DP32(flags, TBFLAG_A32, STACKCHECK, 1); - } - if (arm_feature(env, ARM_FEATURE_M_SECURITY) && FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) !=3D env->v7m.se= cure) { flags =3D FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1); --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571844922; cv=none; d=zoho.com; s=zohoarc; b=GS0OPw+zZGdz+XsexOtCqFG7EUj16lWUgECbm+NncVDBNqAtUrNPTb3JCgWT8REcmKnDQg556dvf/9drgw+4w1J/dOYQLq+BvuzYXPw6ahXyFNic0vXGLidl/ktmiEeDLtyc8m15yE/h00MFWqJhk7PQW4vZWm39wQZCz1sy/jI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844922; h=Content-Type: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=O5qTDR4/yunqOnDsae4ZjoUIG4TsLVXzaOK/t5hnYkI=; b=e2Qb4He+NZeyMQwyMDJPR9YMI1wFokNNunSoILha0lwmY5DvupxufTc1gnDXxdmEtOcNbI0DEWXXu0JWAmFTKrVTmtRHN+Sf4iyihlo1rgOHC+zm+ku28NqT3i4BOjisCufBvStMXJA6f5kbMb3FHCaJrKO0ttZsJ/ASLdnEDbo= 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 1571844922691367.1721017080765; Wed, 23 Oct 2019 08:35:22 -0700 (PDT) Received: from localhost ([::1]:39586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIfR-0002E7-5m for importer@patchew.org; Wed, 23 Oct 2019 11:35:21 -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) 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) 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-Google-Smtp-Source: APXvYqzHUgUZQfYwl9frKFcArMJajYdoXKPWvPQIv9htqXX0Mw8xMISFB2EJhUYtZm/pUT1XCxsnCQ== X-Received: by 2002:ac8:6c9:: with SMTP id j9mr9311096qth.81.1571842870635; Wed, 23 Oct 2019 08:01:10 -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 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: 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) 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=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.c | 49 +++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 26 deletions(-) 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, =20 if (arm_feature(env, ARM_FEATURE_M)) { flags =3D 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) + !=3D env->v7m.secure) { + flags =3D 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 befo= re + * executing any FP insn. + */ + flags =3D FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED= , 1); + } + + bool is_secure =3D env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MAS= K; + if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) { + flags =3D FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); + } } else { flags =3D 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, } } =20 - if (arm_feature(env, ARM_FEATURE_M_SECURITY) && - FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) !=3D env->v7m.se= cure) { - flags =3D 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 =3D FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED, 1); - } - - if (arm_feature(env, ARM_FEATURE_M)) { - bool is_secure =3D env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; - - if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) { - flags =3D FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); - } - } - if (!arm_feature(env, ARM_FEATURE_M)) { int target_el =3D arm_debug_target_el(env); =20 --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571843344; cv=none; d=zoho.com; s=zohoarc; b=DNsGXOlv+A5xRy745crxaM/lIwP/H2/rQiMkeASMzg+JRx8Y6wtG2V1DNTNUV3rnz2wng4xAxeWBJxtBxS+/CyukrIuzxR+1OWmV95Zu+pCRAHg3sLV18KFw5jW+C1mRUV7FKR6/6MT8Sm/9svFIKN878z8TGYVan3eKeCZnoJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571843344; h=Content-Type: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=IBA+abtZ26hlRDDlZ8eTB3Pn4yNYwZChmFB+u2JQGOM=; b=iwVyg19KHtX6sjt5O/qAHOIAk3X7B0z6xu+787lsjTIB/DXMehGfiQXJ3N5zwlUaR6RNoQhK0C3E9uSLPav7/WiW/oDAl34FG7vHX8FJNKtrOaw21C9XcbdKKESQDVdFKaz5NA/zzG6B80hPCFe1vPEknNFYMLEX83RW8ZJA/rQ= 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 1571843344638526.7229979037658; Wed, 23 Oct 2019 08:09:04 -0700 (PDT) Received: from localhost ([::1]:39024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIFv-0004yc-Bn for importer@patchew.org; Wed, 23 Oct 2019 11:08:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35095) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8r-000861-T6 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8q-0001Dg-MX for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:37773) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8o-00013Z-L2 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:40 -0400 Received: by mail-qt1-x843.google.com with SMTP id g50so18582133qtb.4 for ; Wed, 23 Oct 2019 08:01:12 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:11 -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=IBA+abtZ26hlRDDlZ8eTB3Pn4yNYwZChmFB+u2JQGOM=; b=Kl7dFo28PEXr9icb+mFQdKLB4ia3YW7xNtm5+36Axi5JLbMVMjmEJg+o1rLT7O6hFY Njdd1uj18qTWYtm1tKivlXWozJ0IXiXkjEMBjxjH1Xtqcy78egANpG+uFQbfRcZOwDj0 FVcZcImevfyeqhw6Xii0bm3EbKKIVsuiQ5xidiZxYuFShVTIpllo8EOt/iqv9JiKt2eb WPe8B12kbWYO8FX4R67m6AdhgjfSeB2Ia0IyFw4pgky5hh7WXRlLZGZNQTU4Ib3rH9ka hjw2vkFPUXNyDR1/FBkytveJpl2WqoS2zJUzfWkrFDoVRFw+xsmiuz3xMdtAv+Z/ZY/+ 2YXA== 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=IBA+abtZ26hlRDDlZ8eTB3Pn4yNYwZChmFB+u2JQGOM=; b=L42PabNQYuvb39SSpTAAOyURxuS6tzclsG/BVRQw4vJM7NJJPOwcV3BS47XE8Vw9yG IJyfsE4aJUDwJvFAWedqVtpPK234nomQ2EhRsU+6o6kJx09keUONxqQ0oOvKaa1bSeRf DobIfi1EBrgRywsaFqhFysb5sWBIAhmxato5JK24iIXuZDezuhK/CQKlVuk5fv0AuiJq cJU+AWX5Xishg+slX0z/v4j5nc5/oCrGWhHEIXXRKN6ScZAvY4szPGSaQbgHttfnOv3n p0tme1TBPIhOfop5RdeRCAshk0mIg+XxoG1x2hZqVQvxJqOLMa8vPNoaCehP34AmOy04 5O5A== X-Gm-Message-State: APjAAAVWPYdKqzrUO4+ZHJiAfTRm5LD+d/He/XgfbNdUCKvY+c+ctr6w E5+I/w9/P2Ahs2JBfWVPmbihuuhKnxE= X-Google-Smtp-Source: APXvYqy3W63RxWhSSR5seFaLZo0aDIGTzsWVncaCydtEqw8o04kC8LCJtNLOZTHhGvLZzwcdsoQHFA== X-Received: by 2002:ac8:3597:: with SMTP id k23mr3420879qtb.195.1571842871709; Wed, 23 Oct 2019 08:01:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 07/24] target/arm: Split out rebuild_hflags_a32 Date: Wed, 23 Oct 2019 11:00:40 -0400 Message-Id: <20191023150057.25731-8-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 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: 2607:f8b0:4864:20::843 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Currently a trivial wrapper for rebuild_hflags_common_32. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 296a4b2232..d1cd54cc93 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11106,6 +11106,12 @@ static uint32_t rebuild_hflags_m32(CPUARMState *en= v, int fp_el, return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); } =20 +static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el, + ARMMMUIdx mmu_idx) +{ + return rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); +} + static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, ARMMMUIdx mmu_idx) { @@ -11218,7 +11224,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, flags =3D FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); } } else { - flags =3D rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); + flags =3D rebuild_hflags_a32(env, fp_el, mmu_idx); } =20 flags =3D FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571843875; cv=none; d=zoho.com; s=zohoarc; b=USN7Zn9c+HNqaEyl3w+P7xw3xRXUe2djXLTmV6UPrl9E4E3jxwWBjENP1RW0/zE0ot22pZlLcDwe+B2jFxXR+BQjl/di6zYeu1+q+KdSMa3DGSStHyJbp5Msc7u8UPXw+4+J/y1fwXq+Yq6BtUE6dHX6x7e1WMJ+BBdLZzxs68I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571843875; h=Content-Type: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=EExBny+oAa/2RvpDTj0xViQxKJSM6o83jutlTagIpwU=; b=PSZjXmJliz78ZLZQFBxYuj6+T45Hk+3goeIeFM+d4LcpowTYR6+9X+1/GMeTMj0zqV/26w+mLl7FDiKHw0JhatIQEzBfyseN2v7K+qsVspWzaCOolvvFb65QIVBBkJpHC5ADXHdi6BsYir6SV0s43LreXQauebbejcwBI4/ZI5E= 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 1571843875264912.7333677544785; Wed, 23 Oct 2019 08:17:55 -0700 (PDT) Received: from localhost ([::1]:39274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIOY-0004FZ-0r for importer@patchew.org; Wed, 23 Oct 2019 11:17:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35239) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-000898-1U for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001F0-8x for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:43 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:42084) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-000148-0t for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x844.google.com with SMTP id w14so32711138qto.9 for ; Wed, 23 Oct 2019 08:01:14 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); 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=EExBny+oAa/2RvpDTj0xViQxKJSM6o83jutlTagIpwU=; b=BHgiuslLxkJnigYSTvXdCp93fuQwDMVJ7gYL9ag7+xEwTumXP37XSSYwnGjBFlatKB at+nvPaGK6BBWW50B/yicOwTFh6ZCIHwJzCDhbFjGMI6U8DX2ZRiS/h/AiZ39Mrj7oPq rPfHVnBiFF9R2M4p46YflPHFUlrE7LncC8MEh6evKEAJh6MNwby61IFzaIF7Ys51Xns5 VtGHmRU5em1h6YINFvzoWWHPqWanK43+p1cibz0M0/sbN2meUWUMEzslx4RsQWbX4Dqd v5ycHBiJ7VE6aN8Zf1o9it3QwYsk1c3k24obdHUWupmlvov/9ux1gjO5+QtwF3ksf8wK /4+g== 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=EExBny+oAa/2RvpDTj0xViQxKJSM6o83jutlTagIpwU=; b=bROpsUkW/yBsdP1NKFbBNi6yU1DeZhYvxWJ++1eF2hjfjmWhWSYX4XcPtogItQN8/L 0gHsuFL4F6QM94YCWUejXS+gUU+xApf98Gu+SffFbQd18zwlW9ccZ9nh1YZr1Spu78rJ QCfUUHvVGApo8wQA/boycpt1wHRi92Fynx+dMJQEOY0vcy6ni3x+Lu8phFC7N/7hYtLA +j3IYyfTRPFlGni8nxdRaL8hLBfQXKMeTv/6Rld/kMVh76lm9JzKB36lhxPqDWmikSrE MDYT+sHky+XVOKBu0q0ZyWJhl/+dEiE2HDmB3nhrmGYE82547wjuGtvTXvE61JoaA3d1 0pbQ== X-Gm-Message-State: APjAAAUVGdsRA7ZrFLPkUNLSrUeEF/q+vJ/vf6WWGb4nCd9dmCp9oC1Z APXhURzQEAhf6/eDYzVRI+w7XPk9E/g= X-Google-Smtp-Source: APXvYqysAqnIEIVoLcGcmM9AA6zb40vpUTcNOAaxXWd3N9zEQETvfzVtMfnR3XLKMZy8Qk/Wjr/jzw== X-Received: by 2002:ad4:504c:: with SMTP id m12mr7250814qvq.52.1571842873178; Wed, 23 Oct 2019 08:01:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 08/24] target/arm: Split out rebuild_hflags_aprofile Date: Wed, 23 Oct 2019 11:00:41 -0400 Message-Id: <20191023150057.25731-9-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 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: 2607:f8b0:4864:20::844 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Create a function to compute the values of the TBFLAG_ANY bits that will be cached, and are used by A-profile. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index d1cd54cc93..ddd21edfcf 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11106,18 +11106,28 @@ static uint32_t rebuild_hflags_m32(CPUARMState *e= nv, int fp_el, return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); } =20 +static uint32_t rebuild_hflags_aprofile(CPUARMState *env) +{ + int flags =3D 0; + + flags =3D FIELD_DP32(flags, TBFLAG_ANY, DEBUG_TARGET_EL, + arm_debug_target_el(env)); + return flags; +} + static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el, ARMMMUIdx mmu_idx) { - return rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); + uint32_t flags =3D rebuild_hflags_aprofile(env); + return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); } =20 static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, ARMMMUIdx mmu_idx) { + uint32_t flags =3D rebuild_hflags_aprofile(env); ARMMMUIdx stage1 =3D stage_1_mmu_idx(mmu_idx); ARMVAParameters p0 =3D aa64_va_parameters_both(env, 0, stage1); - uint32_t flags =3D 0; uint64_t sctlr; int tbii, tbid; =20 @@ -11262,12 +11272,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, } } =20 - if (!arm_feature(env, ARM_FEATURE_M)) { - int target_el =3D arm_debug_target_el(env); - - flags =3D FIELD_DP32(flags, TBFLAG_ANY, DEBUG_TARGET_EL, target_el= ); - } - *pflags =3D flags; *cs_base =3D 0; } --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571844161; cv=none; d=zoho.com; s=zohoarc; b=ACq6LqW/2fzB6FHpr3BIcusEr9EvoPkcJQMDtjotQR4trxbcddwqvjrTRQvSu08rJ/0/oc0twxxCyj3FQ4yh6WcxYoZ/1oBWQRUFg9+E7vDBBw8tDXjYZ6D6Hh4Cg9QcsyGnxgWxlGBNY7ERQG3iWokR2B3qPX1Y8WgXDf94mYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844161; h=Content-Type: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=+w+DpqTaqyThsFD3h0g6qTaqlae+kRMVgywC4mwAkDA=; b=H+SmI28G05r2BlZamAfzC9RVRV4RGGPDMxzlKMv2bUOSjYEjjlUON71lVzChh7UgISfRScI+G99lR58kh2z566WYKuSzpNHZadCBfaSVfzrGbNyiZx1EgcPC54Dcc76YwjU9reYgNfBMKkFI96VBLjXebYFKwVaKtArypbX2CLk= 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 157184416150848.45962417032786; Wed, 23 Oct 2019 08:22:41 -0700 (PDT) Received: from localhost ([::1]:39354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIT9-00089M-W1 for importer@patchew.org; Wed, 23 Oct 2019 11:22:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35238) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-000897-15 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001FO-BG for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:43 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:44401) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-00014g-3T for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x842.google.com with SMTP id z22so12215931qtq.11 for ; Wed, 23 Oct 2019 08:01:16 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:13 -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=+w+DpqTaqyThsFD3h0g6qTaqlae+kRMVgywC4mwAkDA=; b=tnqnVCH/71/mrfaS0bcMDWr06WHHWLbRbkKUHXp/nAueUslzhqQ0NwfEE0F1M56+kq gYX1meHPZKyM23Qo/XT0jI+I14W7cfHxL7sK6cIkR8vY/fMIy+1xQicWP+AG+UwgValm NrbTS6WOHNZZIiBykpTj3IN1bb7m14dy9k1nMaX9mw8uBNIDEywxHS8JQw5CTeliZ+2d Etl6kQdEGr935xJIkYvaM4GZiDQX4m1rB/bZWEE/kH2Ws0fI31oXsdQOM1sSFiybAiW3 vhOSQ5424NdLolQlmBlVUfTtMDTLwZQ3uuZJ8To8BlchaBkcyxJvlF0+UKI5qqoze6HK +MsQ== 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=+w+DpqTaqyThsFD3h0g6qTaqlae+kRMVgywC4mwAkDA=; b=lqhExIn/7FhCuAOrqRfUOv6CbE8hUHSGws+u5AZcgazv6mtR/UND6nH0yp8iGMoxeC j4ocCnCgUzqTEFucf5BtYOX2P8Ic9fs1VLfxNurllnCKh4ySHsP40VonR0in5wiUNF4j cBvCYbrUl/zF8gKQcrNa2gFKFYpKPqK9kCDN/6Oc7Liylz/vCTmNtwCvRXgrz5nPfe1y 9oVkJ1sPM9YLeXJyNYAycffrZF1iXDDkpRUq50TTn5QEu6y2BDpeieACamZlA9BV5u1R OuvmDnjnqUF4jxcNM2cAPF15zb5RhLULdNOOBVZm/fYzU1j7Zk0tWU+7hyd+e96/glC4 tlNA== X-Gm-Message-State: APjAAAUDyJqyHv1d9x1aIm7kMGxKc1YDF+F3xyMPmWJs6wj7no317pfm pQHwnOV3iA0IzBe7qpIIVn2c+EqU+6E= X-Google-Smtp-Source: APXvYqymAu2qq90HIwOCAccVR1AIkmMJs2/5U2AtYyn3ZAxtMUjB1fvD0dPKPKJlWgjeaXxopss7RQ== X-Received: by 2002:ac8:664b:: with SMTP id j11mr9706105qtp.137.1571842874422; Wed, 23 Oct 2019 08:01:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 09/24] target/arm: Hoist XSCALE_CPAR, VECLEN, VECSTRIDE in cpu_get_tb_cpu_state Date: Wed, 23 Oct 2019 11:00:42 -0400 Message-Id: <20191023150057.25731-10-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 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: 2607:f8b0:4864:20::842 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) We do not need to compute any of these values for M-profile. Further, XSCALE_CPAR overlaps VECSTRIDE so obviously the two sets must be mutually exclusive. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index ddd21edfcf..e2a62cf19a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11235,21 +11235,28 @@ void cpu_get_tb_cpu_state(CPUARMState *env, targe= t_ulong *pc, } } else { flags =3D rebuild_hflags_a32(env, fp_el, mmu_idx); + + /* + * Note that XSCALE_CPAR shares bits with VECSTRIDE. + * Note that VECLEN+VECSTRIDE are RES0 for M-profile. + */ + if (arm_feature(env, ARM_FEATURE_XSCALE)) { + flags =3D FIELD_DP32(flags, TBFLAG_A32, + XSCALE_CPAR, env->cp15.c15_cpar); + } else { + flags =3D FIELD_DP32(flags, TBFLAG_A32, VECLEN, + env->vfp.vec_len); + flags =3D FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, + env->vfp.vec_stride); + } } =20 flags =3D FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); - flags =3D FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len); - flags =3D FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_st= ride); flags =3D FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bi= ts); if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { flags =3D FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); } - /* Note that XSCALE_CPAR shares bits with VECSTRIDE */ - if (arm_feature(env, ARM_FEATURE_XSCALE)) { - flags =3D FIELD_DP32(flags, TBFLAG_A32, - XSCALE_CPAR, env->cp15.c15_cpar); - } } =20 /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571844401; cv=none; d=zoho.com; s=zohoarc; b=VHltE3Ke7NLZMPrG/gX2oif4cs1ZdFbOliqpB7eQfhW20xOxq8o/R9IUnRq//IW5tr3gG37QhyB6B/XwGw/9rhvgMEB2HrslNaIYa6lOvxPeOYnF55gn8bxRnoAi0bToHRt0Gh0sdRpTW3E9BjVZofsSWGqvw6f0BxPxZXqlW+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844401; h=Content-Type: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=v4LDoKiCDj8UEOXKdxGeWLogI6gqriKirwE9ruJcfe0=; b=fO+TW1GOqdcwsFTNCZEhe9dmfShNKPxx0p4cZjbv1Pvl5+S9DA+eThiY7yjOfbOPjz9Q7c7qu4+lEqKy1tCQvjmbgi5Ebs+RPL3DBCLiFTZ6kZzVhbekjAoo0YaMoHB1/K9SaXOBb8SiFbKT+2q3UtwZdXuQHx3lwzFmAStQw3I= 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 1571844401199428.84738742711284; Wed, 23 Oct 2019 08:26:41 -0700 (PDT) Received: from localhost ([::1]:39434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIX1-0003oT-FI for importer@patchew.org; Wed, 23 Oct 2019 11:26:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35253) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-00089O-BZ for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001GF-L7 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:44 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:44402) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-00014z-Ei for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x843.google.com with SMTP id z22so12216025qtq.11 for ; Wed, 23 Oct 2019 08:01:17 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:14 -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=v4LDoKiCDj8UEOXKdxGeWLogI6gqriKirwE9ruJcfe0=; b=pch7YEBHcbkJ3G36TFQnhM/UL9PaTpFqbBNyr18NhZ9em5c89l9FC5BbzzErrpaL/x twr46E3i15KySqyHLzMRFVaf6iSlYbZLJ9nQGULn7jQLP9uhiHoXmTaMdJpVToNd3H0t 7g9+sFi1vDVcLv2tt5hXDcvxhseEyrhak1iX4WM2dCgplwaXNbbyX9mRCtUrXSpNYhu2 Zh88iWomFGJ1/tmNGyrPVtR0Zvev3oZ8Fixu30Ix2NT9+YpVEUbywr8pvHw6FMw1eIqj MthYRGE7obg14+ryc61LsweJsqQftGUGpTXL+eLzKXmsI5QVFM3ze5lrtEKfOxqos5Ue nKbA== 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=v4LDoKiCDj8UEOXKdxGeWLogI6gqriKirwE9ruJcfe0=; b=bE6Uc/r2NfAAHLprWiTwUUv59eCB03p0JJ68UpvYcrDjVQYAK3EJBGflHQvjJtU3co D/pUoCcZLnIHk/PGQwOgkpYQzK+rhQGKU5Ep1JW4Fnfz561oLKZymACla0dMlVetJqJ4 +SkB+OW1ACfub1PpphkML2sO9ccV3DudIt7OCurKREOgq8eY9zEm0jDDTuAnvFMz4Ygt TCymwF3twJKQWY8toKidjU5TzLiTl3X8xvoZyP9Q4tgSsrtf0Gwm+O0HiXLPvCpXqOph JluiuWhGeTiQwpnCvGZBh18XHIAjd3linAXiK79az0Cglt1uly+Tyt7DkiFYoXzznvdH z7xg== X-Gm-Message-State: APjAAAUjIPJ9sIyuRfBJBWWf5/va5QQ5AwhGhkvzdwzz3oL5yGj53bXZ lQME0nh65oAhSF5hDEZw9bj9nrevE84= X-Google-Smtp-Source: APXvYqyv43VECs+qbnv5dWIVHpSWTEq8mz9IMJ5YfNvFzDAW2mdU/4weO2ygnUZX5sn0ktVM6Jhm0w== X-Received: by 2002:ac8:542:: with SMTP id c2mr9880986qth.338.1571842875633; Wed, 23 Oct 2019 08:01:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 10/24] target/arm: Simplify set of PSTATE_SS in cpu_get_tb_cpu_state Date: Wed, 23 Oct 2019 11:00:43 -0400 Message-Id: <20191023150057.25731-11-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 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: 2607:f8b0:4864:20::843 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Hoist the variable load for PSTATE into the existing test vs is_a64. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index e2a62cf19a..398e5f5d6d 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11197,7 +11197,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, ARMMMUIdx mmu_idx =3D arm_mmu_idx(env); int current_el =3D arm_current_el(env); int fp_el =3D fp_exception_el(env, current_el); - uint32_t flags; + uint32_t flags, pstate_for_ss; =20 if (is_a64(env)) { *pc =3D env->pc; @@ -11205,6 +11205,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { flags =3D FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); } + pstate_for_ss =3D env->pstate; } else { *pc =3D env->regs[15]; =20 @@ -11257,9 +11258,11 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { flags =3D FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); } + pstate_for_ss =3D env->uncached_cpsr; } =20 - /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine + /* + * The SS_ACTIVE and PSTATE_SS bits correspond to the state machine * states defined in the ARM ARM for software singlestep: * SS_ACTIVE PSTATE.SS State * 0 x Inactive (the TB flag for SS is always 0) @@ -11267,16 +11270,9 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, * 1 1 Active-not-pending * SS_ACTIVE is set in hflags; PSTATE_SS is computed every TB. */ - if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE)) { - if (is_a64(env)) { - if (env->pstate & PSTATE_SS) { - flags =3D FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1); - } - } else { - if (env->uncached_cpsr & PSTATE_SS) { - flags =3D FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1); - } - } + if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE) && + (pstate_for_ss & PSTATE_SS)) { + flags =3D FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1); } =20 *pflags =3D flags; --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571844113; cv=none; d=zoho.com; s=zohoarc; b=aVlp2CrFbeW6O46rjRqT2ugALdWOztralbRvJQ0b/lmbZqOQoQFEpfS7CbNBOd3ExgANgD2mWsSaumZBdCM42vt6h30FLOKD/fxttNBvUCEfQOLTqafemRhXotyDobYnHVQMhOo0sKQD+0KgJdB9C5MwhLEO+SATMz3utIr2HXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844113; h=Content-Type: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=HNW+DKXClNFoWE5mAVnYOdmYoSifNB4F8oskeNBuM9U=; b=dTUMjLpMntJ1oYMZHkneLWpczg+K5IocnIqBHGHXbtrlbD6HabCNQ3mU28ph0xaNgb594GKPCDZIAP4kQoMkfTKGElbXVvklN22CIntZaTMjHZIjH1asi8lsJ5oN+tiAjgRIvNh5UQd9STVyUq+kYM+rPWN0ddH+ajsG5g9pXlI= 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 1571844113449295.1140673342827; Wed, 23 Oct 2019 08:21:53 -0700 (PDT) Received: from localhost ([::1]:39346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNISN-0007Ih-Sq for importer@patchew.org; Wed, 23 Oct 2019 11:21:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35131) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8s-00086d-8t for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8q-0001Dw-OT for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:42 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:36365) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8o-00015R-LL for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:40 -0400 Received: by mail-qt1-x841.google.com with SMTP id d17so18125848qto.3 for ; Wed, 23 Oct 2019 08:01:19 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:16 -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=HNW+DKXClNFoWE5mAVnYOdmYoSifNB4F8oskeNBuM9U=; b=NPGPOm9CWTUgQoSl2rMq7xjPhiZsh6cQc40fR2j5H7rxtL7wRftv8sHsrtaFz/L4ud O7VsXruMvHv7l1EDcgNnSbfeRjQtWjMEWVjSci5FMi46J23lCeQ4+7tMn86/whdBwQH2 PmVf+ESWvCXI7XYCVyQkKArDAZ5QtJax4fm85wR8Lp0oY55H/lg2tk8EjPbVSrhRhpFI s9GQVP5pIDvm3c649EnPx95dcYbf+UC5MbP63l4xEQsy6ykGJLs7UK7g7mv2pUy5eSsy oTwDw7rGfxL+8QZ+MnWPuD9mOBmeIf+uJ5RGYg5UH6/YHmgXhu/1rTa8AtEXslUQkqBa Oi4g== 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=HNW+DKXClNFoWE5mAVnYOdmYoSifNB4F8oskeNBuM9U=; b=I0sSA721Jo7rab87rtP+TAGMjSCnDCxuez9ZGwtIEKTbK5nVFZPyKVyh6ohxmVjX8p Tsb2o3SFhEYUaQXTNtTaCfqEY20N1mTRzRomFrj/datXMChL2oF5qdoJKl7N4D6O16nN nV+N2ZSM3aG3qEzasyqIEFf6Q4PLOKfTzI2eg8zIfJWhFDv8R9R1qNWcC0Drmf/Th8cu 1NLXeluOQ12o0ttjiFx6acVUTbOIyCR/iODYGC3ojz1VYI0HSC9TojLtNHGjSBNZNC68 ddlNTx9qDkxy/kbmK60/4v2dr8QmboMFC4sEVabE93stRpib0dpBTfzD2lXfDg38SanX xK1Q== X-Gm-Message-State: APjAAAWQyyu///pIfNyB2SrRw9H4r85Z7VDnTBevT02R/MzfbmW8JDto 6ceAfySGic5jgyemRdYMSdIBwhxbgbY= X-Google-Smtp-Source: APXvYqy4GnStcvi0+33cwPp6vVatT5Zcn86HuxcTb0Vzx4okZ8RAXkMBtzUWuciLmn/3aV2G6TLDxw== X-Received: by 2002:aed:3f21:: with SMTP id p30mr10025551qtf.236.1571842877297; Wed, 23 Oct 2019 08:01:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 11/24] target/arm: Hoist computation of TBFLAG_A32.VFPEN Date: Wed, 23 Oct 2019 11:00:44 -0400 Message-Id: <20191023150057.25731-12-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 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: 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) There are 3 conditions that each enable this flag. M-profile always enables; A-profile with EL1 as AA64 always enables. Both of these conditions can easily be cached. The final condition relies on the FPEXC register which we are not prepared to cache. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/cpu.h | 2 +- target/arm/helper.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 4d961474ce..9909ff89d4 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3192,7 +3192,7 @@ FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2) * the same thing as the current security state of the processor! */ FIELD(TBFLAG_A32, NS, 6, 1) -FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Not cached. */ +FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Partially cached, minus FPEXC. = */ FIELD(TBFLAG_A32, CONDEXEC, 8, 8) /* Not cached. */ FIELD(TBFLAG_A32, SCTLR_B, 16, 1) /* For M profile only, set if FPCCR.LSPACT is set */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 398e5f5d6d..89aa6fd933 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11088,6 +11088,9 @@ static uint32_t rebuild_hflags_m32(CPUARMState *env= , int fp_el, { uint32_t flags =3D 0; =20 + /* v8M always enables the fpu. */ + flags =3D FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); + if (arm_v7m_is_handler_mode(env)) { flags =3D FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); } @@ -11119,6 +11122,10 @@ static uint32_t rebuild_hflags_a32(CPUARMState *en= v, int fp_el, ARMMMUIdx mmu_idx) { uint32_t flags =3D rebuild_hflags_aprofile(env); + + if (arm_el_is_aa64(env, 1)) { + flags =3D FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); + } return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); } =20 @@ -11250,14 +11257,13 @@ void cpu_get_tb_cpu_state(CPUARMState *env, targe= t_ulong *pc, flags =3D FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_stride); } + if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30)) { + flags =3D FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); + } } =20 flags =3D FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); flags =3D FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bi= ts); - if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) - || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { - flags =3D FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); - } pstate_for_ss =3D env->uncached_cpsr; } =20 --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571843698; cv=none; d=zoho.com; s=zohoarc; b=ZuwfEheB4h+e7SpSw+rUD2t1umH6BtQ82UfQlkRGJONBzl386SGZZqrZV3kyjhfL74JuCMnREPIoUClPsLd0xwqR45QJAFyBrMWeuPnWtAB8ZStPlEeU4QRzi3o8234Tybb3FqfTvaJ66FAI/r7MJsxAuYD7izCQrrurxrUAE7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571843698; h=Content-Type: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=PtanC1h+OlQIbLy4htGIe38tBGV1DOrNspWjSEGlJl4=; b=inbrn6VxWFRIoaVNNm9J8fZQff2yeLW2YuzpXdjH8uRJvUrXRgWhU0wIKkW3tXcntCLrBDHucMrF2WWeGH2sFcEMcO6xC94Shx4X7IvknVXPPC3sAtvcbT9TJdAtrutnSnr7IPrpnp05mMkc4sGlTqVgqCAGApdBIbNoLy3y2/0= 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 1571843698465491.9751738510172; Wed, 23 Oct 2019 08:14:58 -0700 (PDT) Received: from localhost ([::1]:39242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNILh-0002IB-1q for importer@patchew.org; Wed, 23 Oct 2019 11:14:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35224) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8t-00088p-PP for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001Eg-74 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:43 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:37776) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8q-00016v-Uz for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x844.google.com with SMTP id g50so18582856qtb.4 for ; Wed, 23 Oct 2019 08:01:20 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:17 -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=PtanC1h+OlQIbLy4htGIe38tBGV1DOrNspWjSEGlJl4=; b=gT/PMVO8fSLBK5v5I57cupb/YDFLU7LxWI80c3PtF3u5wlTT+TCVchjkQFyaZn1DGE Y2nM8RAf1Jd0AmRXzNEPMA+HAXGuWCcCl83DNRiwM7eBMCGgc2kuCcyM7gXWSRbiLHBy tu9+HqS6PH0QosydLNCCBgA6uhK+P77pOKMyo95P/ioyGUuNKuxanpl8lks+XoyjvnTe QzBTJOoBiQ/L4AEj2vNZeaPAhnxfmWA7vhGVqYh+VSdb/9aAcq1yUEr+wiS3uZYHwJk+ ta0RsfU23frI7derHLkzkrqei4scRqtiwZrUYuLQhwvqKI1hUwfPhHhEFfXEC9s41X0c JhLA== 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=PtanC1h+OlQIbLy4htGIe38tBGV1DOrNspWjSEGlJl4=; b=fNPAUJ2tnO5X/9stS9WFmdsUV/XkVuMnojoSnLuPesLqdVSykBTwCgmU5hlLOxhPec HdblQL6iS2LMdVB+khA9k/iX0tpRsGFtdgDL/E0aedeaeQlDVXoxu/iHAec4TYsLxJAA NH0Q72Hixm74jsyA7oRjQ/22qLVEq0R3rTr3+xGAxYoaL101YL5KfozJGrrBgnBSDWSR XpMr8SqMBeo/rYDVbL70y/990VzEcPsSAZnFRh/+xWSz2N+5vn+pZbtNshkAXF831NdJ hkhKbvlE6wB8XKrat59GMMgQCYbALWduGykvVt9pS5JuSTdesesC3QOfqdDtYdIXRUnR 3oJQ== X-Gm-Message-State: APjAAAWs66Yz30PUcVZAFIABz7Txp7XbQ6ROoxFfFQHV7i7xw25oNxy+ KniokbnPr6vKwBVsBK2UMBYhUurULt8= X-Google-Smtp-Source: APXvYqyU5QXl0zNSRXGLx3rw4IsoLGYtP12oNai/csEGXQepE0EVwAyKaSpY+CMTeEmHC7hjCrLw8g== X-Received: by 2002:ac8:5547:: with SMTP id o7mr8502758qtr.315.1571842878494; Wed, 23 Oct 2019 08:01:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 12/24] target/arm: Add arm_rebuild_hflags Date: Wed, 23 Oct 2019 11:00:45 -0400 Message-Id: <20191023150057.25731-13-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 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: 2607:f8b0:4864:20::844 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) This function assumes nothing about the current state of the cpu, and writes the computed value to env->hflags. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/cpu.h | 6 ++++++ target/arm/helper.c | 30 ++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 9909ff89d4..d844ea21d8 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3297,6 +3297,12 @@ void arm_register_pre_el_change_hook(ARMCPU *cpu, AR= MELChangeHookFn *hook, void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, void *opaque); =20 +/** + * arm_rebuild_hflags: + * Rebuild the cached TBFLAGS for arbitrary changed processor state. + */ +void arm_rebuild_hflags(CPUARMState *env); + /** * aa32_vfp_dreg: * Return a pointer to the Dn register within env in 32-bit mode. diff --git a/target/arm/helper.c b/target/arm/helper.c index 89aa6fd933..85de96d071 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11198,17 +11198,35 @@ static uint32_t rebuild_hflags_a64(CPUARMState *e= nv, int el, int fp_el, return rebuild_hflags_common(env, fp_el, mmu_idx, flags); } =20 +static uint32_t rebuild_hflags_internal(CPUARMState *env) +{ + int el =3D arm_current_el(env); + int fp_el =3D fp_exception_el(env, el); + ARMMMUIdx mmu_idx =3D arm_mmu_idx(env); + + if (is_a64(env)) { + return rebuild_hflags_a64(env, el, fp_el, mmu_idx); + } else if (arm_feature(env, ARM_FEATURE_M)) { + return rebuild_hflags_m32(env, fp_el, mmu_idx); + } else { + return rebuild_hflags_a32(env, fp_el, mmu_idx); + } +} + +void arm_rebuild_hflags(CPUARMState *env) +{ + env->hflags =3D rebuild_hflags_internal(env); +} + void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { - ARMMMUIdx mmu_idx =3D arm_mmu_idx(env); - int current_el =3D arm_current_el(env); - int fp_el =3D fp_exception_el(env, current_el); uint32_t flags, pstate_for_ss; =20 + flags =3D rebuild_hflags_internal(env); + if (is_a64(env)) { *pc =3D env->pc; - flags =3D rebuild_hflags_a64(env, current_el, fp_el, mmu_idx); if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { flags =3D FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); } @@ -11217,8 +11235,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, *pc =3D env->regs[15]; =20 if (arm_feature(env, ARM_FEATURE_M)) { - flags =3D 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) !=3D env->v7m.secure) { @@ -11242,8 +11258,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, flags =3D FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); } } else { - flags =3D rebuild_hflags_a32(env, fp_el, mmu_idx); - /* * Note that XSCALE_CPAR shares bits with VECSTRIDE. * Note that VECLEN+VECSTRIDE are RES0 for M-profile. --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845965; cv=none; d=zoho.com; s=zohoarc; b=mEfpYlAtZA8AJZLwUm/cwQzIVo/RDtkCo58jZ1vglH9yR9a0rm2qABwfeREy95kg4lC0mnFrlrSlXeLzndWNrLw2XYi9s09YeFs5aNktXiCD/0J9eCb17JL2xo34p699OxF5fg6uH0Y3+EwdsPmjLLj3FBvhmaW42hFB4hdsYzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845965; h=Content-Type: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=xWBixVJrplgoFEDYWsC1KvhyFbMO/zEb6ezvCN+GZN0=; b=IH9Cpz4yYy5sKW3zAfUN52SA7HRuvdDO5aYiw+wsGm0JPi6aNyHcxEJ5+c8Um2CUMSKwPZMFRcXVqOhJLEsvlKeNv4T/73Vk/zK9V1w6ctjVOXM+8FiMHbrQyRkYbDUMfLcRrNVsZMbvmEnHXyCRknmX0JToIUgRlMY3uHJAoLY= 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 1571845965337414.9047448380903; Wed, 23 Oct 2019 08:52:45 -0700 (PDT) Received: from localhost ([::1]:40134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIwF-0001jk-Hd for importer@patchew.org; Wed, 23 Oct 2019 11:52:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35252) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-00089K-B9 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001G4-HJ for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:44 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:39959) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-00017X-By for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qk1-x743.google.com with SMTP id y81so16142557qkb.7 for ; Wed, 23 Oct 2019 08:01:21 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:18 -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=xWBixVJrplgoFEDYWsC1KvhyFbMO/zEb6ezvCN+GZN0=; b=ubohb+G+UrTjpIMomWpQ9Sa5nmzNxu1vYatVTsSKyMH1bdJ+VsGOuRhAFBp6IwZJuH MGcS9tTAerLZT8AXkq0eDQ+cm93ffExLqa3t/2PhgOJQ2kI24JigrTOR857+4+ZfRajZ MovB3vZMhCgfN2nk2Xg9nysn5DGTXolLJsDrj9HzSq5gYnKMlDLHi1W1KKD/ZeMPhgu8 X7gDQJwrWFSzHAO9OMDLwmhsqyt6ygUOyZZCryl+weZ2+HRggRCZmVO9ciuy+3zklBjz xTHVgP4zTsHL64ppddC/34xbQhqgXJsWBA0NuKw4RqNsCnoQNOslD0/qbALeQf/Vyz/Z 8aRA== 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=xWBixVJrplgoFEDYWsC1KvhyFbMO/zEb6ezvCN+GZN0=; b=H1dhMT5dOMZZarAiPrYvaMZPDnwQ3B9XyL3juZHPKAZTXpKT1yEdbLlB01t2LuNEGf QFSShnC5QAgMtda2fwu/fdzdcfM5Uk6JDsozEheiLW9kiILtvBoHxuUNWGrDXUMNLA8V zZSYG5h3vip2mMrgfYTkRReGHR7lDB0NxRzsnkW8bT37FevzciWmdQWya5azHq4lDdbV l0FZeDqGePIGOTEGz8BV5YE28gLrQsROCNYEW/rBB6VRXM7JOHmp7Og7naSAmZkq7ykK lYVPE0GQwoQo6roCsUy6Re+rV+eHpUuxPcKVWBmWcJd63cZQ8vmZJ2ho3++LfaCFkWI0 JS5A== X-Gm-Message-State: APjAAAXgtwOrJ01aBfAk9Tup3IOgJ35Hov5ro9AqzWqHU0qV016JdBGD otE4BpJ3v6N/J5OYS7Nr5YoJk5hXCmk= X-Google-Smtp-Source: APXvYqzRUxaU7Dkk3J9CLeppMSsAAH/S/MQuusshm+MzSO4XiYeDF57RdpH8n2aHmWqxUulXfGKYnw== X-Received: by 2002:a05:620a:4f6:: with SMTP id b22mr8910127qkh.65.1571842879590; Wed, 23 Oct 2019 08:01:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 13/24] target/arm: Split out arm_mmu_idx_el Date: Wed, 23 Oct 2019 11:00:46 -0400 Message-Id: <20191023150057.25731-14-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 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: 2607:f8b0:4864:20::743 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Avoid calling arm_current_el() twice. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/arm/internals.h | 9 +++++++++ target/arm/helper.c | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 232d963875..f5313dd3d4 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -949,6 +949,15 @@ void arm_cpu_update_virq(ARMCPU *cpu); */ void arm_cpu_update_vfiq(ARMCPU *cpu); =20 +/** + * arm_mmu_idx_el: + * @env: The cpu environment + * @el: The EL to use. + * + * Return the full ARMMMUIdx for the translation regime for EL. + */ +ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el); + /** * arm_mmu_idx: * @env: The cpu environment diff --git a/target/arm/helper.c b/target/arm/helper.c index 85de96d071..3f7d3f257d 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11026,15 +11026,12 @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMStat= e *env, bool secstate) } #endif =20 -ARMMMUIdx arm_mmu_idx(CPUARMState *env) +ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) { - int el; - if (arm_feature(env, ARM_FEATURE_M)) { return arm_v7m_mmu_idx_for_secstate(env, env->v7m.secure); } =20 - el =3D arm_current_el(env); if (el < 2 && arm_is_secure_below_el3(env)) { return ARMMMUIdx_S1SE0 + el; } else { @@ -11042,6 +11039,11 @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env) } } =20 +ARMMMUIdx arm_mmu_idx(CPUARMState *env) +{ + return arm_mmu_idx_el(env, arm_current_el(env)); +} + int cpu_mmu_index(CPUARMState *env, bool ifetch) { return arm_to_core_mmu_idx(arm_mmu_idx(env)); @@ -11202,7 +11204,7 @@ static uint32_t rebuild_hflags_internal(CPUARMState= *env) { int el =3D arm_current_el(env); int fp_el =3D fp_exception_el(env, el); - ARMMMUIdx mmu_idx =3D arm_mmu_idx(env); + ARMMMUIdx mmu_idx =3D arm_mmu_idx_el(env, el); =20 if (is_a64(env)) { return rebuild_hflags_a64(env, el, fp_el, mmu_idx); --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571844749; cv=none; d=zoho.com; s=zohoarc; b=On2Oab0snrT/XABZC0hKje/UGrd43NXeJ4tmydETI3r0nd3vGlG/G9j70qGGnQxTDqxtGFu1o49tX2ddtrvpBREAQ5n5KlUSsjovL6VpI2u3FPaOYZhMmAaTL4NgmEa9saIJT5vsnPaA9UmDYEj3YRWTTS40x07s8lcgPvalqD8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844749; h=Content-Type: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=bIwXZuVFcex8c2gsnRtwJL32LXPTCWgJCQzC/Gsa6O8=; b=gv0dWVZgrd1ttr8ROf08q2teyYYVBdFM1GwHy7MEIy6YbMia/TXHKW3mSccRC1MizRZo7tBcyEYhvpk+/XkdBie2on+oZ5nShWELu0zJZpNR4uw5Ual2rPCOZ6btO2FSs/LhitswldD6KHkynOiiRLAnfBcWB+uuhFZ7InVtQVM= 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 1571844749304815.0964326600224; Wed, 23 Oct 2019 08:32:29 -0700 (PDT) Received: from localhost ([::1]:39566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIca-0000V2-6f for importer@patchew.org; Wed, 23 Oct 2019 11:32:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35284) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-0008A7-Oy for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001GY-NJ for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:44 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:46550) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-00017c-GO for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x841.google.com with SMTP id u22so32678675qtq.13 for ; Wed, 23 Oct 2019 08:01:22 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:20 -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=bIwXZuVFcex8c2gsnRtwJL32LXPTCWgJCQzC/Gsa6O8=; b=m2C8RoibueHknxvHHmygii7frJMQFcjjKTc7biRX04nhvioilXfsWLektiwgg02/gs 2dGtRi03vI5AFS0Yw60XH+QL1UikrZ4ujJxcEaCVHmyIFdgt2hLcU20zgRF49kCkqsp5 Kz4g8aL7OD7ihrlK8KUB/tGvfDnAo9vC1DdvCoAp5bGrmLmbNHncrjDIzgrYrwMLLVKv Mb29/Kd/ftwtdKCJoRhpjg4/og4NAy2LNJx3+y5LmFu5vAQtDKNyJXlD5c/MXZRp5zwo jx5jAU1kiEBJlK6IdWzMUprT9Ymmx2+IEMIkvPULrmMU/REsY7B/llk+po+YWh8Dd96W kE9A== 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=bIwXZuVFcex8c2gsnRtwJL32LXPTCWgJCQzC/Gsa6O8=; b=cX4N/iecPhmXIp93EsoAnwPpKf3HjIy0pIGMLeF1iUAhHXZuhAYzZIFiJYs1n7+ZKE hcde4c33ysETsr8jHIUbsf5PVLG5sF1lNTXdr/zGubKP5MYl8Jj35uLLkXEzc28Q5cP9 va6SX/7vB71qRUa3tIj1Is0jX1MFu08hdJ9cPw+LbFlE9Dqd9qqHWZf/8pADFDcx7cDj erZYBy5PGpZOxXf04LL9ggW2UFPI0s6E9vnTmWFrwvuaXvr6jmKc9gQzeaztvmmOtvyI JOtdM8J2w8l9ZcoLRS6yRY2cOrHJdk4eq573NtGIOu8U4Pm+jZcbTK3Si0lE28FlheVc DBew== X-Gm-Message-State: APjAAAVAgeqXjSUPdJ4DN1ZbXsihY6sVI0+09vHjzbHrhm4W6XqxMhnv ZJnhPbXG1s33iP9zmnis+IgHhSMsrfA= X-Google-Smtp-Source: APXvYqyuG20jKzkwbvXtrRkkDZ1tv+rSWd1in05BROTQsfWpdtAal92eOyCIQ4VAjC/NGBxZOVy04A== X-Received: by 2002:ac8:2a66:: with SMTP id l35mr10054665qtl.340.1571842881175; Wed, 23 Oct 2019 08:01:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 14/24] target/arm: Hoist store to cs_base in cpu_get_tb_cpu_state Date: Wed, 23 Oct 2019 11:00:47 -0400 Message-Id: <20191023150057.25731-15-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 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: 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) By performing this store early, we avoid having to save and restore the register holding the address around any function calls. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 3f7d3f257d..37424e3d4d 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11225,6 +11225,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, { uint32_t flags, pstate_for_ss; =20 + *cs_base =3D 0; flags =3D rebuild_hflags_internal(env); =20 if (is_a64(env)) { @@ -11298,7 +11299,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, } =20 *pflags =3D flags; - *cs_base =3D 0; } =20 #ifdef TARGET_AARCH64 --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571844400; cv=none; d=zoho.com; s=zohoarc; b=fihHFYS1ctTVvoT4E+bQpmfRT8cY8bQ6T06dLns0NYkIFXmTQ5FtXErdq0KUW+T6O6RbqMYNmW3dBKJHxRHTsIE7UP4V9CSw9UxnILd87GiF0ZClQanOWP81O7a8AS2MRDS94gycWh78ePv2ZwXVEZfC8FbKHE4jMFgvcjxfPFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844400; h=Content-Type: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=ksJ29EsO4EC0RqRT/ptTGb/nh233vty3hFHL48/i7gI=; b=QZp+0CHkkML463xlmZCPtZXk1beoIJAarXJK0uTCG9Z4TkxU+UkyDbEud2SR3tqiDCdp/PrNClDEu2tUjgr3znzNTCF31/LUQ8nAO9efP1CTDIAwyIQSSaDPTLPJSPvIL/bz1ghtCCDgOrzsKG5TAXytEfYLtHxBcMc5YJORcVc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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=fail 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 1571844400105597.5806702592935; Wed, 23 Oct 2019 08:26:40 -0700 (PDT) Received: from localhost ([::1]:39430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIX0-0003ge-Kz for importer@patchew.org; Wed, 23 Oct 2019 11:26:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35240) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-000899-1W for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001FQ-By for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:43 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:33722) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-00018U-3l for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x844.google.com with SMTP id r5so32789254qtd.0 for ; Wed, 23 Oct 2019 08:01:25 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:21 -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=ksJ29EsO4EC0RqRT/ptTGb/nh233vty3hFHL48/i7gI=; b=ToQyPTDtGgKWs253kz1CECPIV+6/w1Axc2rqud0q/XD45AKLnTK3jL26xz1ef0xRP8 KwEpp57ALlTCzWKaaQPEvvSk3E8uxlVb2Ez52IJxC2+ijQT+o0pQEq0qjvzTNavYI8b5 +y/UNhxiiO8xVwUQdL70UKQ5loEDksmc10WwKT0lfBmO4vYb4j4aqrkHMKbAP64oateO S+7h2AbDRg4s88Xro5zkyh7JjitiGd637Lloe6pUMAzbK3Dg1ictt+mP9n8UEw0JntxN iitFcX8P1GOXE4vtNMR00cqbxIhPMlQTR4nIODejXzIRjnMOY6uSa4ijkbf0ed9C8+By KuXg== 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=ksJ29EsO4EC0RqRT/ptTGb/nh233vty3hFHL48/i7gI=; b=BK0Kjs+NoCs6MLr7eUTVp/PqipfTTTEfKzELaZHRYDNcgajBSEtgqCcQ2h9OeqNScI lhsIphpTLCefLV8o1K95SjAada9TsNB2vd4SPQX4vY3DKY2hEP7zP4amTUAThKSaUI9K SvSLLMrLTuwfgWzK40AW5SmWQT3dZ0WnhDYiPSn95lzLw42VRVDivzB1UkPyoH5aFbMT gnVMjqUIRgddRmgPRYHoZOosi6BsOVbAiewe4MfavkR0FEHlm9yjWh14NHr6zMfOfsUp OH6s2nRRrczhBrrN5bqBLRPTBI3qxUKj1OVBk31Y7plIIeCdfwZPPXJi7O0fgRfkVdt8 sMAw== X-Gm-Message-State: APjAAAVZn+1384z7LVkdVspYVsOc/DVxCBWchyP2emH5T3dXFaAuQ6zL gg8oNckh+kJmiXtg4kVF2f1dK5hqSaw= X-Google-Smtp-Source: APXvYqybycC6Rs7DHcgp3wGm2hX01NZfnMPvBTjIr9ApISxhbG9XBxk/b/uJbcNVMIooLzeJUgDZTQ== X-Received: by 2002:ac8:1604:: with SMTP id p4mr9899981qtj.276.1571842883078; Wed, 23 Oct 2019 08:01:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 15/24] target/arm: Add HELPER(rebuild_hflags_{a32, a64, m32}) Date: Wed, 23 Oct 2019 11:00:48 -0400 Message-Id: <20191023150057.25731-16-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 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: 2607:f8b0:4864:20::844 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This functions are given the mode and el state of the cpu and writes the computed value to env->hflags. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/helper.h | 4 ++++ target/arm/helper.c | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/target/arm/helper.h b/target/arm/helper.h index 1fb2cb5a77..3d4ec267a2 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -90,6 +90,10 @@ DEF_HELPER_4(msr_banked, void, env, i32, i32, i32) DEF_HELPER_2(get_user_reg, i32, env, i32) DEF_HELPER_3(set_user_reg, void, env, i32, i32) =20 +DEF_HELPER_FLAGS_2(rebuild_hflags_m32, TCG_CALL_NO_RWG, void, env, int) +DEF_HELPER_FLAGS_2(rebuild_hflags_a32, TCG_CALL_NO_RWG, void, env, int) +DEF_HELPER_FLAGS_2(rebuild_hflags_a64, TCG_CALL_NO_RWG, void, env, int) + DEF_HELPER_1(vfp_get_fpscr, i32, env) DEF_HELPER_2(vfp_set_fpscr, void, env, i32) =20 diff --git a/target/arm/helper.c b/target/arm/helper.c index 37424e3d4d..b2d701cf00 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11220,6 +11220,30 @@ void arm_rebuild_hflags(CPUARMState *env) env->hflags =3D rebuild_hflags_internal(env); } =20 +void HELPER(rebuild_hflags_m32)(CPUARMState *env, int el) +{ + int fp_el =3D fp_exception_el(env, el); + ARMMMUIdx mmu_idx =3D arm_mmu_idx_el(env, el); + + env->hflags =3D rebuild_hflags_m32(env, fp_el, mmu_idx); +} + +void HELPER(rebuild_hflags_a32)(CPUARMState *env, int el) +{ + int fp_el =3D fp_exception_el(env, el); + ARMMMUIdx mmu_idx =3D arm_mmu_idx_el(env, el); + + env->hflags =3D rebuild_hflags_a32(env, fp_el, mmu_idx); +} + +void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el) +{ + int fp_el =3D fp_exception_el(env, el); + ARMMMUIdx mmu_idx =3D arm_mmu_idx_el(env, el); + + env->hflags =3D rebuild_hflags_a64(env, el, fp_el, mmu_idx); +} + void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571844075; cv=none; d=zoho.com; s=zohoarc; b=EyqvNAGlJvAEZfQvwUrSFIMPIJHtwHPI1ku7BLmgVx98NgxZiHJ9T5VzP5cXijXttPOZkXpZgHlQZI+efrekbCjiN67RYEMwWfojyrwhF69kYpeiaa6a1UZYp5c+cZy/W0v90aajkJu7KwVWMjB+zqjpAGohIX7rBG90V+XYnKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844075; h=Content-Type: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=SiowrkM/1iAKWki4Ii968zkKQyJbLh4wL5XVrtx3P7c=; b=j5S8RIQK2UoFVcLo1ZOSOFyKJa8ZK4Akwe9TeWAjeeddnvb+II9gIEkLjrjdDSHaZPCRkQzARwZWoHUME6wc8/b1R9RTdozhgJp7ev4ZaabKZcGp7zowU+SyHe9UouwTnZnCiuWs64S4P36WDrTEnIkZ33xt+nE4prVX9dKC3XE= 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 1571844075861687.9218314545482; Wed, 23 Oct 2019 08:21:15 -0700 (PDT) Received: from localhost ([::1]:39336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIRj-0006Qc-BG for importer@patchew.org; Wed, 23 Oct 2019 11:21:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35160) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8s-00087W-Sk for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8q-0001EM-Un for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:42 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:32790) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8q-00018a-NG for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:40 -0400 Received: by mail-qk1-x744.google.com with SMTP id 71so16169344qkl.0 for ; Wed, 23 Oct 2019 08:01:25 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:23 -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=SiowrkM/1iAKWki4Ii968zkKQyJbLh4wL5XVrtx3P7c=; b=I4xTugx1trsGqtBfJ4WWtytCUbLwO2vvQUbXv97YcuwFCCUuVBTT162f7pqymGAhxK OBMFGvz+nSdYGkpWmGqskrFvQABHhvo4pt1lo2wLq++ocQ9m5s5JnMAWRYPcxEkWy9EB grmabn6a74KmPXOgtMhxI7FwiSLbEPMAwsYYgv9piX5VuTLkF8q1e3f5ll1P3SY7A1AI QhzWk9VYpCX4Rstq7PdmyzMW6OIZTb9IpSUzmjVqrog6bw5+ckZ/KNuTUQPTD4edfZeB jqH+ZRss6zo0AWJx+RagjvrznCwRhzGCZWEDoc9L5YLlZL8h9roS5Gki3Q7TkhIUCR4A 0mjw== 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=SiowrkM/1iAKWki4Ii968zkKQyJbLh4wL5XVrtx3P7c=; b=FnpOFZGCdgfqzXu0F0rn9qXNotbrodloTf3l4ojTlKGIlvvomToMsQMpEG+HEMwiHM 8qlqq/JLgIcg0zZJp6VxZdjUfwuh/oe7RKQS1ozZG/73BdEINwxxa6KZBHWP3n+C31Rk Bnl52XG1O6/XXsn5YuWl2e1HgJFHlz0tP4MHV4I0JR2A2NkgleDs4asDiuRkptk4D+hn 3ZNwh6S1izjLq9oirbw8MO/6+jYMom3XrM6jxAJ/2lw3LUSRNeblxU5u6fA0gGd6+oG1 dlzZMytu+Jyht9LUlCdT/NhCSnzcY1/t3f1gaeUwYDv6Bd+AwIgRbSDDMaK22NB22Py3 696Q== X-Gm-Message-State: APjAAAWAgpYFIgyPANvAw3hJ31IcivByBYgck9Ge+70dbIrF/828sYGM bgBxZf6gT4MDzU4p53cQ3FF8JpzThDA= X-Google-Smtp-Source: APXvYqyl5j3u0x5vrhFGWw+SjB91pwSoiHLYRRG1vjVru9rc/myCPlPkalgAPBgtZlnxMcw7p0Vtsw== X-Received: by 2002:a37:4dca:: with SMTP id a193mr8753818qkb.292.1571842884203; Wed, 23 Oct 2019 08:01:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 16/24] target/arm: Rebuild hflags at EL changes Date: Wed, 23 Oct 2019 11:00:49 -0400 Message-Id: <20191023150057.25731-17-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 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: 2607:f8b0:4864:20::744 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Begin setting, but not relying upon, env->hflags. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- linux-user/syscall.c | 1 + target/arm/cpu.c | 1 + target/arm/helper-a64.c | 3 +++ target/arm/helper.c | 2 ++ target/arm/machine.c | 1 + target/arm/op_helper.c | 1 + 6 files changed, 9 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f1ab81b917..530c843303 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9984,6 +9984,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, aarch64_sve_narrow_vq(env, vq); } env->vfp.zcr_el[1] =3D vq - 1; + arm_rebuild_hflags(env); ret =3D vq * 16; } return ret; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 13813fb213..ab3e1a0361 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -406,6 +406,7 @@ static void arm_cpu_reset(CPUState *s) =20 hw_breakpoint_update_all(cpu); hw_watchpoint_update_all(cpu); + arm_rebuild_hflags(env); } =20 bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index bca80bdc38..b4cd680fc4 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -1025,6 +1025,7 @@ void HELPER(exception_return)(CPUARMState *env, uint6= 4_t new_pc) } else { env->regs[15] =3D new_pc & ~0x3; } + helper_rebuild_hflags_a32(env, new_el); qemu_log_mask(CPU_LOG_INT, "Exception return from AArch64 EL%d to " "AArch32 EL%d PC 0x%" PRIx32 "\n", cur_el, new_el, env->regs[15]); @@ -1036,10 +1037,12 @@ void HELPER(exception_return)(CPUARMState *env, uin= t64_t new_pc) } aarch64_restore_sp(env, new_el); env->pc =3D new_pc; + helper_rebuild_hflags_a64(env, new_el); qemu_log_mask(CPU_LOG_INT, "Exception return from AArch64 EL%d to " "AArch64 EL%d PC 0x%" PRIx64 "\n", cur_el, new_el, env->pc); } + /* * Note that cur_el can never be 0. If new_el is 0, then * el0_a64 is return_to_aa64, else el0_a64 is ignored. diff --git a/target/arm/helper.c b/target/arm/helper.c index b2d701cf00..aae7b62458 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7998,6 +7998,7 @@ static void take_aarch32_exception(CPUARMState *env, = int new_mode, env->regs[14] =3D env->regs[15] + offset; } env->regs[15] =3D newpc; + arm_rebuild_hflags(env); } =20 static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs) @@ -8345,6 +8346,7 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) pstate_write(env, PSTATE_DAIF | new_mode); env->aarch64 =3D 1; aarch64_restore_sp(env, new_el); + helper_rebuild_hflags_a64(env, new_el); =20 env->pc =3D addr; =20 diff --git a/target/arm/machine.c b/target/arm/machine.c index 5c36707a7c..eb28b2381b 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -756,6 +756,7 @@ static int cpu_post_load(void *opaque, int version_id) if (!kvm_enabled()) { pmu_op_finish(&cpu->env); } + arm_rebuild_hflags(&cpu->env); =20 return 0; } diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 0fd4bd0238..ccc2cecb46 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -404,6 +404,7 @@ void HELPER(cpsr_write_eret)(CPUARMState *env, uint32_t= val) * state. Do the masking now. */ env->regs[15] &=3D (env->thumb ? ~1 : ~3); + arm_rebuild_hflags(env); =20 qemu_mutex_lock_iothread(); arm_call_el_change_hook(env_archcpu(env)); --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571844515; cv=none; d=zoho.com; s=zohoarc; b=ewnmjhdjj2b8JfZTAWdtjjo0EUoiZ0DSiHhLEQq0zs9ZT3+UPf6NrnOmZR7JmT8F4Ewegt1THarw3Fc7/d7tVny6luBxEMlW7eROk/mQFpqafydG8KQBSbBBgpTqP606p3iY8z+Npy1gR7cmYptFu4VyELib7AM/3Cg51JkLzZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844515; h=Content-Type: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=LNnrsVkwlgJ6QoJB/sOp9/3FjmMcP/pJsCavmGVFX6A=; b=Y12inBoLDQAHxjRIAEUv8D9dHWwbJq0nC7hMHKo7QGIB740+u9m1lpRvAnStjN9oFPj0z0KRvS7XoNTQUcno6khuwtvFATU4edlukbLxQNyaxx23K7Pz1jmvKwv2jgMVxa6rPTqXhMapiJHgkn4KIGWQ58pvW/DivM9XVB7eNSg= 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 157184451557742.76998076029133; Wed, 23 Oct 2019 08:28:35 -0700 (PDT) Received: from localhost ([::1]:39478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIYr-0005jU-Le for importer@patchew.org; Wed, 23 Oct 2019 11:28:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35340) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8v-0008Cl-OM for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001HJ-Uy for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:45 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:34709) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-00019T-Na for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x844.google.com with SMTP id e14so12965632qto.1 for ; Wed, 23 Oct 2019 08:01:28 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:24 -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=LNnrsVkwlgJ6QoJB/sOp9/3FjmMcP/pJsCavmGVFX6A=; b=PI8SmEt0aWF4SMPYVp+5sC2i8RM3azhNXYGSc+CvtQ8YlR5iFc2AxLG0r4mM5pCgmy c5WNM9XNMFvTP6LfK69OIwvCqLYqlVcrFaE2k2xIak8XvzOFkcnQAvNIt2KkJlj+yP7q V4SMg2kudwbrWNcnK+TQEziGrSOntG92jqw6CgWPjTfPQehw366erv8H4ZBWrWc3t+SN Is27wco728zLE0P/jaBR+MLCvnxgydHRb1NzbnzokNAx/TcZvzRd5tsqwOSWJHhH214R HQlkhNrc9eaeNuL2XoNCe1v/hEfAftaXkdRzJH06lgvWGKLDTxdBpC9WtUW0+6AKmkbW 3aLg== 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=LNnrsVkwlgJ6QoJB/sOp9/3FjmMcP/pJsCavmGVFX6A=; b=qbf6aCU++pMmirTLICLl8ZtaJMMnuDsDCygKCWiw4eWPxVZpuyoeaesukkRZQ0grOG LIunIkndEBy28jIGfIzd5hUB2hu3Wj0MHZ+llHG9P4Qu4mQEPysx2at3/ASC5E1Q/OQk IuqWDXEshtlPaNZBrurCUEUnfl7a9bpyRTqLb/3SB4kzicrVyMXkh2R0YPF09M14iqir 4Vc79JtLKmnVNi5C7yhJTvhcWi1dduiDuS6hFiAdXNV2g4r9FagB4s4lPbYf0OAaWiZk f2i5kS1KeQvIOxU9PGl6gPbxBySlr3AHtEiuXsLrUSdXAovOlK/JSnkIA8+S0RfZTivS FYhA== X-Gm-Message-State: APjAAAX1C41JkqqtzeE6ri4qxOqWxSd5FgPOB8sQNGPxsJ3nJCRoPEtD swa93mQ3fqkwJfV5C3Wt1qS/QZPu1So= X-Google-Smtp-Source: APXvYqzfmMNJdYqK29hN/+0l7tBJjQJOeRsrax52S1jkYwx392S9hpJDlZXyjOQcWBG+8goJli8fsg== X-Received: by 2002:ac8:40c5:: with SMTP id f5mr9979337qtm.344.1571842885143; Wed, 23 Oct 2019 08:01:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 17/24] target/arm: Rebuild hflags at MSR writes Date: Wed, 23 Oct 2019 11:00:50 -0400 Message-Id: <20191023150057.25731-18-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 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: 2607:f8b0:4864:20::844 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Continue setting, but not relying upon, env->hflags. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 13 +++++++++++-- target/arm/translate.c | 28 +++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 2d6cd09634..d4bebbe629 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1789,8 +1789,17 @@ static void handle_sys(DisasContext *s, uint32_t ins= n, bool isread, if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO))= { /* I/O operations must end the TB here (whether read or write) */ s->base.is_jmp =3D DISAS_UPDATE; - } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { - /* We default to ending the TB on a coprocessor register write, + } + if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { + /* + * A write to any coprocessor regiser that ends a TB + * must rebuild the hflags for the next TB. + */ + TCGv_i32 tcg_el =3D tcg_const_i32(s->current_el); + gen_helper_rebuild_hflags_a64(cpu_env, tcg_el); + tcg_temp_free_i32(tcg_el); + /* + * We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition * (usually only necessary to work around guest bugs). */ diff --git a/target/arm/translate.c b/target/arm/translate.c index 96340520ee..46a0bf51c9 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -6890,6 +6890,8 @@ static int disas_coproc_insn(DisasContext *s, uint32_= t insn) ri =3D get_arm_cp_reginfo(s->cp_regs, ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); if (ri) { + bool need_exit_tb; + /* Check access permissions */ if (!cp_access_ok(s->current_el, ri, isread)) { return 1; @@ -7068,14 +7070,30 @@ static int disas_coproc_insn(DisasContext *s, uint3= 2_t insn) } } =20 - if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_= IO)) { - /* I/O operations must end the TB here (whether read or write)= */ - gen_lookup_tb(s); - } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { - /* We default to ending the TB on a coprocessor register write, + /* I/O operations must end the TB here (whether read or write) */ + need_exit_tb =3D ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && + (ri->type & ARM_CP_IO)); + + if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { + /* + * A write to any coprocessor regiser that ends a TB + * must rebuild the hflags for the next TB. + */ + TCGv_i32 tcg_el =3D tcg_const_i32(s->current_el); + if (arm_dc_feature(s, ARM_FEATURE_M)) { + gen_helper_rebuild_hflags_m32(cpu_env, tcg_el); + } else { + gen_helper_rebuild_hflags_a32(cpu_env, tcg_el); + } + tcg_temp_free_i32(tcg_el); + /* + * We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition * (usually only necessary to work around guest bugs). */ + need_exit_tb =3D true; + } + if (need_exit_tb) { gen_lookup_tb(s); } =20 --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845683; cv=none; d=zoho.com; s=zohoarc; b=epCOk3w+YrUnplhbUFFGL7zadn6rS4Rg3UVPnU4Zancea3RGT01CbjE8KHKW2cPLJLNyb7/DpTzCdfZfFO/hfeAM1sUGZo1izm3k/Bpmv0oLT+k6WFqpXTNDO6eDsJf+B6igkHiQomPpOXkhLj+OxeK6fdFC6gdci/ZIKEjaUfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845683; h=Content-Type: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=Iym+ywFHjEBpwuu12wdHsU0gouX4jDUf3/+DDNH9pyk=; b=OuCxj0/PoTAsEJIx8cUmac4jnzKlUUe+go6U7r60UkLXsmfk7oNmAzspTs6+8KXb4MYkM6fyPnQ8gqg32X0357qUf5yLaj+BCDFvsPISwXqHLWiLiKi0iBSGz0P6Wj4nOrei77p+q4nF6LgYIOVjmwXvOuTPSWRULwQHs2ukIJA= 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 1571845683122272.42674570263785; Wed, 23 Oct 2019 08:48:03 -0700 (PDT) Received: from localhost ([::1]:39910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIrh-0005ma-85 for importer@patchew.org; Wed, 23 Oct 2019 11:48:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35246) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-00089H-AU 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-0001Fi-Cf for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:43 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:37710) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-00019G-5g for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qk1-x742.google.com with SMTP id u184so20055030qkd.4 for ; Wed, 23 Oct 2019 08:01:27 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:25 -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=Iym+ywFHjEBpwuu12wdHsU0gouX4jDUf3/+DDNH9pyk=; b=JBY+uoi/+fsxKtaVdEUfo1r3jJJ5rjOraTo2FNLPBuEm++0n3Useh7V3OBM7lNWtVl BwFFrYx2/65n8V4wsrimWFSkDg9Rx0yhIz1U7FMqv10Faud1dPXihm+aY02nZEUx0li7 YLYjtbsHzXvhKxikF+MJnDRIz888rOYaPOaAgFn+afBbHBEtzY+hORHnaIT/IeXFuE9Q WYVHfnlckqHzjRAJ948RWqES6iMm5PEUob0LAYQukgTP8flk3E1bZPMTquIaSSWBQb5+ p2JZStIJfYpkIaR39moIqnwOQO0Ve9CJUuLvdN0p5Et8aCCFiixR0g21GcXhIveVA3EP 3VeA== 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=Iym+ywFHjEBpwuu12wdHsU0gouX4jDUf3/+DDNH9pyk=; b=fDfArEoMbuOpMPHO3yZ1LmciQC7OcA/gIALOEnzOnnzHHymCPEZLGD5/uT4OLfZJ0z MB7HNMACr3QGtxb1/PYBXsH1fBRG1CaQedLZ2sBhn2se7Y7055+CzJG6OBLHvpk2QCjo NBtjcA5om8aYiuL9P8kFbnJDQxNqcdjgW4RSRU36Qib72BJM7JxE41aGNuhdkHZ5hwkK siyrQ9+MzNdIu8GoheE525EtuA0ovHfe4B7zkj/oOelJVUaoxxVi/Z90Jk7W4JZ2/rAh PxLv3k3OWhpxBUFTTIdlf7Edys5L77AqJ76u0YzlkLTEMkBcHWbA5Jkrqa/LFPMj1rbY zCVA== X-Gm-Message-State: APjAAAWFCZT7JN4mrGB1nF2dQLSSyAUp6YIioDMVaIODhzR8u0pO7Epo LILovL4nIiw1jY54a5PuQPNBBX5P+W8= X-Google-Smtp-Source: APXvYqwVLYygu3aZa5y8PikWE9QpbG4d78hexpVHPahE5sDQBPTYv8jX5EFgGDYbZBpcJoLPsBSoPg== X-Received: by 2002:a05:620a:20d2:: with SMTP id f18mr8909266qka.474.1571842886526; Wed, 23 Oct 2019 08:01:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 18/24] target/arm: Rebuild hflags at CPSR writes Date: Wed, 23 Oct 2019 11:00:51 -0400 Message-Id: <20191023150057.25731-19-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 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: 2607:f8b0:4864:20::742 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Continue setting, but not relying upon, env->hflags. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- target/arm/op_helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index ccc2cecb46..b529d6c1bf 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -224,6 +224,7 @@ uint32_t HELPER(usat16)(CPUARMState *env, uint32_t x, u= int32_t shift) void HELPER(setend)(CPUARMState *env) { env->uncached_cpsr ^=3D CPSR_E; + arm_rebuild_hflags(env); } =20 /* Function checks whether WFx (WFI/WFE) instructions are set up to be tra= pped. @@ -387,6 +388,8 @@ uint32_t HELPER(cpsr_read)(CPUARMState *env) void HELPER(cpsr_write)(CPUARMState *env, uint32_t val, uint32_t mask) { cpsr_write(env, val, mask, CPSRWriteByInstr); + /* TODO: Not all cpsr bits are relevant to hflags. */ + arm_rebuild_hflags(env); } =20 /* Write the CPSR for a 32-bit exception return */ --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845671; cv=none; d=zoho.com; s=zohoarc; b=ePwjLvNy0scuPHUzXS8IvZQmE23tRtTgs9LVevvOg1H6erolQ4n8EIQXN8AyjNxRNM6QdNvCDtKODIWQN39m+J5B5H9/HmNTjJTzfQtZxGdQPezjZA+nOQC8GHUGSDkFucJFUaASLyK2mPKbdZUmCGqSJbSlm96tw+S8Skat5wA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845671; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=4z2zPWedOviyKqg3qmIWn8g3R8jv2yS1u67ka41eHWc=; b=mlEN2+IEWe/AukUapaeoeFMYzMid5K5cUBDoUOJXJB1yWixn6fmlsSgdDf+sl5m7HV2qaD3nzcdAT10V8ZJ0cyCv86NSSxg18uLvhnjeSyWr8jMvhPFahMHIwIPeKKZkb5XST1rMjM7ewvH29oIfZd3mBIq8gLsNdJ9kvY1XKYE= 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 1571845671262668.9897995041167; Wed, 23 Oct 2019 08:47:51 -0700 (PDT) Received: from localhost ([::1]:39906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIrV-0005cD-Ee for importer@patchew.org; Wed, 23 Oct 2019 11:47:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35503) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8y-0008Hs-Tt for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001Gm-P8 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:48 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:35195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-0001A4-KE for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qk1-x744.google.com with SMTP id w2so20044779qkf.2 for ; Wed, 23 Oct 2019 08:01:29 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:27 -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; bh=4z2zPWedOviyKqg3qmIWn8g3R8jv2yS1u67ka41eHWc=; b=kRI/7VjdZTOejYq4avHlHxKBwzld0iJdrnmUJYizOKUKU4Hvyw5X6xk+vB3jQ3MwbE GLKAtYQpd6/4UIjpbFlHS6RsMGZxt96vmQr8KHoZK7vq5Q/I2gQ+CJI+57KmH+9Tw/S8 jzDgMHMp9/O4vIyfV63ewmnma2+XgWyqvayX8qP6LVmCGw6aqVx45uxbJG+W0jeX8edm vnZPw0Rra91QSKoi7rjXjY4gcglLlxA2jg29dVM2MKfyQt/2mAW4CjZid7E+oJ6jfNFo pTRacCtRxTQJf7PP7+OSofKTGq+VTEZPtewTlc93jRXkXg6C8Q6+fjTdecgZ+Gl/GAZe zI0g== 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; bh=4z2zPWedOviyKqg3qmIWn8g3R8jv2yS1u67ka41eHWc=; b=FJbhdIcmXvTqR2KPuBkWfeGMn7WStQ+i45Bma6yDZCj/O0407PL0jCFYyS4q8DvPK0 DF7gNbl4ESwHCSGoNe+nU3PaN7YGYVYDfwqeffPYIpt3qS9jcJUV9F+cidYsPlufjoPm ZoXNEn0Pq9flEZNouBmXGQGacmFnJ1/viIx1ZijjJ48rBFfOxpOZ5KDcSv4w3q5btBdI 4CUvEMOPlMDdAjOLtNbDan8mUkbPxeyoEp+CUgID35ZSHMa5/NKd+FRIYHyU0zrE32G+ y0iqX9oQyrrEuF7fN4p8N/7aJwi8KGHGjbTPbH9ybJrQvDAiSgQUmVFI9FX8zmybOO1m GQ3A== X-Gm-Message-State: APjAAAUsBzfuNvHLNwhn2QN7eD9oETzArtyIMSQ6OFuc0DkvVixjSMNm cfyao0P6kq2iGO3WiKAgojvv6O8xAyw= X-Google-Smtp-Source: APXvYqwCyMJQhJXQl7OBCRepQyVtAXf4gm3vuPK9zHOvZBO9kBA4nDc4WfFJAdKfCphS9Oio81wzGg== X-Received: by 2002:a37:7906:: with SMTP id u6mr9178909qkc.5.1571842888188; Wed, 23 Oct 2019 08:01:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 19/24] target/arm: Rebuild hflags at Xscale SCTLR writes Date: Wed, 23 Oct 2019 11:00:52 -0400 Message-Id: <20191023150057.25731-20-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> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::744 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Continue setting, but not relying upon, env->hflags. Signed-off-by: Richard Henderson --- target/arm/helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index aae7b62458..c55783e540 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4174,6 +4174,16 @@ static void sctlr_write(CPUARMState *env, const ARMC= PRegInfo *ri, /* ??? Lots of these bits are not implemented. */ /* This may enable/disable the MMU, so do a TLB flush. */ tlb_flush(CPU(cpu)); + + if (ri->type & ARM_CP_SUPPRESS_TB_END) { + /* + * Normally we would always end the TB on an SCTLR write; see the + * comment in ARMCPRegInfo sctlr initialization below for why Xsca= le + * is special. Setting ARM_CP_SUPPRESS_TB_END also stops the rebu= ild + * of hflags from the translator, so do it here. + */ + arm_rebuild_hflags(env); + } } =20 static CPAccessResult fpexc32_access(CPUARMState *env, const ARMCPRegInfo = *ri, --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845312; cv=none; d=zoho.com; s=zohoarc; b=a5olNRMyICpMzyMuGkjTqnhsCPYQYm1Wb90H2SREMf2+9O+anx9q0sNFhC+VoFRNEUTevBngRLyf25GrE+DgVL9s0vNYvPYThr0bvDPOJZZPlw3x8TPI7oCwqkbqhvpAaikwIcntQDYoo3uAkJM8ixIEF6rvj4taH+xT1BPCUzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845312; h=Content-Type: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=rIJBgOSYgiSfbsgLfenw64t9SfwWSxf6NKjgwJPoM10=; b=U7rkQDR8dpMJQRjM+yIVW7n35LJQJmVAfovmxvNMMYz1YCYg+Jb70XJdUUAaZvIX7/Ro6bB7194gGvx+lU2JNfXGcoyhFWaORZcj4/oEv2R2LiYoNtYYnQjgm1MOdUjY1nzH8hHvkaYQ4ExseEcYc7PpWAsiHm4gXlQzpxOMbjs= 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 1571845312463194.38986062922538; Wed, 23 Oct 2019 08:41:52 -0700 (PDT) Received: from localhost ([::1]:39696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIlj-0000TX-Ah for importer@patchew.org; Wed, 23 Oct 2019 11:41:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35335) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8v-0008Ch-Nn for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001HQ-Vo for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:45 -0400 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]:36062) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-0001Ao-OP for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x829.google.com with SMTP id d17so18127102qto.3 for ; Wed, 23 Oct 2019 08:01:32 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01: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=rIJBgOSYgiSfbsgLfenw64t9SfwWSxf6NKjgwJPoM10=; b=frskiv1cbSK/QFp9mvPnqe39foJ3Ph/2NYWRWQAhw5vwrxgHkTZs8OQtUGuUDycBoY qC2BVSmn16ygtuj2O2gXSphi+X+giZSnaUhcREJFRnmwGCkxSctLw78NcoZm8Tc03spC 6hzLa258VaaKGrj5CbvQ7SCuP6gfoPlu7h9BInwYw6VcscN+raxdZj1s7l31cOKaXAVA AbibaTBkcJKkNl9t7NKMBUTbyoJatTt+aotOMQ+h5c0pd3AX1WsATHm9gCiR+jc0uUnI cOt19ZxpbTWYEbp2NhvQRJv4U7fOqvh33rFx8+lDmzSpjLU0lF0gxjgbRVd8AWMPrutR y03Q== 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=rIJBgOSYgiSfbsgLfenw64t9SfwWSxf6NKjgwJPoM10=; b=KdRH4aEVeMwpN+pasXPukl3Zd5yiPEbKBgZPFOUI3r3ak2gwC5ntcfT7KecyTMQlTc gg7Gr88pOtNPy5t0Zkg50WaJ9sAK/t12bfsmaIBb7PiT85/EeErypEknsrgjZ2JeSfU4 vH/0hXP9nsFyhS5LPzNHPcuoqrZAtz2MW/jOHMGWfBvMT+Obmsu1Ut/2LGRMzzQNTu/w nLiceOAsYjXl7nMzXFChQZyYs7lmqteE7QtJ5GmypG4YS5ZqOcuoVpe0Q7NSDl3n6JkV IzBbBUJ3YPU7IS3kcl99KydLhuyb/Z8Hi+YFNtFSRO7LaLpn9c4mypmH6E/oUyTKeIzG /WeA== X-Gm-Message-State: APjAAAXoTY6EbYaY0IoNkxD3tZK6VPFD5qmUMCgnd2VGbJvcNcJvqT+u AvGKsn8W14rcU+L+ecVbkOc3iw8wZvA= X-Google-Smtp-Source: APXvYqwlUhkfOB7ndu61aKy7GnC2pEneL3MSqsrZOXmf5+eXToC+SeWgBt/+IX/oDmKaQUCA9K965A== X-Received: by 2002:ac8:5214:: with SMTP id r20mr8820861qtn.140.1571842889292; Wed, 23 Oct 2019 08:01:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 20/24] target/arm: Rebuild hflags for M-profile Date: Wed, 23 Oct 2019 11:00:53 -0400 Message-Id: <20191023150057.25731-21-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 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: 2607:f8b0:4864:20::829 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Continue setting, but not relying upon, env->hflags. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- v7: Add rebuilds for v7m_msr and nvic_writel to v7m.ccr. v8: Split nvic update to a new patch and generalize location. --- target/arm/m_helper.c | 6 ++++++ target/arm/translate.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index 27cd2f3f96..f2512e448e 100644 --- a/target/arm/m_helper.c +++ b/target/arm/m_helper.c @@ -494,6 +494,7 @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest) switch_v7m_security_state(env, dest & 1); env->thumb =3D 1; env->regs[15] =3D dest & ~1; + arm_rebuild_hflags(env); } =20 void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) @@ -555,6 +556,7 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) switch_v7m_security_state(env, 0); env->thumb =3D 1; env->regs[15] =3D dest; + arm_rebuild_hflags(env); } =20 static uint32_t *get_v7m_sp_ptr(CPUARMState *env, bool secure, bool thread= mode, @@ -895,6 +897,7 @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t l= r, bool dotailchain, env->regs[14] =3D lr; env->regs[15] =3D addr & 0xfffffffe; env->thumb =3D addr & 1; + arm_rebuild_hflags(env); } =20 static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr, @@ -1765,6 +1768,7 @@ static void do_v7m_exception_exit(ARMCPU *cpu) =20 /* Otherwise, we have a successful exception exit. */ arm_clear_exclusive(env); + arm_rebuild_hflags(env); qemu_log_mask(CPU_LOG_INT, "...successful exception return\n"); } =20 @@ -1837,6 +1841,7 @@ static bool do_v7m_function_return(ARMCPU *cpu) xpsr_write(env, 0, XPSR_IT); env->thumb =3D newpc & 1; env->regs[15] =3D newpc & ~1; + arm_rebuild_hflags(env); =20 qemu_log_mask(CPU_LOG_INT, "...function return successful\n"); return true; @@ -1959,6 +1964,7 @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu) switch_v7m_security_state(env, true); xpsr_write(env, 0, XPSR_IT); env->regs[15] +=3D 4; + arm_rebuild_hflags(env); return true; =20 gen_invep: diff --git a/target/arm/translate.c b/target/arm/translate.c index 46a0bf51c9..2ea9da7637 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8327,7 +8327,7 @@ static bool trans_MRS_v7m(DisasContext *s, arg_MRS_v7= m *a) =20 static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a) { - TCGv_i32 addr, reg; + TCGv_i32 addr, reg, el; =20 if (!arm_dc_feature(s, ARM_FEATURE_M)) { return false; @@ -8337,6 +8337,9 @@ static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7= m *a) gen_helper_v7m_msr(cpu_env, addr, reg); tcg_temp_free_i32(addr); tcg_temp_free_i32(reg); + el =3D tcg_const_i32(s->current_el); + gen_helper_rebuild_hflags_m32(cpu_env, el); + tcg_temp_free_i32(el); gen_lookup_tb(s); return true; } --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845328; cv=none; d=zoho.com; s=zohoarc; b=KYDP4GCWLV8bjdlzTVttlexXyJbkeg38qBW+AkNjsk67GdVAmopYkVQHszyrlZmT6YJtnJ3jYQrJg/OlRXGBI2XQmQKnhqJ6QibTiUBBr34syp724iZYe5g4avV2K9cEvJ2XXnylvZm6ImegaYLqC+ZheA1kphxnkI9Vj8GBBac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845328; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=X22okviioTNDt7zI04Hhn7/Ba9cdRHpUwnG0LrTV7qc=; b=KwSA5Wqhz8Zj9GuV6+0eta/fQTpWfOL0OxpC0PCb/Zcs2/X5pOlMyQr4pytBwSalX8SPOqvX7Th+LlUZuXxKGQV/MxUoQ46DoAWfD0JrXuDmNjoggB4+6fyzpszk4nx9gxsp9bYs4fOoaSn95t+DHzD5mBibTRScXmbHqcF+XAE= 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 1571845328282199.9394343953794; Wed, 23 Oct 2019 08:42:08 -0700 (PDT) Received: from localhost ([::1]:39712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIly-0000sd-Up for importer@patchew.org; Wed, 23 Oct 2019 11:42:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35406) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8x-0008F7-08 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8s-0001Ic-BS for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:46 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:40482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8s-0001BC-1G for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:42 -0400 Received: by mail-qt1-x844.google.com with SMTP id o49so24899748qta.7 for ; Wed, 23 Oct 2019 08:01:33 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01: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; bh=X22okviioTNDt7zI04Hhn7/Ba9cdRHpUwnG0LrTV7qc=; b=W7hUYkvBV4U84FkGgu5j4qdKyHLytPYVaAmgc1TcoF7kDY+hBgJktlSMHu+sOn8g8v 6j2aDHaY00/K32dfJPL8WYfJtG4JCQ3olPYZFb+7LrS6dlWB7SXkMRgIHCj9mebasoL3 nvSC2yN9Lsu+cyPMophx5upiL8QYj2jR0y9R7/xk49LkWcVJv0UDchl71MIj74mUk2HL GJVCqsBeYj4ytI5c8gMrf2CcO6NkTvHJ6e+eNrQq7m03xCHMOs1/5RVkH8YzxB07hI3i UFQSIbaqNeJALnezQuP1x8/VT1Xv51oTQswEnCSpxJScLmL+00Ykn81brw/Z821lJMKZ Ftyw== 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; bh=X22okviioTNDt7zI04Hhn7/Ba9cdRHpUwnG0LrTV7qc=; b=iVbz34qPHy+poOgbzXhKsrmI40gtO5VoQnHnFrohudynp7Wj26z3d3nYX/2i8K+7Ox /y3Jonlrrg4nm3MbcMBKeNC3lgfJEg6J1n2X3Z6pwLia179BHu1rAmz8YuCaG8SoyDfD 2c747v/joNZZ1xYz8YYRKyE8hP/xbyM9YBZp6ZHbYceaiuyM13qqQ9Pn0y8srfzZ/Mqq a2ymdexCXo6DbWAWBkmRUfxVDL+h7j20dVGlTRyD+2xswRTK/OVC3/tXpKONJ2yrYQCN igXkWnr6Gs6NBedmTIqE0GJiErRLOLSTRy9lGwFBXgLEBdfHxEXURGVxu+X5ovaniKym 15Kg== X-Gm-Message-State: APjAAAXbagvgJozcISCl5kSUB5U8Htk/GwjKX2VsbYOTrHIHGWlzkC0V J3i1LndJkvQYT+BhGAr+5Cx3bRiBXuw= X-Google-Smtp-Source: APXvYqzwMsqdinJ/S+z+oMWC3UdLEQNd1VjGgTpfl9fj+J99q/H/udX72efLIoZwIysab7KRXflctg== X-Received: by 2002:ac8:1194:: with SMTP id d20mr9752190qtj.275.1571842890760; Wed, 23 Oct 2019 08:01:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 21/24] target/arm: Rebuild hflags for M-profile NVIC Date: Wed, 23 Oct 2019 11:00:54 -0400 Message-Id: <20191023150057.25731-22-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> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::844 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Continue setting, but not relying upon, env->hflags. Suggested-by: Peter Maydell Signed-off-by: Richard Henderson --- hw/intc/armv7m_nvic.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index 8e93e51e81..e8c74f9eba 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -2251,7 +2251,7 @@ static MemTxResult nvic_sysreg_write(void *opaque, hw= addr addr, } } nvic_irq_update(s); - return MEMTX_OK; + goto exit_ok; case 0x200 ... 0x23f: /* NVIC Set pend */ /* the special logic in armv7m_nvic_set_pending() * is not needed since IRQs are never escalated @@ -2269,9 +2269,9 @@ static MemTxResult nvic_sysreg_write(void *opaque, hw= addr addr, } } nvic_irq_update(s); - return MEMTX_OK; + goto exit_ok; case 0x300 ... 0x33f: /* NVIC Active */ - return MEMTX_OK; /* R/O */ + goto exit_ok; /* R/O */ case 0x400 ... 0x5ef: /* NVIC Priority */ startvec =3D (offset - 0x400) + NVIC_FIRST_IRQ; /* vector # */ =20 @@ -2281,10 +2281,10 @@ static MemTxResult nvic_sysreg_write(void *opaque, = hwaddr addr, } } nvic_irq_update(s); - return MEMTX_OK; + goto exit_ok; case 0xd18 ... 0xd1b: /* System Handler Priority (SHPR1) */ if (!arm_feature(&s->cpu->env, ARM_FEATURE_M_MAIN)) { - return MEMTX_OK; + goto exit_ok; } /* fall through */ case 0xd1c ... 0xd23: /* System Handler Priority (SHPR2, SHPR3) */ @@ -2299,10 +2299,10 @@ static MemTxResult nvic_sysreg_write(void *opaque, = hwaddr addr, set_prio(s, hdlidx, sbank, newprio); } nvic_irq_update(s); - return MEMTX_OK; + goto exit_ok; case 0xd28 ... 0xd2b: /* Configurable Fault Status (CFSR) */ if (!arm_feature(&s->cpu->env, ARM_FEATURE_M_MAIN)) { - return MEMTX_OK; + goto exit_ok; } /* All bits are W1C, so construct 32 bit value with 0s in * the parts not written by the access size @@ -2322,15 +2322,19 @@ static MemTxResult nvic_sysreg_write(void *opaque, = hwaddr addr, */ s->cpu->env.v7m.cfsr[M_REG_NS] &=3D ~(value & R_V7M_CFSR_BFSR_= MASK); } - return MEMTX_OK; + goto exit_ok; } if (size =3D=3D 4) { nvic_writel(s, offset, value, attrs); - return MEMTX_OK; + goto exit_ok; } qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad write of size %d at offset 0x%x\n", size, off= set); /* This is UNPREDICTABLE; treat as RAZ/WI */ + + exit_ok: + /* Ensure any changes made are reflected in the cached hflags. */ + arm_rebuild_hflags(&s->cpu->env); return MEMTX_OK; } =20 --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845163; cv=none; d=zoho.com; s=zohoarc; b=KmTJsFse/n32cW8pvnBt3iyvBezEKKO+br1Nqk06Ix6QK9U+4RZC6aIEZL1sjLTocSCMpbKOLTNo/2N7xcn1MNKmdWFNMGRn3VxlseeTInrzkepTZ9Vx+PyAQeH/ufqxEylxsr0RHgQvvxV14/Bdb8S2nUnzaIowaRZpQe0MTFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845163; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=uBYls1SEkoMOURVj/C3yUJq0TivKPiwCZV3WGA+/blg=; b=Y58iaLe0YxdJ6RDlXI1SBOBWtjJYpokDoAwEfrhNxB4rRd3bGikMPByIoezNkUuNy8xGMBhR1UTMwVbqTTKh3yIChjdjVNer2HMhsCJ5Jh8AftUSNFWUj75uQEjkf04kZ2/fwxbOGbSgm0/LAx1cnCdfPTAoRx2EdniOeBTcmHo= 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 1571845163267169.79084891480966; Wed, 23 Oct 2019 08:39:23 -0700 (PDT) Received: from localhost ([::1]:39656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIjJ-0006ks-UE for importer@patchew.org; Wed, 23 Oct 2019 11:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35328) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8v-0008CZ-Bw for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8s-0001I3-7e for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:45 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:36630) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-0001B1-UV for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:42 -0400 Received: by mail-qk1-x743.google.com with SMTP id y189so20056655qkc.3 for ; Wed, 23 Oct 2019 08:01:33 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:31 -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; bh=uBYls1SEkoMOURVj/C3yUJq0TivKPiwCZV3WGA+/blg=; b=jX7BbMZtmCMcQNAA2JyC6isSAjc+uHKsYPzLSkyYxQgRloKo42DLTG2el1Pwy7imCD c9eiFdTNnoxf7+6KQUiKcQDjBaDlGXbeDOOq1a5hMcR4PF9SEeeHXAjNZlavdHdnohSA bzHeCUYYPhi67/lGkgfVTnkE2nsbg8B5aX3RbNaszoXSBi57+5WP74ubw5Bwe1bSe8n/ /gHB3Tj0jR4d4nWsuoNI0Ium1zSjP1SF6wk1kgXNhL7o3wYmzyOzdiVWuSE0ThUWxOxj bmYckK8vgNfJtWX6FGtPLMxneKPIv2sGvgebn7RciW9zPEmKHZCois8utIQdhpoXp54G UIog== 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; bh=uBYls1SEkoMOURVj/C3yUJq0TivKPiwCZV3WGA+/blg=; b=orJwcMH/xDNV2ljl6j3uPiOBtoAoC6yNHXrosPZvbPRn37D8fRntTPt0Hyo5nxLDon 6hhHx0vqn+lw6tedBHN0wgm4/d4dJbqtSLbTCX8aWaPcfqlTNNp2/ah/+40HIAzxEyLz GHZtBPD9B4cWpZQ30OJDA3o+Wo+K5F+cVXHW/supw9T4RCqvJPVLrGw8EdhWP0CA0uJi DuX6R7wetLAruC9IJaWqAygwuyrsmdk4ZhwLzsHvn32BNEcXooRVLIfLd1CV9s/ZPoJF Dxq6SadMEgzLkokszJ9NAK9OjvTHLuL52dnvu0seL6S6rL45Pz22Dna8sdplw1tULdKz ejsA== X-Gm-Message-State: APjAAAWsp5G/ZPUpO1YugOZpe6prmK+kCWYUptIfPcpMiFFiKQjEOI8I JgipNCCiBIqy6M+STYlwRGxWpJjWNvA= X-Google-Smtp-Source: APXvYqxyL54cWvZL6imBachjGXjLYcU6CS7fyOeSH21UEAakeV+dk2wzN9FVfMPKO7KVbAlN6YSLsA== X-Received: by 2002:a05:620a:204b:: with SMTP id d11mr8974408qka.379.1571842891810; Wed, 23 Oct 2019 08:01:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 22/24] linux-user/aarch64: Rebuild hflags for TARGET_WORDS_BIGENDIAN Date: Wed, 23 Oct 2019 11:00:55 -0400 Message-Id: <20191023150057.25731-23-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> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::743 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Continue setting, but not relying upon, env->hflags. Signed-off-by: Richard Henderson --- linux-user/aarch64/cpu_loop.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 1295fa8531..31c845a70d 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -173,6 +173,7 @@ void target_cpu_copy_regs(CPUArchState *env, struct tar= get_pt_regs *regs) for (i =3D 1; i < 4; ++i) { env->cp15.sctlr_el[i] |=3D SCTLR_EE; } + arm_rebuild_hflags(env); #endif =20 if (cpu_isar_feature(aa64_pauth, cpu)) { --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571844400; cv=none; d=zoho.com; s=zohoarc; b=Y8o2k3W4WOKhXgPf0LHGlUqqgKbmwoh8pNbtvxCqLZjptTNJkfyLxNx7otwIX1bF2T8+PKhsM78qdEhuqHfiGNIvs88h/fn4NRIispA9M3fsFNOvo9llC1yy2xgZwIdTfSzY9fKd0n+N2Px/8PyPX363KJIjNCCV9H3H04GlDcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571844400; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=EixSCP/+s4Pul7ok7q0wZeyo8cfwDyotG9VjfWeZAIo=; b=gCjStkWIlN7Fb2EYhdf5aCdllH5ErkWEQEcmHFFF3bs5oYWVubgceBPDJUCmp12ORDdcS9/FkGpQfJ2DWBXrFcoh3hAkP6rLDmbP3ozJSrzWdWRKfEBGZO3wbla54ZF1ZxpqAJV/1/pKOKz77XXG2s8iGWg6UnczcOh9PwGB1aA= 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 1571844400549444.1445282680045; Wed, 23 Oct 2019 08:26:40 -0700 (PDT) Received: from localhost ([::1]:39426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIWx-0003e5-5z for importer@patchew.org; Wed, 23 Oct 2019 11:26:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35106) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8r-00086C-Vf for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8q-0001EG-Ul for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:35196) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8q-0001BV-N4 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:40 -0400 Received: by mail-qk1-x743.google.com with SMTP id w2so20045124qkf.2 for ; Wed, 23 Oct 2019 08:01:34 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:32 -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; bh=EixSCP/+s4Pul7ok7q0wZeyo8cfwDyotG9VjfWeZAIo=; b=GlbSIzeRKSN/EHYUAeDY7EnT8G2ux3tThi7Ui+TJAxomVtmu7TRpeE52UIwqz4aDcr 469KLYqwpj3BoNTWyfywn0cHwFt2SvViu15RU8ayL4i6KJFRtaYiSYQ7mcfogCzpUvib mqLFyGotWK4wklkSCUEsjMaZrOHoVtDra4ZGUgNlGDlEcaby9FsVA2xW+59FE5styI/P zWbuM5dF8JWYSZB/zblE3Xv6jBFhcYBXSJlof+R3eRHVXDg1Qrdujt4kxm6p8TJnGYqy eIj87hd1XxUL0hlnclvAi6A/WPrYaQofwKUnX7BpJP0e/ViK6xWdYhe6J2ZMEe75oBel 2ffQ== 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; bh=EixSCP/+s4Pul7ok7q0wZeyo8cfwDyotG9VjfWeZAIo=; b=VFsQ3QhxGSJEZF8yHZLtvAJMSbWC5yk3tOYH64l8KMYARLurDyI8uJ5sT6C+stzESd l3Y3MQ0eiecxh00/48arl20qYphm8RlHKGcCLZjB4K8Dwf0tDchz9IWNUxZO332tKbdR 35/TAfdMayvwJ2/i+I4Mre1a41fYnixtSEtVA5qaxoWvG0/kdjp/7QnnDmKjx8yKTRQQ AfZ5i7BJxf/mzTlw6mm6bwFkO4zR+Kst0NV2piFmLS0AXUa7h+RkrAPDUoSKCWtJiDdM 8JFYT3+pIzZuQtWdw0DcuGT1Suej46PXod2hykZvLWZshr2WEXg6WiLV8L9zJbxVklo/ 3Ejg== X-Gm-Message-State: APjAAAWtnfjbTttfOLV3r5yysaqy9maQm4hz2EKCI2RYulGmJtqFXO1Q 4ReCa45NF0bdqzJK7LzB6XV61bxkgVA= X-Google-Smtp-Source: APXvYqwQmtF6+GgcY9RhEJtB9xJKxvUKmTqvnBhoo8B/iDW8C87j/k22/3iAmix5iRLok56JmNLn2w== X-Received: by 2002:a37:6554:: with SMTP id z81mr3910082qkb.9.1571842893582; Wed, 23 Oct 2019 08:01:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 23/24] linux-user/arm: Rebuild hflags for TARGET_WORDS_BIGENDIAN Date: Wed, 23 Oct 2019 11:00:56 -0400 Message-Id: <20191023150057.25731-24-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> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::743 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Continue setting, but not relying upon, env->hflags. Signed-off-by: Richard Henderson --- linux-user/arm/cpu_loop.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index e28c45cd4a..7be4071751 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -440,6 +440,7 @@ void target_cpu_copy_regs(CPUArchState *env, struct tar= get_pt_regs *regs) } else { env->cp15.sctlr_el[1] |=3D SCTLR_B; } + arm_rebuild_hflags(env); #endif =20 ts->stack_base =3D info->start_stack; --=20 2.17.1 From nobody Thu May 2 00:18:08 2024 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=1571845115; cv=none; d=zoho.com; s=zohoarc; b=hjkn7v+XHryBfaitJfBchprJ6bzvnIIpHTzyp5tlmbiGMwBaxD/V+D33QgRyk3wkVup1maqJLk9F3hMu8tkCpgnZrDoR0QKxh8EkErhadCMsq8f40cQz8c1LbFJnqVyXDVLa9oma87fq4xRraD154OciBrsPJX1ocSTKPwyfyoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571845115; h=Content-Type: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=xYzA79nlkAAXT+tYBTRBvIlOCILLFnnuEHFTBSl+bu8=; b=hTpOtlyR9+f8Eg4JsXkmgo8woAxVJNf1ynWZ4y+GmNv8G50bgcd3KXFzV0dwpRhD4Ccz91kBLBuHScqa/ImHZdhKH5f8GhZ3AcxyOi67KIcdwtrSPQoDns1uNCVq/E2ru4ybT5nf31gCUXXNF/lKP3xCoyv2j02W9+da4JW4MSk= 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 1571845115561489.8593930330145; Wed, 23 Oct 2019 08:38:35 -0700 (PDT) Received: from localhost ([::1]:39644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIiX-0005k5-UO for importer@patchew.org; Wed, 23 Oct 2019 11:38:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35245) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-00089G-AX 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-0001Ff-Ca for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:43 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:39581) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-0001CZ-2a for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qk1-x742.google.com with SMTP id 4so20038632qki.6 for ; Wed, 23 Oct 2019 08:01:37 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:34 -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=xYzA79nlkAAXT+tYBTRBvIlOCILLFnnuEHFTBSl+bu8=; b=ZivIxCUwhBahdfwsD+jB9v9enkTyy4s1h8QmliJq3nU6rG7z0ArOqafJwiMOzZVcO3 JnKE1LAj5rVNTUbPS1nwgEZvlGE/ERU3ygD6/9+zTRcQCEf1xUKX5nbbnx9TgtUp0bac Wly9VPhtukbkXDeaVg9AjGRl9YkOfRNNJJHvqBhsDExHkmDaa1iqKU/05zzu08zupMAA BIDnToG4ihtrYzYPTslSlFN6xKD51r8b7ae5xEhShXjNseBedcLkfwW+z+0jA3JmvmKo pCDB6Vq2lT1lgz9lFzumAb+e2a+W8IGMzHy6s9FOpDcd4HgpJa9sGRwI+rQ3E5shXVcX FoyQ== 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=xYzA79nlkAAXT+tYBTRBvIlOCILLFnnuEHFTBSl+bu8=; b=AbkA8dNMEm6USSf6la+Z7RJeIl/zZJMy/4Z0JEJJ0zOnARgF/ycXlH3FOC9SBGKYVU bEzOQUXAh4LmuiEkUWHjCRoZsDbaNIRnTv5l/xXAyC82ggHlzJI8bSNXqjCzAWIgjedU oYD8XSASCmi1fNnOV50L+F7zBcUbxiOByWlrgeUBE13awQjXwxSVBGk/kynA6L20+S24 vE7gG3rhBf2v5d8GYE+hWTTME8RWWj+5tW9jrqWevO3veMUVCP2nWNZAJ3VhHUCOStp+ VkoosrGjOjdVw/7KMFWBV9zgmE8xoWbxaQNuYwEVmWAv1+1fQjaMtKyZjlY5dxJo4ezR LYJw== X-Gm-Message-State: APjAAAUb7bSY3qbzBOgivcraaMTeA8UoGrC+5Z+XNz2byowmw7cJ2huf zFAXjYd84VlIBeAxs+WLJOXsttCqIDA= X-Google-Smtp-Source: APXvYqyrEX+iVc67UgrQRraWRhosEPAngw2m6XlEIcYJ1njJhORgHSa4En49LmxiwB5vJ30i39Q1Uw== X-Received: by 2002:a37:684c:: with SMTP id d73mr8797940qkc.176.1571842895829; Wed, 23 Oct 2019 08:01:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 24/24] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state Date: Wed, 23 Oct 2019 11:00:57 -0400 Message-Id: <20191023150057.25731-25-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 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: 2607:f8b0:4864:20::742 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) This is the payoff. From perf record -g data of ubuntu 18 boot and shutdown: BEFORE: - 23.02% 2.82% qemu-system-aar [.] helper_lookup_tb_ptr - 20.22% helper_lookup_tb_ptr + 10.05% tb_htable_lookup - 9.13% cpu_get_tb_cpu_state 3.20% aa64_va_parameters_both 0.55% fp_exception_el - 11.66% 4.74% qemu-system-aar [.] cpu_get_tb_cpu_state - 6.96% cpu_get_tb_cpu_state 3.63% aa64_va_parameters_both 0.60% fp_exception_el 0.53% sve_exception_el AFTER: - 16.40% 3.40% qemu-system-aar [.] helper_lookup_tb_ptr - 13.03% helper_lookup_tb_ptr + 11.19% tb_htable_lookup 0.55% cpu_get_tb_cpu_state 0.98% 0.71% qemu-system-aar [.] cpu_get_tb_cpu_state 0.87% 0.24% qemu-system-aar [.] rebuild_hflags_a64 Before, helper_lookup_tb_ptr is the second hottest function in the application, consuming almost a quarter of the runtime. Within the entire execution, cpu_get_tb_cpu_state consumes about 12%. After, helper_lookup_tb_ptr has dropped to the fourth hottest function, with consumption dropping to a sixth of the runtime. Within the entire execution, cpu_get_tb_cpu_state has dropped below 1%, and the supporting function to rebuild hflags also consumes about 1%. Assertions are retained for --enable-debug-tcg. Tested-by: Alex Benn=C3=A9e Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- v2: Retain asserts for future debugging. --- target/arm/helper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index c55783e540..63815fc4cf 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11259,12 +11259,15 @@ void HELPER(rebuild_hflags_a64)(CPUARMState *env,= int el) void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { - uint32_t flags, pstate_for_ss; + uint32_t flags =3D env->hflags; + uint32_t pstate_for_ss; =20 *cs_base =3D 0; - flags =3D rebuild_hflags_internal(env); +#ifdef CONFIG_DEBUG_TCG + assert(flags =3D=3D rebuild_hflags_internal(env)); +#endif =20 - if (is_a64(env)) { + if (FIELD_EX32(flags, TBFLAG_ANY, AARCH64_STATE)) { *pc =3D env->pc; if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { flags =3D FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); --=20 2.17.1