From patchwork Tue May 16 19:41:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 682398 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp19707wrt; Tue, 16 May 2023 12:54:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ51BXPjMMa76GNzr2HpwjbRpxbpk+ePcCzzmiU5fnX6dMyvOf4VQJNMLdsKJG/TBEB+kYf/ X-Received: by 2002:a05:622a:350:b0:3f3:96c9:b071 with SMTP id r16-20020a05622a035000b003f396c9b071mr46311007qtw.26.1684266867944; Tue, 16 May 2023 12:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684266867; cv=none; d=google.com; s=arc-20160816; b=d+ilx+PMRhdnrZMONyAVlVmvz4um+CzZXPy7x5+5FWgPfMk39OqXBdl3ECgZl+Ht5Q 9TqltYYpkVyHmuZcgUonzIJZsaKhQt4jOmD5g5g3i9Nce5GLWott9ezXvn3xvSNQIkch oQHSJAmugL05EDtrY2W9JqkTwcYkeOCFZLfV5WH7AFsq2VOX/X937oy+/ALold4aNSTJ JwSSqm9w4OJLOw92K/GxKROuXKP+5vKErEd6G1WkYFJ/zEx4FYE8n+SEQpDEIpc5YwLd kv8/YOKJ2vrsLTEepNzu+p2p7uio4W2l9iFV6wCh8Da3XaaIBqo+yAfTBjs4CbmJ1D8C 8Olg== 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=1qqlVmOWLkkD4N0TUKCkau5U1AXPhMOrCn0VUAaOFSs=; b=PkwRD2A96RynGkf1tgjaT6yEw1dBFPbx5+NZHA24N3/fUKRpOXIsuigExhRDWjmAMM 79wmr8YKjB8h2b31rGJ9eKp61q3W649aIp4JcK+XIm+ANyVyAh/EU8ROqjO1LfdOnriv 5qJrq0TxQy25EoXCNJ9hVG/hry1BAu3PkOyA63tShxBXX7O1xutA0i+yZFE3EyaPfbcO yMvSVif3VU2LC3g5a8KZi+CoyU5W6rTC1liGfF/AXg+4fdftfLwbzPE2NIXRrFEvs+fY bhyVRt/Y35bF7yk9GshUVbOwfVAEZw+QXwjjIJA5Iy8Sy9PpddbTz5hDk4oWTUf6MWr3 Gqag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VMVhWe/J"; 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 t29-20020a37ea1d000000b0074debe9eb58si258971qkj.279.2023.05.16.12.54.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 May 2023 12:54:27 -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="VMVhWe/J"; 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 1pz0bz-0008Ox-Dk; Tue, 16 May 2023 15:45:32 -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 1pz0bu-0008Hy-K0 for qemu-devel@nongnu.org; Tue, 16 May 2023 15:45:26 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pz0bs-0003eh-Ph for qemu-devel@nongnu.org; Tue, 16 May 2023 15:45:26 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-52079a12451so10506643a12.3 for ; Tue, 16 May 2023 12:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684266323; x=1686858323; 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=1qqlVmOWLkkD4N0TUKCkau5U1AXPhMOrCn0VUAaOFSs=; b=VMVhWe/JxWeftGcUftozwAjFobVowe+43QdO1ZTTHJ2HPAjNtEwuSw+kQhWhOiV6Lk 7+xw86dRuXgtLwfuWtOlszi74mZjyl9uKeaB12jO18IXy7ysfyNqEAVhfPuSuPjus1qW rk/qoyQp1Xzoy3DfjR+lSdqzlDGHlTzZhg2Vnqcex68Y/oD5dl4ChYGQU/L+AmYnLzL6 PSzn/qoIJ3wkkq85UkVxEwF28IV92xg6iDplbLP2iX7hw/pLEPGM6m8FWSxEHR6vt8yj FZ53Id4SHU2Sf1dyLkWXxkivh77CzJhe/+/dvMF6MR/HbabnA6toaVLBUSXFledZ5Rqg kQDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684266323; x=1686858323; 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=1qqlVmOWLkkD4N0TUKCkau5U1AXPhMOrCn0VUAaOFSs=; b=XF9V9U+W5GbkAyCZ6eAkipEY/QP+5z9QR7ylY2ESXNBbZPoZfl6G5kN5h/gO905Egk kcs4ojOm9VZ6U5etCioFxKYVy1cUOUcWn8MtPt9bFKQ4Z780fCM5tDavjhjbLPhlVmB1 q/OfXtYD9IE8e/PLj6Pb9jNSMnU/CwZ9Gnk/ClT5Y+AcUyozzSQ7yJdcPQyCkqQncfi3 EhVGKnRlv0Sh4UgW7oOShPM8BlMIxqXHySOKCefExhXNArcqhLdUAFirqp9au3fGLv0B twviXhSECAcMEVw+NnoAXyqNliVutKeFuu+j2zBosBVQ+8Xb31t6EUuKbXgvV6hq2+KK 5oCw== X-Gm-Message-State: AC+VfDzIW5uoXe1RLJzOV7hyxBLQvVlO/XNC3CvePFuqcPFlVUwBs9vk 302gdZqky99zc6dnWuCDL+uh21nkJ/GJxVCcnaQ= X-Received: by 2002:a17:90a:e68b:b0:250:8f09:75f2 with SMTP id s11-20020a17090ae68b00b002508f0975f2mr28857460pjy.22.1684266323347; Tue, 16 May 2023 12:45:23 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:ec81:440e:33a4:40b9]) by smtp.gmail.com with ESMTPSA id y12-20020a17090abd0c00b002508d73f4e8sm25555pjr.57.2023.05.16.12.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 12:45:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 40/80] tcg/arm: Use atom_and_align_for_opc Date: Tue, 16 May 2023 12:41:05 -0700 Message-Id: <20230516194145.1749305-41-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::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 No change to the ultimate load/store routines yet, so some atomicity conditions not yet honored, but plumbs the change to alignment through the relevant functions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index e5aed03247..add8cc1fd5 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1323,6 +1323,7 @@ typedef struct { TCGReg base; int index; bool index_scratch; + TCGAtomAlign aa; } HostAddress; bool tcg_target_has_memory_bswap(MemOp memop) @@ -1379,8 +1380,26 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, { TCGLabelQemuLdst *ldst = NULL; MemOp opc = get_memop(oi); - MemOp a_bits = get_alignment_bits(opc); - unsigned a_mask = (1 << a_bits) - 1; + unsigned a_mask; + +#ifdef CONFIG_SOFTMMU + *h = (HostAddress){ + .cond = COND_AL, + .base = addrlo, + .index = TCG_REG_R1, + .index_scratch = true, + }; +#else + *h = (HostAddress){ + .cond = COND_AL, + .base = addrlo, + .index = guest_base ? TCG_REG_GUEST_BASE : -1, + .index_scratch = false, + }; +#endif + + h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, false); + a_mask = (1 << h->aa.align) - 1; #ifdef CONFIG_SOFTMMU int mem_index = get_mmuidx(oi); @@ -1469,13 +1488,6 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, if (TARGET_LONG_BITS == 64) { tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R3, addrhi, 0); } - - *h = (HostAddress){ - .cond = COND_AL, - .base = addrlo, - .index = TCG_REG_R1, - .index_scratch = true, - }; #else if (a_mask) { ldst = new_ldst_label(s); @@ -1484,18 +1496,11 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, ldst->addrlo_reg = addrlo; ldst->addrhi_reg = addrhi; - /* We are expecting a_bits to max out at 7 */ + /* We are expecting alignment to max out at 7 */ tcg_debug_assert(a_mask <= 0xff); /* tst addr, #mask */ tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, a_mask); } - - *h = (HostAddress){ - .cond = COND_AL, - .base = addrlo, - .index = guest_base ? TCG_REG_GUEST_BASE : -1, - .index_scratch = false, - }; #endif return ldst;