From patchwork Tue Apr 25 19:31:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 676842 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp2881273wrs; Tue, 25 Apr 2023 12:45:15 -0700 (PDT) X-Google-Smtp-Source: AKy350b2k4BG2SDmgiPPFfgJ0C6nyDJQzvD2z7vm9jgkngO3aBKJtmH4xXSEo7qz8euEMr0s03Jt X-Received: by 2002:ad4:5fc5:0:b0:5e6:1bf5:1af2 with SMTP id jq5-20020ad45fc5000000b005e61bf51af2mr31861888qvb.18.1682451915163; Tue, 25 Apr 2023 12:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682451915; cv=none; d=google.com; s=arc-20160816; b=v1p3r6j17Uf2lmv7UOkTQ+LmXYULpfXVWvUtvYsSVyqpKLguqPRHt1rFRffKzelSGQ xk9qO/NdSvkC5Pmb2ABRRTLr2LapThRnEJKzlLv58KDQpmV8kw4RTz41Gg6BoldMLIzg jHt1J6RMHg/SGONZbP3QR4aL61PRCqjJUjWYh//ItFpgbnHOiFJmMEGlFfkrtxrm1z/B F2I1d39yG0yRg9z5mq4QAOBZHhVPlaMvf86Qzk9qoI7JG7UYHLDw7j1jdga484ek2voh JhGDlh7p3P02Yy2zZKE2dllHx3cOiYHJY7gTIQRAivV1A8Tlx33BNPWELSCD6GfqcV3U TIOQ== 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=RTRyUJJ//8McRlEJCpdcC3CCDoyJJ5ltYvB50/bCFGE=; b=nSPrTtW83Chg0kJKGwG/4VyT98W++i++53utWZrwKxS3Wv08TxAl7VSrxR4W4W0Imd evrjl0FvQGCT8qoICuUppa4amTbnvNyxtzFdmnIo0Ux+MYAboG2g0CBrKB2zL9O7tRkx HplFZBZ1CBp3Ay3t29/oQSxn2+OEBylG4oK8xAxzB/uGUT0XJzoBEOlkY1lr9Dui0MxE m9Mx/fyYZ6lnbKoO4TIuFSdamfV0vZgyixrygD3QdUvCTbfGdw1x68kTyS26naodKTyV LkKxvcqTdu4TcP+PDx2t0NeLEvoU21WO7TrQPzHDattku/xynyBi8A/JgMqmA/EDmjaV RK5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JucbdGKM; 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 i8-20020ad45c68000000b005355b070980si9303830qvh.463.2023.04.25.12.45.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Apr 2023 12:45:15 -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=JucbdGKM; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prORr-0005h3-IY; Tue, 25 Apr 2023 15:35:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prOR7-0004Ch-Af for qemu-devel@nongnu.org; Tue, 25 Apr 2023 15:34:50 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prOQz-00050V-Sn for qemu-devel@nongnu.org; Tue, 25 Apr 2023 15:34:47 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2a8baeac4d1so60912301fa.1 for ; Tue, 25 Apr 2023 12:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682451279; x=1685043279; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RTRyUJJ//8McRlEJCpdcC3CCDoyJJ5ltYvB50/bCFGE=; b=JucbdGKMAchPxx+TKrrskyDhoA5x9eyO2R4fxUbLt9rH5Quqn58Eeua6J21M97NhCY tfxi2VOa+cWFKOC5iY8Lrr6IfVcnrAJpttBs15pnH7RU/zmCH473/kdzGrnZOrNOwFcP u6ojuX0ukfks96mPjQ6rgji5Z4umdRqMIpdr8EMD8KbeCnxSm3BHd9hWc4c6e8wco/Uv Sgskva6A0RM/Iqj0LrCbLTDFjjxFHaWGM4qci3Y4K/n7GxrRwuFM7CbokjNvfVfQuQQ8 l2nyufQFJp5D5KEjjNLH/ZIGl72IVUMUMTKqOG8aUDr+SmsrLaflu/EDL/jCnYqvh3ug 9pag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682451279; x=1685043279; 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:message-id:reply-to; bh=RTRyUJJ//8McRlEJCpdcC3CCDoyJJ5ltYvB50/bCFGE=; b=ELXqDchZTerKEybBi4wy/z9H2uJzPNtFSH+JPMRt87uYX8+ADkWXpLve5wCWf22mP6 JKC8c4g/yDtg7+XI5tDKWzUKoq7KuUepF40asHz67fas4qT3SHwSJcc4a+mRRgOMYAUK jk5jvVpNJoqFdULNJaIx03X9g8/PwOWnMDINVQ3t4fsw8LfP+mjLMWZdDZL3ireVto5W vsTBXx8Gias2J93s6p8gB/yKXrdoqmhyRJZDo7T8Vw5hNrrzYgQoz88wIfeovS8qAc4y fXS7xbff5GrvG99qLxnewty1rOsYBWUuhWpYUZ5rEF66dmAzvvRBlDCyXCKMwJxAE3WW lVIQ== X-Gm-Message-State: AAQBX9dq9pruLhWjMHBBApWtEjRaZqNEVeWOPxFoYSBkBkubuCu2VhoA +hjgtQXE+21rHWGlQTYoKYQ9Dt5SvzTd4Ja8RLzY/Q== X-Received: by 2002:a2e:8216:0:b0:2a8:ae90:83d6 with SMTP id w22-20020a2e8216000000b002a8ae9083d6mr3579235ljg.48.1682451279612; Tue, 25 Apr 2023 12:34:39 -0700 (PDT) Received: from stoup.. ([91.209.212.61]) by smtp.gmail.com with ESMTPSA id z23-20020a2e8857000000b002a8c271de33sm2160484ljj.67.2023.04.25.12.34.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 12:34:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, git@xen0n.name, jiaxun.yang@flygoat.com, philmd@linaro.org Subject: [PATCH v3 28/57] tcg/mips: Use full load/store helpers in user-only mode Date: Tue, 25 Apr 2023 20:31:17 +0100 Message-Id: <20230425193146.2106111-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230425193146.2106111-1-richard.henderson@linaro.org> References: <20230425193146.2106111-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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-bounces+patch=linaro.org@nongnu.org Instead of using helper_unaligned_{ld,st}, use the full load/store helpers. This will allow the fast path to increase alignment to implement atomicity while not immediately raising an alignment exception. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c.inc | 57 ++------------------------------------- 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 7770ef46bd..fa0f334e8d 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -1075,7 +1075,6 @@ static void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg, tcg_out_nop(s); } -#if defined(CONFIG_SOFTMMU) /* We have four temps, we might as well expose three of them. */ static const TCGLdstHelperParam ldst_helper_param = { .ntmp = 3, .tmp = { TCG_TMP0, TCG_TMP1, TCG_TMP2 } @@ -1088,8 +1087,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) /* resolve label address */ if (!reloc_pc16(l->label_ptr[0], tgt_rx) - || (TCG_TARGET_REG_BITS < TARGET_LONG_BITS - && !reloc_pc16(l->label_ptr[1], tgt_rx))) { + || (l->label_ptr[1] && !reloc_pc16(l->label_ptr[1], tgt_rx))) { return false; } @@ -1118,8 +1116,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) /* resolve label address */ if (!reloc_pc16(l->label_ptr[0], tgt_rx) - || (TCG_TARGET_REG_BITS < TARGET_LONG_BITS - && !reloc_pc16(l->label_ptr[1], tgt_rx))) { + || (l->label_ptr[1] && !reloc_pc16(l->label_ptr[1], tgt_rx))) { return false; } @@ -1139,56 +1136,6 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) return true; } -#else -static bool tcg_out_fail_alignment(TCGContext *s, TCGLabelQemuLdst *l) -{ - void *target; - - if (!reloc_pc16(l->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) { - return false; - } - - if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { - /* A0 is env, A1 is skipped, A2:A3 is the uint64_t address. */ - TCGReg a2 = MIPS_BE ? l->addrhi_reg : l->addrlo_reg; - TCGReg a3 = MIPS_BE ? l->addrlo_reg : l->addrhi_reg; - - if (a3 != TCG_REG_A2) { - tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_A2, a2); - tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_A3, a3); - } else if (a2 != TCG_REG_A3) { - tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_A3, a3); - tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_A2, a2); - } else { - tcg_out_mov(s, TCG_TYPE_I32, TCG_TMP0, TCG_REG_A2); - tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_A2, TCG_REG_A3); - tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_A3, TCG_TMP0); - } - } else { - tcg_out_mov(s, TCG_TYPE_TL, TCG_REG_A1, l->addrlo_reg); - } - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_A0, TCG_AREG0); - - /* - * Tail call to the helper, with the return address back inline. - * We have arrived here via BNEL, so $31 is already set. - */ - target = (l->is_ld ? helper_unaligned_ld : helper_unaligned_st); - tcg_out_call_int(s, target, true); - return true; -} - -static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) -{ - return tcg_out_fail_alignment(s, l); -} - -static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) -{ - return tcg_out_fail_alignment(s, l); -} -#endif /* SOFTMMU */ - typedef struct { TCGReg base; MemOp align;