From patchwork Tue May 16 19:40:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 682357 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:558:b0:22d:db33:bb6d with SMTP id w24csp638729ltp; Tue, 16 May 2023 12:42:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6H+nfI1EneO7RgrHUULNBv4YiC435E58Gc2v64F6epNEzHMspuN8BDEXSrlgkD/FXxuQqE X-Received: by 2002:ad4:5bcd:0:b0:61b:5b4b:2a4 with SMTP id t13-20020ad45bcd000000b0061b5b4b02a4mr12844437qvt.29.1684266169756; Tue, 16 May 2023 12:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684266169; cv=none; d=google.com; s=arc-20160816; b=gmOylqkdWrSDTu4b8rANwEN0oFE3ndrEZ5U/vSYLMzuKrfwIiG0rpYvRwjEw2u5iq4 ErX0zOFgjkNnTFwMR3ZZAmSJHPlaFi4ay9XbzP4BD3Ol6RqauTj0Ro/UVPa0wIsIN+LF 7QgTIcLpCaOGWaNk28ihiYNFRvpfLEo8An8WMEpDIFgpX3v+O+0QwL38glLGloyGvHzY Kv4CwPMJs5tRqDq7mJWrXDle0L1YApG+/UT7CJfaaLrWfMdxC9zaMSvXU8YWnANWo9tI qJh6INtzvXEdRK/YFpCqnfphhB25sF7DI+HtDXkvTnGc6wVPa23LDuZel7ILh404mUF1 Yoow== 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=W19ruQQxWDDIeEDzZGJivenEm5AmU9KSchMTkoB+WqU=; b=S4dzuu2BlhOjMOp9NHiROEE2mULeBHvng+yQvZW9W8jNFQDmEKRPmmyoY18QvvmktY Mc0M63u2x/8Q5fGJBwHu0ZcNn2z9i1bpHTBuNTcSBa7U4+2u6JHtmKqEMEwDnp1OljC+ hE0i9WIMNC/9CYWvlC4pHRWvPkrlUpL3wSWpNoFdD68DR79VPKfRw8AhyZBaSuG4j5Xp //Fi49Jl4CFJB4oc60O4NniFy1Kus6dWe24E77jLUQn6MsPmlYchKiP9J1qvY2rzKRbG lhbgNe1izig20dbYyTVrtJySL002ueTroqR2K4Sg/2asT1D4R6CoLHqdpvqlfG2DOe21 BAag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZeIhiwuV; 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 x24-20020a05620a12b800b0074e19a5795dsi231839qki.340.2023.05.16.12.42.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 May 2023 12:42:49 -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=ZeIhiwuV; 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 1pz0Yi-0006h1-Lr; Tue, 16 May 2023 15:42:08 -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 1pz0Ye-0006fM-VW for qemu-devel@nongnu.org; Tue, 16 May 2023 15:42:04 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pz0Yd-0002lO-44 for qemu-devel@nongnu.org; Tue, 16 May 2023 15:42:04 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-643557840e4so15613786b3a.2 for ; Tue, 16 May 2023 12:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684266122; x=1686858122; 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=W19ruQQxWDDIeEDzZGJivenEm5AmU9KSchMTkoB+WqU=; b=ZeIhiwuV0DyAsO/BKOZrb56VSlvN9ZtwUXAvDVoOwMDeNrGh0BXfqvb5nxJtBAs5CI FMkNnyfSt1DXd9rcHG5T+R6CPWHj6f9m3sd7v+uCG4uLe0QlVXdia7seXfcZnjzT1jUP jwb0IrKBYVqTOuGJucsOPKP60ROzrNztJ/K4qEVdNEGdpLwMB3UYkE7Gpu221vqiB0Lk Iv7uEzzGfZEPHEO3CWu0jWmCFEfcVXhkA8uAU3DbJGr3X+4vTdV5e5ZbOJlYulJ2NR3k WinCqN5imZexdyKVD1BqYoOPqiTkpxXwy+Ro0sMiLFjpQ6jC2ltMx+OOzx/q96lqtfsT AVag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684266122; x=1686858122; 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=W19ruQQxWDDIeEDzZGJivenEm5AmU9KSchMTkoB+WqU=; b=NSxmKoy2z5lRhtEXXQFgcpE6QooWUIb2mcEdNyBfRRJa/w7oOAc1+xDcIFE93OLjsy aW8bEuHV33004ErFmdE+JW0p3stSw2uhMRlkVZX0Ntx8Na9lSV59Kcpa8/JIT8renDOD NsQpebhxe2as0qefmOTfaepXvN6GxSEV4/ri/Q86Q9CbIZNll/ca529VRLBIZRzdCw6h 5ZI3DdentpldQjlIPIY9oVunLfPdto66wNTLBmQqa8xHxT3flaU2babW+gYFSKlhIzOW AnFlbjzjByvv6H3wy8oglbG4e0eSvYHp6Xk/2u83t5MpXxIclsCpHCp6Id1Cbbt2/+u2 Q4Jg== X-Gm-Message-State: AC+VfDzN6Tl1exiI7zSK1sKjAyunJvEVDxc5wXMVby+0qAgS9rr+ezRf qpEYwkcxBR9j/gsIn/tQa/CHpXYqrRIznr1OXe0= X-Received: by 2002:a05:6a00:801:b0:63d:2260:f7d with SMTP id m1-20020a056a00080100b0063d22600f7dmr54301260pfk.8.1684266122352; Tue, 16 May 2023 12:42:02 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:ec81:440e:33a4:40b9]) by smtp.gmail.com with ESMTPSA id z21-20020aa791d5000000b006260526cf0csm13771165pfa.116.2023.05.16.12.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 12:42:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 17/80] tcg/riscv: Use full load/store helpers in user-only mode Date: Tue, 16 May 2023 12:40:42 -0700 Message-Id: <20230516194145.1749305-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230516194145.1749305-1-richard.henderson@linaro.org> References: <20230516194145.1749305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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=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-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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.c.inc | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 8ed0e2f210..19cd4507fb 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -846,7 +846,6 @@ static void tcg_out_mb(TCGContext *s, TCGArg a0) * Load/store and TLB */ -#if defined(CONFIG_SOFTMMU) static void tcg_out_goto(TCGContext *s, const tcg_insn_unit *target) { tcg_out_opc_jump(s, OPC_JAL, TCG_REG_ZERO, 0); @@ -893,34 +892,6 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) tcg_out_goto(s, l->raddr); return true; } -#else -static bool tcg_out_fail_alignment(TCGContext *s, TCGLabelQemuLdst *l) -{ - /* resolve label address */ - if (!reloc_sbimm12(l->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) { - return false; - } - - 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, with the return address back inline. */ - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_RA, (uintptr_t)l->raddr); - tcg_out_call_int(s, (const void *)(l->is_ld ? helper_unaligned_ld - : helper_unaligned_st), 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 /* CONFIG_SOFTMMU */ /* * For softmmu, perform the TLB load and compare.