From patchwork Thu Sep 16 15:30:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 512964 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1339418jao; Thu, 16 Sep 2021 08:51:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj1YBMfe44n7LrJX7o3986geZ5QMU/iQsRiXLJEx6rbNzt2Ma0IyRjfXnGCYXJC8BIIgyt X-Received: by 2002:ac8:410f:: with SMTP id q15mr5521316qtl.299.1631807483588; Thu, 16 Sep 2021 08:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631807483; cv=none; d=google.com; s=arc-20160816; b=tGrWLGL5IO5G1sWtNzSvRRCMFPj7Og6muSHNVYtLC9J/HWmPJ4JWw726MBapjmKS7s w39WcYYIth05eXBRtQFJLGeY50x+oFiAKeV0t9rYx/5nyPJDHnJJWTrx/hTNVSIL0YY+ /vANMrvkuzYuDCSpNAat2Ap1djatlSGhYGb4EtRsT+wQQ7Kf+P4+fUgIyB4oh74uX3Pr pZcqaok30d7TL15PmsmqtXpNGI7+TDFOlAOqysima9KTYWTOa9qnjM0gcuZStacXRvV1 NsefopGCi2CgXo2AHNE4EziOL8kgTaZsssx5boGDMv3yLXsTYfvRLQFcVWoBjReqW3D9 X5pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=sx9OxIFdY4NzqELX94oh/fd9umRX24uKGyg1w/4NOWY=; b=cyhw34mRkxe6dlftsQ8TrXG+VBwI+204mZK/mu0J1DAKAXOLDDknfNRoRV11fjoPUg gOf5qSlv/2H/OouKrsf5O1gkKaex4fO3wbzdgOBI45AFoqDSac9h/h1cxwGk2vH3c5Nd K/8rtoiGgE2F4fTh85zLMou/ZIID13HfRniQs9ZbxO0FwdqHmbjJantBMAdYPIfFt2MD HFoszlbHzL128aSHZvE9uTvmCKiHvKx2QXhvXCctZeCUM7nOD1+pnTWO1bWJF+QR0NFQ uK6GpGA480Kw8Abt+X0/GuUxI/Qz/pNy62EG55jwVh6YswuGo4TMPQTFCEodgttn0FqF AY8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Chb+4yuw; 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 71si1862826qvc.86.2021.09.16.08.51.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Sep 2021 08:51:23 -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=Chb+4yuw; 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]:57324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQtfX-0003Qm-3f for patch@linaro.org; Thu, 16 Sep 2021 11:51:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQtLp-0001qh-5Z for qemu-devel@nongnu.org; Thu, 16 Sep 2021 11:31:01 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:37696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQtLh-0002gA-AB for qemu-devel@nongnu.org; Thu, 16 Sep 2021 11:31:00 -0400 Received: by mail-pj1-x1030.google.com with SMTP id me5-20020a17090b17c500b0019af76b7bb4so7131443pjb.2 for ; Thu, 16 Sep 2021 08:30:50 -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=sx9OxIFdY4NzqELX94oh/fd9umRX24uKGyg1w/4NOWY=; b=Chb+4yuw/cV/lINWg6Sl4dc0FB6+1UBfYkzhS8JQP+pwvygJY+lyZOsPClNuDIH1tx +0hNGBMv9DCpqAQ1fV4McEOflYjNBL1Knrnt1qPOzPnI/PAfU25zPsmalmKduLNMY+K3 LendHxwOPJzc80QpxF+9spGYNJ+8EjO9BUkufu8l0PeyjZ9dDVnqL7RBFrOT4k87/G8B 1DGUPW9Z+XXqZOo1u9jX21aQGLIM5fnv3nIJ2hpSdEJ9XFkZNEq0G7Xqt5TSROrWkZ/h kKhb/2Dfm1/xTLlAkw9Lo3A5znuXW4nPanuonEuCWzcVEiMc+NMU2B+p+N2QNKQvBtdE 9E1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sx9OxIFdY4NzqELX94oh/fd9umRX24uKGyg1w/4NOWY=; b=NkQ/dGEviQh7lJcKwTeNEmoe5S5rbBYyP03XFj+zDeLCm2XSMcJWI2aaPdc/1VFIDB vD11xzYU2yMV4sK0rnUdhPNvOvHXyf4p8mR1JZwfaAP4KR5MrAr6Rt63FCyY1AleeEYS 3oxonXL0ulbinqcokyNxgXDaWbfXjuVrNoAY08rjRD/JeBO3Ya8ijsczxL46jPgo8bu9 hMkHjawsPMc7nLkCysJ01k9eoz9lJ7fHLmo8TIZbRYObcbEyIjLeMVZamR6Kl7Ie5Wal VrutFSShlfLNosvqeMfMycwDzsVB+7RnW+Kj12O9V64Czd6+iKDPVM4a93oznTW0Cvme rxBg== X-Gm-Message-State: AOAM5327+TL7d889gXZ/+1IBlXfuuHTkdYhuYfMtHeMD4c4o4NRDM/Xu +0FSqj269hCqCr15hvW1tzjNfHt0Udcj9w== X-Received: by 2002:a17:902:ceca:b0:13c:8366:deac with SMTP id d10-20020a170902ceca00b0013c8366deacmr5210440plg.68.1631806249862; Thu, 16 Sep 2021 08:30:49 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id b7sm3779447pgs.64.2021.09.16.08.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 08:30:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 34/35] tcg/mips: Unset TCG_TARGET_HAS_direct_jump Date: Thu, 16 Sep 2021 08:30:24 -0700 Message-Id: <20210916153025.1944763-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210916153025.1944763-1-richard.henderson@linaro.org> References: <20210916153025.1944763-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Only use indirect jumps. Finish weaning away from the unique alignment requirements for code_gen_buffer. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.h | 12 +++++------- tcg/mips/tcg-target.c.inc | 23 +++++------------------ 2 files changed, 10 insertions(+), 25 deletions(-) -- 2.25.1 diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index 3a62055f04..c366fdf74b 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -39,11 +39,7 @@ #define TCG_TARGET_TLB_DISPLACEMENT_BITS 16 #define TCG_TARGET_NB_REGS 32 -/* - * We have a 256MB branch region, but leave room to make sure the - * main executable is also within that region. - */ -#define MAX_CODE_GEN_BUFFER_SIZE (128 * MiB) +#define MAX_CODE_GEN_BUFFER_SIZE ((size_t)-1) typedef enum { TCG_REG_ZERO = 0, @@ -136,7 +132,7 @@ extern bool use_mips32r2_instructions; #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 -#define TCG_TARGET_HAS_direct_jump 1 +#define TCG_TARGET_HAS_direct_jump 0 #if TCG_TARGET_REG_BITS == 64 #define TCG_TARGET_HAS_add2_i32 0 @@ -207,7 +203,9 @@ extern bool use_mips32r2_instructions; #define TCG_TARGET_DEFAULT_MO (0) #define TCG_TARGET_HAS_MEMORY_BSWAP 1 -void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t, uintptr_t); +/* not defined -- call should be eliminated at compile time */ +void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t, uintptr_t) + QEMU_ERROR("code path is reachable"); #ifdef CONFIG_SOFTMMU #define TCG_TARGET_NEED_LDST_LABELS diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 3a40af8799..41ffa28394 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -1654,17 +1654,11 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, } break; case INDEX_op_goto_tb: - if (s->tb_jmp_insn_offset) { - /* direct jump method */ - s->tb_jmp_insn_offset[a0] = tcg_current_code_size(s); - /* Avoid clobbering the address during retranslation. */ - tcg_out32(s, OPC_J | (*(uint32_t *)s->code_ptr & 0x3ffffff)); - } else { - /* indirect jump method */ - tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP0, TCG_REG_ZERO, - (uintptr_t)(s->tb_jmp_target_addr + a0)); - tcg_out_opc_reg(s, OPC_JR, 0, TCG_TMP0, 0); - } + /* indirect jump method */ + tcg_debug_assert(s->tb_jmp_insn_offset == 0); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP0, TCG_REG_ZERO, + (uintptr_t)(s->tb_jmp_target_addr + a0)); + tcg_out_opc_reg(s, OPC_JR, 0, TCG_TMP0, 0); tcg_out_nop(s); set_jmp_reset_offset(s, a0); break; @@ -2538,13 +2532,6 @@ static void tcg_target_init(TCGContext *s) tcg_regset_set_reg(s->reserved_regs, TCG_REG_GP); /* global pointer */ } -void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_rx, - uintptr_t jmp_rw, uintptr_t addr) -{ - qatomic_set((uint32_t *)jmp_rw, deposit32(OPC_J, 0, 26, addr >> 2)); - flush_idcache_range(jmp_rx, jmp_rw, 4); -} - typedef struct { DebugFrameHeader h; uint8_t fde_def_cfa[4];