From patchwork Sat Oct 1 16:22:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 611384 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp273716pvb; Sat, 1 Oct 2022 09:27:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oJZvdMHI1kF5kBAkQgJedzKITHDgU8hsxxUBWmb3KWvQCUKfdd45CMQUVQQpI8V3If4SU X-Received: by 2002:a0c:8e0d:0:b0:4b1:7c1d:d33 with SMTP id v13-20020a0c8e0d000000b004b17c1d0d33mr2219538qvb.86.1664641672159; Sat, 01 Oct 2022 09:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664641672; cv=none; d=google.com; s=arc-20160816; b=z6RSliL1uT0UPf/0iv6Xhu6sKVspt46lxKRuFnRQp11wsQEphbca9FWC6+EZfifw44 U1hbUYCw9lRyfkHpDshn0DpWj+KK+YP99vqVFIQp1T4zVmmWUAGEaVuyhhE9hI1d9NdA etGr1hUK2jbHOHgC4mPYnkO7JGZzoqIK8i/T3Pq/DMnY7qxH6DZN2NulbSchP7yvt9LU JgcB2SmnB5VbQff8w9eXEhBMTqUpIe89icLdtBWVBKcHzPSA7dV6qQT3tHrURB9xct7g yAmB/No7y6HxSC7mLp/fjRKlLr0mUBTGeuVzM+6uCoCQTi30MWTwJXWhYmgBFuP3f+FT 0BdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Tnfc5rXfCku9MasFsfztuydoPYwIjiauClakmhLN0A=; b=YiHf4WcF1dT6ARv0LMC9lxN7Zis6k/BLG4DRgJncIlnsxIDnFOYUfQEJo+mKGzEd7T xi35gxGbQeq6OYlQq1BSGf+jhBEtjFVcPqPDnbiK++cuwxwvGPWP9GUDA7O6sQzoXoRU QIsm6k6SVJhPy8A49h2fNK+bqUn5VDaMBNGhbdw1zqHVLXrKQllwbkanG7GmpZrTtrDo ZP9wqVu4UXLAJk72o/K2Z5WxPRtFHyPmqF2jFYz1w0aO00p0bcQJldm+bJNxU66dStoe Cgvlq/JtLqkU/Rn5SeKUnzuXsWrPm/VdpTiMqVZ4JpnryeY2XTvMl32nNsUvXvQz+Fr4 O0lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EvjkrmHC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t21-20020ac865d5000000b0035bc9608ba9si2250102qto.326.2022.10.01.09.27.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Oct 2022 09:27:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EvjkrmHC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oefLD-0005OL-Kw for patch@linaro.org; Sat, 01 Oct 2022 12:27:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oefHB-0006d0-Hc for qemu-devel@nongnu.org; Sat, 01 Oct 2022 12:23:41 -0400 Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]:40490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oefH8-0006DP-GT for qemu-devel@nongnu.org; Sat, 01 Oct 2022 12:23:40 -0400 Received: by mail-qt1-x831.google.com with SMTP id cj27so4336523qtb.7 for ; Sat, 01 Oct 2022 09:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=6Tnfc5rXfCku9MasFsfztuydoPYwIjiauClakmhLN0A=; b=EvjkrmHCJzh9pvhJhXid6iFFNxK7GGiyvCnoXwsWpuW4aUVEsYpMrWxs5WtQBz1C9u Vk98uNPVRXH6i+p97Kq1Mgf98xA2wM5rInMUMp4M1zesAM2H/6bcmzaofMKgMCkhDIGE LMnFxx15UHjyAaHqiCOqVMOxEIQ+CNPDEks1+/4g49F2GYUtNKqo/FFYuwS/U8Lvf3Hm J2G8s9xvHLv2RvnHYou/CxkmCZcfYqpJtiF1q1gRxtXg1CIjdgQyXgxspqXWmMmn0QKi J/EeWoOvsz8wq0Sc0wvCxLdM+i54uZC1wkqMe8mIdhaFc8u+yIl8QFkey4NXNRRqduvn xIVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=6Tnfc5rXfCku9MasFsfztuydoPYwIjiauClakmhLN0A=; b=VVP51IixSrzzUQe2YPEH2Llw9sLg2+1a79m01j8LhpLQSeiEVKk2dW3lpG3M4roIXv v5O32V1WWJ0wIltdPp0glSjQ45elkOwjSaefOj6qkkDG+67B9rBKu+3E4iygbv8/Qdd8 ccvWALuhu9rlH1v+0icEIupA1AxWI5tMroBtUZFJXcivvTMXSB1PChG/ndZS1zAYnmlu Iudnf1tu1K3j8ALDPb8SyA4ams022mYBm6UkFjqL8AVJ75X9XNd32RcdPI/CZhHqZ9j7 fxmZ0SF3gDNHgryv8x7nv6FOCCKG11jLVrDQFir6tgUyYWu2ZQLnRbh1oQW9fjzzgy3E BDsQ== X-Gm-Message-State: ACrzQf1ZkxEml9sFB5cw4rO4wJbfHsg8/PcXxjkI4UgqYw3/YMxILC0K Z0SefOxBsP9Q/FWZzdDQbwNhZ8AJi8BmwA== X-Received: by 2002:a05:622a:1c7:b0:35d:4a61:f2c7 with SMTP id t7-20020a05622a01c700b0035d4a61f2c7mr10802438qtw.578.1664641417854; Sat, 01 Oct 2022 09:23:37 -0700 (PDT) Received: from stoup.. ([2605:ef80:8084:91a4:f7cb:db31:c505:b931]) by smtp.gmail.com with ESMTPSA id t4-20020a37ea04000000b006d1d8fdea8asm4387445qkj.85.2022.10.01.09.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 09:23:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v3 06/42] target/arm: Add is_secure parameter to v7m_read_half_insn Date: Sat, 1 Oct 2022 09:22:42 -0700 Message-Id: <20221001162318.153420-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221001162318.153420-1-richard.henderson@linaro.org> References: <20221001162318.153420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::831; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x831.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Remove the use of regime_is_secure from v7m_read_half_insn, using the new parameter instead. As it happens, both callers pass true, propagated from the argument to arm_v7m_mmu_idx_for_secstate which created the mmu_idx argument, but that is a detail of v7m_handle_execute_nsc we need not expose to the callee. Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/arm/m_helper.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index 5ee4ee15b3..203ba411f6 100644 --- a/target/arm/m_helper.c +++ b/target/arm/m_helper.c @@ -1981,7 +1981,7 @@ static bool do_v7m_function_return(ARMCPU *cpu) return true; } -static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx, +static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx, bool secure, uint32_t addr, uint16_t *insn) { /* @@ -2003,8 +2003,7 @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx, ARMMMUFaultInfo fi = {}; MemTxResult txres; - v8m_security_lookup(env, addr, MMU_INST_FETCH, mmu_idx, - regime_is_secure(env, mmu_idx), &sattrs); + v8m_security_lookup(env, addr, MMU_INST_FETCH, mmu_idx, secure, &sattrs); if (!sattrs.nsc || sattrs.ns) { /* * This must be the second half of the insn, and it straddles a @@ -2109,7 +2108,7 @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu) /* We want to do the MPU lookup as secure; work out what mmu_idx that is */ mmu_idx = arm_v7m_mmu_idx_for_secstate(env, true); - if (!v7m_read_half_insn(cpu, mmu_idx, env->regs[15], &insn)) { + if (!v7m_read_half_insn(cpu, mmu_idx, true, env->regs[15], &insn)) { return false; } @@ -2125,7 +2124,7 @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu) goto gen_invep; } - if (!v7m_read_half_insn(cpu, mmu_idx, env->regs[15] + 2, &insn)) { + if (!v7m_read_half_insn(cpu, mmu_idx, true, env->regs[15] + 2, &insn)) { return false; }