From patchwork Fri Jun 19 17:03:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 191266 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp711245ilo; Fri, 19 Jun 2020 10:03:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+W+AJiL/XDC/O0SHcJENv8ktRhrJ3r/S4iGlYF6kCxDcP8FF4A+GwKDabU7NccJK/TRhg X-Received: by 2002:a5b:5c8:: with SMTP id w8mr7677568ybp.178.1592586220617; Fri, 19 Jun 2020 10:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592586220; cv=none; d=google.com; s=arc-20160816; b=jo7DHftGCG19nozjSWkf4wzFoYMkkEDH0l2x1tuSeWF16YRtAAbWQI/ebH+KcyvaVc 8atc15BU4/Hkbo22Ls2pzdLOEUjOB4woJBRIluA5mgONAhiJdhHjDDb4V0giDUjw6XRG IeKfPov7iFTZPDkSpIOIAcw6kVS1XmgKLqJl4l3el68a4LlzmtlDnXH3p35nR7bVoswE 07i/5eNp954U+7Sh37OT+FbpC5FXltlUWmNL6yP13pWl8p29YskkVc6t4E9zDMuK7Upe 9INB8Pix3xkwWrstoVjmeJ7embE8ZkpG3JaKF001GYhd1t6/jJ2DoOgOJKVgeo8Uqon0 JGSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=GYiZ1xEPMJbBnQLRCPAHG6+ogJ1s4ydI9hrrJEU1OmY=; b=fIcKiEh5472ARIYWeWhw0ES+eS+Ki5Boy1Lyh815VUJj7vNiTTF6DMKULIDm75aTe2 jsJ2F1bJBhNdLVBZgjX+0Sz9DOSmSMaY8BDudYTkt/qLLZW0h73+tM827AfIEKyg49MA CzFE2JJFsWiHql94DWOkG5OjyQZvhAA0hxSwcejtnU3kNRg7t1fg/Ags0er2HQtCEKkC KqcvNN3w8sr71k0voLuqjGNeIcb9E32RSWkL5LBQDm2TqZN0sn2uCqGJ6UlsUn8Vv/fL 5gUv2W+qkTIvrcbysusYfkQvNfk5AlhRH2KKsV+TUpk8mi+yEssHsBZes0Ahn2sSV33c nQQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xn6VMQhX; 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=fail (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 o18si5991088yba.318.2020.06.19.10.03.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jun 2020 10:03:40 -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=fail header.i=@linaro.org header.s=google header.b=xn6VMQhX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmKQW-0005rS-5O for patch@linaro.org; Fri, 19 Jun 2020 13:03:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmKQM-0005qE-Or for qemu-devel@nongnu.org; Fri, 19 Jun 2020 13:03:30 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:50591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jmKQL-0003iZ-0r for qemu-devel@nongnu.org; Fri, 19 Jun 2020 13:03:30 -0400 Received: by mail-wm1-x32d.google.com with SMTP id l17so9082742wmj.0 for ; Fri, 19 Jun 2020 10:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GYiZ1xEPMJbBnQLRCPAHG6+ogJ1s4ydI9hrrJEU1OmY=; b=xn6VMQhXt+eLYKC+z4+ojovsahLJShdYj7IqpOBt061U6E36FkmQNSEIpvlWgpR/Fx sghGplLT+XIpjBstjlNKmY6eWA1WuOjDyYhDIELuZnW7xbVqCrj4aIE+Qg9cN+kLV7n+ +pWOQHEACN8TOqe1Qvo9hJmIxb+2VDLAIJF6Bog3IGsn+wBGdjuaH1eLuV31sFYhZUXD qXQ3RnNFuoKSZ87aOFcimu4j56/P9S1XAMExRCPqR5P7TBv3jFy/PSLZccDufVxP9LMe J1XzBERhhNo/sI+KDAKHdsKsJhEW+UShLeUX8PtUIARxAMkO8mKSopLSCP04XSfvauc+ 6b+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GYiZ1xEPMJbBnQLRCPAHG6+ogJ1s4ydI9hrrJEU1OmY=; b=SD8mJo2L6UlDK9YK3g5+jsDPHRO1C/mZDvxOHwfkGO6i6NhIlovBXCc9U6UTJldJhW kYrVnxh5QFCWX8je34wv1cRENIxbj9COYCaTqjQxpfkGyIEeS61SmNzKH/iWPgYJWJvj tjjXwjF9qe9m5bgkohwaSCL15XY3ecwMOaR/m69nRHuGTybheOKguwfwMLz2pvW0Uuh9 t7y4vMyFliu9Z1X/NxV7upBIJV+84DrU7mEa1nNPnWq1YvBBKV40HZGjckSNntZjEl3C co6MBrkyHYdbpN5bVTxO9BL+IM8kaKm+KH6trqawBVCG6yYMKPJf0jX0MRkx8IQdCoXc r6vg== X-Gm-Message-State: AOAM531aekneed87EvpyCIhAdovNJqTbVgJ/P8vB6m+IjyaF1UhecHCf u+6hNmHvVqPWA4xg43juJ7tJIg== X-Received: by 2002:a1c:98cc:: with SMTP id a195mr4646798wme.89.1592586207324; Fri, 19 Jun 2020 10:03:27 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c16sm7982936wrx.4.2020.06.19.10.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 10:03:26 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH] target/arm: Remove unnecessary gen_io_end() calls Date: Fri, 19 Jun 2020 18:03:24 +0100 Message-Id: <20200619170324.12093-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=_AUTOLEARN X-Spam_action: no action 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Pavel Dovgalyuk , Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since commit ba3e7926691ed3 it has been unnecessary for target code to call gen_io_end() after an IO instruction in icount mode; it is sufficient to call gen_io_start() before it and to force the end of the TB. Many now-unnecessary calls to gen_io_end() were removed in commit 9e9b10c6491153b, but some were missed or accidentally added later. Remove unneeded calls from the arm target: * the call in the handling of exception-return-via-LDM is unnecessary, and the code is already forcing end-of-TB * the call in the VFP access check code is more complicated: we weren't ending the TB, so we need to add the code to force that by setting DISAS_UPDATE * the doc comment for ARM_CP_IO doesn't need to mention gen_io_end() any more Signed-off-by: Peter Maydell --- target/arm/cpu.h | 2 +- target/arm/translate-vfp.inc.c | 7 +++---- target/arm/translate.c | 3 --- 3 files changed, 4 insertions(+), 8 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Pavel Dovgalyuk diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 677584e5da0..cf66b8c7fb0 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2334,7 +2334,7 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) * migration or KVM state synchronization. (Typically this is for "registers" * which are actually used as instructions for cache maintenance and so on.) * IO indicates that this register does I/O and therefore its accesses - * need to be surrounded by gen_io_start()/gen_io_end(). In particular, + * need to be marked with gen_io_start() and also end the TB. In particular, * registers which implement clocks or timers require this. * RAISES_EXC is for when the read or write hook might raise an exception; * the generated code will synchronize the CPU state before calling the hook diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index e1a90175983..bf31b186578 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -119,15 +119,14 @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) if (s->v7m_lspact) { /* * Lazy state saving affects external memory and also the NVIC, - * so we must mark it as an IO operation for icount. + * so we must mark it as an IO operation for icount (and cause + * this to be the last insn in the TB). */ if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { + s->base.is_jmp = DISAS_UPDATE; gen_io_start(); } gen_helper_v7m_preserve_fp_state(cpu_env); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_io_end(); - } /* * If the preserve_fp_state helper doesn't throw an exception * then it will clear LSPACT; we don't need to repeat this for diff --git a/target/arm/translate.c b/target/arm/translate.c index 6d18892adee..2677eaeb1e1 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8824,9 +8824,6 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) gen_io_start(); } gen_helper_cpsr_write_eret(cpu_env, tmp); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_io_end(); - } tcg_temp_free_i32(tmp); /* Must exit loop to check un-masked IRQs */ s->base.is_jmp = DISAS_EXIT;