From nobody Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421112; cv=none; d=zoho.com; s=zohoarc; b=OTPAOs3+Ijl8SFeFiBvpigu4Zu7PzZ/iE4yz518F2m4RvBWgSezXNT/8v+Tlic4lc9FSWPL6M1WGtmU9ITheFv4GP1Put5uXF7uiqArFlqq/e6WBrUnAoiL/eIa4+zsAcLzfMIzHriGK8coBNnDPsTyh5MeH34dF1AhASmRQewI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421112; 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=j8/RhLxit5Twt5k2auzM1rNnTMTr+vkD4C44GGZrz/bMHDXKB4wNjwVYjafvXKF3mcJV91UQQEdCg1pixmns59ky2hRuljcJQgNqOlhSRBysWA9crs9v56xOyJcqfbeebtXJEcTEBBqrT+jjNyMeE/qAYE/TGAUNlNaza8PBKs4= 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 1571421112835401.8161495203926; Fri, 18 Oct 2019 10:51:52 -0700 (PDT) Received: from localhost ([::1]:44296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWPn-0004oV-5L for importer@patchew.org; Fri, 18 Oct 2019 13:51:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59037) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIn-0006Ot-OM for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIl-0005Jr-Gs for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:37 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:37336) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIl-0005J5-B0 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:35 -0400 Received: by mail-pl1-x643.google.com with SMTP id u20so3195460plq.4 for ; Fri, 18 Oct 2019 10:44:35 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44: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 :mime-version:content-transfer-encoding; bh=/TI4mK10x/uGohRoaKTTXXODiX4sOLe+8x03viKmFL4=; b=LmIafnQPZ1zka4369ciWgZJRpt6Q/xgZJuKCoFEIN4P4lNA0DvAPJkq4Sa5EbZUajq wRQb2fUtgpCnTRXFPWhWgVnXQp1BBIF5A+nkJ6UsRUJkXINgiGFf+AZbvRvH1XrUWDZX eChLrwHKsGhTDCVzVsYJSJr5R5ONpuBPQpBKURYeluoDEDxgrzzvJ9pNX+KPeHocgWzr zMct9uqLBmmr4xEkCIzg24rduEbuF6EGNxIG/QZWbz1ocoXdTs3/pKLCtYht6Oe5qV/k 0VUGYK30bJxfVOWP1tXDWdGcGaBlCWEJstFO+ziGuzQPSH/4w+YfX6QURqCMU2xanMrh zJBw== 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=VbG1BloG63jNYTZU7DhmFBOdO1z8bwgk+yxYgIdgpl9szwiuPc8d8tdNb3gP/gtrev Qi8rgyRuFgB8aCQ0l3I7qx8jHmF+9sBfSkNaKd71zd9E2emCRsGkFspoT+Hz4mE7Of1a ske0Ia8zRmogaH2cW40wwLcBaAp9Hlgq7035RN931n6cEoq5IXvFQOlNn8nrUCM9a+X+ G8JB5UR+Es9mxVPGBciYBzXWMmNjiSEm5htIvWr79lQinda6gU3ZmJyZaZTsnS0CsrAh 1QZh5YReQoJNCdR7PnVqZRNb2pNk2ljVbkGOJ43Gy05GoYQAZ9+tYgEqTdMIeH4HenyV LK7Q== X-Gm-Message-State: APjAAAWeZ5vwGSDDbEw0/dJWeAVLFaVJvlwMnEP4NJ6Aw2hhbqCX9R7m /x1df1eXc0dKI82OQMp95bjunhx5j6o= X-Google-Smtp-Source: APXvYqwFjICimZ+gELxpLIpma/UK0Rl4i7fqar3VxrYL/s/xkXJaHGi84L2W9rn5+1Xs4a4xv3NTMw== X-Received: by 2002:a17:902:9f96:: with SMTP id g22mr3953269plq.286.1571420673623; Fri, 18 Oct 2019 10:44:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 01/22] target/arm: Split out rebuild_hflags_common Date: Fri, 18 Oct 2019 10:44:10 -0700 Message-Id: <20191018174431.1784-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::643 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421042; cv=none; d=zoho.com; s=zohoarc; b=NEp2eKAdeVJo14bZzQmthVEzphjeFLZny6Z7DWUXq29dzudqfdPa55SuJGE8vn0b7f5wJOTSRNCT8SDR/89E31AiPL4pZtemm1rsEVDl+5G0kj9iEC74TODRUFKnYLEAlFMfZ0skzvte9fzmZ6ylppFBmOhPa9GzPkyzPoWBsMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421042; 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=JRSCcR0j9KynxUbos/bkRAWxzwfmCtryQowDwvSORr4ck1mOOF4YJG+pYHwVarV7nogCl5SlLm4mj0pYJYvR7zS45bv1QT5ZNp10wTBcbV261rN65h3hjpuCaMSZows67AsnwcY+bRAQLWzeAiXJcu+o8vxyKa13AXkejm6V13Q= 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 1571421042392341.0948147811588; Fri, 18 Oct 2019 10:50:42 -0700 (PDT) Received: from localhost ([::1]:44264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWOe-00032U-Vm for importer@patchew.org; Fri, 18 Oct 2019 13:50:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59069) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIp-0006P8-O2 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIn-0005LW-Ms for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:39 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:39393) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIm-0005K3-3J for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:36 -0400 Received: by mail-pl1-x644.google.com with SMTP id s17so3181967plp.6 for ; Fri, 18 Oct 2019 10:44:36 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44: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=qxe5WkTH2gH9OxzrQymT8yteWQToRtaNSxbFtmMzahk=; b=TglGQ5w1lkkBL0n1CzRUpYRAeD8WLHtjq70P5SsSvtLR6n6hjUvijmTXwTUjyWsZbk +symiKA08DnlmIdYa/oWymh5DEkzUl/IS3WkyUWvih2Gx4+bjsx/ErGPrynA3UE1DYBb XnlJ86eeSAMSZeML3gdLXdu+OTmo+rAHvzbxuocjLgjw97n74A2qFDI0MaQiiiJ7WAdg cCa6QVyEtPpeSZlRK7sCqH8ge9Ahv6z/Srz6umNSTct1nEs0Pb8xFloHKOggqVxPCn5z neqKoymVLwsMlQOq7FBtacOsdaN10Q0nk4Fy01qFD2nN5L+x66g8Zlq7URRmuaN8bNhp LTDA== 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=K0O8KCW3s5n3og0Yt2DSy6jDVp6BsPaWU6s71E1y+pqbcBibZ4AQCaPflFwnqDVXza GFFlWRXfJYx1ohhu0eWqc5MOxCIYz9eBl7GP6esaHE/x9SvtldF7Gkoh4vMVDk9My6tP g1vns2I0uzOtXaUNr+ADeTv1/g4m7dPiPlLwucVTNKVmwhoSJs2oyMltYo+UoArQicKq tcKsJjNB5iJ9V7B0WecpgOKxiLbyMeU6hD+UXiQ3ikA/cMCP9crsdZJrvR2przfx8tAw 4f4LS+Q+cG1DCfEt5Nsn44OxfvspDOoFT8TM34MwPKO58JDoqgG8LMRYPOAnJTgGVcLF TBIA== X-Gm-Message-State: APjAAAXkQ8rVbrtvruPImttcOyO5EaYIg2ktW+q9L14udT7ShjXITt3d iummBy2ijliKeDSLRoyWt146MDrTbws= X-Google-Smtp-Source: APXvYqxgcMg5+46B5/CuFtNg46TWxi3+tDKnUEzKYDXPFhXOwSz/aoGkKcTu42mIlwXIvEaBh3gtVg== X-Received: by 2002:a17:902:d88c:: with SMTP id b12mr11323181plz.254.1571420674653; Fri, 18 Oct 2019 10:44:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 02/22] target/arm: Split out rebuild_hflags_a64 Date: Fri, 18 Oct 2019 10:44:11 -0700 Message-Id: <20191018174431.1784-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::644 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571420891; cv=none; d=zoho.com; s=zohoarc; b=Homx9rEA3IgWkMGb8vDZeTD0j+G7iIVFCB7B5qSML1OMRgAAGzwHka75KKCDLo2Dcjuo1Kx+gP/6exuRHaZrXMqRYwYFfKZKpGrEsAbt2VSC56/Z5IJiD/ocH05d73iE8rHPZu2SoOZvoKo0Wngj9vSGhPCiX0lwJLl8x1n4BLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571420891; 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=mj/Q9flkQOKXCp+7MM59xsc818CfF99maEAG2R8hGfxMxJhXz6pprOYB1gkDPlRWoT2ZJIit08Cy/rNuIcN/SxDkGprTPRsoui6cxIqJO8KIV5LzUy/QhmvdLpdY86fQ4nt+ShXVspJXCwEEpy21cIRwXqQkvib21JfbSdCf0T8= 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 1571420891287234.2319024755335; Fri, 18 Oct 2019 10:48:11 -0700 (PDT) Received: from localhost ([::1]:44220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWMC-0000Mu-3N for importer@patchew.org; Fri, 18 Oct 2019 13:48:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59070) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIp-0006P9-O4 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIn-0005M1-ST for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:39 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:35084) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIn-0005Kq-NG for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:37 -0400 Received: by mail-pl1-x642.google.com with SMTP id c3so3197440plo.2 for ; Fri, 18 Oct 2019 10:44:37 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44: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=+UgAJ6EhcwGdb7pezBRTrZ79eaC+NjRs0dqrTWfzTFo=; b=XlSNcfVErnQtom0GJDyUW051sL+xfl4993QiT/Izb3Ol9gNuFHuxiuVohqlNjAQ+OE zXTrPvaoTrd+PB4iEhEdvRrzMcFTRnYLYMvd5OdGWpKewCpDx7vOnAvEjHALLuEMdq3i g6oSmw8JPpnS+/K+u1RMC/xBpSnx97gWZcPom0ZoQLCVgJKOjyOjVMwd9ypsfFEBJn/2 iaF5Qn636yH/0x/patzvI1XMGzC1SCr8enowIZazAXTH/ZNaOh5PiVCCs+dd5pdCbbQw ViRY0rdo6TLbmJNk9lJK5Py6vMUpXVQyh6LT96dCpTic4yT6UK4EwL/47GgqCz7SdR14 w3gA== 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=AKEdytv+5qgdDQoaxmTwbAcb8xG18vxZoSRaJwgPnVTrDjPr9RdZ0xH+lFYN/AF/Zz tU7lvSDZj2+QLxNb0cQS4lw1v0avuwdxcUWPjFfoCnoU0TlNZpOOEeRb1PjFpJ2/WbZa Dnc1L7szYdIn4JP4NUZsxLxXvIL8tXB9zC+8SYMMibIQC6KM/xiczdJPurN27XRRDfM7 IYssJCZOz2URPTrOtBBR1ACmVv4fiv4gEDlBXQYPawP21keKAljjm9r/tNXF1IibzuO+ YOXg2YCU94Vm6vYzM08nVk13IyUV4PHbv3WCgSouGKVN5vqCb1Za5zvyNktYGo9Eylvn v6yg== X-Gm-Message-State: APjAAAVNpcDb35aVrs/Fsh6Eh9S6L8u0Ya5rTDPLH4I2kBVGt7w6TqHt 57+eujmHXjt+WoXuhXAQAh3ldYhrHao= X-Google-Smtp-Source: APXvYqz69a4CPwAo0eTu6B9qVkn8iJX02uE+0/tfuJ3Th1Z1TuXKQnp+X1StAZNCFuh1g0l926LnYw== X-Received: by 2002:a17:902:8507:: with SMTP id bj7mr10594199plb.73.1571420675884; Fri, 18 Oct 2019 10:44:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 03/22] target/arm: Split out rebuild_hflags_common_32 Date: Fri, 18 Oct 2019 10:44:12 -0700 Message-Id: <20191018174431.1784-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::642 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421517; cv=none; d=zoho.com; s=zohoarc; b=OG2J7xWuegKqtqs6dP415zY1ZFsrlViQ+VapELme+D5qExhoLYJ44FW8KwredvWloGHHxwolTOAMknOzK6seiQeCm37KJIXppqmP4IsPvECZIieMujSImOejSo5lK7zuvP4w7ktKlyAgv3esACfcQXterzx2CRyNFaBDLIvBBi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421517; 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=Swy9V7i7y1+WxK2X2pRcr5WQj2ywk9i2Yjparkw8TRgmP5EPmRjl3HVqDI8fXIv89SL44h5GJMa7rMI3B26mm/lSSsCANEQQaldP2o1KWMfW/VjeWuUE00Rtpa1HrzHoJXTYeN3a0W57GPiC387QCgPDF0P181+kk4XJq79/q5I= 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 1571421517740724.3843356238596; Fri, 18 Oct 2019 10:58:37 -0700 (PDT) Received: from localhost ([::1]:44456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWWK-0004KE-6a for importer@patchew.org; Fri, 18 Oct 2019 13:58:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59145) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIu-0006Su-AU for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIr-0005OV-Mu for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:44 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:45045) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIp-0005MN-Lg for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:40 -0400 Received: by mail-pf1-x443.google.com with SMTP id q21so4303166pfn.11 for ; Fri, 18 Oct 2019 10:44:38 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:36 -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=pan73PhXQV5z7gdX5CbXBk0Q7XbJeIfWLw5XQZxD1KJU6n0g+opRjZLEB0F1X7qa/K N0RwSUbCterjFa2wjt//ev4aC7x0heMSEIswoDQcxozmjtWy26NttRiR60HsWgrWoT/4 70JHBQg75hYuCGs1vXemUd4v2R0Mzs32ZGzjaX6cXLqXZGlHupex3O/71JX10niXWCxt 0X2jmhxxuu1xYo0IoUxcCTsMHQIE1FzDA1rVk189BCoFsetkECAg9yH8xZpRHmlQjZcX Qd3dcV0uxSlCgQc9/RPDpdDfqOsjyQID+6e1DeApnHxBTZoBvADOvfzyqgnwp/grMV9H F6Lg== 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=HHYzv6xo76RapPpISdkOPLYT4XFWLkdY844SEE+4HMUPPLXzD2fbBWU30ptZFd6ljc DS3GEjpUvGv1YBOXIHVtY0Fek75JAwHPClvKIGluaEDAJ40jHjTDhxtN7wrdBqEmiIuQ u4JbAWpv1S/0GsBPb8/qRfUfr5LrpUUYlxOJ6PIVcaJJSlvf3P2VeFF1w8lKotcKaH8S yo0YTU1xOx96qVdNQF+27DWm3w+TSS8SUCiArDN5+4tE1d44IZc9uxv2rRjRTPAAVElb 0MRpcgHV5YqaFTXlYMo2RkfZ37i/5X5oGwEoboTDLF0nqRroAhmGQxuuHsWnTJ+EeXMM JIvQ== X-Gm-Message-State: APjAAAWmPVYv/bzxLJoXVXb5Y5tVwoa9ssvdrY0L55IkexTFPOpcb+c6 3NAlIsb7DM0bosObqj00wk9eP/5iL/8= X-Google-Smtp-Source: APXvYqwOQL3oNNTbkIk2QS9IEKoG9MkhOjm6qduvUIuxr21Dp8+6GX5oWfa96jzl3RfWBwr37jRXaA== X-Received: by 2002:aa7:9156:: with SMTP id 22mr8171150pfi.246.1571420677165; Fri, 18 Oct 2019 10:44:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 04/22] target/arm: Split arm_cpu_data_is_big_endian Date: Fri, 18 Oct 2019 10:44:13 -0700 Message-Id: <20191018174431.1784-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::443 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571420926; cv=none; d=zoho.com; s=zohoarc; b=AjX36PSgVL2xNwqVwpRAKEDHpKdaD/0QgaZ8OsA2j5T4QXsS+8t8SwBnX5hDQ6spyciqkLvqL2ZECzd9uAUfGLEYwbYIeIsDKzIIcGdmV9roUM27L5qV8uzuIUsswP5B9v3Hb91yLRIbSmJQpi7Xze6LSqbSg/CkQCgkkbzPLDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571420926; 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=X2XLNKXICLNBscgVy+E4ZPx93JHrqK047FXnPebaIpukR2BchHFSQAuZoGLRzRgcE3CvYGlEsgeJjRzkvTC0R3nizHhqTRl1GkcbXsNsCh3pcYfWwob/pmRY57adkevxAq1ImMyyKO1jXtZh9O0MwNl4f5QYo42MQACDcW4wV/Y= 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 1571420926086105.78968558126996; Fri, 18 Oct 2019 10:48:46 -0700 (PDT) Received: from localhost ([::1]:44230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWMm-0001LU-GD for importer@patchew.org; Fri, 18 Oct 2019 13:48:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59147) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIu-0006Sy-7g for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIr-0005P0-R0 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:44 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:43728) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIp-0005Ml-OC for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:41 -0400 Received: by mail-pg1-x544.google.com with SMTP id i32so3742545pgl.10 for ; Fri, 18 Oct 2019 10:44:39 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:37 -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=kFYtkl62zY6PW+luGe9TZwJ7mEStN2EUGHwVIjT7YnMEr1NtqavFgtXVKH1l+75sRf 1ixz+lv/bl0D/bRyYRBsTHb+7WsT4RNjKbWXP7fVV9sMRjqJvhARthjNdfKF3iyI15Qj KkhU6VJHJuNpAJ+XUJc7L/fuUnwey4LH/EfXazpVwvmdAnTYfS5zlwxSQty/70HflDcn 96Q3ng07ztaLWfHXYuUBYQmjl0dE8dZkiLbPLd6fZCaUkFmTgmecEBiGl5PlwkGSx8lk gsGpcqeE/7A/7A7LeInXQBB1+nbSrAtMHj+wpSgLVEp2hTyW7wR4A+Qh5NkrCBu+/H5G bECQ== 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=YdR4Gy59ovE0psWW40T/baMwtwgeZHiIDEWZCzQPF6qAh35mNxforYKSEDVwCRauDd 5gEG0ym8XBKwpTjmX8TOfZGytdd9jdSoeEZpIyGcpD6OZDIwHPmYTtXxqVdCOBJ8tXgg du96rCg9LWG+mFf4u93dLeWz/L8dRQJA+7NBa19svZ93Y1GFOuKA/d9bjv5Wz3BJGcK8 Ijk1GjJFsdocydO5zXlYOguLLxWt/83+A+29LhHLdG/8oNEDxAgTfP440MvWnCZp/F93 URUd+60FAZkvlR6GjdGZzCJdFTI0diy3jhRlV9O7hpWqJY4xdgMY0DGhdRpjNviEPwfn XJbg== X-Gm-Message-State: APjAAAU9Nfjf/dy9fId9yxHEKHgp/I+XMtfZUsdBiK/bR6YYjxRXvem0 Y+9iAzJHoEI/rUPxLkZXy1ZtOCc02dA= X-Google-Smtp-Source: APXvYqxRGk3ekGXtet2DVt9zA+r68xusBL9gqOdmANCfXFgpOwZQpd6bqYj20/Z44zuU89An8IU5rQ== X-Received: by 2002:a17:90a:aa97:: with SMTP id l23mr12570299pjq.7.1571420678183; Fri, 18 Oct 2019 10:44:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 05/22] target/arm: Split out rebuild_hflags_m32 Date: Fri, 18 Oct 2019 10:44:14 -0700 Message-Id: <20191018174431.1784-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::544 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421133; cv=none; d=zoho.com; s=zohoarc; b=fWiuILWwsuLHJ58KFLEJXpKtvbs4YpFeoiEKTs+AXOqj6CTCD1WQiKZosVsylhpi05JigZ0281V0tO1l7W+z0aKN8qlHhTQq9ShUb9M8t+He1LyiGh248um9Wxw4iZ5iRoybK5e13tYTh1iQ1EX6Gx5ErA3S+04fpyVT9/Fy4oc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421133; 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=nZJT6tJPkB47sY6hzc2rgiKcSxpL9bEY7Pdu6RUhrl94tvqduAGHAZNgUQhC5DR7XBP+WyII8+0k4XwJpdJ27O4Ta9ktaQSMNhOChwpbyneKVvPkdUEIhFYKCfpyfxWhLlLfBe62t5sWp+HJr+650vMXjnkRSR9XmhmodKF66Mc= 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 15714211330331008.710840859433; Fri, 18 Oct 2019 10:52:13 -0700 (PDT) Received: from localhost ([::1]:44304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWQ3-0005De-Kj for importer@patchew.org; Fri, 18 Oct 2019 13:52:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59153) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIu-0006T7-Aq for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIr-0005PE-Uh for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:44 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:42902) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIr-0005Ng-PI for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:41 -0400 Received: by mail-pf1-x442.google.com with SMTP id q12so4311301pff.9 for ; Fri, 18 Oct 2019 10:44:40 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:38 -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=a/O1FjpnSDTBNHQcZsOznehraztcF4C6rwZ0hMgYS0GxM0Q9Uv47pb7bArYiHwVrfM egAxl6bcj0Bc42hadAgWZBDyFGB3rQTNYK9rIiw5YbmA+nOgYpI8jn0PCU4ksoAitWzl LdoePutqQzeq72tt69Lsa0r4mllzQ5boORY8Jor9ZbL0MN8wlvT395OOnWriGRBl0f2B cPJaHEKQp5kRTlCYWra4qFZrPqWwEVEkcOxAVpOWfK5lWKKtcOoYHmBJ9Bp+pdLkSKgS oe9bnAZq15bf06y6YCp0Ec16BX0hZKrrtE++caHrXv2AUBYJ4ay6MAu1M9jPsD8u27iz BDLQ== 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=cGgcpIB5tKurg40aNrSz0+sHqNFCeieYfu7RSug8bP3lJLNfAj+NkSzIbqEBjLgyar nlrUK2EUZd7AU4uT1gfSzc/yCH1jla+xP7fXylNiK5GASCSFIqFvWhKCZm+5Ql8sxb4H M26g8/AgIkrf6CX+4MpDn8TSJ6KjQ18aTaAw31ZwxZQ1rjOFDEVzCj6boYA/GxogvMbU Mq/gY2njltdhwYe9ZvEg1apLFvI7+rIi7bNM5z5NMA/kwrVj610GMLZhT3m6NIv/dXw9 JhJnlXBKp/P585tOnx0FUflSIjO/FP656cBXVB7CssHcjxTAQ98/zBMO1MoXO9K1DC+J kHLQ== X-Gm-Message-State: APjAAAX3FUEtpF1oqH/X1oesqXMM14Y4diVVfdG1CDKRVgE7AQ6f/sY1 gYgyaVkCckUWjbUzx5brPfCPNY4qKig= X-Google-Smtp-Source: APXvYqw4DDetWHJk0AKxMja5lHldRP/1vbsNWG3YISsrohV7ldYOD3LCuyqoF1bmYaQXscyfYv2/5w== X-Received: by 2002:aa7:8691:: with SMTP id d17mr8194090pfo.152.1571420679438; Fri, 18 Oct 2019 10:44:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 06/22] target/arm: Reduce tests vs M-profile in cpu_get_tb_cpu_state Date: Fri, 18 Oct 2019 10:44:15 -0700 Message-Id: <20191018174431.1784-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421220; cv=none; d=zoho.com; s=zohoarc; b=IqJwPn7Wa0slBZ58XyYqBpEU7uKwA9h6Fwy8igWuEhlrqkdhZbMeYp4HXN/3IkJQ27tQxletMb2AnV8VNwyYkdPPYn6QgpWu7+fpef2b45XjTyE4r75wyB7+rzbXPTdRbwrp0uIRPg3zIvE3vTuw3tV4H+2CIYVFkGH5pTZYxlQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421220; 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=hFTfS7rrVhErqZM9AjlDUSN4vXNd6lMPcmUiSGXI3xCK2Ap8q9XEg7RbLT/mKcdaBDPXOEcPrHv6sW6ltZR6EIheUFJA7EMvXE/ZIOZKfyv2S1lmCAZ+WvLMvHDNHBF8SAzcPIH+2Pez+c50iV1Ax9AIdS2xMfsuTkR6ONTnEsU= 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 1571421219967993.7647543014493; Fri, 18 Oct 2019 10:53:39 -0700 (PDT) Received: from localhost ([::1]:44334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWRV-0006xR-LI for importer@patchew.org; Fri, 18 Oct 2019 13:53:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59197) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIv-0006VF-Ba for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIu-0005Qs-7M for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:45 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:33303) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIs-0005OZ-CI for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:44 -0400 Received: by mail-pf1-x443.google.com with SMTP id q10so4340048pfl.0 for ; Fri, 18 Oct 2019 10:44:42 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:39 -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=CmQzsPrvDUP7TGC3Xij7NV+0fVY9PVR/mErfUMpWnbVHd0/oFLChlsIsrlZY7Zwrfl i0eRuvLYsOB2lO3rnSYAwmuA9V7NX7MQMtEdJq8YXwNNIanQSEFpN4T1Tcj76WqsWRSk n+x/LSuytWhOfARUfG9zy1AzkFiofTCTTyk6lcEDwvk3CN5/knom+NbGhKMbdE5/SqlX 7+JDx+BJLKau+8aK1NqnekbjmsQ9R62XHbnmUoVQDyEGp2gm868uw0XkyqXYt03+fulh LWKwCDGlVkAA0aNQmzRWtxLPIteb/oupb3tc/vgYmWhKKMYiR7JL6HVxZBEQX+kLSk/7 8v/w== 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=hshnB8PYALP3LjizqBsOPWaW85gXjCezx1gl+cHzkFc7mXc79560ggrIxG75BMkTkl bI7K6ASwZ0Bw1T/SUye1yC2lzMtAAxY5omIeftEfN468wgXj/krGK8FJetnTBXt+zZah x6R/0kaWl2+iq8ClgO6Wz2tUEISmrG/hDCcfBLJK1LbHEqNKz0JbDrR7/UC8xNGFYu8j 48GamPyafuuSjWIaaO0fh6Q9Q1b5c/YTajvnksVRWK/tZmSf5vmD27AbXp5yyaNWVpGB kLOIyJFg6+lfdMHxjkONImuBFWysPXMlscr5Y4EQZu1KcBXlbF0OVJqAFhI8Fml7ECvv Lzyw== X-Gm-Message-State: APjAAAV+tlGTkqQgOrqFwEtsi1itjdNVUWeBs4MD/wSNj9v2nlGmlqoB nTEkzyEGCoTMWjWLajIiJ/JKzSURXzY= X-Google-Smtp-Source: APXvYqyB6TfaFS2GJV27stjPhOaxcYlMHWRoS0gl9TVNgUKBUm6XuIz+7hlNPPsF/0QwQjihLEtOag== X-Received: by 2002:a62:6842:: with SMTP id d63mr7967828pfc.16.1571420680836; Fri, 18 Oct 2019 10:44:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 07/22] target/arm: Split out rebuild_hflags_a32 Date: Fri, 18 Oct 2019 10:44:16 -0700 Message-Id: <20191018174431.1784-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::443 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421817; cv=none; d=zoho.com; s=zohoarc; b=SU7PP3hSyRd7D7gD0tGs5xyF7JQqotBALztnu1/qnbe+y2z4T7bZo0i3m8xl7Mp+n5oPmFThXsKXT2A1zbAYjQhadPCcCP6atUBwVf51dxhufcnaS+hWbv0M+3Lqk7LaZQzdWkjjw/9JEAuspDnv3obP3Z6etbekRGZAxdrPfhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421817; 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=iJZhY+e+ZHSah21Qv4UCozh1but72zsgVXhswd1+eXOnT6jHerjL/5QDmxaaDERV2a5ICeQcnlFhEUeEMfC5WXUKy8CM1RtKhfojCE6anP7mNuFSPLY/WqekkdiVvP9XzQWp5OCf/tOwxspJ0EoLpoOBIqnWDc2Ld5tAy4CINyY= 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 1571421817083397.44043750499725; Fri, 18 Oct 2019 11:03:37 -0700 (PDT) Received: from localhost ([::1]:44554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWb9-0000SL-42 for importer@patchew.org; Fri, 18 Oct 2019 14:03:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59246) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIw-0006Y9-Py for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIu-0005RZ-EF for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:46 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:42904) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIu-0005Pq-6Y for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:44 -0400 Received: by mail-pf1-x444.google.com with SMTP id q12so4311358pff.9 for ; Fri, 18 Oct 2019 10:44:43 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:41 -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=jqqk+gJiZ9YrCR3dy0o3Lgiw7Z6ZqhF1P8W+cy4NtzomqpZ8PrM4mz/jL6j2JhgsR5 HxiaSaMqOiq7zTWCHl0SU8YnfWKfBh8Rau+7AdBfO00MPF7tCs1D/nW7POj3E6RR4+Np fvCuO5qo5WDIrHNgR2CL6kUZfBP+V1HA6e8McptspXkKcsXDJxDCi4edsDzua71ZCdsc +4OwL01JdMDficT9qtIHihX0x/W6TZ9kchFmNVS7QjKblCnpR3QuWPYoEoJ+v/3u6fYa QOFbuZzbGa1IvMe1rUEXsXulOD4ZUJMSU3Kl2PS5ECL2v5n5gPqxEJQCa3zcxsXR88pG ZHPw== 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=XOiGNherXt8KTVN8r/CoFT2BXlj0kE9rvTG9KQj7WbUfLj8SZ/u8hfEaH3E3kxsuLx 9sHocId7eDLdt5pC1zhGy5Ioa1LVqraFlOcnoQEAlDq9m+IVHElaRzi32mcrLVLJFFmm kLPMxOihc/BBVYr+/gS4Ks7Bv6aAb9dyX44O+rX+2bq0iC9SLki372xVzZXnqXYjP1S0 3B7Ylngn1ozb91SIjtqxC0d56CNxKAzCRHluevTrlxxU9dV0M8WIvfL2A0ClgwE5z+Fp MvjVBfIoieVxSTN/CvMxQgcQudj41+fDn2hHcBKkWbAdJC8Hk2p+Nc32iR+7Vlogyrqt jOHg== X-Gm-Message-State: APjAAAVsALiqBTI+ig6yp/r0cq+dRVB+GUBuSo0Nj6PKxuSzKvTVha1X BfAU8vrrJaBFwtsM+uxSDUuqHznC0R8= X-Google-Smtp-Source: APXvYqzLQUC6hh/IqxoPtGDjyO1VhA5GgyP8xz1xzWcTx/3ot4w+5tTZnPHPfizhpflbjIvQy1ggDw== X-Received: by 2002:a62:b616:: with SMTP id j22mr8036487pff.55.1571420682064; Fri, 18 Oct 2019 10:44:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 08/22] target/arm: Split out rebuild_hflags_aprofile Date: Fri, 18 Oct 2019 10:44:17 -0700 Message-Id: <20191018174431.1784-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421134; cv=none; d=zoho.com; s=zohoarc; b=V1MiF9hIxvMab0ltDEZjRpbVVuuZE3C4jRDpralUM+bsdp33RndlGbtbGHPRbyhj7K75dsZsfGGATspPWE3r3X0puTqImcSrbPQ+/iEjfjDTqnFtoorc2SCbuTUuY0gg6jCFYFGb+uZE1Zsi/NmngDmf9XA/LFuYgRwEV/EgS+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421134; 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=K9FGjEIabLu/hYu2hCZghcee0/h00Cwqv0vuTiLHQgklTvSXyRJxextCgtbKu7+rrZj5KoTXLnYAFFYU0oPC7g1n1GyRDT5F/4RtdUzvCkJvUAbvggd8IBNi34RWMunujeYQV34cchI1BOObmgo7GhUEXGUi+VzdqP1BksPmoGU= 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 1571421134454338.7175816829025; Fri, 18 Oct 2019 10:52:14 -0700 (PDT) Received: from localhost ([::1]:44314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWQ8-0005MS-Tz for importer@patchew.org; Fri, 18 Oct 2019 13:52:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59248) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIw-0006YF-M4 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIu-0005Rr-Ri for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:46 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:35604) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIu-0005QW-Mj for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:44 -0400 Received: by mail-pf1-x441.google.com with SMTP id 205so4324305pfw.2 for ; Fri, 18 Oct 2019 10:44:44 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:42 -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=XRL03tO8pYpwmYBVCiyu9Lv8vVDOHUC7ETMWAW7W1kc8cD43sIBCE0sWA3+7pu2dB7 o0hkTWRIMmT/oMAPLYyHMBhvV66LFxSnNM0JYwwXGSQC4mOb2cH7Piku0f/HWqAzoz0j c8ViFL4Q+ohaJW9+58VcFaGAc1IJl9NEeddcAEZbpTujNH8WHR3HUc6k7Z0C8wdf5s5N MpgJM8k5CvUqak5s9CyqlLbClfN4BtqoUT8Y6nrPIgxR1vdImJUkBqQCLLZo9RLD7WXC /7UfyEoLA9MePfONCv1BsJ8FRSzf6v9WPYXSj4rSzE2Cc0KP05VNs2SCiXcs5CYZ1ov5 xKgA== 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=aosH+gi21GO2qpAUtAUZD2SNezPjJu9XClpkr9MEAdJd2lmRJv6X6WWP4V0CgBdPWw XbcEWlVCTA8Jvum/sjBS74/s6NxovkAtPkKIZsOQ0aukqfH72Odo6cZnf3fIxoMLpMOm Rc/4RTAYOmCynxqCMiNRULeD9/1BlY9RkJOFit0kzGMHv3fJXoZkyHHDb0mHcEmPLHuG vxchvWcTEsfT52lTXi7wNlMrNMLcS10ZWXIggX9/HO0fixX+L/E8nPNu6Tw+uKfuzf+r ykGaadVsjEN1TnejcdgXbDhmJgsPj8kTITx7BxjQVW/TF7HsGohUik6AP1RM21tY2Ugp KhnA== X-Gm-Message-State: APjAAAVKwaoOzqdBusujYVuxZB8hpvQIM7qQutrw9bRSq7OThQsQhtc5 CNhbK7XPw1WadmIAfQGrlV5EFhrZSmk= X-Google-Smtp-Source: APXvYqytVUYW2cMjAgUhtXmNs96M/WjGkTPmKysgz8cOAx+n+I4gJA9n9Woztx7W2tyHhTIEfPZzvw== X-Received: by 2002:a62:b504:: with SMTP id y4mr7982540pfe.124.1571420683357; Fri, 18 Oct 2019 10:44:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 09/22] target/arm: Hoist XSCALE_CPAR, VECLEN, VECSTRIDE in cpu_get_tb_cpu_state Date: Fri, 18 Oct 2019 10:44:18 -0700 Message-Id: <20191018174431.1784-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::441 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571422024; cv=none; d=zoho.com; s=zohoarc; b=mHzw7z9tpT8YVlSdmOjRrBoWH1i9t9ynE3V6Nne1SgwiM8ZotPSGGWBKDt1cYG4LSkjM6brBoXS6CpKdaOoTGhsdYIUF5cgisAlwefjfnxBFSpwgnH/TrsyTXvNumRfsfFL2rdGMKqSjBrZOfR2AApGYg+UI6JvhMaHKseTCMuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571422024; 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=KxNz5GAcHsgdoD3KDrlNSXm71s+rEU35kzXNaIjlwObkN/R/qe2QO/IXCxzGDuQsVD8up2NNzLusEUShDkMKccb9uLLwBt0Ga1DVmZ82JH0bKBJgz0pa7V/g/6x1QHAveqEPbVAO1R9lp4uc0xXROIpoxqaT1Lma+QEIABw0ZHI= 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 1571422024936675.425114896847; Fri, 18 Oct 2019 11:07:04 -0700 (PDT) Received: from localhost ([::1]:44618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWeU-0004J3-G9 for importer@patchew.org; Fri, 18 Oct 2019 14:07:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59256) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIx-0006Z0-1i for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIv-0005Sv-SA for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:46 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:33113) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIv-0005SG-N4 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:45 -0400 Received: by mail-pg1-x544.google.com with SMTP id i76so3773056pgc.0 for ; Fri, 18 Oct 2019 10:44:45 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:43 -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=pWIoIHOzUUgQIGhlSzHdOdcPTYTWLBK97r2ZWl9k015vOd2yzVVP+iljAdQzhj4WBj el2sVOFN3Gxe2v1gpdI7NJrlWBsEvCZuegNIlLif6TVPt70MZpkCtOsYmv4mAl7Il+hV xZFZyk4eP5/ytJB6oC1coEAbB1yMSBYqOoX+Pb8Ck9Q7tzvc9xIalZtyB2eolkQq/XzB ZAWsZMOdGojYoCjCNRBoj4KEPRRBmuo7qQyCej+Ka6usaFP0NC4vUVqjWYtNKfGRmfLK iEGsBErXfpg6lrZzzTftIiNkSSRf8M2kmwSxILqxBPlDXBQee/aggExOmwN2Wuo2a1aY 9eAQ== 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=EbV8N4XRdnQs9w60Eja+BC+g6DSihvDSf+LWDmYcPoEVewPC7eyfCxl5fn5624k60S 0BAI76JBqtU6PQeVUvsJzMfc+bYy1ucDIznWDvwB0jaqPx5kSPWkj/8aRricaXNxKkPb 3O/0b3aHtoXLbiF4WmHi8DQMR3vQNSciwj/H+TiCQVWQSx2soAs+QxmKXf/RUtDqcR2t jFoXVfdMC+tc0qESU61uGLsZNQCNQAqJ8vWYw8B1SwtgAcOEmgv9NSv9luB1BnHuPYHE 7rhMO1p9UimC7OZTVniBSUjXkRTE9k0ACsz9Hu74CJH27GmPGFeJ/MkoKvF0NFkKeSsa SQOQ== X-Gm-Message-State: APjAAAVAYVPQonJS7NduviscQtTGGwWycqM7Som9eZrzrNN6FZz6BFnt 89veoCD7dc+KgHRdxUGPy/PafAwCqAM= X-Google-Smtp-Source: APXvYqylbdzzZzn2VCWxl4WoOB9V4Pt26whNtCeqdGiQFyJypjkj3Ld9hAQ8eNIFhW+ZlrjujThUbA== X-Received: by 2002:aa7:908b:: with SMTP id i11mr8245647pfa.186.1571420684462; Fri, 18 Oct 2019 10:44:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 10/22] target/arm: Simplify set of PSTATE_SS in cpu_get_tb_cpu_state Date: Fri, 18 Oct 2019 10:44:19 -0700 Message-Id: <20191018174431.1784-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::544 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571422180; cv=none; d=zoho.com; s=zohoarc; b=L2TWi1exqp9E57UVmskJBxrgTIlOj2L5bxi2seCjGOhOv3/gy2mJTe9IgE9VytpeaQj8Ttx9blw1qRnlK7BEaHRh4tLnQgE+xQ1Ma8FXXGHka0RYdF2f8u7JbfZhLh96FO+O/bsuEEXye2l7rBJcWBJlaiT1jPaZ76qGGPCIUA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571422180; 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=BPQsJCj/GsJ9G5zDF8N+4NCZGXE+vCyN+83nzzewQGubzN1g1PCvS+jEfu749sN4iV0hojNrwrjZ5ieQNVmR56LG6kKHvZei3gvzN0cfE0HIFuojvYbb3H0Nt8a6+f2XyKgxVokXlBkHX2WBaRE3mohwwfF8u93hwniAGrs3Wgo= 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 1571422180391856.9068994866017; Fri, 18 Oct 2019 11:09:40 -0700 (PDT) Received: from localhost ([::1]:44682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWh0-0007bU-8Q for importer@patchew.org; Fri, 18 Oct 2019 14:09:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59297) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWIy-0006bk-IG for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIx-0005UM-CI for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:48 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:44718) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIx-0005Td-6g for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:47 -0400 Received: by mail-pg1-x542.google.com with SMTP id e10so3741485pgd.11 for ; Fri, 18 Oct 2019 10:44:47 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:44 -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=X5gHWOT202VQRwzSmAviUtQdEEfz1DuVcXPtMUdkmFhvtmwVqWeZSSA6EuKgHx/ig7 IJPgcibeDPYPIfNviQe+aAwrVhmFYPXtVClBAy6yke4pVKHCBywOAzqCKLyLsEpbrRLZ aZ1pnVwGs1fMSLkP9yxe3rAjbIFEKeaTZy2bHj/6czbhpHCj1Eiqkqg2uwypAuII58jA sCWh9rBZiZc7XWufeR3G0fq4cG77JJk9ycnKofn2OVs/RVUzS6uXZeT0jd8NRS3MuJx/ kKki63c8PKpmdPc8fHfzVfpxdQh7LHh6MupU11Ba1Un3ltW5wkgFa3ZqZUldEH+SaQVi wC3A== 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=uM+MNuz9uAuSigx135mI2x/ftGePpiMmC7YEeW3kqhjBZfEZGt9Xe1mQvicavfgHHt xgm7kLGOOLgqfx8cYcFzikAHIq2OysCZTtfi55I9HZ2m/0PE/onIukD5ghQRVOoTmRq6 Yq78fmeRFsLvDWh6TmFQH1M8+xpieBq/P+Gl9qRKuq5QUf+BypQMrMrs2MjOKwr2a62v LhrX9+o5QPIknbN37dCHZ9wY2+AULPPclnr2G7Sv4+aw4nBySheuKyZjMubijgkO/bI6 YOHZ3Si15YrYwoJAtHOnzt6k/Dp8iYYthkn+eN9IrMFaGHcIlPlnHTfW8IMZgiYqEUtI /PEg== X-Gm-Message-State: APjAAAVs4he1nAA9jgjGSL4xRaqigDNDnkNalQF1FN26/a5/DHpk3ehN h180zqDBdhy6p8F4WMpWz3dTxGKz/54= X-Google-Smtp-Source: APXvYqzrMztr0EtKpXatimDu0CSZtbBxsY2M0Nr4p4GLJrNlI+48Y1uI/6xyOqrIAdtSWpVjfuxFDw== X-Received: by 2002:a62:ae0d:: with SMTP id q13mr8199450pff.53.1571420685722; Fri, 18 Oct 2019 10:44:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 11/22] target/arm: Hoist computation of TBFLAG_A32.VFPEN Date: Fri, 18 Oct 2019 10:44:20 -0700 Message-Id: <20191018174431.1784-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::542 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421322; cv=none; d=zoho.com; s=zohoarc; b=D7IyNhjBScuI8XemWRE5Cm8KhOGg1PSL1WCz1B8hphdjH/uMZd5rXyQPo7Fugh+xmDeuwgRqIv0zPZGLtkny0JswMdX9/OAWei5ua7jR992Nfow6a+EfDGkDeWf5V3ZInN2CZf0QCMc8BKCxAhM0MAC+VOsmKKP6lDmxM4sCHR0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421322; 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=X3yc3ymu3VI3a3Dr50Wv2U786Bh7XA2E52wLA8p7W6OPTk80BzevKVfHkp6lsFOlmhyd80ZHxnLhZgUIp0kp+q5EuV/owI4YfKq9VqLgwOMcnDKyjYqdMQjWor5tW9ggRMrNAqbHqjQIEGJc37Msrn+jY01ILPiv1qER6D7AgXc= 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 1571421322283991.5567627481634; Fri, 18 Oct 2019 10:55:22 -0700 (PDT) Received: from localhost ([::1]:44394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWT7-0000pj-Sq for importer@patchew.org; Fri, 18 Oct 2019 13:55:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59321) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJ0-0006eQ-0l for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIy-0005Vg-Ma for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:49 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:40952) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIy-0005V0-G2 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:48 -0400 Received: by mail-pf1-x444.google.com with SMTP id x127so4316165pfb.7 for ; Fri, 18 Oct 2019 10:44:48 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:46 -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=FPZScvTzDGijzfsnuo08ASLnDHdJ5jbt9rzyrPrCCvwHqStJdW3b28sF3atJoDgM8O 2xLzYSURiSEYnOVegGcspyTFAVSYtNIi21D3A2jqh53FPWgc5bg0oUh8t2pLdG/9EU2E szPMfQqOQWIOkAMdWiIw1Ds0ggq/9yoyPkIbgC9gnXR3UcJiYTaZl0/CZ1cj6IlVaOex 37WpfsysgYtcKtMlQEgP3Gxv/5Ug95AcUFjzq1RyiNUoqVBfDsdpafRMvROvP0PZQTaD fQtat0CS4uDsj17m6YjnxIRZ/Ftn9rjNSxOxflAKXPBcnRPn1asEWw7k+GCo9t97Akxq NlNg== 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=PZX8S2lG100Wmx2ch+NG/G70CDxgpY+DLRK0Fg0ggRdwOOVsBLh+PhBn3HbWtQmi+C CmX04OepSmAr8GD1QJ49Qf94YZNV9iR8KcvL6kGFHxu9iuVMJUjj2ckQLATiAwIZSzzY xMQsd2a24QzLd70d7OWjriK3Y0Bki9ZwcLacSf1x6BrYuTy1zvagoxfGBRgnnf6kXZcP zOsR39b8IN/VyUP9n0eaXP8gTKkbr4pn46h8L6FHPZe5gVHKEzFN4Ubwod++khslSLco DKK1NPSw5eQ2nt8XjqQdiwUnqiFJ4ZNeEWHZTWCsUwL6iXW2hzaisLiCDpU0dcYZ4Ukl CR7Q== X-Gm-Message-State: APjAAAUambk4/JB12I2YYFy9JLYV3bzUOdLOsSxPoNVtmK+jFO5FLa+F mKncVirCKG2d0F8CLMdLdvrRpbPZqcQ= X-Google-Smtp-Source: APXvYqytu68A6TSchkWFuCUtRMprxxoCQHbhKlWOktVnDcrG+vmVjoDHKoL66oIlYsXMVO24j1mLNQ== X-Received: by 2002:a63:3d41:: with SMTP id k62mr11117117pga.129.1571420687048; Fri, 18 Oct 2019 10:44:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 12/22] target/arm: Add arm_rebuild_hflags Date: Fri, 18 Oct 2019 10:44:21 -0700 Message-Id: <20191018174431.1784-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421408; cv=none; d=zoho.com; s=zohoarc; b=f27shNRQfK1LffchdWidpodf8zTTaLzKEK0HlIc4KRyucOvI+v1PsZDDOkOBr094ZAKYMIByb7qzZC2CiXRyOjtxATWNZQ9YBzMTMwkih7cEfiW3jE2bRgS5UjPQXGMz9jzfeN8sFPmug2O1QGJtryze5mDXBtWWGwR/OP8Bz0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421408; 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=BTPLBlzd4oFw4QZroM9po20yA3G15nVk4GLo+fPIkOfd9JVTOX/H8QJ1BJFHD8IiLd7AX5LrN+jH6D91lhEdz2dz4JgbGdRDVpF03Bh24c3V7Z9LNkSrIYBYykT4A58NI62HcBKCkk0oA1fv+gqiG63aIBGEu0JbpqSuZFNLimE= 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 1571421408441491.96330011689577; Fri, 18 Oct 2019 10:56:48 -0700 (PDT) Received: from localhost ([::1]:44435 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWUY-0002sV-OC for importer@patchew.org; Fri, 18 Oct 2019 13:56:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59346) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJ1-0006iI-RC for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWIz-0005WZ-U6 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:51 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:39039) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWIz-0005W6-Ov for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:49 -0400 Received: by mail-pf1-x441.google.com with SMTP id v4so4319412pff.6 for ; Fri, 18 Oct 2019 10:44:49 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:47 -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=dglCRhRmDlAuRYTGEnSfh2itP+od7kl+pn1w7imqqkyyp60rDuE+rhaxKvmhN8IdQQ MgTCl5n8s+BRdC/VmrXsz6G5l9UCzBwFECtEiIBiMibpFLUreQgN83UiYv0EqZCHAwwm jbR/pEMeuJOoIaUkFucA90yAcTMq7fuZRtZGv8v+zw2EPQVeItt0l2WeyF3RzXTLlYSO sar+2KQyzoXqe+QTFmd4Cl1thsy+/4Ny1VUoM5xxXCmcz3UkL/Xwo3wW9Nn84Lsmul1c rVjsccj+3IDTvK1gXzqhyuS096/Fyi/eFG+as9ljQ++tgcN6ha+Ia6Cms+MW1Bn20eWn zQ1A== 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=h0vNKMw6h1CyekfrxOgKUuiklTZY6fQQ9nZ6zS7zmRHVnDcyuu/+ubRj6X85SoqPL7 xQQOdXLmtwtln5iUQDr79ZnHjfIcTEhLTpCF/ruaqTxo1bztNzXwNTjdJ78A4lIKVzc+ Y/BCVuW4zJNatKmbfAkfXeRwFla58gjdaFyqFYRQAYLBvc8IWh2oI9JB0+WiAfuKDEgT hOpOPVioWjbdW7/um7yC+NY1EkCNcQe4zrxmyd1OR609/A41nrFl3r7vhOI4eDdMvTry XEtQjZzHCLQim/ThvDMrW4n/LB0grvPU8YdF/PA/WkXK28oqkJ2JKZpLBxV//LLfFHQ2 SiSw== X-Gm-Message-State: APjAAAVNNWpsJ+E8oqKDr46aiIiBvXQVe+cwLguse49atYErZ09cGDSz U7X4YaTUNTz3seaGXMdWPpZCeg513RI= X-Google-Smtp-Source: APXvYqw3IMb9CnCv45F+wNL1inKJ2k1pmNwybDQG3CIAoojmORHIEBiL47sG6ue9qu/nL/6gqzv0SQ== X-Received: by 2002:a17:90a:a407:: with SMTP id y7mr12510200pjp.124.1571420688434; Fri, 18 Oct 2019 10:44:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 13/22] target/arm: Split out arm_mmu_idx_el Date: Fri, 18 Oct 2019 10:44:22 -0700 Message-Id: <20191018174431.1784-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::441 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571422272; cv=none; d=zoho.com; s=zohoarc; b=TL81TjJj/48xHT/dpHAMQGjCMTinCYdK+RytO3WFMoy2ltI65his6qqBHDUN3wVy+7nqymzR5QfbQDcCTlN6NpTc7pgkvGIl2eheWEWCSzwxivKQfn/Q8kFujxkbxWVf7XAylWj8/82RyPLqVCb6JGgx2LrmTe8IzzMDb86jkTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571422272; 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=fpmPiC6UVscyIBAzMnudi3lZLV3AcvANyxtJVraFQBWboUzy0vu71uT4+UnBKnxKe5Xh5zrFAcFAXUGtO13fdKWIhiYJn7/GIQQXf0KZp9EoUrOybTnPkBv4Tw42ZlxcqGD+epYYQx2tng2y9mfeveFqZ4yqMryhpCJP7hT6zpM= 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 1571422272269119.47705380328193; Fri, 18 Oct 2019 11:11:12 -0700 (PDT) Received: from localhost ([::1]:44718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWiV-0001EO-2D for importer@patchew.org; Fri, 18 Oct 2019 14:11:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59397) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJ5-0006mG-0k for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWJ4-0005aY-3z for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:54 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:36178) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWJ2-0005Wz-C7 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:54 -0400 Received: by mail-pg1-x542.google.com with SMTP id 23so3765086pgk.3 for ; Fri, 18 Oct 2019 10:44:50 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:48 -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=SNMbParSoCGF7WYBp3B8k5/vpmixY7ksuS18lVNemz2GZPYdU1q4SLEZ3ccNRRRfmo pqgShOKXVlAxY94DrdCeiqMAxvUOZpUPf4F0BDFvqEDSDP9KS5EcqUn9sRioOFpdnRyl ytbmSy2RJONilmLS3nU5rmxUn/7dPyt86YaMZqT4ggKNerRCXGkKiTuUI4OX52VE1N9v RVdAaJeEr+OHeET0kRH4F8VuqTn/Y73EPVL/NsVy+afUAyLrjvEf3m5yG7YLt9mzxTAT dVLWRMHVzmrzd3htQCSqon1g0C3jaXzxPCZ42vTOcOj7r4G5zV0wGIStZnUAHnHMYW1p fRLA== 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=i4iEGftzR3J1P6iGXvavAPE61zrcLpK4u0JnofVz+h92ia2zobxwDbGbwKQr4eswpI ZooNeytALL1Ha5vTImtirliDGHOn1bYAphYe93HA4IIqIUQC/PFW5A2ydOC45yzISwBx 9OjFqzsfrQNWoI1D39eGSaRr2+sRR2Yg9KkzZMlXkXC5bETIH5U2R/xDS43q0C0WnPfM qFTejlJDfFwMQZ8bDFCqXWJQF/A8rbQrGGs/m+kA8chZjagLlLVXlQH0cQkF6E5ewkxq UEUD4/LSVaCwt8xavywKs/Pbf1nwWgIBDj9kxvZ+DWqNgk8tHS/dP5KymzaXD3iH5oXt dcrw== X-Gm-Message-State: APjAAAV9RHeXtQVjYqah0NJcuNq+8VJvJjZDr+nW9JsGU9i0MuHPTmqB Ta++j+MdznDBiXDRi++Smc5Acwkv5Mk= X-Google-Smtp-Source: APXvYqxdBMJQXqfViC5XJeYTkwi0lH4byylV6XM3ASAzGFTdov3hCRGgDC+GYFsnN/9qaHO9Ir6JJw== X-Received: by 2002:a17:90a:86c2:: with SMTP id y2mr12391573pjv.105.1571420689679; Fri, 18 Oct 2019 10:44:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 14/22] target/arm: Hoist store to cs_base in cpu_get_tb_cpu_state Date: Fri, 18 Oct 2019 10:44:23 -0700 Message-Id: <20191018174431.1784-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::542 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421365; cv=none; d=zoho.com; s=zohoarc; b=Qmy8KIN3pdOyZEwcifXLF8dZkYSip0azeuKPiICfmRCeJwFm7jcFK5/2xcZUnsCpeY4S5jo5yqSfb+5vgIFG6mNkC+EqAvZGpxQJTnfLJCwm+EkuXP42NT4STKbp380pwCa4xbxjPdbraxEJb1ht6UxDCrwBc3d0Z0eYODQIzHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421365; 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=hIxaVRUBxkkP/6GvBF0ndgGqLM9VMO7oAzlezMxOhbrceFJo1jwRJib/ja2m+J+HUfWVFbLMjzw/KbJShxsAIQJPr2hPfyObe15BfUZu+kjQebgkw7fctL562TiAH82CR5vg0sW8vUx5AauGN9g12K+YuGr2KG/HO9Tg4RRveI0= 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 1571421365552752.1805631995927; Fri, 18 Oct 2019 10:56:05 -0700 (PDT) Received: from localhost ([::1]:44404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWTr-0001ih-1J for importer@patchew.org; Fri, 18 Oct 2019 13:56:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59400) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJ5-0006mH-5D for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWJ4-0005aP-3S for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:55 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:43728) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWJ2-0005Xp-9z for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:54 -0400 Received: by mail-pg1-x542.google.com with SMTP id i32so3742820pgl.10 for ; Fri, 18 Oct 2019 10:44:52 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:49 -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=hZHwdPeEBA2AK5wNx1xD+5hnv39LM/tC0jfD0A5B9JMZUCZTWzkFMUPZNiEzngiD00 DykvZK+XCp5mXLSW/kIvFMiPG/+Z/qcVp2MTHBboWNgE0kWVw10akFp1WFWyw7a8ektb i2GDDDv9z8nSyFOt/H/xBAajBs/pSb0rGnuuL/kFq1zRi0h1T22qz17cBDxKonMsTX5W hhIu4giEickQYIXnUhG6qR2HwVSl6HsdNTq8/a3+UtCdnqiiD1rXHhMK9cpQsnsiOzW0 p7BBEw4hppAnlx4NXa9vwJx2ayxuot/3Y3sm1gtgzHHDRTxDmap79oEzLBXjcU5Y+aVI fiUw== 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=bJMd+RLLfDpl3FZwMUOjzLgeUgFYu6rMu4fmlAEMWcq7DX5eYikgX617YyQEs+b55s WzNjiSBUEcjhrNC/7AR6Xmm/nsjA+eQmTJ57pu1EZdOWmfZ7CQD9U/YjKQr+u2iSSGfd BcTQaEuJvrYwFX7QoLenuYfEO1QzaHzu4yLBz/vfEO6pDijkcAPi1ZW3bOreCpWkLkmR M5UkUCJCR9prXWBHzutOuKBE5o2Dc2pW7xPODR2l5xDAKYkvvbMvmAyy2eU+SAyjwWxx bCkgCXD8gdyAwa0PVZpYYD1pKc1Zs4fMg2age/C/PX6gJ9xc+ba5vUf/q36VRcM5UyhL Sxnw== X-Gm-Message-State: APjAAAWeRP2jroTTgFohpoFU/b8mvK+9M70eHEl6yyaR3yEvKhmufR1M bR1KfGNNv8PJx1irtNnHjXFly7pTXL8= X-Google-Smtp-Source: APXvYqxq7auk0JHXIH29XkI5jKNf7Ond3xfOrSuFv2JmuxA0/fyQHjbm5vPeKYcffjEI7r/D6b6J9g== X-Received: by 2002:a17:90a:b908:: with SMTP id p8mr12857107pjr.62.1571420690907; Fri, 18 Oct 2019 10:44:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 15/22] target/arm: Add HELPER(rebuild_hflags_{a32, a64, m32}) Date: Fri, 18 Oct 2019 10:44:24 -0700 Message-Id: <20191018174431.1784-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::542 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571422381; cv=none; d=zoho.com; s=zohoarc; b=juPR8e0lAxBEB+5FfpvsV+t0J+8aIvsJExRMbaivMsrp/M0zLNLHAapgQjjrHtDKSMN6NWsMlJG1mCrlnSjvZDtrW304da9LFqnXtNbBpQEfsG0yRmp+iQD+RBhv7BCokQlErnpE4OAOQPtpwPhVNEXtRUZR+05XRHzSgEEoX90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571422381; 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=Lq3/b5OXsgTHbcSMFLOFHm3tF7v/Y0wC/PpxwPnfroE=; b=TKAkF6bfeIt4OV+afDq9G9vJgIL2zYUPSLBF0B9hPa1znFAz8iczRMea++YNFOJLoBIglg4+zj4uQHZ+lgF7B5iy/CfTATJi4r9ssmTjmQ3rMzEHBArXtRdXpCmwLGuLbNw80K5Mo7LrLwQPhqu5vqsZiVYFuYie0tLeS1flQjo= 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 1571422381515328.36742351908526; Fri, 18 Oct 2019 11:13:01 -0700 (PDT) Received: from localhost ([::1]:44740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWkG-000304-D8 for importer@patchew.org; Fri, 18 Oct 2019 14:13:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59411) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJ5-0006mI-IM for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWJ4-0005au-DL for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:55 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:45688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWJ4-0005YX-7u for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:54 -0400 Received: by mail-pl1-x641.google.com with SMTP id u12so3174436pls.12 for ; Fri, 18 Oct 2019 10:44:53 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:51 -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=Lq3/b5OXsgTHbcSMFLOFHm3tF7v/Y0wC/PpxwPnfroE=; b=Ztf1GH7vLBOL9JAXoGunShOuW+rmYPuT+itDVi/fgcZYc1IVT/CioSw8lE9pv62VAj MpSkhhaC9sCqPdjbJusVJ2gGVrw+dYMumbXRruQxZb97iq7RIxGPu4Tey77Nbbem8zSU 8qft4U6YOK+9Pdl4BBaf2yynhtK+C7BbUnkAlKRkte4vMr7IivZI0zcKjik2ooyQ3Vbl vL2tEYdudcV5g8117sxScBzPc8C5gArrqhK0K07/9WTNOVUbmT+LA6yYMu6xMTDkrq1P ICtMSGGxdcxrgaNf3MKzx1WN50fF0dN2iGlM+Wq3K/Ig+hHPQ6M1wWqzbWX2yevNtouK vcyg== 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=Lq3/b5OXsgTHbcSMFLOFHm3tF7v/Y0wC/PpxwPnfroE=; b=Qq3zSyP9TcTlbFoPTKFulkTQQtog1ABzjoWEvaDMEPGUWbofdVfH0ZSalPq8A1Sis6 7uhJoQaF85LZ6aU2MMXUdxwePljAFMHw5HXylagsVCQ2ZQEJd5J3vHgBDVax7mu6u5a5 JHz1NZhFXYVYRoqiCnFRFVTlg6e8m4xGhSLXSjOVAt0kR7hYYT/Vk1WX4EiwPmCY7ePd 9+xiArPvzgulOxLfyifxa7x3r4OYG5q59ckFZSkgkQ/edNEZ+JC0WFDRIKePsRhCu0Fb Z+nwZ1rm6aP8ZwE29AqijRxi16DW7m7ZwlF/KbpYnFn+dJD1hnTyXNNzpA3Gtn2JNd/t FMsg== X-Gm-Message-State: APjAAAUrcZAsk7Bxhr5a7lbJgjcBUi040kdZ4FyzsDBSN4zU+5aW1/U2 nSLocB8EeOMQv4GctfjoMXY7dtTWrWk= X-Google-Smtp-Source: APXvYqzq+URV/9Ba0ifhMevtB3V9Jb6OlPlw8wRuMW+g6OOmlWOzNKJDvKVXPRgAn/UVmoECMKwjbQ== X-Received: by 2002:a17:902:7b95:: with SMTP id w21mr11476538pll.322.1571420692242; Fri, 18 Oct 2019 10:44:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 16/22] target/arm: Rebuild hflags at EL changes Date: Fri, 18 Oct 2019 10:44:25 -0700 Message-Id: <20191018174431.1784-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::641 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) 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 e2af3c1494..ebefd05140 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9982,6 +9982,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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421877; cv=none; d=zoho.com; s=zohoarc; b=gbrdHtLrnXDNExjUkKdmnvQdL/rPAECDR58QStGTgJlzbTXx3hm+tP1g27mFb6cGv20IL/BbXgtqgKkatQhleuJhMp/Em7guLQxFeyCqt3WaZittF/aq/fozvGuJArz3W5uKRmNnhlHqJjYIbtyN+cYoMLqlEOAJ3tRvjSm/TBs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421877; 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=0mb3YwiZncjKHxGhu+AsTIpQEFeyLEnUoSMmhup1oAE=; b=TuTSJEOFW1pw/Ur5m5MZtj+z0o+gV+JTAEQj7bFxw/IBsgrSTIxRrvHZgtfIDL7Eoic/ZOitJQFT7gVg3Q5lD0EgQrpXLu8lR9bRXcnSZi0Swy8i1/kGHvzm99u+ZpvfU3BOGu9a8vyDkl7CBo1zGRERNVJH8M03CieTOL6UVYk= 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 1571421877263824.8588098904245; Fri, 18 Oct 2019 11:04:37 -0700 (PDT) Received: from localhost ([::1]:44560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWc7-0001It-Py for importer@patchew.org; Fri, 18 Oct 2019 14:04:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59452) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJ7-0006oW-Pz for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWJ5-0005bg-7p for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:57 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:46554) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWJ5-0005b1-2P for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:55 -0400 Received: by mail-pf1-x444.google.com with SMTP id q5so4301805pfg.13 for ; Fri, 18 Oct 2019 10:44:55 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:52 -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=0mb3YwiZncjKHxGhu+AsTIpQEFeyLEnUoSMmhup1oAE=; b=Jwr7py+bQBoYaWXfiCoTCjoDBKkiPGxT5+nrQPKZHeCpFuyXWBm3YPesYDJtr2rkXU H+gI1NQBAMM7nIjTCfxUkfFm/jwgwHWlJBZ4dJcjVE3BvHePh3CYYiU24hfpfr2hgLp0 uP0BP0626ht6iEtLZ8xnFhshCsvvqvc8ARS0sWbZ9q/P4pkmB69Y3om/cJnK4VLOQzTO ZPvNKxDqG7NRWrLIUnUFi7B0Pt1ogv6w5oAQsy+BPsvFPGmyQROmNt2ZGVaxFVYrQ/pv LPM5iBoJaWLxcL5WToWu/RjoAIMHfacy5hqBwXdNHRAv/AHuEKRwQFZviu9xnOmjlIEy F6xQ== 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=0mb3YwiZncjKHxGhu+AsTIpQEFeyLEnUoSMmhup1oAE=; b=JUdqUP1SKWV4aeBYiTndEz53XRVILX3nLT5ipiivksj3KuvHrXYy/hTD+MeC+J+fTL 5R/CsmNPgfie0r5esvw2Bl08ZW/ryrVpM8uuQX5mujWJo/8q8F2njjQPd8E69ZBK4++K SEM1ZCvIWcOxXYLeq9wAYh15kL0kwALxQXmPjG6Vasbp3bBx2NWrWye+nRp+yckLApni FzZcH27QKiBHDpGiT97NCZb6mQgv8TQthSDU43W3Cx9zoRy2kOpCeS7uvLWDNGI3LSY6 fBMwjk0oQMdEQCuDSojnf7pQPzG27Gm3QjEARX2q9Fbj++BXahzDS025lCPBOJxEqwe9 GNMQ== X-Gm-Message-State: APjAAAUfv45dWERznl4QTR1v+/XJ2EqbP3XoA70vCSRllr1T3BUHMGp+ z4bxIA6pQlN+7biQz5N5AX7dyF7xynU= X-Google-Smtp-Source: APXvYqzEXbM6YDk/HoT0MA7FbFYgf07ZtQmPY/7vP65uFPIqxPAKneCJdJzE6jtaDRMqRFNPftvhSg== X-Received: by 2002:a63:4f12:: with SMTP id d18mr11835824pgb.52.1571420693696; Fri, 18 Oct 2019 10:44:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 17/22] target/arm: Rebuild hflags at MSR writes Date: Fri, 18 Oct 2019 10:44:26 -0700 Message-Id: <20191018174431.1784-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) 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 698c594e8c..cb47cd9744 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421574; cv=none; d=zoho.com; s=zohoarc; b=XEh1Xo335dB8/DUk5TOS5D519zBV5nXVW2n0vmWsNikCNksv8pbVvPjiKA8BEy/eP9QHFZL8EVuRyBRZGzauU0sqsSHlgpb0wWuIgFONqiRSL3LXPgYBNUKaaKjoXgCB3jS0nDOu96MVs7vm2yalrgFGfwO3365etZvr3xVabJc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421574; 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=fH1PfnSU9lSg88kSjRjgWr6sFa/nuN2LNT+1x5nw8L6S8QEsM70W98ZMjhouKyj8rf3tT+ydBktN6XDEP93cYkDZsVOce8+QaytB3CFxgpTo/8/QEIKFccVSeeJKCXbs0u9nTl1d40ImeDr7UrZFRa/CrwT5Sp0tVt+gE6hPnWE= 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 1571421574377981.1247084831116; Fri, 18 Oct 2019 10:59:34 -0700 (PDT) Received: from localhost ([::1]:44482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWXF-0005pT-4Y for importer@patchew.org; Fri, 18 Oct 2019 13:59:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59457) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJ7-0006oz-U4 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWJ6-0005cl-NH for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:57 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:45802) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWJ6-0005c9-I8 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:56 -0400 Received: by mail-pg1-x544.google.com with SMTP id r1so3739500pgj.12 for ; Fri, 18 Oct 2019 10:44:56 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:54 -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=pATM9ssFkxdigDI20QfMiusWkLq9ZFxqjeIY84nbG+ObLMz20Bk5mN8NBKXHLAtYCK SqSxE4tOdn6VrESxF94B1nPMlHxkEi+ROiz9wEXeruDUOJvEz1m8LPuvpAgiE27FzrcV Q875XXTvOR1tnKjLjl6hkAg7+a/SL9rt+XXKaQM/1Xzf4QovmWHlpMpCvx6lmxD2tdcI uWbYbNHtH27PEHBekoL9PEDQM8qatIauBE2asth1uVJ7PX9CPQvtyZwRWAnRNRa0JMJN S/uEHGcknS5SONOXKK+djAeyziJIJQtNLLqBrX+WCcrKNMivoe8f6qB+rKJvL7SoXwS8 RZaA== 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=XWMevuYojBWFxaTOfZ01/itFW90111sU8D292cWS9SAyDQIFjEZQJAvnN0ffWjr2wx kvUurmuyld4GO9Qrg1+AdsCdDAkvIZeu4Bl28mQZJxMDJ05GPtVA+8Ud9VdwGgKpL/Rl E+lnh8wKkN4UPVaoxJMp1d2JDTp6hseAmCvOzEe7XXUqNcdTOJf/AR+DVloJjiq/A3I2 FOiXEm5fQ9BSJdKIMkAoZmXmnCgZQ3nE/eD/I1bhMg16rNv/TA8yB25X7tP69IF5Q4PX vdpHYX2P6aX9Q16jktwnbijWUUca/k7FK4zSJk+hwSZpLdheJtUfBfmKYtGBzhCD00WC wCLQ== X-Gm-Message-State: APjAAAXOy/0ixdaka+LGr4oXjEYg6ufi5u66ZvCIeRxplJycc2GcIqEx CIl+YeGCZ/iElURWIcnAud5T6/n7J1k= X-Google-Smtp-Source: APXvYqyEZzJOoYjgY/4/WGnJED6vZ7cCjAez8SeGJXJL9TZ01Ntz0/7YiyycHgQAIRi33qr1X9UFlw== X-Received: by 2002:a63:3104:: with SMTP id x4mr11264412pgx.135.1571420695215; Fri, 18 Oct 2019 10:44:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 18/22] target/arm: Rebuild hflags at CPSR writes Date: Fri, 18 Oct 2019 10:44:27 -0700 Message-Id: <20191018174431.1784-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::544 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571421794; cv=none; d=zoho.com; s=zohoarc; b=UYdSRDXcM/wo6VZZlGp5jBaS3gfcrVYZovKvFHxOHfbPPJX2L5f44UcT+zt2b2wni44/bdok3J3f2QbAbM2oHH9EZDj+Z0bDK/gr5SCUQOGg9/FSm4QABqRKO4Ghq1aLMAmPJXmFFp8B87kxg2ELxKVldTfqiiPUGVMH3Z/4L5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571421794; 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=CJs7Q06wbY1dfgE9isYp+J8Vi8Cv3yMo13k0RDZ8msiM4kqQjg13aOMEPG6egGmIeKlmvPImBTzoCUUKtkmFRzza1mJ+2x6ltX31KsSu1jT/e0i/L9cYTDV83Rts7bLGGjtUDLbU4cFj1JwcNB/CiKqb1Tr6RKNRJV3qATesjUU= 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 157142179458323.343916320041558; Fri, 18 Oct 2019 11:03:14 -0700 (PDT) Received: from localhost ([::1]:44544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWal-0000Ds-Vl for importer@patchew.org; Fri, 18 Oct 2019 14:03:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59490) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJ9-0006rE-3c for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWJ7-0005dw-Vz for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:58 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:40071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWJ7-0005dQ-Qz for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:57 -0400 Received: by mail-pg1-x543.google.com with SMTP id e13so3750371pga.7 for ; Fri, 18 Oct 2019 10:44:57 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:55 -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=nI0rWgGQzrA9U6zEdQj3b1jl+SAttb9L65Ev0KMFewggAH/JgNkTbBgKH5FUFPaVUk yT77aBDq1capTDD5XBJ0kHvzCdLzW6UtviyBLhNXknkCHDTIdwRE8n4wPP/ipPvq42lN huTPPuL9IbYNLT2RuvJF2FZm+rZf1BQUIvcsqi+l1ne7UiawUsAaimf2vg27SEVhGf2Y +wu4VSTc9ZZovdt++QjjrMcI3FwGjhB9l1KOmwFPGGedB55xqNd0bG3gyY2o/8br/beF RsaaHHn7Symv/XgyQANNCF1A4200J3lPZGuMZYYgVaGIvAb3DJl4GBKNwIs0/ZH65EE3 JFWg== 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=isAgvnkhVpwRsNGRp77zdYWxQG5oaGtr0p0zrWzJ+9jOLtF9EwXC6Xo56SFZFZxUKj 53Q31mTPcqkxA8zkYNDcBhtomBDUiWJs2nggl1zMy977UYKB+KPfIAncrLjZ60kXePbt h9e4WHoubPL/rf3N6xN2RpZYB8tJZovuedxngDUlv6mVUjo8phX8oItCWQtJ/ay25FfM /ozWc7tys9L7FTQ/MYWHFHTm07E43UffD8ztZdnrMycdql56zgT6I5kq3XB0ustK2jCi N77HJ2JrU3aHxaxbLiUqJ0R+qUtn1SnWvqSjVKOVXfujMTB2cFZbgoEqWF34gW7Aq3Ag lydQ== X-Gm-Message-State: APjAAAUq+iqxGajxnijP54MR83oYzIi2uIxxNtR91MAgswy6RiCf/7dw Dsuxrg98gUM0WNyjLGZmhsM8FUYMch4= X-Google-Smtp-Source: APXvYqwxy1zRvO52BhYb3sT+8Kuovf6j5LDyQQBtrjSUB7osj1rB9wryaNlqvorPcNxjV43eQGd0HQ== X-Received: by 2002:a63:ff54:: with SMTP id s20mr9314597pgk.398.1571420696525; Fri, 18 Oct 2019 10:44:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 19/22] target/arm: Rebuild hflags at Xscale SCTLR writes Date: Fri, 18 Oct 2019 10:44:28 -0700 Message-Id: <20191018174431.1784-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::543 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571422477; cv=none; d=zoho.com; s=zohoarc; b=op9A+MMfgl31pq1lf7VHHxI0U23+j2/EO4TjmvialbWY+DM1S0d/ei3NG6gIpl0rMboI1SFrN/JqxJLFVcHwzB4vUaF28vBjxG5oC1o4CctjM7YaVWp35kF7NSOuW3yRGSz+L2Bvn69QC/QQv7UepVzh4P/GyGfzXELDgMjyzrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571422477; 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=HGoDHAyFTg02BbCDc0SzUOS11VgHC5xQyCe+OvrFqFc=; b=nE6EOhrJjY1qvzlYqUIGS2EAqPGv2OgAK7txjKq2Q2z4orwO+5165TzYbTAjFzz1n5EugOPAO03p11kE7Epzq1Qx6OwaXkj9cXLdoysj/gT7OGZS4QNC+TYjQgOP6sgcJ7cRqtitXg7gT1fsyzdPYhLc78WVxEvYZd+E8BMoxQg= 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 1571422477547766.0299849676337; Fri, 18 Oct 2019 11:14:37 -0700 (PDT) Received: from localhost ([::1]:44764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWll-0004Zq-Lw for importer@patchew.org; Fri, 18 Oct 2019 14:14:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59518) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJA-0006u4-FT for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:45:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWJ9-0005ey-8T for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:45:00 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:40691) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWJ9-0005eF-37 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:44:59 -0400 Received: by mail-pf1-x432.google.com with SMTP id x127so4316405pfb.7 for ; Fri, 18 Oct 2019 10:44:59 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:56 -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=HGoDHAyFTg02BbCDc0SzUOS11VgHC5xQyCe+OvrFqFc=; b=gH4ePKI0ZYmF3BKEWSo9PNClpVHrBkapR2R7ZkhfqrjHkMHJS0HX4sdTlt21lXFwtc 2tKmh+xORcUbroASKsXq+0bA1pUBHlDJndVV1+Wuh2WRFy5pCmXxAaB3cH87LD9FyKXb IXQZH9TBrb4pIXteiwfFCvBGPW1Tzaoo8oyue8TYz0MouKhMLXpwpwEIz/3TmgsQh0SU rCTNdMyVME5zlZXAigmt3XoGOgmV6t40LujfLvl/DO78he81jF+v7I7vuI6cFTTDCAkZ VeC8eSH+ufI37bf33sNcpqxpTpY6vLGvUMUpMuxRtnhE/twy081+Txs9R2p5D860HpVB khuQ== 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=HGoDHAyFTg02BbCDc0SzUOS11VgHC5xQyCe+OvrFqFc=; b=phxqSPjd5LuDlfEx2aeKlAcMlv3gCHDyQQLjDSZjz0hR5lfaSXg56cSnMhjJvmef6t bKttAhMW1hzffemOIYVrS1R3pxmWRoWd/m6+0S59TRhGSjRqi+rtJSSQ+Jj8cPEB4iDG TSsZkCc0AL61G5Do1sPPxOvI3bMVOR7gP4qoxKfzZYEECjSnVt6nY3SD1yZw6CfVxXjP g/6L8PBi/fH9kvCNslTmyETNUJVNJPhq5pQFr2BE71gstf35pwrRav/3zA3inlGQ80KE IjEFmgQj/b3hksjgKluVnn8CpNCWpw6Tc2h7PE62Cwd7LttGypUrV4Z4FwJPR4DVopXH 7jFg== X-Gm-Message-State: APjAAAXx6F4tDoFr/DHnN+J7i17fMy+7/cGnk9yxbv4fm5vTf2hPmuCt bOEwxLMk+mahne1wl8YACeLioNsUeSM= X-Google-Smtp-Source: APXvYqz/KFTKYBmeodxvJ4P9FIz9BFgjMqOd1Kk6fWEJ/ZKOvUUWq3TqvZHYNZXviyd5iFb4LDKbGQ== X-Received: by 2002:a17:90a:376d:: with SMTP id u100mr12408557pjb.23.1571420697691; Fri, 18 Oct 2019 10:44:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 20/22] target/arm: Rebuild hflags for M-profile Date: Fri, 18 Oct 2019 10:44:29 -0700 Message-Id: <20191018174431.1784-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::432 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) 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 cb47cd9744..b3720cd59b 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8325,7 +8325,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; @@ -8335,6 +8335,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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571422030; cv=none; d=zoho.com; s=zohoarc; b=YHnsSSRywN0LUFvF8Tg44gamJXJarDf/x8knZZl8dzStP3QyKD17Pm/1bLROohskrP3otCk3UBPQYvZbFKTsdFghbk/x2lf3GYCAHdg7J+1GxTui/6UIRQiLtxmY/I/mVRqXDtjwssE01Vi9HFCxVmdfK7uNr7oXdbf+BXLLago= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571422030; 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=QHpx9koVxvSE4B2XqJ4vym5g3kIwzbT/XqthBzNJRnenBBVeBFRmPGjuAaOWv2IDbmdaNmEdnr5UMy1YQTXvv+TJ+nPGZL6xwf2XLSuWOb7VbcqgUK9PaDFGHOyzRG3FB6PmKMV/iP/iKwstLD8Vad4urfiaEgBR/wKQ4KJd9pk= 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 1571422030864733.6607380263993; Fri, 18 Oct 2019 11:07:10 -0700 (PDT) Received: from localhost ([::1]:44622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWeb-0004UH-B4 for importer@patchew.org; Fri, 18 Oct 2019 14:07:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59547) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJC-0006wS-6Z for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:45:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWJA-0005gO-QP for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:45:01 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:33304) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWJA-0005fm-Kt for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:45:00 -0400 Received: by mail-pf1-x441.google.com with SMTP id q10so4340457pfl.0 for ; Fri, 18 Oct 2019 10:45:00 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:57 -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=Uvo+O8B5nhB1hCuO8tXl8IgS+fjESYIng+bYLuPYt0ykIXNCI9m9GMcqDYYKDAKUKA B7NgaY+lnBS5CbCpqcZccKMYBn9koqvBa6866Y8ApTyAAH+4mUVRGAKNhEwRrnUmE5Sg GcoVkm338NIhcWuUElXc2hMzpc0a73HGAdUeC55c7a0KTnUWQFFeoVD2Z6z/U8mq70Q8 meuefAnx0EK/BAeNBVRQDbWW2m0g+J3ZMpQZ59xkw+IcR66NyyykpZoM+gXWKxIjbUa7 YZSxTyooCpviez/XFSKbT+Gej1f2p8N6ODFg1jmHiLx5sJGGGWtn4zz81uP1FoLWuh7D cMZQ== 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=BirXQzCuSv3Z3FW+HAEU/fk944JJvFkip6fqjJ8fyxfUo4aDKSaB4CNYazlwdiVs9i lKlPMD6R2QBPen+qaPyzWAPJSJ6ykkEbIc0zfdZwbk3f6C1xc8Ckk//3oDEdyHld29v2 U2k0bWfgRpd3ZQM7kroROjvm8Gr/Xauey4qrSdhMTLtXPDtWXKM0RaoqJfeQyLUreQKW rhAPe3ekY3PsLPiHqGUhnG32o92NsEaH8xv/K6mFlip6wrvnXGwpn+DFTwsu/Rc1pD5p q1tP/LHC4xKv550+4+88D6n06xVrH+gCR0/K+6S2/q/RiZ/LKN6NhPT9diP4H4zcjThR IcDg== X-Gm-Message-State: APjAAAWnGVJ7xPu/ACOwVaM5MaRffX01o2WymN61BqTZjlqrzdQ4Lm/x e1/PuKYt2RdPFBQh12tMrJBCivBVS9U= X-Google-Smtp-Source: APXvYqxEiMHTFWd0+8+Jjwot2B4GNA7AKnYndljV5p2qZvznW7FluKoKIk5gs03JrCesOj8KQEDmxA== X-Received: by 2002:a17:90a:f311:: with SMTP id ca17mr12070981pjb.112.1571420699116; Fri, 18 Oct 2019 10:44:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 21/22] target/arm: Rebuild hflags for M-profile NVIC Date: Fri, 18 Oct 2019 10:44:30 -0700 Message-Id: <20191018174431.1784-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::441 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) 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 Wed Nov 12 15:02:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=1571422180; cv=none; d=zoho.com; s=zohoarc; b=EHCtmgj+ZogcZbafaKQ0LJ9SNM0VZAjC/4iQCmhqI5WmJ7/FbldUBvU568akDYDs0GwkugyHwuezI6Hv2U2sXK2NCIT1h8WiLpuN0MXimLiJsz/aj9TJBPInRdHszEotxvlqpSTimWELdvYgSGX/GfWWQw6uMqvkZ5wihqlE2Y4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571422180; 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=ZJfYJMDD93Qf8/wjfX7bMSqaklMh9TAJlt0Ev7k6nE7CwSYSoZe8HM09+i3vtLNMIpwe08ozvvDytmQiwqGew+t/tk63gMytBk7Nz8U9llKRIjfr23cA9a3TZWKUeEgaD0btlv7E/4RM83mvAOfZ7gmmq9WznjxmPq8G9LtAEzw= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571422180274638.3489128635113; Fri, 18 Oct 2019 11:09:40 -0700 (PDT) Received: from localhost ([::1]:44678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWgv-0007V9-SN for importer@patchew.org; Fri, 18 Oct 2019 14:09:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59571) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLWJE-0006zr-5M for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:45:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLWJC-0005hx-Uo for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:45:03 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:45361) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLWJC-0005hQ-NR for qemu-devel@nongnu.org; Fri, 18 Oct 2019 13:45:02 -0400 Received: by mail-pf1-x441.google.com with SMTP id y72so4303689pfb.12 for ; Fri, 18 Oct 2019 10:45:02 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d20sm7857534pfq.88.2019.10.18.10.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 10:44:59 -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=vSIDsLNqsnrQQPJVv21MsXEaz4hVN60xT3imyizOIAuCOBHlxzIpfVSEN7ngciqPVv HCRNpEGWxcfpAC30lbz6eEB94vkXTh/Bzeg+sIPc039kJeTPyPRcZKngAujNtbIaHMuw Xex2OQfPcj8wyGm21ub2exiE7HoeZ3mDNUuzceF+sm+Qbhn/SiJvbDhTGlutN85l7KiE 8DPYmi75i9pXbnqMF2WhnzipDr2fOnDriz4518pbZ310JKLW3Crao8XBtqbT+hwDu35u i1GphTsBa2aDA8fPOMONO66ombvkYAdmVTC+Sjpo7cJVYIoiRpvffZmbaCRgNjmzytB0 JF7w== 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=MbRoz7R0laPnVo/k40jSVTvE4W1m2cqnRgzsWqwwECc8smD+TM7qyZFGe39UIrhLkg pwQcYhPcJ5aUeUwmaU4tZL3y4XnDsWWUbSHmMe0e+FBWU8o7siEhFsAm5p9mpwiqR+3g OJxD7KTffrETQK1fIgM/wOvYS8i/TSAW0MwrRKxCplEJTnoz9lNg94O5VLK3EpJ39BTi 9Lswo/Y1OHSL1HoIU6LZUhQyOht1pRWjFYP1fkfFVH4ZUFF2KHLCQspeOoKaysWch/W5 dcPU1sPPrFyZSCJzbOuxAhiNAMTchexucynghM7Il5Tr2Y0YSXu8mFUydoJODfVEHYRl Fx1g== X-Gm-Message-State: APjAAAWZdIYoqHh/WVtnwMLWzLRL6XIEgrLz27Wg4yUbxHRXD4LhWbbb ptAmsDLDv8gBsOtpP2uvtyN6w6YqlxI= X-Google-Smtp-Source: APXvYqynyLdcscgIG5Yxy2j2jsrMtHtCcKuyvCnVHwQu3YvRskmWbfiqLGfUNkoZA46dpHbYk4oUBQ== X-Received: by 2002:a65:5a81:: with SMTP id c1mr11210178pgt.245.1571420700036; Fri, 18 Oct 2019 10:45:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 22/22] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state Date: Fri, 18 Oct 2019 10:44:31 -0700 Message-Id: <20191018174431.1784-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018174431.1784-1-richard.henderson@linaro.org> References: <20191018174431.1784-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::441 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 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