From patchwork Tue May 2 16:08:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 678414 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp595174wrs; Tue, 2 May 2023 09:09:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66sP0owAltEIjp/gONLM0246SmmQshyK9o8TNhK6tfwDt7LAm/syfKrNSUtdQ5SDWhWlNe X-Received: by 2002:ad4:5f0c:0:b0:5ea:9fc5:fca2 with SMTP id fo12-20020ad45f0c000000b005ea9fc5fca2mr5837150qvb.45.1683043782810; Tue, 02 May 2023 09:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683043782; cv=none; d=google.com; s=arc-20160816; b=FD4EBMkUuN+SIlrXFoM04QPfVR4W1ix5v1iUgQssZ3AwyLqy7mY7YAj9ySy5aH2uSt PGBLs0cwo/rYHMZgJQA5mz1qWymwKqs8wFKATaqnQMrRuXWrrRx5kFMDVPKsDAum2rj/ Jnlz+7xdH5DS005JD2qNJdg7bXZhuiZHe30v2kOt3SQku/cA2X+Gn17U9BP+fmk6jDV1 7icTj8ILeEQN4j03/8HRsLxMg1gHnmiIutY4HduwGB/c4o74kt2MkCu5P2dS042CipY1 A+ADp6ZH9sg1lYFgrI2dTzBSOgeJ3SWExmKGwkGKmMKbpbR1RevCrtM7eGSNwM6UrHP6 vtSQ== 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=ElGkLkSZPG5U6w3IO50r2nvTqh+XRQqzsanCGPviKUM=; b=S96IDUAQ8Ga/lvwJVsD9E9h9pTKoTU5Morue4BQIEks1gPAIl6aYMN93JfnqtEJs1m s1Zek1buVP3B13QYx+KyvRX6Bc04gCMWlc1+Ms9xpK1vB0mt2A6bepLgZp/CujYdcq+A RpnKbwK4K/yizR4wBHWkQfDZRpUUY460/7TNiXxa9eeIgtoVNXfxqgxH2+V7K36qCNBY DKhauKWexsb5eMGePawbmw+7cEAe5+iMPHuGfQVfio7T3ebHedL9ylrF8g0Ep6szBGqW mO7qhyJVbUaJRYDxLjCh4WpHrtL5VCtwJ8oBaFXvxFZPbFQzCGPthzMCCqbtH9REC7+y 6Ezg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jr2g7nGC; 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 bj13-20020a05620a190d00b0074fc523b35dsi10026159qkb.311.2023.05.02.09.09.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 May 2023 09:09:42 -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=jr2g7nGC; 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 1ptsYw-0002pM-Ik; Tue, 02 May 2023 12:09:10 -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 1ptsYf-0002lm-MN for qemu-devel@nongnu.org; Tue, 02 May 2023 12:08:59 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ptsYc-0000b9-Sc for qemu-devel@nongnu.org; Tue, 02 May 2023 12:08:53 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-2f6401ce8f8so2489766f8f.3 for ; Tue, 02 May 2023 09:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683043729; x=1685635729; 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=ElGkLkSZPG5U6w3IO50r2nvTqh+XRQqzsanCGPviKUM=; b=jr2g7nGCKLSUqBjmWl2In101FECMXT4VwKxb+mXz7gobIPG0tqjipoHNngCj2KGsKS i9OEN856b0Sbbp3KlV7PcpFuze14EWeSWeSskjzYR/BJ8SD/09nNTBfHGo+PwSZBVpHi Nu+JnjHLAWNwOlBx9JYNQvj/g8+TA8TjwscctE+Kj6SCyyqmVC7N6BBtL8Yrej6kHkG3 hkUGon7PLL8sc2Km6I4KPUhNsHxraGbji6wgGeBa613Ss6VlrNsIk/2hWTeJsdlbYCYI osLNKfhfK/5XKVP8UBkGaScIV960Pw0Ed2GPNX0B3Y4Xyi5EKk6x8Z2c6bjJ5FuqpAlq UslQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683043729; x=1685635729; 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=ElGkLkSZPG5U6w3IO50r2nvTqh+XRQqzsanCGPviKUM=; b=ILxAhS44Mi8biUT+iPx7fCfMHNIDAl+Mm84JspWEmw1mvPqC0L30/c9gAFyBIZhpJ4 kNYeTeOTvhK9ilnZp2ZWaPknYmBQLBXGMTUmlfQStRtmQMLgAxaYXc3wwj9etCbusY0C tV4aE81d+vrXeS6LmG70Iu9n5qe8u0tLY4l3TV5TAVQWYIalb8FWjehEDLzrwfD6qsr6 b3ZXiOkzCvXujgHekd+J41J4GXksUm3JqCpOfnCFPCDKLqneceh/EjzLxTY7hzQFHivy zGAbryCgJzx8ra6DUepdfZEPNqJGas/6b3XfRWQrciqxg96OSz3JpUChu8Zk5lmATpRk Dqjw== X-Gm-Message-State: AC+VfDzSIdtK+O264XHTW1WRo1j+VdYPwJ0pLB1wOjGltz1e0In+ANyp vTwP/P9S5XIHOJ5QA4OGlJwX6LVTKQ1nwwnGx4L2TQ== X-Received: by 2002:adf:f892:0:b0:306:320f:7bd0 with SMTP id u18-20020adff892000000b00306320f7bd0mr3695310wrp.19.1683043728974; Tue, 02 May 2023 09:08:48 -0700 (PDT) Received: from stoup.Home ([2a02:c7c:74db:8d00:ad29:f02c:48a2:269c]) by smtp.gmail.com with ESMTPSA id v16-20020a05600c471000b003ede3f5c81fsm39918471wmo.41.2023.05.02.09.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 09:08:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, jiaxun.yang@flygoat.com, crwulff@gmail.com, marex@denx.de, ysato@users.sourceforge.jp, mark.cave-ayland@ilande.co.uk Subject: [PATCH 02/16] target/alpha: Use MO_ALIGN where required Date: Tue, 2 May 2023 17:08:32 +0100 Message-Id: <20230502160846.1289975-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230502160846.1289975-1-richard.henderson@linaro.org> References: <20230502160846.1289975-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x429.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 Mark all memory operations that are not already marked with UNALIGN. Signed-off-by: Richard Henderson --- target/alpha/translate.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index ffbac1c114..be8adb2526 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -2399,21 +2399,21 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) switch ((insn >> 12) & 0xF) { case 0x0: /* Longword physical access (hw_ldl/p) */ - tcg_gen_qemu_ld_i64(va, addr, MMU_PHYS_IDX, MO_LESL); + tcg_gen_qemu_ld_i64(va, addr, MMU_PHYS_IDX, MO_LESL | MO_ALIGN); break; case 0x1: /* Quadword physical access (hw_ldq/p) */ - tcg_gen_qemu_ld_i64(va, addr, MMU_PHYS_IDX, MO_LEUQ); + tcg_gen_qemu_ld_i64(va, addr, MMU_PHYS_IDX, MO_LEUQ | MO_ALIGN); break; case 0x2: /* Longword physical access with lock (hw_ldl_l/p) */ - tcg_gen_qemu_ld_i64(va, addr, MMU_PHYS_IDX, MO_LESL); + tcg_gen_qemu_ld_i64(va, addr, MMU_PHYS_IDX, MO_LESL | MO_ALIGN); tcg_gen_mov_i64(cpu_lock_addr, addr); tcg_gen_mov_i64(cpu_lock_value, va); break; case 0x3: /* Quadword physical access with lock (hw_ldq_l/p) */ - tcg_gen_qemu_ld_i64(va, addr, MMU_PHYS_IDX, MO_LEUQ); + tcg_gen_qemu_ld_i64(va, addr, MMU_PHYS_IDX, MO_LEUQ | MO_ALIGN); tcg_gen_mov_i64(cpu_lock_addr, addr); tcg_gen_mov_i64(cpu_lock_value, va); break; @@ -2438,11 +2438,13 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) goto invalid_opc; case 0xA: /* Longword virtual access with protection check (hw_ldl/w) */ - tcg_gen_qemu_ld_i64(va, addr, MMU_KERNEL_IDX, MO_LESL); + tcg_gen_qemu_ld_i64(va, addr, MMU_KERNEL_IDX, + MO_LESL | MO_ALIGN); break; case 0xB: /* Quadword virtual access with protection check (hw_ldq/w) */ - tcg_gen_qemu_ld_i64(va, addr, MMU_KERNEL_IDX, MO_LEUQ); + tcg_gen_qemu_ld_i64(va, addr, MMU_KERNEL_IDX, + MO_LEUQ | MO_ALIGN); break; case 0xC: /* Longword virtual access with alt access mode (hw_ldl/a)*/ @@ -2453,12 +2455,14 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) case 0xE: /* Longword virtual access with alternate access mode and protection checks (hw_ldl/wa) */ - tcg_gen_qemu_ld_i64(va, addr, MMU_USER_IDX, MO_LESL); + tcg_gen_qemu_ld_i64(va, addr, MMU_USER_IDX, + MO_LESL | MO_ALIGN); break; case 0xF: /* Quadword virtual access with alternate access mode and protection checks (hw_ldq/wa) */ - tcg_gen_qemu_ld_i64(va, addr, MMU_USER_IDX, MO_LEUQ); + tcg_gen_qemu_ld_i64(va, addr, MMU_USER_IDX, + MO_LEUQ | MO_ALIGN); break; } break; @@ -2659,7 +2663,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) vb = load_gpr(ctx, rb); tmp = tcg_temp_new(); tcg_gen_addi_i64(tmp, vb, disp12); - tcg_gen_qemu_st_i64(va, tmp, MMU_PHYS_IDX, MO_LESL); + tcg_gen_qemu_st_i64(va, tmp, MMU_PHYS_IDX, MO_LESL | MO_ALIGN); break; case 0x1: /* Quadword physical access */ @@ -2667,17 +2671,17 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) vb = load_gpr(ctx, rb); tmp = tcg_temp_new(); tcg_gen_addi_i64(tmp, vb, disp12); - tcg_gen_qemu_st_i64(va, tmp, MMU_PHYS_IDX, MO_LEUQ); + tcg_gen_qemu_st_i64(va, tmp, MMU_PHYS_IDX, MO_LEUQ | MO_ALIGN); break; case 0x2: /* Longword physical access with lock */ ret = gen_store_conditional(ctx, ra, rb, disp12, - MMU_PHYS_IDX, MO_LESL); + MMU_PHYS_IDX, MO_LESL | MO_ALIGN); break; case 0x3: /* Quadword physical access with lock */ ret = gen_store_conditional(ctx, ra, rb, disp12, - MMU_PHYS_IDX, MO_LEUQ); + MMU_PHYS_IDX, MO_LEUQ | MO_ALIGN); break; case 0x4: /* Longword virtual access */ @@ -2771,11 +2775,11 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) break; case 0x2A: /* LDL_L */ - gen_load_int(ctx, ra, rb, disp16, MO_LESL, 0, 1); + gen_load_int(ctx, ra, rb, disp16, MO_LESL | MO_ALIGN, 0, 1); break; case 0x2B: /* LDQ_L */ - gen_load_int(ctx, ra, rb, disp16, MO_LEUQ, 0, 1); + gen_load_int(ctx, ra, rb, disp16, MO_LEUQ | MO_ALIGN, 0, 1); break; case 0x2C: /* STL */ @@ -2788,12 +2792,12 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) case 0x2E: /* STL_C */ ret = gen_store_conditional(ctx, ra, rb, disp16, - ctx->mem_idx, MO_LESL); + ctx->mem_idx, MO_LESL | MO_ALIGN); break; case 0x2F: /* STQ_C */ ret = gen_store_conditional(ctx, ra, rb, disp16, - ctx->mem_idx, MO_LEUQ); + ctx->mem_idx, MO_LEUQ | MO_ALIGN); break; case 0x30: /* BR */