From patchwork Thu Feb 16 03:08:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653990 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123167wrr; Wed, 15 Feb 2023 19:10:20 -0800 (PST) X-Google-Smtp-Source: AK7set+FdiTgJLglKvpF+yo+oDG3HNRskLDwIziT4Ki0JepLzVT4FnfSmIwaUAwCxvZITwVM5aWT X-Received: by 2002:a05:6214:e4e:b0:56e:a899:160a with SMTP id o14-20020a0562140e4e00b0056ea899160amr6318614qvc.0.1676517020070; Wed, 15 Feb 2023 19:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517020; cv=none; d=google.com; s=arc-20160816; b=zF0eWePq//UZP3HeJBKI9/QG5+f3ZtbaHMnW30WuHQUnnVe3afUTl4M4BMO2bPp4T0 yc7LogQXCKxjmVpxo6LkVTNiso8YRXFzoPIucFGfah/7onidqk9rdw8OJ3c5TXiNphND sdG+oyG62CEYvalGix6O3gT+y2bIBn/GoURuZHnpfIMtqycVWt3ugqLS2DemDQtMPilV 6pV3BiZoKzuOjbaXaWoOiQqlX9v2Xe860RtknIJSHbam18is+HJFzSjxNEfa9NvmywiP BTZqGB7X62AfqvM+0MLOjmtd8LISmkaqZ4x/BpgdR/oxzNIhxOMptk83yrK2PIjE54nq v22Q== 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=5MWcfMPzd9PL4JEvdoqxUVWO14/+wVWQFzje3SFl6vk=; b=vtAocYiQu5Wpvc8kdnmIYEsvC+j8aJm0UET7boSkNmdSMTNgw81pBrWliVz+kT0LQg YUfWjcOr7x9ICUhXeRg9Ga3LXgeD8ZJM+JdAA7ormCDeqwB2/EC3UUERNIsI6mLXTJ9X xXu0HPi/ajgPOGVnRLsZz+i2STwV1jgIwlbQXz3I9yjYgfYybEH3V2rDbobfLNeu8k5L 1VhxiCg0yjLR/gy8/DgIsGir3nspD8E/z8/QXcdUHd3Xf8tJEL/+aruBc/2M10C7IbsW 5O07yBbRxsJRUHKfwEg7Ec11cxkT1kzvrvdn87ZnJmy8WU13FHl6l4rE2v+XcGD43dxx mNNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rrKM1dFK; 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 s64-20020a372c43000000b0073b7761b271si324808qkh.724.2023.02.15.19.10.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:10:20 -0800 (PST) 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=rrKM1dFK; 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 1pSUds-0007Gh-Pn; Wed, 15 Feb 2023 22:09:04 -0500 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 1pSUdr-0007F8-1V for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:03 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUdo-00004w-Na for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:02 -0500 Received: by mail-pg1-x52c.google.com with SMTP id 24so424295pgt.7 for ; Wed, 15 Feb 2023 19:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=5MWcfMPzd9PL4JEvdoqxUVWO14/+wVWQFzje3SFl6vk=; b=rrKM1dFKYaWD2B+eYgQhlwH5tqQxEIEHlQH/NS4evGCluACblzjNjn+Jz1CySwyXm4 NRJXT0ARKrfx3YVH2Qq7YTT2msE7HW5ROMnWuBawqrwdTHsdONHi2mNcGqbF0E6jLvae Ig4iCJG8MGUxwwKsaJuN0+JoLvMeX09/+3lpJ8x3pR0x85gYSi2wkcUl2s7zXbhC9Vpx dQVoEFGC6zom0LF9R0YHPCxbBjIvdm/k7rUsOPBTz0ICmNLzbIfcb7fP/J8580i42ZIm FetJDS0WbRBTl6vS9c8PxZ7OqjoJ4eoXE2o6mWE7bt6vnYwnf0dVo5rarrhak701Hi4w nXPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=5MWcfMPzd9PL4JEvdoqxUVWO14/+wVWQFzje3SFl6vk=; b=spa4XyiBY5CFgsFPUJdTemzCTjGZqLoNigw7alAL0fyxqBk6Zi0p1K9L6kB7i2FszP DvZwkRzbe4CZTB/XbsujoTvha3Mjy+Wm5x4fojg3x0VK6/8SlFv9kzLwkjsf1rids11e 0HwVSpb7S357qRUxLSq4hln6qUvuwzKIGwZHveO8xH5YRqomwJSMm/2q8iwXGHvPmjEL quPoAbjKa6ICKVFx2MRHWohJdBgPqafQke9E9PsUVsV+KTYTbeC8v4sWqCDdBfVNdoaf VS9GSF4s4cdjGsWNUFcP2vTTU7owzhkTQy4imAGMU9rEEfTrhG3DTADS2rjqtqYgczA8 9Shg== X-Gm-Message-State: AO0yUKXBS2z46Xk87pR+pC7Ywo3D3rdfeXEdp744/UbfD7PSJZzdPQcx YK8Gk4tjVsapu68bq0Avxdj9JJZIw1fxhhioLH0= X-Received: by 2002:aa7:9ad1:0:b0:5a8:a82a:bd8b with SMTP id x17-20020aa79ad1000000b005a8a82abd8bmr3456896pfp.20.1676516939312; Wed, 15 Feb 2023 19:08:59 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:08:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 01/19] target/arm: Make cpu_exclusive_high hold the high bits Date: Wed, 15 Feb 2023 17:08:36 -1000 Message-Id: <20230216030854.1212208-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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.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 We currently treat cpu_exclusive_high as containing the second word of LDXP, even though that word is not "high" in big-endian mode. Swap things around so that it is. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 54 ++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index da9f877476..78a2141224 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2547,17 +2547,28 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, } else { /* The pair must be single-copy atomic for *each* doubleword, not the entire quadword, however it must be quadword aligned. */ + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + memop |= MO_64; - tcg_gen_qemu_ld_i64(cpu_exclusive_val, addr, idx, - memop | MO_ALIGN_16); + tcg_gen_qemu_ld_i64(t0, addr, idx, memop | MO_ALIGN_16); - TCGv_i64 addr2 = tcg_temp_new_i64(); - tcg_gen_addi_i64(addr2, addr, 8); - tcg_gen_qemu_ld_i64(cpu_exclusive_high, addr2, idx, memop); - tcg_temp_free_i64(addr2); + tcg_gen_addi_i64(t1, addr, 8); + tcg_gen_qemu_ld_i64(t1, t1, idx, memop); - tcg_gen_mov_i64(cpu_reg(s, rt), cpu_exclusive_val); - tcg_gen_mov_i64(cpu_reg(s, rt2), cpu_exclusive_high); + if (s->be_data == MO_LE) { + tcg_gen_mov_i64(cpu_exclusive_val, t0); + tcg_gen_mov_i64(cpu_exclusive_high, t1); + } else { + tcg_gen_mov_i64(cpu_exclusive_high, t0); + tcg_gen_mov_i64(cpu_exclusive_val, t1); + } + + tcg_gen_mov_i64(cpu_reg(s, rt), t0); + tcg_gen_mov_i64(cpu_reg(s, rt2), t1); + + tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); } } else { memop |= size | MO_ALIGN; @@ -2604,36 +2615,29 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, } else { TCGv_i128 t16 = tcg_temp_new_i128(); TCGv_i128 c16 = tcg_temp_new_i128(); - TCGv_i64 a, b; + TCGv_i64 lo, hi; if (s->be_data == MO_LE) { tcg_gen_concat_i64_i128(t16, cpu_reg(s, rt), cpu_reg(s, rt2)); - tcg_gen_concat_i64_i128(c16, cpu_exclusive_val, - cpu_exclusive_high); } else { tcg_gen_concat_i64_i128(t16, cpu_reg(s, rt2), cpu_reg(s, rt)); - tcg_gen_concat_i64_i128(c16, cpu_exclusive_high, - cpu_exclusive_val); } + tcg_gen_concat_i64_i128(c16, cpu_exclusive_val, cpu_exclusive_high); tcg_gen_atomic_cmpxchg_i128(t16, cpu_exclusive_addr, c16, t16, get_mem_index(s), MO_128 | MO_ALIGN | s->be_data); tcg_temp_free_i128(c16); - a = tcg_temp_new_i64(); - b = tcg_temp_new_i64(); - if (s->be_data == MO_LE) { - tcg_gen_extr_i128_i64(a, b, t16); - } else { - tcg_gen_extr_i128_i64(b, a, t16); - } + lo = tcg_temp_new_i64(); + hi = tcg_temp_new_i64(); + tcg_gen_extr_i128_i64(lo, hi, t16); - tcg_gen_xor_i64(a, a, cpu_exclusive_val); - tcg_gen_xor_i64(b, b, cpu_exclusive_high); - tcg_gen_or_i64(tmp, a, b); - tcg_temp_free_i64(a); - tcg_temp_free_i64(b); + tcg_gen_xor_i64(lo, lo, cpu_exclusive_val); + tcg_gen_xor_i64(hi, hi, cpu_exclusive_high); + tcg_gen_or_i64(tmp, lo, hi); + tcg_temp_free_i64(lo); + tcg_temp_free_i64(hi); tcg_temp_free_i128(t16); tcg_gen_setcondi_i64(TCG_COND_NE, tmp, tmp, 0); From patchwork Thu Feb 16 03:08:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653997 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123455wrr; Wed, 15 Feb 2023 19:11:00 -0800 (PST) X-Google-Smtp-Source: AK7set+5nr1qsCCgmOqCRyLvGpJz7EVXkN5x9D1Y2+fCQduCUi0fyrW1/kuO7LsQ5Cxh0hrAheHG X-Received: by 2002:a05:6214:246b:b0:56e:a6c6:445c with SMTP id im11-20020a056214246b00b0056ea6c6445cmr8410495qvb.43.1676517060524; Wed, 15 Feb 2023 19:11:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517060; cv=none; d=google.com; s=arc-20160816; b=aiakNI7JeOzNKMZtraBzZVOW13Efx/tYeuNk62C7C7UXCvp3nsOHP7N1YJWf35wiUw wMHh+x2Nx1kTyucSH5zxF4dXaDmqxJowoAQzIKj0d75bCXrUfdVBom2ZuqcC2zC5/Nxx GoVT9OXUIBEXHFugRVdnMYNBwIS4LPaobEa+g+6XPFqSrCiwAkxjk//S1zgnbDCDtU9v 6e/WX3ZKZNCFEx8VxUqweHW3KZ759GzN3wK+k5fuOgziDv0BpcCkd7yLQWuo8kjJ+33G RP424z/l3qMdppxD2FqA9BgxEDlkUmFn3k7bAME+lFWtWCzu+5r0o+M5yMyd00avst7O iU2A== 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=a88LQ5xXE27mwhJIuM1/tb25IT852LOJBFHH8gvWTUs=; b=nlh7ipnZBZWEkWt5QWjSAK+lNWaYvLUOGXwQ6szOMcGAjEG7fBmFoH22KkI1ke/rnX VTTjp3/CPfmq5tAdI9FwAvk2fM8T7+zTyUzjEdK59JnM+vz30qu4JOSMBfvz7mOS3w6W lf7quIEX800FK7clLKwWWreRxcERtck+so5tj2QkV7vO/qApWW1oFnf0LY4axXAoie9W Gj44SgPd3ECvFZ3M+43Sp3XxusX/QU0yWEioZXY8E/Wpeh5e4hWkFwJT9+5YvkKH1VuK XvMRPz8dpXYKBGy2t96HNrj1qrDUo04kkslBwQpjhZGJODOA0XYYoncOD6oQQdwsYsqp R/4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xaKJ47Ok; 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 13-20020a37040d000000b006fc3fa22f44si398583qke.221.2023.02.15.19.11.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:11:00 -0800 (PST) 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=xaKJ47Ok; 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 1pSUdu-0007HD-7w; Wed, 15 Feb 2023 22:09:06 -0500 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 1pSUds-0007Fv-9E for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:04 -0500 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUdq-00005K-8C for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:03 -0500 Received: by mail-pg1-x529.google.com with SMTP id z6so458068pgk.0 for ; Wed, 15 Feb 2023 19:09:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=a88LQ5xXE27mwhJIuM1/tb25IT852LOJBFHH8gvWTUs=; b=xaKJ47OkBZJssOQ7fMuQRBeDYOYDxKtYo/5Rxta9Ik2UPzwWj0HqO+6N8usyFZwea+ 4RxsoOGQD+ase/DrWKsWO/4abOtAPAon+P1I8pQeWpX0PutqMAU8Lqn7xINJyYtoyRCN Mxvt4TXr1bk7aGdx2YUSAnWmiY7rWmw7csht91yG6SzBQniixebIUpkSF5AA7qTt/Ntl t+DsMdUc8H4UtAWYgoJRQXIPhCyOyyWdtgtnKdDqDG8hF+TbRjMS+QYYsRJDaNh6zsvB BaVEq/rKCXAYCpBaGCPRzXhUJZ8l7YObWrXA9WYYcEhkFCAH36evTy7XzhtjamPIUrJ1 6Q+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=a88LQ5xXE27mwhJIuM1/tb25IT852LOJBFHH8gvWTUs=; b=kwIlvkRv4gzkXlfwUjnWoUiEkpZwdg3dxlFFG1hF8qvlARWbZ4NkdsnD+rZsE3RrG+ GBMUrg6LIEHc1gfvW7AlQKcqsg55USFB7DvoyTV8CZtf5pfGnmq2B9ihx7cB+nNSKGm1 rRs1xoAY20Jq9+y9sHkAZKahMpqRnMNuj1nuKckOXVT8RL9/N6fgRCz5sxl41DSyxEI/ 0M3LUGwh/5/rnhjtcN0ybXW3IZ2pvbLrSWoW0jlGFRmOs8O+YKHrpq3eH2nmdLhbt4SD 9f6jP/s56GzAeLvq1HyJFQ81GB2fKLM+PMmU+DZVhaXEf4kDJ3ZGcY+bQBI2TIZSMUtD m7kw== X-Gm-Message-State: AO0yUKX75W1tfFVCYvWZkgG4K13K9nk/964I1TcYPwKgEfLklifWV+y3 2ZTTzwJubyhGkSNQNdb2ToVU4KJ8QQz0w+665FY= X-Received: by 2002:a62:1888:0:b0:5a8:d502:51ce with SMTP id 130-20020a621888000000b005a8d50251cemr3157141pfy.5.1676516940866; Wed, 15 Feb 2023 19:09:00 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 02/19] target/arm: Use tcg_gen_qemu_ld_i128 for LDXP Date: Wed, 15 Feb 2023 17:08:37 -1000 Message-Id: <20230216030854.1212208-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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.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 While we don't require 16-byte atomicity here, using a single larger load simplifies the code, and makes it a closer match to STXP. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 78a2141224..d7d4b68328 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2545,30 +2545,27 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, tcg_gen_extract_i64(cpu_reg(s, rt2), cpu_exclusive_val, 0, 32); } } else { - /* The pair must be single-copy atomic for *each* doubleword, not - the entire quadword, however it must be quadword aligned. */ - TCGv_i64 t0 = tcg_temp_new_i64(); - TCGv_i64 t1 = tcg_temp_new_i64(); + /* + * The pair must be single-copy atomic for *each* doubleword, not + * the entire quadword, however it must be quadword aligned. + * Expose the complete load to tcg, for ease of tlb lookup, + * but indicate that only 8-byte atomicity is required. + */ + TCGv_i128 t16 = tcg_temp_new_i128(); - memop |= MO_64; - tcg_gen_qemu_ld_i64(t0, addr, idx, memop | MO_ALIGN_16); + memop |= MO_128 | MO_ALIGN_16 | MO_ATMAX_8; + tcg_gen_qemu_ld_i128(t16, addr, idx, memop); - tcg_gen_addi_i64(t1, addr, 8); - tcg_gen_qemu_ld_i64(t1, t1, idx, memop); + tcg_gen_extr_i128_i64(cpu_exclusive_val, cpu_exclusive_high, t16); + tcg_temp_free_i128(t16); if (s->be_data == MO_LE) { - tcg_gen_mov_i64(cpu_exclusive_val, t0); - tcg_gen_mov_i64(cpu_exclusive_high, t1); + tcg_gen_mov_i64(cpu_reg(s, rt), cpu_exclusive_val); + tcg_gen_mov_i64(cpu_reg(s, rt2), cpu_exclusive_high); } else { - tcg_gen_mov_i64(cpu_exclusive_high, t0); - tcg_gen_mov_i64(cpu_exclusive_val, t1); + tcg_gen_mov_i64(cpu_reg(s, rt), cpu_exclusive_high); + tcg_gen_mov_i64(cpu_reg(s, rt2), cpu_exclusive_val); } - - tcg_gen_mov_i64(cpu_reg(s, rt), t0); - tcg_gen_mov_i64(cpu_reg(s, rt2), t1); - - tcg_temp_free_i64(t0); - tcg_temp_free_i64(t1); } } else { memop |= size | MO_ALIGN; From patchwork Thu Feb 16 03:08:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653987 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp122849wrr; Wed, 15 Feb 2023 19:09:34 -0800 (PST) X-Google-Smtp-Source: AK7set+sy5zVw1krg7agcPPlmuUx/99s7DZouZ2ZIrD2fYlCzspEEYf9v619aTJWFvE223TBh6Pz X-Received: by 2002:ac8:5c14:0:b0:3b9:b436:4c6f with SMTP id i20-20020ac85c14000000b003b9b4364c6fmr7902153qti.39.1676516974607; Wed, 15 Feb 2023 19:09:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676516974; cv=none; d=google.com; s=arc-20160816; b=MMcH34MLh+VTB1QgOhKHEfOVez4N7TK7WnXYloMOU5zhQ69sy204pdoBsrsIhFdnoQ C/tcUKIGL2i7AWVXQ94gJVHEfzFQ6YxbtHvoVNR2bZP6KAsKwIUFvxW7fHswudwHBSTN VDHT+rRubKVGJHRxC0eju7ul+ScDKVIWhlSB2oewqO3u1E7ZCJL96ZnQQ2csYs8cOUHl prGGqiEolC+ctfcvgZMH7SXVh0h2KQayaZnmimiPYrEX8bwtzotrS5HAFVWq9aSW2KqV 4y7cPt/WpjhoWrox5H0o6H32hQmtZ8HnLzjSKkHpzzpQwNGfgmxf+b5BmLVbb42pXo0q PLUQ== 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=DmwtowJSaitTccWLoWYueof39S9NQxf7bK1L9fJ0J9g=; b=QJK10FvQAD8WxuaomKs4UOyJuYUaLMEFp4U9gowUxMafgOZZGFBzE4LucVSt3+MsMK VzShz8wfmB3VVqQkOQUifB+xE+bmYokzjLb551Cw14hriSsI5Eyaxd0MQejZkGXBYCbn kksK4/xDiBfyVhwOmVKdagBpgTPMub7Z6ZkKyt0g0MzZ1zuoIrOVHLeTj2lYhmykOqQ4 PskFkcbSJQmX1W2o+jLb4ZKnx6d4nXGDWD5mwcLSQNihgbmaE/tAkK/0NheNPyFHLRsL 7mpE+5CosFO8Xs3mrqL7saVzaHdQjM2aiwqKuC47goDpJfvwPRklXQQ9BWSjEh7RiHaK XqXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=itDVOOib; 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=fail (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 127-20020a370485000000b0071f43db84cfsi356505qke.671.2023.02.15.19.09.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:09:34 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=itDVOOib; 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=fail (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 1pSUdw-0007Hz-Er; Wed, 15 Feb 2023 22:09:08 -0500 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 1pSUdt-0007H8-CW for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:05 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUdr-00005q-Md for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:05 -0500 Received: by mail-pj1-x102f.google.com with SMTP id v6-20020a17090ad58600b00229eec90a7fso5197911pju.0 for ; Wed, 15 Feb 2023 19:09:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=DmwtowJSaitTccWLoWYueof39S9NQxf7bK1L9fJ0J9g=; b=itDVOOib8sQbDGGMUBPA8KrlnXmwQ5kMJMGYtuAQx+GXYwgCZuGTrU1p6jzn8I06fX aKQtr5wAVGn3q/y2sca4xgJfxIhWQShVos2x7qe9aAkfi8L2DwNCwzoWNbzoR2beK+9u 8BESgJSO6d7qIyKXOx6YjWkONmekzUWB7DEURkIlZMbOvX/+YeJJggdv7WryQ7M0mFRg I2w229Ct0cQ47pPEdR7fbtzvLIZNLAOkKDn1erYaQuNATLRAprCwGGMEZNoaNjY+aaf9 +qRkId8WQkKSxclGaNCgv6hxpkXTjGLwlw39fnYIh7oqU3jsAxri1KeiGnTOQoCcHhNz dYgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=DmwtowJSaitTccWLoWYueof39S9NQxf7bK1L9fJ0J9g=; b=jlqxXcfII3ZQ/H60/O1x5QjGaEOJxa/79/YyWPAYS/UnJptQs4ntrGpMqsh9MC/QeX FwzHmfrQFxs38T6VGAW7bNwVzxyx9gBrgLsO3oe2ZjuJQN368/hc1nOL/plSpikfk/5a qxZts/Y8TIIKFfSZuh2dJpwnKAl3KnVSoW521+9smYXUg2bHdXJNBFMOLyLO+ZHG2bct TJYBI4AZ9r9mq3J/yOpKmW+tAYBPvpITgd6/B+7Ghf+oz2L2q6af/Zdm4nFWh1IYXUmZ tDGpJp/r4MYYMWfAkNW63WLOwHUi8jxDvRXeFK0uTlzdrTLC4TSDBM/xo0IQt1IFQHj2 06AQ== X-Gm-Message-State: AO0yUKWV7QjcfxjRC4eVcIEgK9Z6qlB2WJ3A675t1paALyjesTERiz3O JYmrdO5Ta/22cGXnCQJS1zRwMLNoLZvSh9aV7gM= X-Received: by 2002:a05:6a21:6d9f:b0:c7:1fff:fab7 with SMTP id wl31-20020a056a216d9f00b000c71ffffab7mr729187pzb.54.1676516942243; Wed, 15 Feb 2023 19:09:02 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 03/19] target/arm: Use tcg_gen_qemu_{st, ld}_i128 for do_fp_{st, ld} Date: Wed, 15 Feb 2023 17:08:38 -1000 Message-Id: <20230216030854.1212208-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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.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 While we don't require 16-byte atomicity here, using a single larger operation simplifies the code. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index d7d4b68328..edf92a728f 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -965,25 +965,20 @@ static void do_fp_st(DisasContext *s, int srcidx, TCGv_i64 tcg_addr, int size) tcg_gen_ld_i64(tmplo, cpu_env, fp_reg_offset(s, srcidx, MO_64)); - if (size < 4) { + if (size < MO_128) { mop = finalize_memop(s, size); tcg_gen_qemu_st_i64(tmplo, tcg_addr, get_mem_index(s), mop); } else { - bool be = s->be_data == MO_BE; - TCGv_i64 tcg_hiaddr = tcg_temp_new_i64(); TCGv_i64 tmphi = tcg_temp_new_i64(); + TCGv_i128 t16 = tcg_temp_new_i128(); tcg_gen_ld_i64(tmphi, cpu_env, fp_reg_hi_offset(s, srcidx)); - - mop = s->be_data | MO_UQ; - tcg_gen_qemu_st_i64(be ? tmphi : tmplo, tcg_addr, get_mem_index(s), - mop | (s->align_mem ? MO_ALIGN_16 : 0)); - tcg_gen_addi_i64(tcg_hiaddr, tcg_addr, 8); - tcg_gen_qemu_st_i64(be ? tmplo : tmphi, tcg_hiaddr, - get_mem_index(s), mop); - - tcg_temp_free_i64(tcg_hiaddr); + tcg_gen_concat_i64_i128(t16, tmplo, tmphi); tcg_temp_free_i64(tmphi); + + mop = finalize_memop(s, size); + tcg_gen_qemu_st_i128(t16, tcg_addr, get_mem_index(s), mop); + tcg_temp_free_i128(t16); } tcg_temp_free_i64(tmplo); @@ -999,23 +994,18 @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size) TCGv_i64 tmphi = NULL; MemOp mop; - if (size < 4) { + if (size < MO_128) { mop = finalize_memop(s, size); tcg_gen_qemu_ld_i64(tmplo, tcg_addr, get_mem_index(s), mop); } else { - bool be = s->be_data == MO_BE; - TCGv_i64 tcg_hiaddr; + TCGv_i128 t16 = tcg_temp_new_i128(); + + mop = finalize_memop(s, size); + tcg_gen_qemu_ld_i128(t16, tcg_addr, get_mem_index(s), mop); tmphi = tcg_temp_new_i64(); - tcg_hiaddr = tcg_temp_new_i64(); - - mop = s->be_data | MO_UQ; - tcg_gen_qemu_ld_i64(be ? tmphi : tmplo, tcg_addr, get_mem_index(s), - mop | (s->align_mem ? MO_ALIGN_16 : 0)); - tcg_gen_addi_i64(tcg_hiaddr, tcg_addr, 8); - tcg_gen_qemu_ld_i64(be ? tmplo : tmphi, tcg_hiaddr, - get_mem_index(s), mop); - tcg_temp_free_i64(tcg_hiaddr); + tcg_gen_extr_i128_i64(tmplo, tmphi, t16); + tcg_temp_free_i128(t16); } tcg_gen_st_i64(tmplo, cpu_env, fp_reg_offset(s, destidx, MO_64)); From patchwork Thu Feb 16 03:08:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653992 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123174wrr; Wed, 15 Feb 2023 19:10:20 -0800 (PST) X-Google-Smtp-Source: AK7set9W9D/D8F04PU3arwSlY1V2OEzPFrcQ9jiwGZBmgpToBvpx+/uUliARqNc1xIZg2EmHs1SJ X-Received: by 2002:a05:6214:e4e:b0:56e:a88f:70ef with SMTP id o14-20020a0562140e4e00b0056ea88f70efmr7447531qvc.23.1676517020483; Wed, 15 Feb 2023 19:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517020; cv=none; d=google.com; s=arc-20160816; b=EYzemfNk8vjtes6cZAbR4tV+Aye1P8wd0XXmVz7Cs/1K9DM1bKuCLhMYwJy+BwCW+n +u5a9uq3U8cu2hMaQh4O/DTpm8W+SrmLeInEeDBiOqs+WXncYDVEEqDVTejJ/VvEBMBN 0ko7V4hRHRMRAnzKdJXmuvEw7kyE5MAmi3ujq2fwu20iEcsDNq0jdix+iM9zNjxojjqe cKrtrQv0RB+43JZZwNM8bC6W5QUDITdmyMOrxo0nQL3AyT6ZiKObh6GxnjOyOB1NdTx9 6impjVzFDJ+b2ZK49bX4IJ5nKpoUvCIj4jStkh2gqcRblBdGuz4euopduhO9GWop4Nqe jnLQ== 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=ifftpNbWqx3/3wdOUbpX/ZIUpWmLL1jR33HqRqthdug=; b=OmGBjWRRl0UP5zeuLfHP/eK+CdAZxM3W9Zdhou9eynmVhitLbVrRCe6Tpg4PeeCdCY d673fHQhOJd8+gbYoJCduAIwJ2qYd2f/x7DrPjJiHf6WOkiOyufPbLTx0txt7dsiDQi5 /8xbCImEouPeosO6Xkj23TWyFwIeN75m19G2BaUYXOUKzNRiMxIBYQ5TMOyi999AEaua 617f3MCUVKf45386ZiimgQvjk71KdapY0uNpxEdBKJwVF+4I4qVJHmLL72hYQsp/hj0o 1CuTSArGfTFFyNxHJWWonZUqfcA4vGJxmUpM1rSwOD0M2Su1FgHqCu/XHjmwW598R2hF zK/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J023b2Fc; 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 t12-20020a0cde0c000000b0056ea7340b30si125684qvk.177.2023.02.15.19.10.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:10:20 -0800 (PST) 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=J023b2Fc; 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 1pSUe0-0007JG-DI; Wed, 15 Feb 2023 22:09:12 -0500 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 1pSUdv-0007Hv-Ez for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:08 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUdt-00006b-4d for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:06 -0500 Received: by mail-pg1-x530.google.com with SMTP id 7so440698pga.1 for ; Wed, 15 Feb 2023 19:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=ifftpNbWqx3/3wdOUbpX/ZIUpWmLL1jR33HqRqthdug=; b=J023b2Fc0U5R45Sy6NwEFHxcQif1cj8X7rIhywFczveHhaLLORUle81wIsA4kSwHYf hMgsi3qbZIrLdwnx9l+isBobe+kJqZ8nZAi7ErUVWpSk4wxBrHk2ek8urJEiAa1I8eJG 1VA+xpJ7MeGAEj1WPvFb02X+iOY0KJf5oLOrwQt/7bg6oGPV1Z2H4hYgj2xzkKeYKTdl y8s0lqJQWkEx+Ck6Y6HyAkuxJKVuCEp70Es2XCXf9A8FNA1XXnOpNrU9e5FJQvbpUEqt 6GVPOp9bIStgJjbCa8VO0UMmTUrnU5F7A9a1bL6qj+97w0K3kWPm8heBl2xW/+pXnj63 FZkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ifftpNbWqx3/3wdOUbpX/ZIUpWmLL1jR33HqRqthdug=; b=KY+4m+BR0ICAf4ArP9VrsYUGL2caWSfT+aM/BIcXyKfqjMsFlI1G4kMzIFuoMRtpHN SSle+Fdrb0lqi6I5mOMZqlDvSkgSlL6bUadc2paaQl6dde+ZPG60XmS0I972fBK05gdz tw6tr+BIV53iNATbLsK3vMYswTszvqirQ0yAsns/ymUaCmBq8fMWltZNg8Z4rOpzd0hp w6k0N/nL03WzrdJ+87QV8Wu9vbOZ2fVjZDveO2mpAUBEeue7uS5W7cIK3LxnU+twPD6p DTOfNR1L5VKBViQpYyTMrNFaiaHiGf80ksXyWEWJM6vFL9RUkQ+Yuq5G/I0FlRnBwaaQ RPAQ== X-Gm-Message-State: AO0yUKWRi74FLonK6Z2YedqqSwYwakSZF0lW/q309KY4PQoO4PYgq4qx eTjKHjl5uc5837bLk4YIO6xPMsx198bRLc3CrKw= X-Received: by 2002:aa7:9591:0:b0:5a8:ab87:eda with SMTP id z17-20020aa79591000000b005a8ab870edamr4019127pfj.20.1676516943711; Wed, 15 Feb 2023 19:09:03 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 04/19] target/arm: Use tcg_gen_qemu_st_i128 for STZG, STZ2G Date: Wed, 15 Feb 2023 17:08:39 -1000 Message-Id: <20230216030854.1212208-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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=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 This fixes a bug in that these two insns should have been using atomic 16-byte stores, since MTE is ARMv8.5 and LSE2 is mandatory from ARMv8.4. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.c | 18 +++++++++++------- tests/tcg/aarch64/mte-7.c | 3 +-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index edf92a728f..b42e5848cc 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4207,16 +4207,20 @@ static void disas_ldst_tag(DisasContext *s, uint32_t insn) if (is_zero) { TCGv_i64 clean_addr = clean_data_tbi(s, addr); - TCGv_i64 tcg_zero = tcg_constant_i64(0); + TCGv_i64 zero64 = tcg_constant_i64(0); + TCGv_i128 zero128 = tcg_temp_new_i128(); int mem_index = get_mem_index(s); - int i, n = (1 + is_pair) << LOG2_TAG_GRANULE; + MemOp mop = MO_128 | MO_ALIGN; - tcg_gen_qemu_st_i64(tcg_zero, clean_addr, mem_index, - MO_UQ | MO_ALIGN_16); - for (i = 8; i < n; i += 8) { - tcg_gen_addi_i64(clean_addr, clean_addr, 8); - tcg_gen_qemu_st_i64(tcg_zero, clean_addr, mem_index, MO_UQ); + tcg_gen_concat_i64_i128(zero128, zero64, zero64); + + /* This is 1 or 2 atomic 16-byte operations. */ + tcg_gen_qemu_st_i128(zero128, clean_addr, mem_index, mop); + if (is_pair) { + tcg_gen_addi_i64(clean_addr, clean_addr, 16); + tcg_gen_qemu_st_i128(zero128, clean_addr, mem_index, mop); } + tcg_temp_free_i128(zero128); } if (index != 0) { diff --git a/tests/tcg/aarch64/mte-7.c b/tests/tcg/aarch64/mte-7.c index a981de62d4..04974f9ebb 100644 --- a/tests/tcg/aarch64/mte-7.c +++ b/tests/tcg/aarch64/mte-7.c @@ -19,8 +19,7 @@ int main(int ac, char **av) p = (void *)((unsigned long)p | (1ul << 56)); /* Store tag in sequential granules. */ - asm("stg %0, [%0]" : : "r"(p + 0x0ff0)); - asm("stg %0, [%0]" : : "r"(p + 0x1000)); + asm("stz2g %0, [%0]" : : "r"(p + 0x0ff0)); /* * Perform an unaligned store with tag 1 crossing the pages. From patchwork Thu Feb 16 03:08:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653989 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123022wrr; Wed, 15 Feb 2023 19:09:58 -0800 (PST) X-Google-Smtp-Source: AK7set9fT0PzZwMe0/+Njryc4l2YMVVI2U1nGuPrDYUWCV4/3tIbIWQnp7SSIYVjRJ6SvSJRYyjy X-Received: by 2002:a05:6214:501c:b0:56b:f4e2:cb21 with SMTP id jo28-20020a056214501c00b0056bf4e2cb21mr9291403qvb.19.1676516998531; Wed, 15 Feb 2023 19:09:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676516998; cv=none; d=google.com; s=arc-20160816; b=Liii0RDLFz7x6RYMRjLh2y2nTif+y5ZsL9+coGxfM3lTrV0feUk1YRruDuQocwkkfw Woulg7HPF5/6kqF8v2jSD9k/9b3n/uPPPfFxX+nKwQEYpVr6HsskEP1wfDy6GT9gys7y wJoRtGry2nDyTdLF1tOq0n5UgKK7foRys8Vbrg4Wnu1qkxJR6lx/1bhzmxmKEAPiJZWV qyz5fCF6F3pTG7oYYY2dxPXj2DDu5HUhQleanYatzneXaPTltZgD8/FSGNXFtWkqhMc9 EaODViumxOrOxdDbgYF8PRDZeRvc8T0GHDknC7lr1PhH30qmtAhf6OFWDVsz4M/00eO6 2dvA== 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=M2fap56PeedHPfSJE6dzUTTL7OKlS8CMUdMWOfCPYes=; b=O7CLD1uuFSHXIB6Vl2B0pagHQcFvZbX28iFY/YwD7eRpIBb+5uVaLxabyEUTJaoyvM QxnjmrOWI7YQ/4vmLko4bE0XdhtqOLVMUlWNkthAT2roNVx2HyJhyRa37Xzm+nxL9Ub2 8lt7C4K5/bPaN2oHQ47zU4rVJy8c3pIwuhE2ANLlQs4gx90w9bDyT2T2rjGaIhw9I0Wy q6bLz9JOwlkQw49aYxJCJzagbZalCa30kaNRrATn0KhKEnBv89JE0fvcbhOK3wRaK1O/ zt7fleXVxCYafRrNFCA1xXQ7VHuz64AqQ670I0GD9lNPGmwR8o7rfS0hlrRfUbvKvX2Q PrPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ucpIMADl; 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=fail (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 d5-20020a0ce445000000b0053777675214si84907qvm.512.2023.02.15.19.09.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:09:58 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=ucpIMADl; 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=fail (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 1pSUe3-0007Kg-1m; Wed, 15 Feb 2023 22:09:16 -0500 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 1pSUdx-0007IG-Bu for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:11 -0500 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 1pSUdv-000079-7X for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:09 -0500 Received: by mail-pf1-x42c.google.com with SMTP id y25so581441pfw.11 for ; Wed, 15 Feb 2023 19:09:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=M2fap56PeedHPfSJE6dzUTTL7OKlS8CMUdMWOfCPYes=; b=ucpIMADlvbWsX4+GbkizWUaxt7RPnnTbKTV4kVhwLEmhDp0bsYX9aaGa/jmS3pJXpo fijPuUQTN6LpiAwde5NpypEy9gvpcJG/K3qBMOG2/MOgZOeLTRq3JrSA5iIk7s/uGK7Y v56NK00P9dd7ZiytcD+l9uYGNd6VXBdeEqaADoQub3EqmqloJATfW+Uc0H1JS8+vmiJM rdeTHVh5hvVc8VvEIG/YImfMhvDCXwvE6D6AKZQcPguw3Afd5dcc48/GQydpGP988yQ0 5wGc88bgpwun4k1/lo+cQSDEvOU2/jBFmtazmqQ58EcRuwecHATWqWkzr54H5NaQyVyX K5Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=M2fap56PeedHPfSJE6dzUTTL7OKlS8CMUdMWOfCPYes=; b=aGsoNlK1C7mup2DuHWfgsuwbvmIV6oyk/uiEsETxxp1j47dHTq6PsZgnD3Qk9jRWU5 UwbvcBuWf7z4EeEqcMgA/yvnDZodKZ7Em8kclR4N5Rums0lda4F6ZllrMoCy409YySEm C9zyr7Wk1mGuJw5rr3ZagUaYIge/y0a90kw6gipYDsyglNjiad8akicC99vmCcILHEEZ LHw/4rdhpKmEcM6d9bHZZWp4dKMunqrg2Vhp21Htrtje5TX5Z3MPKnEWZ+H7sVJukU8y m9edFX22jL6l/jiOAsFFlPHjySEi2Z3Tt+UcEN7uGx/TYyDJgKlM5bYaBZRPvzKn2J22 C5xw== X-Gm-Message-State: AO0yUKWdNeBoKhgLxE/V8Ym42PAAIXZ9atk6LjUSNpGNJ3tNJt0kYf+Y TTIrmtCLscDKe62WlpUUJ7zS984kLRZqCdvfucY= X-Received: by 2002:a62:1a07:0:b0:593:ed9c:9f07 with SMTP id a7-20020a621a07000000b00593ed9c9f07mr3355701pfa.27.1676516945248; Wed, 15 Feb 2023 19:09:05 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 05/19] target/arm: Use tcg_gen_qemu_{ld, st}_i128 in gen_sve_{ld, st}r Date: Wed, 15 Feb 2023 17:08:40 -1000 Message-Id: <20230216030854.1212208-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-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 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 Round len_align to 16 instead of 8, handling an odd 8-byte as part of the tail. Use MO_ATOM_NONE to indicate that all of these memory ops have only byte atomicity. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-sve.c | 107 ++++++++++++++++++++++++++++--------- 1 file changed, 81 insertions(+), 26 deletions(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 621a2abb22..f3d5e79dd2 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4312,11 +4312,12 @@ TRANS_FEAT(UCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz, void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs, int len, int rn, int imm) { - int len_align = QEMU_ALIGN_DOWN(len, 8); - int len_remain = len % 8; - int nparts = len / 8 + ctpop8(len_remain); + int len_align = QEMU_ALIGN_DOWN(len, 16); + int len_remain = len % 16; + int nparts = len / 16 + ctpop8(len_remain); int midx = get_mem_index(s); TCGv_i64 dirty_addr, clean_addr, t0, t1; + TCGv_i128 t16; dirty_addr = tcg_temp_new_i64(); tcg_gen_addi_i64(dirty_addr, cpu_reg_sp(s, rn), imm); @@ -4334,12 +4335,20 @@ void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs, int i; t0 = tcg_temp_new_i64(); - for (i = 0; i < len_align; i += 8) { - tcg_gen_qemu_ld_i64(t0, clean_addr, midx, MO_LEUQ); + t1 = tcg_temp_new_i64(); + t16 = tcg_temp_new_i128(); + + for (i = 0; i < len_align; i += 16) { + tcg_gen_qemu_ld_i128(t16, clean_addr, midx, + MO_LE | MO_128 | MO_ATOM_NONE); + tcg_gen_extr_i128_i64(t0, t1, t16); tcg_gen_st_i64(t0, base, vofs + i); - tcg_gen_addi_i64(clean_addr, clean_addr, 8); + tcg_gen_st_i64(t1, base, vofs + i + 8); + tcg_gen_addi_i64(clean_addr, clean_addr, 16); } tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + tcg_temp_free_i128(t16); } else { TCGLabel *loop = gen_new_label(); TCGv_ptr tp, i = tcg_const_local_ptr(0); @@ -4357,16 +4366,25 @@ void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs, gen_set_label(loop); - t0 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(t0, clean_addr, midx, MO_LEUQ); - tcg_gen_addi_i64(clean_addr, clean_addr, 8); + t16 = tcg_temp_new_i128(); + tcg_gen_qemu_ld_i128(t16, clean_addr, midx, + MO_LE | MO_128 | MO_ATOM_NONE); + tcg_gen_addi_i64(clean_addr, clean_addr, 16); tp = tcg_temp_new_ptr(); tcg_gen_add_ptr(tp, base, i); - tcg_gen_addi_ptr(i, i, 8); + tcg_gen_addi_ptr(i, i, 16); + + t0 = tcg_temp_new_i64(); + t1 = tcg_temp_new_i64(); + tcg_gen_extr_i128_i64(t0, t1, t16); + tcg_temp_free_i128(t16); + tcg_gen_st_i64(t0, tp, vofs); - tcg_temp_free_ptr(tp); + tcg_gen_st_i64(t1, tp, vofs + 8); tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + tcg_temp_free_ptr(tp); tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop); tcg_temp_free_ptr(i); @@ -4381,6 +4399,17 @@ void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs, * Predicate register loads can be any multiple of 2. * Note that we still store the entire 64-bit unit into cpu_env. */ + if (len_remain >= 8) { + t0 = tcg_temp_new_i64(); + tcg_gen_qemu_ld_i64(t0, clean_addr, midx, MO_LEUQ | MO_ATOM_NONE); + tcg_gen_st_i64(t0, base, vofs + len_align); + len_remain -= 8; + len_align += 8; + if (len_remain) { + tcg_gen_addi_i64(clean_addr, clean_addr, 8); + } + tcg_temp_free_i64(t0); + } if (len_remain) { t0 = tcg_temp_new_i64(); switch (len_remain) { @@ -4388,14 +4417,14 @@ void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs, case 4: case 8: tcg_gen_qemu_ld_i64(t0, clean_addr, midx, - MO_LE | ctz32(len_remain)); + MO_LE | ctz32(len_remain) | MO_ATOM_NONE); break; case 6: t1 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(t0, clean_addr, midx, MO_LEUL); + tcg_gen_qemu_ld_i64(t0, clean_addr, midx, MO_LEUL | MO_ATOM_NONE); tcg_gen_addi_i64(clean_addr, clean_addr, 4); - tcg_gen_qemu_ld_i64(t1, clean_addr, midx, MO_LEUW); + tcg_gen_qemu_ld_i64(t1, clean_addr, midx, MO_LEUW | MO_ATOM_NONE); tcg_gen_deposit_i64(t0, t0, t1, 32, 32); tcg_temp_free_i64(t1); break; @@ -4412,11 +4441,12 @@ void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs, void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, int len, int rn, int imm) { - int len_align = QEMU_ALIGN_DOWN(len, 8); - int len_remain = len % 8; - int nparts = len / 8 + ctpop8(len_remain); + int len_align = QEMU_ALIGN_DOWN(len, 16); + int len_remain = len % 16; + int nparts = len / 16 + ctpop8(len_remain); int midx = get_mem_index(s); - TCGv_i64 dirty_addr, clean_addr, t0; + TCGv_i64 dirty_addr, clean_addr, t0, t1; + TCGv_i128 t16; dirty_addr = tcg_temp_new_i64(); tcg_gen_addi_i64(dirty_addr, cpu_reg_sp(s, rn), imm); @@ -4435,12 +4465,19 @@ void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, int i; t0 = tcg_temp_new_i64(); + t1 = tcg_temp_new_i64(); + t16 = tcg_temp_new_i128(); for (i = 0; i < len_align; i += 8) { tcg_gen_ld_i64(t0, base, vofs + i); - tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUQ); - tcg_gen_addi_i64(clean_addr, clean_addr, 8); + tcg_gen_ld_i64(t1, base, vofs + i + 8); + tcg_gen_concat_i64_i128(t16, t0, t1); + tcg_gen_qemu_st_i128(t16, clean_addr, midx, + MO_LE | MO_128 | MO_ATOM_NONE); + tcg_gen_addi_i64(clean_addr, clean_addr, 16); } tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + tcg_temp_free_i128(t16); } else { TCGLabel *loop = gen_new_label(); TCGv_ptr tp, i = tcg_const_local_ptr(0); @@ -4459,15 +4496,22 @@ void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, gen_set_label(loop); t0 = tcg_temp_new_i64(); + t1 = tcg_temp_new_i64(); tp = tcg_temp_new_ptr(); tcg_gen_add_ptr(tp, base, i); tcg_gen_ld_i64(t0, tp, vofs); - tcg_gen_addi_ptr(i, i, 8); + tcg_gen_ld_i64(t1, tp, vofs + 8); + tcg_gen_addi_ptr(i, i, 16); tcg_temp_free_ptr(tp); - tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUQ); - tcg_gen_addi_i64(clean_addr, clean_addr, 8); + t16 = tcg_temp_new_i128(); + tcg_gen_concat_i64_i128(t16, t0, t1); tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + + tcg_gen_qemu_st_i128(t16, clean_addr, midx, MO_LEUQ); + tcg_temp_free_i128(t16); + tcg_gen_addi_i64(clean_addr, clean_addr, 16); tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop); tcg_temp_free_ptr(i); @@ -4479,6 +4523,17 @@ void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, } /* Predicate register stores can be any multiple of 2. */ + if (len_remain >= 8) { + t0 = tcg_temp_new_i64(); + tcg_gen_st_i64(t0, base, vofs + len_align); + tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUQ | MO_ATOM_NONE); + len_remain -= 8; + len_align += 8; + if (len_remain) { + tcg_gen_addi_i64(clean_addr, clean_addr, 8); + } + tcg_temp_free_i64(t0); + } if (len_remain) { t0 = tcg_temp_new_i64(); tcg_gen_ld_i64(t0, base, vofs + len_align); @@ -4488,14 +4543,14 @@ void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, case 4: case 8: tcg_gen_qemu_st_i64(t0, clean_addr, midx, - MO_LE | ctz32(len_remain)); + MO_LE | ctz32(len_remain) | MO_ATOM_NONE); break; case 6: - tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUL); + tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUL | MO_ATOM_NONE); tcg_gen_addi_i64(clean_addr, clean_addr, 4); tcg_gen_shri_i64(t0, t0, 32); - tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUW); + tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUW | MO_ATOM_NONE); break; default: From patchwork Thu Feb 16 03:08:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654002 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123655wrr; Wed, 15 Feb 2023 19:11:28 -0800 (PST) X-Google-Smtp-Source: AK7set8aJtZIAq9RoRXLQHt9nkeLUCqZSlW6lCnAemMk28An3mjS78+729P6JKLfOCIirYbVTy9w X-Received: by 2002:a05:622a:8a:b0:3b8:6a90:ece5 with SMTP id o10-20020a05622a008a00b003b86a90ece5mr7432143qtw.62.1676517088252; Wed, 15 Feb 2023 19:11:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517088; cv=none; d=google.com; s=arc-20160816; b=zB4dYS2xiz7BgRrQ1uYc5QTfvsjuYgbfCGgUufe5iTY6muEmLExlnftB1HAdiu0jCQ hSNfhXoUudW+O1kxUotnN0tWlaUcYs4H62pGWxe4+3Ss5N851/Lt0Jtkb6zbuENNDItr 1dtXZAIZ4RBh7e82temsiOceZ6YwQddBRCoc04w0i6detXe2btTiOyxcEBWLUV/WYiRq xyXs4dq8AFn8flNa2M79YmPovQK4GfEmffdbfaQdhIeYAfsiqpQP3HyU047IWkGMJKa4 lF+q/4EIPTdj1PcxxqmyDYiLO8GIXBY33foaLOcC/PXARUW+twA7mJ9MGoPb2hDp1s4I JiNQ== 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=dkykD1onhYW4HMW3gM5JC5OMb89CFmlkMrHkTJXibCw=; b=0kKjAEe3EWhI97vv+08UKhtGfgIL4P+OyYxVJSM/vXQ5cjAMBpm2ELJzI2rmjQgdJm 7P4BKS+e6RIUbwgoAQ6evz+JP04Eh5wFZFWVjhyUZjCdevcAHVqtKifVuj8YWwoZV5Ip Iwd1s4kTym5bOMmbYHWe9s7A/C3FGnARsrnfUBMVCdIVxYmHCAi5GDiD9yxiGU3rpuVC Zk2cmgYtKnQXacsntb7m2j2tPqiGNOzqGY8+XR56sVaNueN4yo/RMfbU9d6v3SCu6/yM ko0zyQANTomaEVBv3UjGGqu/GYXrayKxCfXzRmfXAZqQplrNe2lEhJ9Ar6kyueSCmSe9 p6cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=faVvEc40; 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 j15-20020a05622a038f00b003b9e33f60cdsi476502qtx.668.2023.02.15.19.11.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:11:28 -0800 (PST) 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=faVvEc40; 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 1pSUe8-0007O2-GL; Wed, 15 Feb 2023 22:09:20 -0500 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 1pSUe0-0007JK-EA for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:13 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUdw-00007S-5Y for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:10 -0500 Received: by mail-pj1-x1033.google.com with SMTP id w20-20020a17090a8a1400b00233d7314c1cso4433142pjn.5 for ; Wed, 15 Feb 2023 19:09:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=dkykD1onhYW4HMW3gM5JC5OMb89CFmlkMrHkTJXibCw=; b=faVvEc40B/Xsh+ofMEtcwOZGDNGp5A+Kf6UQJSXsd9p+fgPlJJepUZ7YtDpTN3RyqH 8VKOOijRyMuRHVdvb1p0+t04xJqhY9LJ3cGejPe0PXelgUIZ6P/KlmLd9dtuw4uxP7oZ tGwQLVDOY7UBgXYvm+9ji4oVLV6LG+9LzS9M/xC8mcpBLnQMPRJer7J9u3/FEIDoPb6/ UbXLcdEGmcIJuXe3y/z4hdsu/aRj6FXxBITuqV3X+WtiC2eHndrXQT2TM5UOSEEvg40R znlFu4PLYX6eug3wFUYXlwIIz+xWqJLylmHaJtOfIoB4LvXs5tpmOPaxE67UhOXVfKsn OoJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=dkykD1onhYW4HMW3gM5JC5OMb89CFmlkMrHkTJXibCw=; b=VHVYX5heDSVkZaofWkbviXjkB7gJkHVmWkV6oSe5oN2f5C28SlExzs3APYwc3xZrs9 9vKnoOzEGBaM75jY2S2I4+Q4t/ZsAxBmDgIi67af/L4613WAHS/uTV30bcZVJQzeGeO2 gHWYjgOErVFjRAW5OgIQkJXBkK5XfL3FvM7GxpyHoeywMheFFgCqlUhUefQ+JN9TBW3J KpNDJNQ1SxaiivrJUAeKpHT8IgJPjN29p+ELSw6uJUjXDxK7bYEJ2vkNCmOkvoIGybJ+ YOxn1wn0GgkvMZH7+nvZQhNyRPSQuJa+9xgCYllI2/XBlN2DjwRDvv7sp/FFo0MIq9PA V48g== X-Gm-Message-State: AO0yUKUshn9BE41QJp11drJIpiv/RGfdVvg696wA5Rf6W9jpDeo6YXdp mswYFaJ7sII3r83YIyk7rdhQou3DHOq/DxUl64E= X-Received: by 2002:a05:6a20:3ca6:b0:bc:50a6:5944 with SMTP id b38-20020a056a203ca600b000bc50a65944mr5416771pzj.38.1676516946636; Wed, 15 Feb 2023 19:09:06 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 06/19] target/arm: Sink gen_mte_check1 into load/store_exclusive Date: Wed, 15 Feb 2023 17:08:41 -1000 Message-Id: <20230216030854.1212208-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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.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 need to duplicate this check across multiple call sites. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.c | 44 ++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index b42e5848cc..cd86597172 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2514,11 +2514,16 @@ static void disas_b_exc_sys(DisasContext *s, uint32_t insn) * races in multi-threaded linux-user and when MTTCG softmmu is * enabled. */ -static void gen_load_exclusive(DisasContext *s, int rt, int rt2, - TCGv_i64 addr, int size, bool is_pair) +static void gen_load_exclusive(DisasContext *s, int rt, int rt2, int rn, + int size, bool is_pair) { int idx = get_mem_index(s); MemOp memop = s->be_data; + TCGv_i64 dirty_addr, clean_addr; + + s->is_ldex = true; + dirty_addr = cpu_reg_sp(s, rn); + clean_addr = gen_mte_check1(s, dirty_addr, false, rn != 31, size); g_assert(size <= 3); if (is_pair) { @@ -2526,7 +2531,7 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, if (size == 2) { /* The pair must be single-copy atomic for the doubleword. */ memop |= MO_64 | MO_ALIGN; - tcg_gen_qemu_ld_i64(cpu_exclusive_val, addr, idx, memop); + tcg_gen_qemu_ld_i64(cpu_exclusive_val, clean_addr, idx, memop); if (s->be_data == MO_LE) { tcg_gen_extract_i64(cpu_reg(s, rt), cpu_exclusive_val, 0, 32); tcg_gen_extract_i64(cpu_reg(s, rt2), cpu_exclusive_val, 32, 32); @@ -2544,7 +2549,7 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, TCGv_i128 t16 = tcg_temp_new_i128(); memop |= MO_128 | MO_ALIGN_16 | MO_ATMAX_8; - tcg_gen_qemu_ld_i128(t16, addr, idx, memop); + tcg_gen_qemu_ld_i128(t16, clean_addr, idx, memop); tcg_gen_extr_i128_i64(cpu_exclusive_val, cpu_exclusive_high, t16); tcg_temp_free_i128(t16); @@ -2559,14 +2564,14 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, } } else { memop |= size | MO_ALIGN; - tcg_gen_qemu_ld_i64(cpu_exclusive_val, addr, idx, memop); + tcg_gen_qemu_ld_i64(cpu_exclusive_val, clean_addr, idx, memop); tcg_gen_mov_i64(cpu_reg(s, rt), cpu_exclusive_val); } - tcg_gen_mov_i64(cpu_exclusive_addr, addr); + tcg_gen_mov_i64(cpu_exclusive_addr, clean_addr); } static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, - TCGv_i64 addr, int size, int is_pair) + int rn, int size, int is_pair) { /* if (env->exclusive_addr == addr && env->exclusive_val == [addr] * && (!is_pair || env->exclusive_high == [addr + datasize])) { @@ -2582,9 +2587,12 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, */ TCGLabel *fail_label = gen_new_label(); TCGLabel *done_label = gen_new_label(); - TCGv_i64 tmp; + TCGv_i64 tmp, dirty_addr, clean_addr; - tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_exclusive_addr, fail_label); + dirty_addr = cpu_reg_sp(s, rn); + clean_addr = gen_mte_check1(s, dirty_addr, true, rn != 31, size); + + tcg_gen_brcond_i64(TCG_COND_NE, clean_addr, cpu_exclusive_addr, fail_label); tmp = tcg_temp_new_i64(); if (is_pair) { @@ -2774,9 +2782,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); } - clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), - true, rn != 31, size); - gen_store_exclusive(s, rs, rt, rt2, clean_addr, size, false); + gen_store_exclusive(s, rs, rt, rt2, rn, size, false); return; case 0x4: /* LDXR */ @@ -2784,10 +2790,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), - false, rn != 31, size); - s->is_ldex = true; - gen_load_exclusive(s, rt, rt2, clean_addr, size, false); + gen_load_exclusive(s, rt, rt2, rn, size, false); if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); } @@ -2839,9 +2842,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); } - clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), - true, rn != 31, size); - gen_store_exclusive(s, rs, rt, rt2, clean_addr, size, true); + gen_store_exclusive(s, rs, rt, rt2, rn, size, true); return; } if (rt2 == 31 @@ -2858,10 +2859,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), - false, rn != 31, size); - s->is_ldex = true; - gen_load_exclusive(s, rt, rt2, clean_addr, size, true); + gen_load_exclusive(s, rt, rt2, rn, size, true); if (is_lasr) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); } From patchwork Thu Feb 16 03:08: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: 653994 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123279wrr; Wed, 15 Feb 2023 19:10:34 -0800 (PST) X-Google-Smtp-Source: AK7set87sfgKYdlbz7yEYtvAmrWV44Orpd5dFz+MyYNjKsRAOvmRR1qZOi9E4XgzHC2lVtCg2V32 X-Received: by 2002:a05:622a:1487:b0:3bb:88e2:7625 with SMTP id t7-20020a05622a148700b003bb88e27625mr8178205qtx.24.1676517034105; Wed, 15 Feb 2023 19:10:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517034; cv=none; d=google.com; s=arc-20160816; b=dart3xzuyjXZz5JVXL40aZCYNl89gSm3m7xj6ST9f58BJkqNTKX3EgV3D9lgusLleT N/Zwx3weQISX4iKTIfp/USXC4b4c1PezlCZtPdOGHNyoD7YNni2lvoCUDZ7eZF/u1ZN7 c+c+9rcpDqyFF0otj5t8VE0+FeJEfd6617PiuBGZGRfzE0g2MJthC4aHLj4ESSbCuNlm eCb6G8OEd0Y3sHApeQxeQwQD6TaR2wb1H5m7ia7GIyWOuYFsn0syBcXgi1i953fuFpOV x24SnNRcEKXPdpl7qLPDaAzKOfOxDIn8cV24ZvuJd0O3j0OfaJ35+KsxMx8+XGzTu/hx 4dIQ== 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=0qVQKGg0JYDYl3B/Ezo35aJccYu0GMCuciVVV8M/s7Y=; b=KNxUtfDCAanKw1dZaNM8i2Iv1yR0VkzueqX/d6/VNIyypRIfapXQE+LbqGS2gUcQjA ci6UwpIINs1XIPE1Ew6MINXCfxt+Y5JmivPiwNKhyQEF62lGThY4LIj7cijCXML0zCSG Fw1Pex9pQFGhaVcude9u4WI3OWRVosJkIFUJD32M8NIHnTCzjFeBEhzBm45ALAKSFzRs rVtGADRygXUD5nVVRy2TRlWpXqv+yLwFMj4/W9isJCzSBw6LTxI7pDTt5H7T1bWuVjmT WJ1ZQmKgLlslZ5zkiLZrx6VpTq//pfzUQmUHai3mT1VDKyCXSrO+JgAU89RNfI7yReh/ yKEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w47xxmO2; 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 h18-20020ac85852000000b003a99334f595si522929qth.655.2023.02.15.19.10.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:10:34 -0800 (PST) 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=w47xxmO2; 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 1pSUe6-0007Lp-H9; Wed, 15 Feb 2023 22:09:19 -0500 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 1pSUe0-0007JI-4e for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:12 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUdx-00007u-IQ for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:11 -0500 Received: by mail-pg1-x530.google.com with SMTP id b22so436196pgw.3 for ; Wed, 15 Feb 2023 19:09:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=0qVQKGg0JYDYl3B/Ezo35aJccYu0GMCuciVVV8M/s7Y=; b=w47xxmO2lqI1unGUC080deed+U6Mj9PRjzTr3USYcPDJlh0A0Phr08dnr+pn+QM5cf SlnyvUYdXZrxiCNC42QMnmMathLnh9Mc/DJbVcdOq4GtT2GPZRx+1aU+pE+zadD7fuX0 kn9hRIL3V9CYDQL4m/8YMKl1YD3/JfX2Ul/xTKPJo1zjElEtnpSlNuVS0KZClBJ3c2Kt z2L99JAIZGYT9RlVISg3L4szFuRDFQO+XnnI2iintgXXUPMYSFU6IWlxUXZhri+5ICTL QL6Wf7L2Zbsft67vQVaTdnB36yd9NgUpNUq3TWY4HVdW6vkqy/Ue5BGprfO6xRxoUQ5W B66A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=0qVQKGg0JYDYl3B/Ezo35aJccYu0GMCuciVVV8M/s7Y=; b=QN62RMUJZiHg4nVocVQCaPFXGvHEjISNCOyDFPm2n23sRGrGRPyxzNI3inhnav68IW nfEpz6utZp4JZA6rhMxEJWQJwxGYGxUw591/eWt+Sv6K0yKdEPVxN9kwKXd0i/LK4CCa 9lwzJtT7d1Zcb5poRTJeXYyt6IF8x85FMPDJSRbCrUw89Mk/KxkXUOhiRPMqKzMcHoUK n4mP+LqavpUBPbr9YfUTIKW0t17o7nCzXMFKg8cf3p+pKPY0pJ0V0JX3JdjaubTI5LoV j3Zo9a5kUBiKVvQDeYufRehqRyGUYnphdTX7QV3eLlanBI4SfXlsCv1d2mQRUu2OFEzB ItPw== X-Gm-Message-State: AO0yUKVXGcv1vYKAfIi1HUroojjGW6mItGISjvk3R2MHlI5NqRIxYsL+ iPqzt5sgY4dTST++eqj8t4ZYNswsr0vPnWvAjgM= X-Received: by 2002:a62:52c6:0:b0:5a8:68c0:5607 with SMTP id g189-20020a6252c6000000b005a868c05607mr3535553pfb.21.1676516948196; Wed, 15 Feb 2023 19:09:08 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 07/19] target/arm: Add feature test for FEAT_LSE2 Date: Wed, 15 Feb 2023 17:08:42 -1000 Message-Id: <20230216030854.1212208-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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.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 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 7bc97fece9..2108caf753 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -4049,6 +4049,11 @@ static inline bool isar_feature_aa64_st(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, ST) != 0; } +static inline bool isar_feature_aa64_lse2(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, AT) != 0; +} + static inline bool isar_feature_aa64_fwb(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, FWB) != 0; From patchwork Thu Feb 16 03:08:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654000 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123599wrr; Wed, 15 Feb 2023 19:11:19 -0800 (PST) X-Google-Smtp-Source: AK7set+BDXNSu+OkxKTRc4ogqmi1Lj+k8imNRWv6FjVA2sRB3yeiFQ+n8p4zptk2eK0OdVIOUCLd X-Received: by 2002:a05:6214:e47:b0:56b:c5fb:bfa with SMTP id o7-20020a0562140e4700b0056bc5fb0bfamr8921231qvc.3.1676517079643; Wed, 15 Feb 2023 19:11:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517079; cv=none; d=google.com; s=arc-20160816; b=onw5EZbbw7QpikFAsTwY2lJ+O9/Rimch/zo5ymMy6YrOpl1D5dEj+/MZIniz+S2VIH iaVP/0kbhyS+/wcVQhERzHj8Kkgw+l7UYSvhIKTZFzm8r5SfdKJe+eVjFZHtJxh0l73X cecLzM3mFxo/uYuLubY90qO34ku9gmoYf+jsHrgUmNneeSM+kEYyUU9r5+L/IT+41Evs FI+1qpjJc3sTH86PFfWOtuNVhix01OF+p7pVKQHzl3ghgp6Eyv02CeO20vXIaSzYU051 KCOAmgBXTh2flLZciFYXs0HONQbsFfb9lZl1hlZlnh0zVsQFS9G8eKbYR79rye7Xw0D1 JDIA== 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=u7PUivR9YRgzFVAw8uLHbwLnPM1WOwEN/2TbJJpnsL8=; b=soMyknztyX4TtYOOntrh+gDuaDOyhOa97fMgAqYEDYFN7j+0KaCJmrjywHkZ/fOcSd Rk0SGw+lGtQJqcYVn6JeFi8mYVP3e2uxLnePyJHpzmd6kFTQAf8TBN2WOOzWDvQ7I0sr 8NnDhTkoE1u+BR5tNN/9P0ZT3XGAoWqjpfb1ioehd4muRwC/tF5Jm/zRggLwkqd3btEA 06zR/uK53r+DzVH+VZ23kEKXl18RjKzpzeEsOC96njG3ebjOGolu/7gItfrNPkQ/GLUn Vtyqfo6Q9aKf40vuyyJ4Ft2C/QYdr9Amv4xvICzwJGgyQWnhojNycqWnmAD49ip3GRIa hppQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sojJnfYF; 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 a5-20020a0cca85000000b0056eaf2d9b8dsi93372qvk.488.2023.02.15.19.11.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:11:19 -0800 (PST) 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=sojJnfYF; 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 1pSUe8-0007OW-RR; Wed, 15 Feb 2023 22:09:20 -0500 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 1pSUe1-0007K8-J6 for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:14 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUdy-0008WD-HH for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:13 -0500 Received: by mail-pf1-x42f.google.com with SMTP id r17so587839pff.9 for ; Wed, 15 Feb 2023 19:09:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=u7PUivR9YRgzFVAw8uLHbwLnPM1WOwEN/2TbJJpnsL8=; b=sojJnfYFKN+VhODxgeAQehBOgAHeniN2bvbNrvMdbwwTsOSbjbUtiydKJ95839HaUL nlKdjpUpIfR3h52V4ibugiYVLLeQc3A3KjFZbsEoRYZOii+6GpOC71CgPawZ3ctlKjPg ZqKvfno2+7cTlIkWN04zni1BAUo/Y4jJQPI1T34joymF63Bd6ux/+LSx/c8fgzDcXR+V Lff/9SyVvIbJhhgAp9VBw4AfYuyjH2l9Tm08b9+zQZ8Y9Yzhn+YP8x6AiF54ZtBKaAXM RuNmUyWssfD5an2oqEF2G+RJv/ByqgEWH3XfvkMuqImXrMK6j8OqUSs344TcZ/dMNMvS stcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=u7PUivR9YRgzFVAw8uLHbwLnPM1WOwEN/2TbJJpnsL8=; b=5/IHJFb5ZlNtY/wwiJthXt14xHgwiSKEmTVjhvLApoo3VPVTY+1cKZQXrIYJcSjPjU Eo+UfQh+Bw6u9a9zk3HK+DBzt/vqFQCRCEZ0cWdl4vhTiekHGVHJPxW0GdJ2OJeU936w A5+JK86qCWfBxYvTAe2auD4ev9wpt3ijr1Afm1aJGJdC64vv4LCcKDTOIoq5CdF1SM6z vG0yjkhBzf4Weod8e+5TGxTBuCEhDotwJo/UdyTq308RunevrJ7S6w4g5gGB7v7k5Q40 8gosBmds6rp8kBzlzxYNHd6EcnkSUknuygEqY2OV4xKrgx2Drl+8p5yvSb1ayFma30G5 sO4g== X-Gm-Message-State: AO0yUKVusDoi+O1W812QflNaD19k9pMhgu8ogOdTURF+3HM9EApifzOl nRKb9d0Lpw7gcOacNjfwLWvzvEnFZflM0N8GTeM= X-Received: by 2002:aa7:9f8d:0:b0:5a8:4d33:f39e with SMTP id z13-20020aa79f8d000000b005a84d33f39emr3839903pfr.24.1676516949674; Wed, 15 Feb 2023 19:09:09 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 08/19] target/arm: Add atom_data to DisasContext Date: Wed, 15 Feb 2023 17:08:43 -1000 Message-Id: <20230216030854.1212208-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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.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 Use this to record the default atomicity of memory operations. Set it to MO_ATOM_WITHIN16 if FEAT_LSE2 applies. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.h | 14 +++++++++++--- target/arm/translate-a64.c | 4 ++++ target/arm/translate.c | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index 3717824b75..809479f9b7 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -54,6 +54,7 @@ typedef struct DisasContext { bool eci_handled; int sctlr_b; MemOp be_data; + MemOp atom_data; #if !defined(CONFIG_USER_ONLY) int user; #endif @@ -556,10 +557,10 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) /** * finalize_memop: * @s: DisasContext - * @opc: size+sign+align of the memory operation + * @opc: size+sign+align+atomicity of the memory operation * - * Build the complete MemOp for a memory operation, including alignment - * and endianness. + * Build the complete MemOp for a memory operation, including alignment, + * endianness, and atomicity. * * If (op & MO_AMASK) then the operation already contains the required * alignment, e.g. for AccType_ATOMIC. Otherwise, this an optionally @@ -568,12 +569,19 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) * In the latter case, there are configuration bits that require alignment, * and this is applied here. Note that there is no way to indicate that * no alignment should ever be enforced; this must be handled manually. + * + * If (op & MO_ATOM_MASK) or (op & MO_ATMAX_MASK) then the operation already + * contains the required atomicity, e.g. for AccType_VEC. Otherwise, apply + * atomicity for AccType_NORMAL. */ static inline MemOp finalize_memop(DisasContext *s, MemOp opc) { if (s->align_mem && !(opc & MO_AMASK)) { opc |= MO_ALIGN; } + if (!(opc & (MO_ATOM_MASK | MO_ATMAX_MASK))) { + opc |= s->atom_data; + } return opc | s->be_data; } diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index cd86597172..fa793485c3 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14762,6 +14762,10 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, tcg_debug_assert(dc->tbid & 1); #endif + /* Record the atomicity of a single AccType_NORMAL memory access. */ + dc->atom_data = (dc_isar_feature(aa64_lse2, dc) + ? MO_ATOM_WITHIN16 : MO_ATOM_IFALIGN); + /* Single step state. The code-generation logic here is: * SS_ACTIVE == 0: * generate code with no special handling for single-stepping (except diff --git a/target/arm/translate.c b/target/arm/translate.c index c23a3462bf..552c376050 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9449,6 +9449,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->sme_trap_nonstreaming = EX_TBFLAG_A32(tb_flags, SME_TRAP_NONSTREAMING); } + dc->atom_data = MO_ATOM_IFALIGN; dc->cp_regs = cpu->cp_regs; dc->features = env->features; From patchwork Thu Feb 16 03:08:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653993 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123179wrr; Wed, 15 Feb 2023 19:10:21 -0800 (PST) X-Google-Smtp-Source: AK7set+t9AAtfZFKteu+T1sTiVrK/5xo8vTtjNUB4bmNRlzew6D8oyKQjTUHArAqjLAbY8F70y+Y X-Received: by 2002:a05:622a:1c9:b0:3b9:b1ea:2d1b with SMTP id t9-20020a05622a01c900b003b9b1ea2d1bmr7813282qtw.58.1676517021096; Wed, 15 Feb 2023 19:10:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517021; cv=none; d=google.com; s=arc-20160816; b=iC0bqlxgNVCBWDBCunRN+BKxZoFDZv8SfV73kZSKIzeFGqhHu5ZEBjngFNdYbUWqbO oxlEcdnapBfIwzsvzot6V5g6ACq1s04aTWso5lRO8QZjq1SYJaValgjCj/EBABnVseqy C2IrcVfvynYhTC2SvqPmJb+jlU+504wiNpWbc4aASBGUxLCArD+74hZNUjC4mEQWc2lg jCvz3ZFt85SfV7xyzX1kwKG/99ORXuUGYxMMlICzcOHOJnz5E/b+ouhBMKR9bqDbo/f1 6+G0maEbr7jH/USLCGdiNJMcqwhcDuEfwGH7N56OYVuQ/m9oPnhQgYr+yszMOLt4UVml GkoA== 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=wXIVB/G8C9wXJG2rRAh3Q1CpNhqpKuo9H1YxYu+YGPs=; b=l/JZ95v41Ek/REk31pWUmB11DbsrKfGszLfqvYKCIG8f3yuuKkbbneuBUpIBdhaQpN Nmi1QK14H2k/IrvA6Mi1bWlvi21XhDxjaD71hC8BM3Y3Sv5xG+4CEWdQRuz+DE1oTQVz o6J//B7cs/ke2HkMd9hPJ4AHBnk7YaYj873t44s8QsKCcYsBCUSIHb1p+cH/tSDnmkUT d+uqPdKkHbgt1hmd4HVOpOZnuvuafps7sOpwKE/5+OUhVDllXfVZxClINXC18HSK64xH giIH/hbVF6bvSK9Vf0rFqzqAtPrbOrobx9fyUVVWBMUWrAmydohW2LgsJBPBK1qIFxG9 hYMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P8x4WH3J; 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 t201-20020a3746d2000000b0073b933bd792si91860qka.47.2023.02.15.19.10.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:10:21 -0800 (PST) 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=P8x4WH3J; 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 1pSUe9-0007P4-Cr; Wed, 15 Feb 2023 22:09:21 -0500 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 1pSUe2-0007Ks-Sg for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:14 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUe0-00008p-W4 for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:14 -0500 Received: by mail-pg1-x52a.google.com with SMTP id r18so413267pgr.12 for ; Wed, 15 Feb 2023 19:09:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=wXIVB/G8C9wXJG2rRAh3Q1CpNhqpKuo9H1YxYu+YGPs=; b=P8x4WH3JzGsfbqjr/W7kq3G31Sj8csnR4r+C8x/HkvsLR59UgRyVo3J2m5GJ7U/hGQ RPRvmjMDagEY0sj6rbnT6rUXp6+E+fcSvc2KYfAM1ITug6TzgrPj//1sVN+jY5MtV+SW adsMXQtZnATkjLgnwFtJr0a9NCfKMTe1IewhL5+OB+6iwiH9a3EVhTFLrjbhg1M5lFfu KDDNDDtTfZ+VxUmHw5hove1UeySsDnvbizRahGmoERbnupO3pUxEn1SgejmnJOGYmWZP R6XTtn261YJ9br1aItlJGYp72JVb61r4KuhawDatHpH/qc5RI4JaP4WZ5Zk3II8SVZYs Mq9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=wXIVB/G8C9wXJG2rRAh3Q1CpNhqpKuo9H1YxYu+YGPs=; b=38PBR5N3lhgewU60e9NiHTKnxN4TlJkq9PMYi0kuxhFhLvVpuVrO4Jv645T8ys2DRA k02hQgVpJlHnRWA+TneaqSl2qLaGOxkpva0K0iK32ggtQBI4UNp07RFYXLN1w21bsc5D 9qsuiHvzm7X4QdpguGqDHaT3J2/iObbuSxqRPQqZtZzSdji2LTw2qvfZBUfMiQES4RL1 uOOeu3vGZu04PSm9id01yv6b5vYZuoJ8NpWycB3jQzB/+kl6KJy9m+ax7GXGvfp0/u3W lqJ1IyZyAaw8ThrDeU0s9gQ6DAOnyaY9tBQPT5oFcYJPFmalcrCrzjMWL+tmMoadoHzV 3niA== X-Gm-Message-State: AO0yUKURfX+s7+s+045M84a+IjCrul+WeUi6fAGyUZW3u+M0zzaus5vT Ew0AFtDcniwBxeaBvkMVFZl1Xx+pdytJ8rOaSCY= X-Received: by 2002:aa7:9782:0:b0:5a8:aabf:46f4 with SMTP id o2-20020aa79782000000b005a8aabf46f4mr4120537pfp.8.1676516951087; Wed, 15 Feb 2023 19:09:11 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:10 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 09/19] target/arm: Load/store integer pair with one tcg operation Date: Wed, 15 Feb 2023 17:08:44 -1000 Message-Id: <20230216030854.1212208-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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.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 This is required for LSE2, where the pair must be treated atomically if it does not cross a 16-byte boundary. But it simplifies the code to do this always, just use the unpaired atomicity without LSE2. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.c | 77 ++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index fa793485c3..c0d55c9204 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -3089,27 +3089,72 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); TCGv_i64 tcg_rt2 = cpu_reg(s, rt2); + MemOp mop = (size + 1) | s->be_data; + + /* + * With LSE2, non-sign-extending pairs are treated atomically if + * aligned, and if unaligned one of the pair will be completely + * within a 16-byte block and that element will be atomic. + * Otherwise each element is separately atomic. + * In all cases, issue one operation with the correct atomicity. + * + * This treats sign-extending loads like zero-extending loads, + * since that reuses the most code below. + */ + mop |= size << MO_ATMAX_SHIFT; + mop |= s->atom_data; + if (s->align_mem) { + mop |= (size == 2 ? MO_ALIGN_4 : MO_ALIGN_8); + } if (is_load) { - TCGv_i64 tmp = tcg_temp_new_i64(); + if (size == 2) { + TCGv_i64 tmp = tcg_temp_new_i64(); - /* Do not modify tcg_rt before recognizing any exception - * from the second load. - */ - do_gpr_ld(s, tmp, clean_addr, size + is_signed * MO_SIGN, - false, false, 0, false, false); - tcg_gen_addi_i64(clean_addr, clean_addr, 1 << size); - do_gpr_ld(s, tcg_rt2, clean_addr, size + is_signed * MO_SIGN, - false, false, 0, false, false); + tcg_gen_qemu_ld_i64(tmp, clean_addr, get_mem_index(s), mop); + if (s->be_data == MO_LE) { + tcg_gen_extr32_i64(tcg_rt, tcg_rt2, tmp); + } else { + tcg_gen_extr32_i64(tcg_rt2, tcg_rt, tmp); + } + if (is_signed) { + tcg_gen_ext32s_i64(tcg_rt, tcg_rt); + tcg_gen_ext32s_i64(tcg_rt2, tcg_rt2); + } + tcg_temp_free_i64(tmp); + } else { + TCGv_i128 tmp = tcg_temp_new_i128(); - tcg_gen_mov_i64(tcg_rt, tmp); - tcg_temp_free_i64(tmp); + tcg_gen_qemu_ld_i128(tmp, clean_addr, get_mem_index(s), mop); + if (s->be_data == MO_LE) { + tcg_gen_extr_i128_i64(tcg_rt, tcg_rt2, tmp); + } else { + tcg_gen_extr_i128_i64(tcg_rt2, tcg_rt, tmp); + } + tcg_temp_free_i128(tmp); + } } else { - do_gpr_st(s, tcg_rt, clean_addr, size, - false, 0, false, false); - tcg_gen_addi_i64(clean_addr, clean_addr, 1 << size); - do_gpr_st(s, tcg_rt2, clean_addr, size, - false, 0, false, false); + if (size == 2) { + TCGv_i64 tmp = tcg_temp_new_i64(); + + if (s->be_data == MO_LE) { + tcg_gen_concat32_i64(tmp, tcg_rt, tcg_rt2); + } else { + tcg_gen_concat32_i64(tmp, tcg_rt2, tcg_rt); + } + tcg_gen_qemu_st_i64(tmp, clean_addr, get_mem_index(s), mop); + tcg_temp_free_i64(tmp); + } else { + TCGv_i128 tmp = tcg_temp_new_i128(); + + if (s->be_data == MO_LE) { + tcg_gen_concat_i64_i128(tmp, tcg_rt, tcg_rt2); + } else { + tcg_gen_concat_i64_i128(tmp, tcg_rt2, tcg_rt); + } + tcg_gen_qemu_st_i128(tmp, clean_addr, get_mem_index(s), mop); + tcg_temp_free_i128(tmp); + } } } From patchwork Thu Feb 16 03:08:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654004 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123684wrr; Wed, 15 Feb 2023 19:11:31 -0800 (PST) X-Google-Smtp-Source: AK7set9QFqKcW0Q0tBnDWhwPdpSUeeLOSjRORZUrkN2o/CrXb3gTkcO84lAqswaPeIxnjp9B/7/B X-Received: by 2002:a05:622a:24f:b0:3b8:ea00:7023 with SMTP id c15-20020a05622a024f00b003b8ea007023mr7833141qtx.19.1676517090850; Wed, 15 Feb 2023 19:11:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517090; cv=none; d=google.com; s=arc-20160816; b=LLVQ1WuUescldwNP7wXdcS6JWs0X5RkfMQaZhV/SV/KbW1QuY9hpY6YTRNWBhFoFDs 8nBVOmLV/qElJ/dMrQ1/u2AOJCBkYQKw7nx+0zvmbqBuOUjRy3AiQDQjEgr0C57U/uvf TUc5LIHN6/IzvGiuJZldgf/af3uQ/l3OOe0ffekFIBax7cS1WmG+eH+bkMrARS6jPQoM VCQJbVMzgKWd/TbK1FK4Yt2MfAjYYnDZ27MHnxHqOxRvcTIdUmD6iDiWP1WSgV5wyP5+ R9U1Sujwg0y+VNImzXwAnooO0W23W0Wj3krM3DW5OVIZrl1LLgiHtm2v+qpF1JFD2gFe XTvQ== 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=kXKMqzkqPC/8m+v36uY3rxvmxE+IMTE35FoSDFgpNdc=; b=akOO6ql05m7rbNlqf8OgQ/Ow7Vbm+jvZ4BFGdARIE2R+Tdx4XGJmJvDurD5KAcPfWu sgznpH0hs8QAJKv6pqFlZ1O0D52+b2y3JNom4TobJLhmsnNjAXLs60EW9yDoutGipaGp i/KotRDYu1dWbhLyn8JV1AN98lKbC6zdSqJEdixvReDVyEG8D6hxd5ZUKMFYD7tqo6VD It4U74ZdXr8/Sbnvnq6rX1Ns81bfFu2v5t4/Km7On3C+6UU1z71Yoq1CP3cfOSNJxxF+ q0Rgy+TUobNodkzf55YVZxwabsipD18kBTGL9uwS6DDAPQb0xg/8rM6K8irzczkQL7Wz 8NuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=G3rwrV9q; 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=fail (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 b3-20020ac87fc3000000b003b68cf4ae53si550447qtk.505.2023.02.15.19.11.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:11:30 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=G3rwrV9q; 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=fail (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 1pSUeA-0007Qd-GX; Wed, 15 Feb 2023 22:09:22 -0500 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 1pSUe4-0007LM-7Y for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:16 -0500 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUe1-00009N-Uj for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:15 -0500 Received: by mail-pf1-x435.google.com with SMTP id n2so603090pfo.3 for ; Wed, 15 Feb 2023 19:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=kXKMqzkqPC/8m+v36uY3rxvmxE+IMTE35FoSDFgpNdc=; b=G3rwrV9qj12efaf7G56zBGN3bJqLyP2/NJIsvQpUEWSZkPe8xc22C4jx1EQiCYKKnl sa6O4jBzboAj0kF8eJimJqvpkz3F57BbgXDXQT4P4XQUdAYkSLUirTL4Zu8SYkq3QAP/ /7ZgUIpNgrRW0dwtmO4lhTra81Qk7/xiqk5IrHF3lk4SFZAbmfTiUBY2ugUri/guKbkZ JMt7GXCZ75xjj0skuy5xwhrFIGPCeHp2oBaHVuSvJF880mFQ7HtP9uVj4jo8z7EIfteT 9jlxEOaLISv5lBu2PhNIjd0MfCWyzbnsTn5snvGEv/ktSi086jUdrXAyVr3e50ah6lOZ SugQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=kXKMqzkqPC/8m+v36uY3rxvmxE+IMTE35FoSDFgpNdc=; b=bl3Gs7MtNITucTIBJI8zsTJfI17q1xJtVPULiBJI6MD9AZLCYjZ8fk+YhM3E5zIm8T QNcj4ynR7exrnkDaANAlnC/ICNxZxyigFxz6S/m9Zw3EgjVfOKp6ru308LoMGKViH9VT TpoL5mCUMSGWOB1g3nK4w9zY6r520aSbJxGE9WBtYGhNiCtuPMUhmOlN4NfNjNVIPVZr 2BWeEewFHS3J3CLDTsIxC6KtQoujduXicRKsn++yqiEULrNJ9mdCq/OBI0BgxRRRC8hi 1pouvPa84+KpyzeeGN0YYn/tPrRZBUyVsu579oiYEssZzoN2ezNEKFzx8j7wEqlI5kd/ u/SA== X-Gm-Message-State: AO0yUKUF7oZBfTjxFm/AAiB4m9kpzUVWTiLaONP28M9EGJH3GKMSnZs0 tx9+IYhuEubTmEfBA7WhtICICs0LIfJmaqhagf0= X-Received: by 2002:a62:1708:0:b0:5a8:b2a1:66a4 with SMTP id 8-20020a621708000000b005a8b2a166a4mr3580198pfx.5.1676516952586; Wed, 15 Feb 2023 19:09:12 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 10/19] target/arm: Hoist finalize_memop out of do_gpr_{ld, st} Date: Wed, 15 Feb 2023 17:08:45 -1000 Message-Id: <20230216030854.1212208-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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.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 We are going to need the complete memop beforehand, so let's not compute it twice. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.c | 61 ++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c0d55c9204..fd499a208d 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -888,7 +888,6 @@ static void do_gpr_st_memidx(DisasContext *s, TCGv_i64 source, unsigned int iss_srt, bool iss_sf, bool iss_ar) { - memop = finalize_memop(s, memop); tcg_gen_qemu_st_i64(source, tcg_addr, memidx, memop); if (iss_valid) { @@ -923,7 +922,6 @@ static void do_gpr_ld_memidx(DisasContext *s, TCGv_i64 dest, TCGv_i64 tcg_addr, bool iss_valid, unsigned int iss_srt, bool iss_sf, bool iss_ar) { - memop = finalize_memop(s, memop); tcg_gen_qemu_ld_i64(dest, tcg_addr, memidx, memop); if (extend && (memop & MO_SIGN)) { @@ -2772,6 +2770,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) int o2_L_o1_o0 = extract32(insn, 21, 3) * 2 | is_lasr; int size = extract32(insn, 30, 2); TCGv_i64 clean_addr; + MemOp memop; switch (o2_L_o1_o0) { case 0x0: /* STXR */ @@ -2808,10 +2807,11 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) gen_check_sp_alignment(s); } tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); + /* TODO: ARMv8.4-LSE SCTLR.nAA */ + memop = finalize_memop(s, size | MO_ALIGN); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, size); - /* TODO: ARMv8.4-LSE SCTLR.nAA */ - do_gpr_st(s, cpu_reg(s, rt), clean_addr, size | MO_ALIGN, true, rt, + do_gpr_st(s, cpu_reg(s, rt), clean_addr, memop, true, rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); return; @@ -2826,10 +2826,11 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } + /* TODO: ARMv8.4-LSE SCTLR.nAA */ + memop = finalize_memop(s, size | MO_ALIGN); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), false, rn != 31, size); - /* TODO: ARMv8.4-LSE SCTLR.nAA */ - do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size | MO_ALIGN, false, true, + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, memop, false, true, rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); return; @@ -2937,9 +2938,9 @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) } else { /* Only unsigned 32bit loads target 32bit registers. */ bool iss_sf = opc != 0; + MemOp memop = finalize_memop(s, size + is_signed * MO_SIGN); - do_gpr_ld(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, - false, true, rt, iss_sf, false); + do_gpr_ld(s, tcg_rt, clean_addr, mop, false, true, rt, iss_sf, false); } } @@ -3199,7 +3200,7 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, bool post_index; bool writeback; int memidx; - + MemOp memop; TCGv_i64 clean_addr, dirty_addr; if (is_vector) { @@ -3226,7 +3227,7 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, return; } is_store = (opc == 0); - is_signed = extract32(opc, 1, 1); + is_signed = !is_store && extract32(opc, 1, 1); is_extended = (size < 3) && extract32(opc, 0, 1); } @@ -3260,6 +3261,8 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, } memidx = is_unpriv ? get_a64_user_mem_index(s) : get_mem_index(s); + memop = finalize_memop(s, size + is_signed * MO_SIGN); + clean_addr = gen_mte_check1_mmuidx(s, dirty_addr, is_store, writeback || rn != 31, size, is_unpriv, memidx); @@ -3275,10 +3278,10 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); if (is_store) { - do_gpr_st_memidx(s, tcg_rt, clean_addr, size, memidx, + do_gpr_st_memidx(s, tcg_rt, clean_addr, memop, memidx, iss_valid, rt, iss_sf, false); } else { - do_gpr_ld_memidx(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, + do_gpr_ld_memidx(s, tcg_rt, clean_addr, memop, is_extended, memidx, iss_valid, rt, iss_sf, false); } @@ -3327,8 +3330,8 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, bool is_signed = false; bool is_store = false; bool is_extended = false; - TCGv_i64 tcg_rm, clean_addr, dirty_addr; + MemOp memop; if (extract32(opt, 1, 1) == 0) { unallocated_encoding(s); @@ -3355,7 +3358,7 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, return; } is_store = (opc == 0); - is_signed = extract32(opc, 1, 1); + is_signed = !is_store && extract32(opc, 1, 1); is_extended = (size < 3) && extract32(opc, 0, 1); } @@ -3368,6 +3371,8 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, ext_and_shift_reg(tcg_rm, tcg_rm, opt, shift ? size : 0); tcg_gen_add_i64(dirty_addr, dirty_addr, tcg_rm); + + memop = finalize_memop(s, size + is_signed * MO_SIGN); clean_addr = gen_mte_check1(s, dirty_addr, is_store, true, size); if (is_vector) { @@ -3379,11 +3384,12 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); + if (is_store) { - do_gpr_st(s, tcg_rt, clean_addr, size, + do_gpr_st(s, tcg_rt, clean_addr, memop, true, rt, iss_sf, false); } else { - do_gpr_ld(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, + do_gpr_ld(s, tcg_rt, clean_addr, memop, is_extended, true, rt, iss_sf, false); } } @@ -3415,12 +3421,11 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, int rn = extract32(insn, 5, 5); unsigned int imm12 = extract32(insn, 10, 12); unsigned int offset; - TCGv_i64 clean_addr, dirty_addr; - bool is_store; bool is_signed = false; bool is_extended = false; + MemOp memop; if (is_vector) { size |= (opc & 2) << 1; @@ -3442,7 +3447,7 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, return; } is_store = (opc == 0); - is_signed = extract32(opc, 1, 1); + is_signed = !is_store && extract32(opc, 1, 1); is_extended = (size < 3) && extract32(opc, 0, 1); } @@ -3452,6 +3457,8 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, dirty_addr = read_cpu_reg_sp(s, rn, 1); offset = imm12 << size; tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); + + memop = finalize_memop(s, size + is_signed * MO_SIGN); clean_addr = gen_mte_check1(s, dirty_addr, is_store, rn != 31, size); if (is_vector) { @@ -3464,10 +3471,9 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, TCGv_i64 tcg_rt = cpu_reg(s, rt); bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); if (is_store) { - do_gpr_st(s, tcg_rt, clean_addr, size, - true, rt, iss_sf, false); + do_gpr_st(s, tcg_rt, clean_addr, memop, true, rt, iss_sf, false); } else { - do_gpr_ld(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, + do_gpr_ld(s, tcg_rt, clean_addr, memop, is_extended, true, rt, iss_sf, false); } } @@ -3497,7 +3503,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, bool a = extract32(insn, 23, 1); TCGv_i64 tcg_rs, tcg_rt, clean_addr; AtomicThreeOpFn *fn = NULL; - MemOp mop = s->be_data | size | MO_ALIGN; + MemOp mop = finalize_memop(s, size | MO_ALIGN); if (is_vector || !dc_isar_feature(aa64_atomics, s)) { unallocated_encoding(s); @@ -3558,7 +3564,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, * full load-acquire (we only need "load-acquire processor consistent"), * but we choose to implement them as full LDAQ. */ - do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, mop, false, true, rt, disas_ldst_compute_iss_sf(size, false, 0), true); tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); return; @@ -3604,6 +3610,7 @@ static void disas_ldst_pac(DisasContext *s, uint32_t insn, bool use_key_a = !extract32(insn, 23, 1); int offset; TCGv_i64 clean_addr, dirty_addr, tcg_rt; + MemOp memop; if (size != 3 || is_vector || !dc_isar_feature(aa64_pauth, s)) { unallocated_encoding(s); @@ -3630,12 +3637,14 @@ static void disas_ldst_pac(DisasContext *s, uint32_t insn, offset = sextract32(offset << size, 0, 10 + size); tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); + memop = finalize_memop(s, size); + /* Note that "clean" and "dirty" here refer to TBI not PAC. */ clean_addr = gen_mte_check1(s, dirty_addr, false, is_wback || rn != 31, size); tcg_rt = cpu_reg(s, rt); - do_gpr_ld(s, tcg_rt, clean_addr, size, + do_gpr_ld(s, tcg_rt, clean_addr, memop, /* extend */ false, /* iss_valid */ !is_wback, /* iss_srt */ rt, /* iss_sf */ true, /* iss_ar */ false); @@ -3677,7 +3686,7 @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) } /* TODO: ARMv8.4-LSE SCTLR.nAA */ - mop = size | MO_ALIGN; + mop = finalize_memop(s, size | MO_ALIGN); switch (opc) { case 0: /* STLURB */ From patchwork Thu Feb 16 03:08:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653999 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123570wrr; Wed, 15 Feb 2023 19:11:16 -0800 (PST) X-Google-Smtp-Source: AK7set8/zsl5iCtXnGOO2TCkKq7CyYbsGLn1GlhJjR1Pc6gLhhYAAwFPYstE/MDjiOIGi2zFG5AB X-Received: by 2002:ad4:5c69:0:b0:53c:5e57:cd02 with SMTP id i9-20020ad45c69000000b0053c5e57cd02mr9308713qvh.38.1676517076759; Wed, 15 Feb 2023 19:11:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517076; cv=none; d=google.com; s=arc-20160816; b=UChKxlbj2J3D3ePw5U9TaRY0O21TdbYIf+T+pOUAuDvTpICeCJLfgd+Jsw8nKTjwDh qoWRDWL7TQ2dbasuIXVVWgW8U2rZgr/kgCHr4FcpSseY2H23yT70Su9p9qjt35PH4byV wAKba7uZ/TqFmJViy32IJmXSVNoaJkN7ZUJK8eCma7rd28U5Ia4fyGD6/pIeyt+slS29 k4v2OdKHQX9FATuZ+sb76XBTgGew6fQOfNGJnl63OByIACGNnapQEske0Tb1a5PT5I5s OZ1vnwm481B3yA2BHU4fHEXPhn0swOj/t4ogvZCR0z7/cq5Krp8U+yyxWKepWll1TrFN eS9g== 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=a0tYDB8IQXSc08aG5pUrvVghYnFW8gqBhheBrsscIzw=; b=qZsMCnIPTsOBrGoMDnZIiOEjgdmDCBcsrAwK/scnRfg7q3p6GrIA3VM52FRj8YPQg/ adIkmEVkwKLEHyyL1oVObYvtErxo79ZdDCTTufnyT2TnWF+LspePDpD67/pCsJ20qQBJ QmR6PBNRbHGxkthA9MsVrEf39eLDYywH5dlWn9rKVaRex7O9zHMtX/4D8suCeo4qlHrj Dw+gZQP3FTUCCSNtMWnCgphNbGsbHOdpffFYNLQdE6MbuIkWF4RS4HuVvE+Pp/ebaf77 2oj6uXzpCqMPqlDlHcTZdCN3HRm+E0P42cCXKOqTMJFE1hOVUtuXtlhULIHtun8akflK 09hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iJJZQx4k; 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=fail (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 u10-20020a0c8dca000000b0056c27632aa1si122724qvb.241.2023.02.15.19.11.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:11:16 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=iJJZQx4k; 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=fail (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 1pSUeA-0007Qe-In; Wed, 15 Feb 2023 22:09:22 -0500 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 1pSUe5-0007MB-HK for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:18 -0500 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUe3-0000A0-KT for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:17 -0500 Received: by mail-pg1-x531.google.com with SMTP id x31so428166pgl.6 for ; Wed, 15 Feb 2023 19:09:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=a0tYDB8IQXSc08aG5pUrvVghYnFW8gqBhheBrsscIzw=; b=iJJZQx4kn8mmBW/eVe1m9hPx3OEkPsCdJzYroC55G+FkDYHzStPjoEdkSkO3nlzUxN 1WzXB7RDC8xiw2c37/ySXOeuoOX1D3JWRGEC7afY2Z0NXJFxXirqaxym1lsg211u1A6d 43Cnu9FMcgU/1eKdbzIkIETrZhsSWcjUUUrBrVw9BojN5VDUVEhWNYhLKO0uFyEvRVz4 hAzquJYZlOmapd/Ky5xvapw26fnAEuIbeYkf7YCBBx+WDowvBO6Apif651v8KfQr8EHf UN2gvMqwfa0wcgutCPA2ezjeS/+EcNbavwCWckQaRl65pSm1HGc83OkT1W22mJbK5Y94 zIsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=a0tYDB8IQXSc08aG5pUrvVghYnFW8gqBhheBrsscIzw=; b=f225anah5fSduHFhEZg0vGCFy7PMqnVWmXxwmXCUU/rliFxzU47+SYHehPySBXF6i3 4giYeGqGss4H05G3nQwHSbthygIXyrIzitmS9Sw+uvTWSHcScEJpacdh3tUXxS6Q6GXy pK89+aq1zlLrA8vC3mx/TWK2wPx/O3giUW7vS3FNh8l5x2FZ3wx7aMZDp1F+hqQuLVG2 d9dxlBLuXhlN9ntGhqJso0Uew2qx/QBW7dSCnv50dmGTPK/xeuAtH7tDZEnoy3w8ouGF w5BTSrMWFEv3MhHjXwdWBzE09MFN9WHbQq4lHC3B3SBZmR9NMMGYhk/WJZ9XuzlGH9pl XJFA== X-Gm-Message-State: AO0yUKWoYI1Kgou9H+wQ4ru0od4YQBxoDA21MbUp2qTFRqUiq7m6X8B5 CT95rvrGOl6sC61DECCPuFjgBOkfzrGv+naSzuE= X-Received: by 2002:a62:1d14:0:b0:5a8:718c:5ee9 with SMTP id d20-20020a621d14000000b005a8718c5ee9mr3749770pfd.25.1676516953960; Wed, 15 Feb 2023 19:09:13 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 11/19] target/arm: Hoist finalize_memop out of do_fp_{ld, st} Date: Wed, 15 Feb 2023 17:08:46 -1000 Message-Id: <20230216030854.1212208-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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=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 We are going to need the complete memop beforehand, so let's not compute it twice. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.c | 42 +++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index fd499a208d..cc857d60d7 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -955,16 +955,14 @@ static void do_gpr_ld(DisasContext *s, TCGv_i64 dest, TCGv_i64 tcg_addr, /* * Store from FP register to memory */ -static void do_fp_st(DisasContext *s, int srcidx, TCGv_i64 tcg_addr, int size) +static void do_fp_st(DisasContext *s, int srcidx, TCGv_i64 tcg_addr, MemOp mop) { /* This writes the bottom N bits of a 128 bit wide vector to memory */ TCGv_i64 tmplo = tcg_temp_new_i64(); - MemOp mop; tcg_gen_ld_i64(tmplo, cpu_env, fp_reg_offset(s, srcidx, MO_64)); - if (size < MO_128) { - mop = finalize_memop(s, size); + if ((mop & MO_SIZE) < MO_128) { tcg_gen_qemu_st_i64(tmplo, tcg_addr, get_mem_index(s), mop); } else { TCGv_i64 tmphi = tcg_temp_new_i64(); @@ -974,7 +972,6 @@ static void do_fp_st(DisasContext *s, int srcidx, TCGv_i64 tcg_addr, int size) tcg_gen_concat_i64_i128(t16, tmplo, tmphi); tcg_temp_free_i64(tmphi); - mop = finalize_memop(s, size); tcg_gen_qemu_st_i128(t16, tcg_addr, get_mem_index(s), mop); tcg_temp_free_i128(t16); } @@ -985,20 +982,17 @@ static void do_fp_st(DisasContext *s, int srcidx, TCGv_i64 tcg_addr, int size) /* * Load from memory to FP register */ -static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size) +static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, MemOp mop) { /* This always zero-extends and writes to a full 128 bit wide vector */ TCGv_i64 tmplo = tcg_temp_new_i64(); TCGv_i64 tmphi = NULL; - MemOp mop; - if (size < MO_128) { - mop = finalize_memop(s, size); + if ((mop & MO_SIZE) < MO_128) { tcg_gen_qemu_ld_i64(tmplo, tcg_addr, get_mem_index(s), mop); } else { TCGv_i128 t16 = tcg_temp_new_i128(); - mop = finalize_memop(s, size); tcg_gen_qemu_ld_i128(t16, tcg_addr, get_mem_index(s), mop); tmphi = tcg_temp_new_i64(); @@ -2910,6 +2904,7 @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) bool is_signed = false; int size = 2; TCGv_i64 tcg_rt, clean_addr; + MemOp mop; if (is_vector) { if (opc == 3) { @@ -2933,13 +2928,13 @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) clean_addr = new_tmp_a64(s); gen_pc_plus_diff(s, clean_addr, imm); + + mop = finalize_memop(s, size + is_signed * MO_SIGN); if (is_vector) { - do_fp_ld(s, rt, clean_addr, size); + do_fp_ld(s, rt, clean_addr, mop); } else { /* Only unsigned 32bit loads target 32bit registers. */ bool iss_sf = opc != 0; - MemOp memop = finalize_memop(s, size + is_signed * MO_SIGN); - do_gpr_ld(s, tcg_rt, clean_addr, mop, false, true, rt, iss_sf, false); } } @@ -3076,16 +3071,17 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) (wback || rn != 31) && !set_tag, 2 << size); if (is_vector) { + MemOp mop = finalize_memop(s, size); if (is_load) { - do_fp_ld(s, rt, clean_addr, size); + do_fp_ld(s, rt, clean_addr, mop); } else { - do_fp_st(s, rt, clean_addr, size); + do_fp_st(s, rt, clean_addr, mop); } tcg_gen_addi_i64(clean_addr, clean_addr, 1 << size); if (is_load) { - do_fp_ld(s, rt2, clean_addr, size); + do_fp_ld(s, rt2, clean_addr, mop); } else { - do_fp_st(s, rt2, clean_addr, size); + do_fp_st(s, rt2, clean_addr, mop); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); @@ -3269,9 +3265,9 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, if (is_vector) { if (is_store) { - do_fp_st(s, rt, clean_addr, size); + do_fp_st(s, rt, clean_addr, memop); } else { - do_fp_ld(s, rt, clean_addr, size); + do_fp_ld(s, rt, clean_addr, memop); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); @@ -3377,9 +3373,9 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, if (is_vector) { if (is_store) { - do_fp_st(s, rt, clean_addr, size); + do_fp_st(s, rt, clean_addr, memop); } else { - do_fp_ld(s, rt, clean_addr, size); + do_fp_ld(s, rt, clean_addr, memop); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); @@ -3463,9 +3459,9 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, if (is_vector) { if (is_store) { - do_fp_st(s, rt, clean_addr, size); + do_fp_st(s, rt, clean_addr, memop); } else { - do_fp_ld(s, rt, clean_addr, size); + do_fp_ld(s, rt, clean_addr, memop); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); From patchwork Thu Feb 16 03:08:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654003 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123660wrr; Wed, 15 Feb 2023 19:11:28 -0800 (PST) X-Google-Smtp-Source: AK7set80IQR25gvrNtqzVGDdtvj7NaoqouKs9cqu1YIAHTaKn7KZol+3oEsSyLAjKGUaAUo1raIk X-Received: by 2002:a05:622a:18a6:b0:3b6:3c39:916e with SMTP id v38-20020a05622a18a600b003b63c39916emr7480180qtc.45.1676517088613; Wed, 15 Feb 2023 19:11:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517088; cv=none; d=google.com; s=arc-20160816; b=b+n3Iu7Ddn1QA+g7eWSdboJ7s839rvNcnF57/PAP52s0H/rDHayH3Wc3dSecUeDp3/ 2Z3LxFzugbX1cLd0ovLuJE5bnxD8Oi9GdqRV1A+EHeT5Dg/fGkXyUO4OWM9Bk9sn9A2F 0cdoXs9+5o0ub4t3Kh0PXLPPWK6lGr9GpRsvijhpzBJdW/uXtoKnDwzpttXoaIpt08FG hgj94S1WMKDgAN7m1582VZErnVy1BHkvatwq7wZZTIaFzNIsqneVTXkZY/D1VO7xTC6M 5T28TisFJuTz44D8Ga4T239kmtmTYh5h2YKF7+UJ1ScF/QJBS2qX+/mV+KYeKekilqHa k7TQ== 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=lfTuYbDwFkSb64uBCRrm2LaC5eHgkpgYJsrn0+BFRDQ=; b=f/PxSEsayhtuhFrPu4nJLYGmc923EvXx+I0qTLCUyYoTrJp9JVhwuVbCCmHhFkvF87 /L5AzTsglm+ixXJWMSCka4IKx0C1i0gi2BlFZ8bGTNlYwMXJYYCyRCcSxEP0rI/oW0M+ mrwCXij+7hURI1Gx+KPuKkCsh0OCWARvuUKRLGuVctntD/IhjrSCB4nppiVUvjNA0+gx HZOhRQiXzP9JsMoV/IImlL9zUbqu/HvaOuFFHt+62kN15sMpBVgV0EzuhwgIWcoGgbfM 51L21xFJWXzLZWrY3EsNsaIXN+Saw4lvJPWPleIOhSp80lXoJqfRv7SFrF8Dr0yf2zCL 3/lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FY7LUO+x; 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 r18-20020ac85c92000000b003ba23d469e6si519450qta.159.2023.02.15.19.11.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:11:28 -0800 (PST) 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=FY7LUO+x; 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 1pSUeA-0007Qj-OH; Wed, 15 Feb 2023 22:09:22 -0500 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 1pSUe6-0007Mi-V0 for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:19 -0500 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUe4-0000AO-P5 for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:18 -0500 Received: by mail-pg1-x532.google.com with SMTP id x31so428187pgl.6 for ; Wed, 15 Feb 2023 19:09:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=lfTuYbDwFkSb64uBCRrm2LaC5eHgkpgYJsrn0+BFRDQ=; b=FY7LUO+x+RJmyQ9t/2GXf9v3jQiZRyvl8LC5yNjYa3jSoeF1gLrnPV5iCGmGgW287b qK926C7Q5XWZfmXXHfKaB+9hU4sQ7g+PIRi8nS18TPs9yKeIX9BmNwX48cyDPmhRV7a6 f96t9p7gohun94jFKUCgQb25FsVFVmNv9S0t4k5E1tqVV6ySL9VQ5t+l5VkeqKalJgXH +qK8/YYZhiWAiZoCEO3xamGQZQxa3ZS8rhGdnrQYWUdCI2jfgpHNsO5F53zLKcaMMhBj a4+OFCYnKMbAYifr4eJD5GokrjI76BDtV3ikr01HkrmfMDx/AvAWukvS13jnQjDDEuhY a08g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=lfTuYbDwFkSb64uBCRrm2LaC5eHgkpgYJsrn0+BFRDQ=; b=Jf3m2+1KE6UTCjIkfGKCl/OC3OeW1a46cblqXXp1J7bUnx6Y55J4Ti7kmS6tWNTBFj fsQfbxI4cTwnm7zPiqAQP72IefkfW2/tO5DWQoD4zDRX4PGGGnN0cNtiGyqikMsmNkYC Fvl03svZIaqPRDtNXe26BO45t6Ph3JNRI1uJ9m6UlSJqJHPUO7YKBbRTc/L1nAmAmc8x cCiXhWlI4wrTvhmdkFL3+9ay7ca6ZZXRUNHyPXP1zwUaOIDQIwXNjUVtzcZnh03jOBhk INai4LG3Iql3Ij5sqUg6E6jZE9oA1eewGSwcq0bArz2ifoZZkxplfTMhzBTZ618152f0 +zpA== X-Gm-Message-State: AO0yUKUEGFxIEgXBE9G/877GLnFJwQTfQVcYIFP/P1pM6ZRYr6bk0TMi nB4g3IQIKsAflvzVC01/vcQPU4HI1M/ZI7dXOes= X-Received: by 2002:aa7:9827:0:b0:5a8:808a:d3ce with SMTP id q7-20020aa79827000000b005a8808ad3cemr4272693pfl.8.1676516955302; Wed, 15 Feb 2023 19:09:15 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 12/19] target/arm: Pass memop to gen_mte_check1* Date: Wed, 15 Feb 2023 17:08:47 -1000 Message-Id: <20230216030854.1212208-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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=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 Pass the completed memop to gen_mte_check1_mmuidx. For the moment, do nothing more than extract the size. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.h | 2 +- target/arm/translate-a64.c | 80 ++++++++++++++++++++------------------ target/arm/translate-sve.c | 7 ++-- 3 files changed, 48 insertions(+), 41 deletions(-) diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index ad3762d1ac..3fc39763d0 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -52,7 +52,7 @@ static inline bool sme_smza_enabled_check(DisasContext *s) TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr); TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write, - bool tag_checked, int log2_size); + bool tag_checked, MemOp memop); TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, bool tag_checked, int size); diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index cc857d60d7..e02bdd3e7c 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -256,7 +256,7 @@ static void gen_probe_access(DisasContext *s, TCGv_i64 ptr, */ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, bool is_write, bool tag_checked, - int log2_size, bool is_unpriv, + MemOp memop, bool is_unpriv, int core_idx) { if (tag_checked && s->mte_active[is_unpriv]) { @@ -267,7 +267,7 @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << log2_size) - 1); + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, memop_size(memop) - 1); ret = new_tmp_a64(s); gen_helper_mte_check(ret, cpu_env, tcg_constant_i32(desc), addr); @@ -278,9 +278,9 @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, } TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write, - bool tag_checked, int log2_size) + bool tag_checked, MemOp memop) { - return gen_mte_check1_mmuidx(s, addr, is_write, tag_checked, log2_size, + return gen_mte_check1_mmuidx(s, addr, is_write, tag_checked, memop, false, get_mem_index(s)); } @@ -2510,19 +2510,30 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, int rn, int size, bool is_pair) { int idx = get_mem_index(s); - MemOp memop = s->be_data; TCGv_i64 dirty_addr, clean_addr; + MemOp memop; + + /* + * For pairs: + * if size == 2, the operation is single-copy atomic for the doubleword. + * if size == 3, the operation is single-copy atomic for *each* doubleword, + * not the entire quadword, however it must be quadword aligned. + */ + memop = size + is_pair; + if (memop == MO_128) { + memop |= MO_ATMAX_8; + } + memop |= MO_ALIGN; + memop = finalize_memop(s, memop); s->is_ldex = true; dirty_addr = cpu_reg_sp(s, rn); - clean_addr = gen_mte_check1(s, dirty_addr, false, rn != 31, size); + clean_addr = gen_mte_check1(s, dirty_addr, false, rn != 31, memop); g_assert(size <= 3); if (is_pair) { g_assert(size >= 2); if (size == 2) { - /* The pair must be single-copy atomic for the doubleword. */ - memop |= MO_64 | MO_ALIGN; tcg_gen_qemu_ld_i64(cpu_exclusive_val, clean_addr, idx, memop); if (s->be_data == MO_LE) { tcg_gen_extract_i64(cpu_reg(s, rt), cpu_exclusive_val, 0, 32); @@ -2532,15 +2543,8 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, int rn, tcg_gen_extract_i64(cpu_reg(s, rt2), cpu_exclusive_val, 0, 32); } } else { - /* - * The pair must be single-copy atomic for *each* doubleword, not - * the entire quadword, however it must be quadword aligned. - * Expose the complete load to tcg, for ease of tlb lookup, - * but indicate that only 8-byte atomicity is required. - */ TCGv_i128 t16 = tcg_temp_new_i128(); - memop |= MO_128 | MO_ALIGN_16 | MO_ATMAX_8; tcg_gen_qemu_ld_i128(t16, clean_addr, idx, memop); tcg_gen_extr_i128_i64(cpu_exclusive_val, cpu_exclusive_high, t16); @@ -2555,7 +2559,6 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, int rn, } } } else { - memop |= size | MO_ALIGN; tcg_gen_qemu_ld_i64(cpu_exclusive_val, clean_addr, idx, memop); tcg_gen_mov_i64(cpu_reg(s, rt), cpu_exclusive_val); } @@ -2580,9 +2583,13 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, TCGLabel *fail_label = gen_new_label(); TCGLabel *done_label = gen_new_label(); TCGv_i64 tmp, dirty_addr, clean_addr; + MemOp memop; + + memop = (size + is_pair) | MO_ALIGN; + memop = finalize_memop(s, memop); dirty_addr = cpu_reg_sp(s, rn); - clean_addr = gen_mte_check1(s, dirty_addr, true, rn != 31, size); + clean_addr = gen_mte_check1(s, dirty_addr, true, rn != 31, memop); tcg_gen_brcond_i64(TCG_COND_NE, clean_addr, cpu_exclusive_addr, fail_label); @@ -2596,8 +2603,7 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, } tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr, cpu_exclusive_val, tmp, - get_mem_index(s), - MO_64 | MO_ALIGN | s->be_data); + get_mem_index(s), memop); tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val); } else { TCGv_i128 t16 = tcg_temp_new_i128(); @@ -2612,8 +2618,7 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, tcg_gen_concat_i64_i128(c16, cpu_exclusive_val, cpu_exclusive_high); tcg_gen_atomic_cmpxchg_i128(t16, cpu_exclusive_addr, c16, t16, - get_mem_index(s), - MO_128 | MO_ALIGN | s->be_data); + get_mem_index(s), memop); tcg_temp_free_i128(c16); lo = tcg_temp_new_i64(); @@ -2631,8 +2636,7 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, } } else { tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr, cpu_exclusive_val, - cpu_reg(s, rt), get_mem_index(s), - size | MO_ALIGN | s->be_data); + cpu_reg(s, rt), get_mem_index(s), memop); tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val); } tcg_gen_mov_i64(cpu_reg(s, rd), tmp); @@ -2652,13 +2656,15 @@ static void gen_compare_and_swap(DisasContext *s, int rs, int rt, TCGv_i64 tcg_rt = cpu_reg(s, rt); int memidx = get_mem_index(s); TCGv_i64 clean_addr; + MemOp memop; if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, size); - tcg_gen_atomic_cmpxchg_i64(tcg_rs, clean_addr, tcg_rs, tcg_rt, memidx, - size | MO_ALIGN | s->be_data); + memop = finalize_memop(s, size | MO_ALIGN); + clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, memop); + tcg_gen_atomic_cmpxchg_i64(tcg_rs, clean_addr, tcg_rs, tcg_rt, + memidx, memop); } static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, @@ -2670,13 +2676,15 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, TCGv_i64 t2 = cpu_reg(s, rt + 1); TCGv_i64 clean_addr; int memidx = get_mem_index(s); + MemOp memop; if (rn == 31) { gen_check_sp_alignment(s); } /* This is a single atomic access, despite the "pair". */ - clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, size + 1); + memop = finalize_memop(s, (size + 1) | MO_ALIGN); + clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, memop); if (size == 2) { TCGv_i64 cmp = tcg_temp_new_i64(); @@ -2690,8 +2698,7 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, tcg_gen_concat32_i64(cmp, s2, s1); } - tcg_gen_atomic_cmpxchg_i64(cmp, clean_addr, cmp, val, memidx, - MO_64 | MO_ALIGN | s->be_data); + tcg_gen_atomic_cmpxchg_i64(cmp, clean_addr, cmp, val, memidx, memop); tcg_temp_free_i64(val); if (s->be_data == MO_LE) { @@ -2712,8 +2719,7 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, tcg_gen_concat_i64_i128(cmp, s2, s1); } - tcg_gen_atomic_cmpxchg_i128(cmp, clean_addr, cmp, val, memidx, - MO_128 | MO_ALIGN | s->be_data); + tcg_gen_atomic_cmpxchg_i128(cmp, clean_addr, cmp, val, memidx, memop); tcg_temp_free_i128(val); if (s->be_data == MO_LE) { @@ -2804,7 +2810,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) /* TODO: ARMv8.4-LSE SCTLR.nAA */ memop = finalize_memop(s, size | MO_ALIGN); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), - true, rn != 31, size); + true, rn != 31, memop); do_gpr_st(s, cpu_reg(s, rt), clean_addr, memop, true, rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); return; @@ -2823,7 +2829,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) /* TODO: ARMv8.4-LSE SCTLR.nAA */ memop = finalize_memop(s, size | MO_ALIGN); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), - false, rn != 31, size); + false, rn != 31, memop); do_gpr_ld(s, cpu_reg(s, rt), clean_addr, memop, false, true, rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); @@ -3369,7 +3375,7 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, tcg_gen_add_i64(dirty_addr, dirty_addr, tcg_rm); memop = finalize_memop(s, size + is_signed * MO_SIGN); - clean_addr = gen_mte_check1(s, dirty_addr, is_store, true, size); + clean_addr = gen_mte_check1(s, dirty_addr, is_store, true, memop); if (is_vector) { if (is_store) { @@ -3455,7 +3461,7 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); memop = finalize_memop(s, size + is_signed * MO_SIGN); - clean_addr = gen_mte_check1(s, dirty_addr, is_store, rn != 31, size); + clean_addr = gen_mte_check1(s, dirty_addr, is_store, rn != 31, memop); if (is_vector) { if (is_store) { @@ -3550,7 +3556,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, if (rn == 31) { gen_check_sp_alignment(s); } - clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), false, rn != 31, size); + clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), false, rn != 31, mop); if (o3_opc == 014) { /* @@ -3637,7 +3643,7 @@ static void disas_ldst_pac(DisasContext *s, uint32_t insn, /* Note that "clean" and "dirty" here refer to TBI not PAC. */ clean_addr = gen_mte_check1(s, dirty_addr, false, - is_wback || rn != 31, size); + is_wback || rn != 31, memop); tcg_rt = cpu_reg(s, rt); do_gpr_ld(s, tcg_rt, clean_addr, memop, diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index f3d5e79dd2..f283322cda 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -5215,6 +5215,7 @@ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a) unsigned msz = dtype_msz(a->dtype); TCGLabel *over; TCGv_i64 temp, clean_addr; + MemOp memop; if (!dc_isar_feature(aa64_sve, s)) { return false; @@ -5246,10 +5247,10 @@ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a) /* Load the data. */ temp = tcg_temp_new_i64(); tcg_gen_addi_i64(temp, cpu_reg_sp(s, a->rn), a->imm << msz); - clean_addr = gen_mte_check1(s, temp, false, true, msz); - tcg_gen_qemu_ld_i64(temp, clean_addr, get_mem_index(s), - finalize_memop(s, dtype_mop[a->dtype])); + memop = finalize_memop(s, dtype_mop[a->dtype]); + clean_addr = gen_mte_check1(s, temp, false, true, memop); + tcg_gen_qemu_ld_i64(temp, clean_addr, get_mem_index(s), memop); /* Broadcast to *all* elements. */ tcg_gen_gvec_dup_i64(esz, vec_full_reg_offset(s, a->rd), From patchwork Thu Feb 16 03:08:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653996 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123382wrr; Wed, 15 Feb 2023 19:10:51 -0800 (PST) X-Google-Smtp-Source: AK7set8yRrX7xBAycuzPeoy9hpvs6oL/5brhnVCzEg/DyhrBcjvSYOxI9kdw9ERnPsSFn5YQPh3D X-Received: by 2002:a05:6214:21a9:b0:53c:f76f:2e3c with SMTP id t9-20020a05621421a900b0053cf76f2e3cmr8216748qvc.46.1676517050993; Wed, 15 Feb 2023 19:10:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517050; cv=none; d=google.com; s=arc-20160816; b=Jj793HTvshDTYiJ6lAuq2JJJFB0yjMkQJG5lu513hRqMc9kKwkeO+PpaAX2unVdMHO 2gWp5SPOjV8eNz85Ued1YfUXUMKb3UFg6rEfwMcqCYCBQ1B9s9gx1yWY7jRgYf5nQXPH NU7uFBpsx3bkMv15gdxFHdp1CMK00EmpVDwspFC8hbHr8ypnrRk7wSj5QT97sQNY5ExD d7DGgwB37xi8Fntyl91cE92ELyEsXz63dOkF2GdAtBQ7E3dcrCSKgue9eXR74Vi/BvHf 4Y8a+2OauwXsYnZndnkNLJkz4ugOXeg24i57Afc/HTAu6Ry6qYdjZqAQUpc7KQVcQu+S epMQ== 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=GZYYZEVvI22BciR3iXbZ7vWiYF2DcV/x+9GdZEBopmI=; b=BbFI+8JVSGdEhYTcOVS9n28vwEXQ6p96R1D8sUB+9wX30afG8BeCCVmdqcZprlRjR3 jSCarqsEulsTFuKfR5owkFDi2EOyRYivKkc4k7dyRiRInop4UZTpIgo2p1S4uFmbXBi0 kV/bP559JCuahMEGN84DIdAiaVOgyZbn5Y7Np+GkgtPbY4EYi6PaYUOam9DvlwBmxUbd WAdGkz4GJ507Vm7awYZkRlWOS5tQboQp/PRW+ckbJOKN+J7mk0P4JV1nA9NRFK5xKmyB iP9BQgs3peCni2cnKn4ptC/JAUG1qhqZxO66ryXujKYmUAWyHXY67AoFp9QaAkCjDiVY 3Lhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lJCgHeNM; 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 e23-20020a0cb457000000b0053543310b13si132416qvf.181.2023.02.15.19.10.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:10:50 -0800 (PST) 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=lJCgHeNM; 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 1pSUeD-0007T7-7w; Wed, 15 Feb 2023 22:09:25 -0500 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 1pSUeB-0007Ra-Gx for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:23 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUe5-00008p-Vu for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:23 -0500 Received: by mail-pg1-x52a.google.com with SMTP id r18so413379pgr.12 for ; Wed, 15 Feb 2023 19:09:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=GZYYZEVvI22BciR3iXbZ7vWiYF2DcV/x+9GdZEBopmI=; b=lJCgHeNMrPuFJ31M1PIdz+YuQp4AZjYmYLrvNFOcdqnjyngCm/Unm+PyYNYq/DfFHZ G3/SSzPTt7wZPQIpjcpAkL8M/0jrWeAY68nHiemqRRP7RKj0dtYc5QMleVj7aSiku2p9 2RZxHkPGBJXJcK3DJavUGWWaqByMGKKQZ/2QoU1yzTiaPoF1xH6R0oMCoE4qACjbznaL OQxo/PYFOZ3vsAuYog28w1JW4GFkxUoMPZJVYywkci3dsltAh0Xc8M7LDeFOrTzbx901 hOYjW3a8fhvzT2d6PUAYV4eiP96p9lE6WuVNQyL62iY/27Jw1561H08KE29jtl+r7UMr Jnnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=GZYYZEVvI22BciR3iXbZ7vWiYF2DcV/x+9GdZEBopmI=; b=uLpPp9ZmfXom9HxXfFU1kkfRWuAEf6kgYaJ2MyruY9f/f5LO3uX72/wzb7tCGWSxF2 Tavg0z9wsjBxchiuFDemOhOp0NlT+ngrnKhAVmyoJtpqZTMCk7+Sjk+qc6NHPMCa8KSP IdiwH74M5Gcaw65Lr8DwH+626UXdb1B+jVdyNwnXIsAzi89syj9SPuZPr+u65i+NCzo0 ghcI3j+YIwziLadHvQDow/AeGa2TFWhmO5guX23Wa3SEYeYV+3Q5b9IXzJqbR2b4KbAT NzKEuUlUkRvdPCg2JlD/tsr19ZwPYkoYb2xc33nGWC27gddJwOhpUsCuSldWBTSZ5fMU wTAQ== X-Gm-Message-State: AO0yUKVOhARKEBLey8MBbe44FKigfayVZbh0/2hmyo5Ny8+MCs5wVjqn fRPP6zobr4mkhYb/LxGgc3dhY62b9wQB5TEfTA0= X-Received: by 2002:aa7:9f8d:0:b0:5a8:4d33:f39e with SMTP id z13-20020aa79f8d000000b005a84d33f39emr3840181pfr.24.1676516957150; Wed, 15 Feb 2023 19:09:17 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 13/19] target/arm: Pass single_memop to gen_mte_checkN Date: Wed, 15 Feb 2023 17:08:48 -1000 Message-Id: <20230216030854.1212208-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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=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 Pass the individual memop to gen_mte_checkN. For the moment, do nothing with it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.h | 2 +- target/arm/translate-a64.c | 26 +++++++++++++++----------- target/arm/translate-sve.c | 4 ++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index 3fc39763d0..b7518f9d34 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -54,7 +54,7 @@ TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr); TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write, bool tag_checked, MemOp memop); TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, - bool tag_checked, int size); + bool tag_checked, int size, MemOp memop); /* We should have at some point before trying to access an FP register * done the necessary access check, so assert that diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index e02bdd3e7c..1117a1cc41 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -288,7 +288,7 @@ TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write, * For MTE, check multiple logical sequential accesses. */ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, - bool tag_checked, int size) + bool tag_checked, int total_size, MemOp single_mop) { if (tag_checked && s->mte_active[0]) { TCGv_i64 ret; @@ -298,7 +298,7 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc = FIELD_DP32(desc, MTEDESC, SIZEM1, size - 1); + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, total_size - 1); ret = new_tmp_a64(s); gen_helper_mte_check(ret, cpu_env, tcg_constant_i32(desc), addr); @@ -2983,14 +2983,12 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) bool is_vector = extract32(insn, 26, 1); bool is_load = extract32(insn, 22, 1); int opc = extract32(insn, 30, 2); - bool is_signed = false; bool postindex = false; bool wback = false; bool set_tag = false; - TCGv_i64 clean_addr, dirty_addr; - + MemOp mop; int size; if (opc == 3) { @@ -3073,11 +3071,13 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) } } + mop = finalize_memop(s, size); clean_addr = gen_mte_checkN(s, dirty_addr, !is_load, - (wback || rn != 31) && !set_tag, 2 << size); + (wback || rn != 31) && !set_tag, + 2 << size, mop); if (is_vector) { - MemOp mop = finalize_memop(s, size); + /* LSE2 does not merge FP pairs; leave these as separate operations. */ if (is_load) { do_fp_ld(s, rt, clean_addr, mop); } else { @@ -3092,9 +3092,11 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); TCGv_i64 tcg_rt2 = cpu_reg(s, rt2); - MemOp mop = (size + 1) | s->be_data; /* + * We built mop above for the single logical access -- rebuild it + * now for the paired operation. + * * With LSE2, non-sign-extending pairs are treated atomically if * aligned, and if unaligned one of the pair will be completely * within a 16-byte block and that element will be atomic. @@ -3104,6 +3106,7 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) * This treats sign-extending loads like zero-extending loads, * since that reuses the most code below. */ + mop = (size + 1) | s->be_data; mop |= size << MO_ATMAX_SHIFT; mop |= s->atom_data; if (s->align_mem) { @@ -3887,7 +3890,7 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) * promote consecutive little-endian elements below. */ clean_addr = gen_mte_checkN(s, tcg_rn, is_store, is_postidx || rn != 31, - total); + total, finalize_memop(s, size)); /* * Consecutive little-endian elements from a single register @@ -4045,10 +4048,11 @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) total = selem << scale; tcg_rn = cpu_reg_sp(s, rn); - clean_addr = gen_mte_checkN(s, tcg_rn, !is_load, is_postidx || rn != 31, - total); mop = finalize_memop(s, scale); + clean_addr = gen_mte_checkN(s, tcg_rn, !is_load, is_postidx || rn != 31, + total, mop); + tcg_ebytes = tcg_constant_i64(1 << scale); for (xs = 0; xs < selem; xs++) { if (replicate) { diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index f283322cda..6a89126fc5 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4321,7 +4321,7 @@ void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs, dirty_addr = tcg_temp_new_i64(); tcg_gen_addi_i64(dirty_addr, cpu_reg_sp(s, rn), imm); - clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len); + clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len, MO_8); tcg_temp_free_i64(dirty_addr); /* @@ -4450,7 +4450,7 @@ void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, dirty_addr = tcg_temp_new_i64(); tcg_gen_addi_i64(dirty_addr, cpu_reg_sp(s, rn), imm); - clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len); + clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len, MO_8); tcg_temp_free_i64(dirty_addr); /* Note that unpredicated load/store of vector/predicate registers From patchwork Thu Feb 16 03:08:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653998 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123509wrr; Wed, 15 Feb 2023 19:11:06 -0800 (PST) X-Google-Smtp-Source: AK7set/JvVhJAR4SLuIeOdJNaUCoUNSPSDME5jBONbd4g1F9TbIQg5lo3V7laxUHp2b2syFkvlSf X-Received: by 2002:ad4:5769:0:b0:56e:b0df:84d3 with SMTP id r9-20020ad45769000000b0056eb0df84d3mr8941243qvx.41.1676517066741; Wed, 15 Feb 2023 19:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517066; cv=none; d=google.com; s=arc-20160816; b=H/+WHlEDjpxKEqnGCwr5APiahx1f88wuzv9cBPvsPMcVzR8+SGN8Y35S9dqj5BwOIN jskiQTyzzH8+Nc6/PYl5LmLY5r1M+r4DRbIllOefRQ04ix6fjANBz0dHfKpRAsHM7J9Q vgaEk2MxwH9Eo69WUCBHXFPvjk9fvOVOO7K46ezjNRghlAnEXwvdVZcp4frAfBRVhCg9 1mLMyz2xoQSmFqOi4mScfCly7Wq0f95mCugGXYlbHP0mBAPlj4fDulyvPIkK+oSEziTo 4heEnEK0QQfzt1dM/jOD4zQ8qKBx7+Xxg5IGXp9OmlQk26CKfuVCeoxDlhNV7OHN851B Je5g== 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=R+SPOBXh2ZkkLG0ahTwSjC1WfDnJ9h6ZheP8kQZQ6+U=; b=T0QXrQsY65R25p5FThHOpGgNYYnhGhtyQjr32a36O6fGzn9qktkJVJwQiQs9JzvZhx DZCjpMx7LfzVINLW9pmRv94USMkx4VlgGQaKfz6QZJCfnrW80K/k5+u7sqc+iDaF8wot VPaHE9hxjyBqSIeE7xdLxITBxIKC2Pk5ubXK7y9Lq3USizzt/GLj9r5LWdkRYf3tE8/2 ximQuLsdThpJlugmecNQNJnPgsOZ/iAWxh6bT36P61FxZW0P1uAM867kUDswVI2ysy9/ 2KBoCFzp08hf73imAvVb5pqlSJanl1b8xtwmdexjhrb9iZFl1ZUvInXOd5swcvasn6Zg zyKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=csO5PEdO; 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 z8-20020a0ca948000000b0056ebdd6c30esi137400qva.126.2023.02.15.19.11.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:11:06 -0800 (PST) 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=csO5PEdO; 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 1pSUeB-0007RZ-Ie; Wed, 15 Feb 2023 22:09:23 -0500 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 1pSUe9-0007Q7-QN for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:21 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUe8-0000Br-1C for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:21 -0500 Received: by mail-pf1-x436.google.com with SMTP id bd35so594168pfb.6 for ; Wed, 15 Feb 2023 19:09:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=R+SPOBXh2ZkkLG0ahTwSjC1WfDnJ9h6ZheP8kQZQ6+U=; b=csO5PEdOROHao7KrXKV/e3e1//f8/dLtgAf5eaigquiYlDNIIlceNlHcTbTzGfgzPB dC0VsZbhRiwtfYTNJ7ithEaoSS44fu3p2vyUpH+RLl5pl+lzehs30QZOYfNO+eWFDCnf HTrXEQJDbcdayhRBLKxYSX8JXvthVZqUpuOQDqOmHRKTMlORaQHqeZ5dbujfOVdEh09y iJoyZxyntehlL4vIultaEVzIUHlqkQaRqEBScpFxuq7fBwAJEnzWJhcWpevAGYf3bNI/ SQoZGIhLRQO3O6ciXcKuexZxXNSKdKVCB9DrJZuGIyI4S6lg4qpr74uJLNTIkqjZscga 8oAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=R+SPOBXh2ZkkLG0ahTwSjC1WfDnJ9h6ZheP8kQZQ6+U=; b=ejbURrq++O6WSI4GlOHdt/6KfN3pvPPn/D/nwe936HkEOBDdCTeXeeCwSevPly3Xib 8hl76WwNoR/UjfKhWM9zCuH7x7nViR+c2FzGlifqEGi9B+zfLs0LCd0LN00JyEP4/W7j fedA7fGwz4uZt30zxWX+5invC8OuY5O2vdEnvuaQUH2Dc//OQBWyRvQwyzjH1yDh3qxI f4hZMHLByRwUv2bcya+XcDPad63dLmqlmWiYMFqT04hOz0+tDnPghVFwNKnaZWzVF/rl 8vWzDtgmnYhrk1FjhDt1QMQQBCbxelcLgoiFptdCJjJlAis7ONIUWZhVtLfiMhGe/ozV kyWQ== X-Gm-Message-State: AO0yUKVrPyUrDmNZDAou4EM9zQaXxfMMjyGVBojmZl6ns8KnLqTIQOVs t1w3AX6cqma6m3l1rMZeRj7oXTe4ftpetevB3C0= X-Received: by 2002:aa7:94a9:0:b0:5a8:ae6a:cee1 with SMTP id a9-20020aa794a9000000b005a8ae6acee1mr3678294pfl.29.1676516958540; Wed, 15 Feb 2023 19:09:18 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 14/19] target/arm: Check alignment in helper_mte_check Date: Wed, 15 Feb 2023 17:08:49 -1000 Message-Id: <20230216030854.1212208-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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.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 Fixes a bug in that with SCTLR.A set, we should raise any alignment fault before raising any MTE check fault. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/internals.h | 3 ++- target/arm/mte_helper.c | 18 ++++++++++++++++++ target/arm/translate-a64.c | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index e1e018da46..fa264e368c 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1222,7 +1222,8 @@ FIELD(MTEDESC, MIDX, 0, 4) FIELD(MTEDESC, TBI, 4, 2) FIELD(MTEDESC, TCMA, 6, 2) FIELD(MTEDESC, WRITE, 8, 1) -FIELD(MTEDESC, SIZEM1, 9, SIMD_DATA_BITS - 9) /* size - 1 */ +FIELD(MTEDESC, ALIGN, 9, 3) +FIELD(MTEDESC, SIZEM1, 12, SIMD_DATA_BITS - 12) /* size - 1 */ bool mte_probe(CPUARMState *env, uint32_t desc, uint64_t ptr); uint64_t mte_check(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra); diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c index 98bcf59c22..e50bb4ea13 100644 --- a/target/arm/mte_helper.c +++ b/target/arm/mte_helper.c @@ -784,6 +784,24 @@ uint64_t mte_check(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra) uint64_t HELPER(mte_check)(CPUARMState *env, uint32_t desc, uint64_t ptr) { + /* + * In the Arm ARM pseudocode, the alignment check happens at the top + * of Mem[], while the MTE check happens later in AArch64.MemSingle[]. + * Thus the alignment check has priority. + * When the mte check is disabled, tcg performs the alignment check + * during the code generated for the memory access. + */ + unsigned align = FIELD_EX32(desc, MTEDESC, ALIGN); + if (unlikely(align)) { + align = (1u << align) - 1; + if (unlikely(ptr & align)) { + int idx = FIELD_EX32(desc, MTEDESC, MIDX); + bool w = FIELD_EX32(desc, MTEDESC, WRITE); + MMUAccessType type = w ? MMU_DATA_STORE : MMU_DATA_LOAD; + arm_cpu_do_unaligned_access(env_cpu(env), ptr, type, idx, GETPC()); + } + } + return mte_check(env, desc, ptr, GETPC()); } diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 1117a1cc41..caeb91efa5 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -267,6 +267,7 @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); + desc = FIELD_DP32(desc, MTEDESC, ALIGN, get_alignment_bits(memop)); desc = FIELD_DP32(desc, MTEDESC, SIZEM1, memop_size(memop) - 1); ret = new_tmp_a64(s); @@ -298,6 +299,7 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); + desc = FIELD_DP32(desc, MTEDESC, ALIGN, get_alignment_bits(single_mop)); desc = FIELD_DP32(desc, MTEDESC, SIZEM1, total_size - 1); ret = new_tmp_a64(s); From patchwork Thu Feb 16 03:08:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653995 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123339wrr; Wed, 15 Feb 2023 19:10:43 -0800 (PST) X-Google-Smtp-Source: AK7set9tWqvtaA5HyajxwsnUrSTkBbSeJVNPSx0t/eL+t4AHp0yoE16mjcLkQ1U7X07KWBOL4jy3 X-Received: by 2002:ac8:7d50:0:b0:3b8:6b30:7e30 with SMTP id h16-20020ac87d50000000b003b86b307e30mr6935352qtb.54.1676517042957; Wed, 15 Feb 2023 19:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517042; cv=none; d=google.com; s=arc-20160816; b=Bj+5gsBrpO6F5DpX1kPMBA1YyJ/+S8xj2gPXeBhxH/VggTDaQ6zNzmLMjxTjadHjav 2VQMsJQfALX4o/JA3XXNfslFiwBco3q+mYoK387kd3szsikRB9WDfwVMbXeZV/WDAWsp sxPkuHvM9oTWpx5FLuyd5urrG6dCZnUPWWEksUYq/b1BuXY4LPEsnIIABpLr8RkE8aT6 QLC+6t/ccvSx6jrpdzgCpBkYnD6RwOrI4Dlg87P+N+FgN5gInfhfmnmBx6EPnXFrMKLO JRM0JFHOOz2Aj/t9bSdB2dyWnISxvNPcYE6adlGJMyizVgNgzZTZwZGto0xJVfWso0pl neRQ== 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=rrGYft0PYoFjdkgdndGx+3sC+bi057jkIwu9gTCtgvM=; b=CPgtohND5XVGsxk2vtpQ4F3I+HGjRbYFHGDIlFKoT66C1nVf/DgUjRQG2zZ4t4nCZD yCrZffotLVD59Y2UzubdJpZ94qY9pGSsLr6uyikVDPmC7b4TZP9XQ0kIP0or0P6Fbx+G aPJCxGkaUs1ARfnpDfMobpTyqBQ+1fNbkBgGQfz0wsMDwQ5XdUNApfw3IFC/Pyo8AG/l PvbJh9B4xhQn+kLpNfZs6cYbdINKj8wer7wJ3y1KrVfsgHSGNyaLw5THa5Ob9qvwJXvj 3d0+pxX1ajIX6JEo8EZSt79O8GhWObUOWnHI8jtIHoB61dBG7BjcKNGaU9VN7PtFgEVN fm0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W6tqc5Al; 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 i22-20020a05620a405600b00720fdb50988si400442qko.746.2023.02.15.19.10.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:10:42 -0800 (PST) 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=W6tqc5Al; 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 1pSUeF-0007VS-2k; Wed, 15 Feb 2023 22:09:27 -0500 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 1pSUeB-0007RF-AQ for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:23 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUe9-0000CQ-7W for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:23 -0500 Received: by mail-pj1-x1033.google.com with SMTP id n20-20020a17090aab9400b00229ca6a4636so4494293pjq.0 for ; Wed, 15 Feb 2023 19:09:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=rrGYft0PYoFjdkgdndGx+3sC+bi057jkIwu9gTCtgvM=; b=W6tqc5Al7n+lfcfdM7MHYKXstmkf/Wnm1CIiLCfWNMyIiYzXD0vPpD0CbXRUeDbmzL kyhUOJJzsUmWYTmZ0VpHRiq8xsAA6HOdgqCi8gy2rFhyRClqm5ISHYASBM7JHjNKEfFQ EFJADJq2dcGoVQV4N5Vks/VpLmfxvh2nEp3cUEZQeCZzk7ZIzCh588VOvFm8aI5Tofpi rrMBOVG94ad7tH2uNJZ9NNIMgG1DI+en3ad9IkErsEPMz5GYmc/4mnYH72U4warDo/J7 4zS/LZBLVoBkAwrathClt8q/ely1qjsRfs02Zm7uKR+uw/AbnnP/xg9iHEKp6r1VjKXx Nmaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=rrGYft0PYoFjdkgdndGx+3sC+bi057jkIwu9gTCtgvM=; b=gXyzqyELGYhpgJ6fOInPlZtHzd5NuKF2XE1Sa1rxZR2OoVYnC0KsGwuM8X92cLP8VS nGcbg5QhEuNCw+IXVKgJR52rIDXhZY45D4ix9G2Mx6AE+X/CRloMEf+k8ldp8oQjP4Df bdCx676psyHf+ik6ia3wdAiDSo23HNp9fcbZI3PQoWqn7oti6758t+nPZCXRSS3PXToO y/5bqvqLFGWsVTM7XQV/GTymnYlssv3RfPl8YOZo7MAHl9F27PXJ5ZFpEMdXG3SJLSPb Fwlii2orcnlWwokEXqVRUZQS6zl1kk1L8hTXxc34SoPuienY56nJGhY5nz9lxTJhvftM zYYw== X-Gm-Message-State: AO0yUKXAlQh3y+YEIFZ5DNjWqjTdYAvd9wvoYo0Fa0NvGb49u3hNeu+3 Phebg0NglyfJTdVXV7P/zjSCrzujqNhjxI52t1s= X-Received: by 2002:a05:6a20:a0a4:b0:bc:6ef3:1e74 with SMTP id r36-20020a056a20a0a400b000bc6ef31e74mr3459034pzj.37.1676516959986; Wed, 15 Feb 2023 19:09:19 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 15/19] target/arm: Add SCTLR.nAA to TBFLAG_A64 Date: Wed, 15 Feb 2023 17:08:50 -1000 Message-Id: <20230216030854.1212208-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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.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 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 3 ++- target/arm/translate.h | 2 ++ target/arm/helper.c | 6 ++++++ target/arm/translate-a64.c | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2108caf753..b814c52469 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1243,7 +1243,7 @@ void pmu_init(ARMCPU *cpu); #define SCTLR_D (1U << 5) /* up to v5; RAO in v6 */ #define SCTLR_CP15BEN (1U << 5) /* v7 onward */ #define SCTLR_L (1U << 6) /* up to v5; RAO in v6 and v7; RAZ in v8 */ -#define SCTLR_nAA (1U << 6) /* when v8.4-LSE is implemented */ +#define SCTLR_nAA (1U << 6) /* when FEAT_LSE2 is implemented */ #define SCTLR_B (1U << 7) /* up to v6; RAZ in v7 */ #define SCTLR_ITD (1U << 7) /* v8 onward */ #define SCTLR_S (1U << 8) /* up to v6; RAZ in v7 */ @@ -3247,6 +3247,7 @@ FIELD(TBFLAG_A64, SVL, 24, 4) /* Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not. */ FIELD(TBFLAG_A64, SME_TRAP_NONSTREAMING, 28, 1) FIELD(TBFLAG_A64, FGT_ERET, 29, 1) +FIELD(TBFLAG_A64, NAA, 30, 1) /* * Helpers for using the above. diff --git a/target/arm/translate.h b/target/arm/translate.h index 809479f9b7..46a60f8987 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -137,6 +137,8 @@ typedef struct DisasContext { bool fgt_eret; /* True if fine-grained trap on SVC is enabled */ bool fgt_svc; + /* True if FEAT_LSE2 SCTLR_ELx.nAA is set */ + bool naa; /* * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. * < 0, set by the current instruction. diff --git a/target/arm/helper.c b/target/arm/helper.c index c62ed05c12..d1683155a1 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12053,6 +12053,12 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, } } + if (cpu_isar_feature(aa64_lse2, env_archcpu(env))) { + if (sctlr & SCTLR_nAA) { + DP_TBFLAG_A64(flags, NAA, 1); + } + } + /* Compute the condition for using AccType_UNPRIV for LDTR et al. */ if (!(env->pstate & PSTATE_UAO)) { switch (mmu_idx) { diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index caeb91efa5..56c9d63664 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14813,6 +14813,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->pstate_sm = EX_TBFLAG_A64(tb_flags, PSTATE_SM); dc->pstate_za = EX_TBFLAG_A64(tb_flags, PSTATE_ZA); dc->sme_trap_nonstreaming = EX_TBFLAG_A64(tb_flags, SME_TRAP_NONSTREAMING); + dc->naa = EX_TBFLAG_A64(tb_flags, NAA); dc->vec_len = 0; dc->vec_stride = 0; dc->cp_regs = arm_cpu->cp_regs; From patchwork Thu Feb 16 03:08:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653988 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp122876wrr; Wed, 15 Feb 2023 19:09:37 -0800 (PST) X-Google-Smtp-Source: AK7set/cqmtDzZZYAATm3see6AWOF8BbebR8olJJdW9QD4VJG5SburOkE3/VMBijbqbbhNy7N0hu X-Received: by 2002:a05:622a:343:b0:3b8:674c:6c18 with SMTP id r3-20020a05622a034300b003b8674c6c18mr6007628qtw.45.1676516977751; Wed, 15 Feb 2023 19:09:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676516977; cv=none; d=google.com; s=arc-20160816; b=plCT3xHTnAuw8qlh/SvquD4SuLv5wcuIIxcJbGbtC+NeO462pMCsR/Ec9BUZdRjUoH ywhrPUatgatQVAM5rI5C82+XkR0DDf8nDwKTIN2X330ON6GYEVQwDkFRZ+Op1EVX88Cu 5tw1MT34+1d5ijuEfzB+TXpU86QMqpV81Cj3GJfwvI2xH6JhnI89RLtwRSv5V9eMNoYc 86hV08rwFn65OPeux5L+QINuC8vW5qyOoW1aFGF8vdYadM33+BhTFxrnFpGJ1PIFPKnX Zs/XPM9ThKm7x5jW7ndIoVVRPwpVgo+wFm64bQn9+w2+7LO6da4kcq6R7UsQ0uJB7hbq ngKQ== 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=iR+OHJC4d8S9ZWAhhg9mI80eUMQ8XMvPXGDeNwWOMUY=; b=fYMJlE24mY4QqEfcQDu2D5EmvpkX+Vdyl/Y1Nu7WMpNlwdTtgRS/jxnm1ftU8MEOPd 3Eev5KOP8KcMpNA62njdCBwKGs3J/MWvJu1jBkfidc8uNTCSlb85gOwClRGQmXP6GvVm jBQEUS0p72ElYQ5xhWLq4YMhddxEN0YC9mu69qHsB9/EZr3Btz46coj27jb8emclriay wazuSqLLOz+SLAhonp6LaDJqY7kqgMpPK4cmA0wRxwPEZ+jG3txhA41cQReBsud+vadk Z5r3c5yCVgsugA0M1Exfr+ffkp7bPY4lgO5Tp0Hfy4kci/Ej7Q12SfNPuliV6nZs6uBK OPTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xarLZJqH; 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 s2-20020ac85cc2000000b003b697992acbsi541018qta.175.2023.02.15.19.09.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:09:37 -0800 (PST) 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=xarLZJqH; 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 1pSUeG-0007Vk-Le; Wed, 15 Feb 2023 22:09:28 -0500 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 1pSUeD-0007TC-3L for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:25 -0500 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUeA-0000Cu-Vd for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:24 -0500 Received: by mail-pg1-x532.google.com with SMTP id s8so414848pgg.11 for ; Wed, 15 Feb 2023 19:09:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=iR+OHJC4d8S9ZWAhhg9mI80eUMQ8XMvPXGDeNwWOMUY=; b=xarLZJqHQWhA4fIKMCEcxFVwZ5Iw+nFFo5TKQofK/gFI6uwKZC1gRSMCLXzQ+2IaT7 ME5JznTey3OMrvkSFchbm71mjC4z0cl7w1h1xo5IY7348HzQrPmEy7neqqg6hF0h8s4u nrLZsyjIJ60DrldHJonu0idqd36FigVQnFGJcisl2+JjsZEcocZSC5qFfHThFYI9XiYs X5xHDDLm2FWdJSL8QUNOiefbZlD9S/7q7+Hx0orsP4iIj+0ey4GnTLhH0Jvosiqeduwd OopotCFDepdPwETQXoybq+xciJZcHxlb9uOnO26WBaN4H64D+CpvMXvXMrlaUu0V5ZlM elnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=iR+OHJC4d8S9ZWAhhg9mI80eUMQ8XMvPXGDeNwWOMUY=; b=HFl2TPyQUO4HXFTnlbJLH+E3HvCBvRtOJ0TF44e5bKRAu8e4MGipHV/Z29oeTzS++L ee7p2sCZyH2OptDiItrHGTfYP6fT14QkFfg0m6v4u1rZ3m+IblGdgvXUZ7XkOaIvvq+u U89dEz0HQ7B0w1lqjeN+82dse9PXJs/W4SO2pttMNwRez043JWlZnElhN0H1MJP11U6Q rCgxtoeJWZay+Yln/6qHUapynrEaW7Wr5FQY/++6mBp6AJtLjxk9YF6kjh22O95PocZn 6UKRo0IK1mj9R3LxPPTnulie8Kpnu3ahlzQXhd2T0OgqINEAReSF2LgNbG6OvNzZw2Vs +M0Q== X-Gm-Message-State: AO0yUKW2ADjV9fKcjGloRjxAMcPmYNnMXKUY7Fq7lA3UJ0Sp8x7Ce+DG rmWp5EhUwRN1MHV7ZKGN5CJGaGO0oRPTZDGV4K8= X-Received: by 2002:aa7:95a9:0:b0:5a8:bfe5:3076 with SMTP id a9-20020aa795a9000000b005a8bfe53076mr3712933pfk.19.1676516961641; Wed, 15 Feb 2023 19:09:21 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 16/19] target/arm: Relax ordered/atomic alignment checks for LSE2 Date: Wed, 15 Feb 2023 17:08:51 -1000 Message-Id: <20230216030854.1212208-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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.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 FEAT_LSE2 only requires that atomic operations not cross a 16-byte boundary. Ordered operations may be completely unaligned if SCTLR.nAA is set. Because this alignment check is so special, do it by hand. Make sure not to keep TCG temps live across the branch. Signed-off-by: Richard Henderson --- target/arm/helper-a64.h | 3 ++ target/arm/helper-a64.c | 7 +++ target/arm/translate-a64.c | 95 ++++++++++++++++++++++++++++++++------ 3 files changed, 92 insertions(+), 13 deletions(-) diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index ff56807247..3d5957c11f 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -110,3 +110,6 @@ DEF_HELPER_FLAGS_2(st2g_stub, TCG_CALL_NO_WG, void, env, i64) DEF_HELPER_FLAGS_2(ldgm, TCG_CALL_NO_WG, i64, env, i64) DEF_HELPER_FLAGS_3(stgm, TCG_CALL_NO_WG, void, env, i64, i64) DEF_HELPER_FLAGS_3(stzgm_tags, TCG_CALL_NO_WG, void, env, i64, i64) + +DEF_HELPER_FLAGS_4(unaligned_access, TCG_CALL_NO_WG, + noreturn, env, i64, i32, i32) diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 0972a4bdd0..abbe3f7077 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -952,3 +952,10 @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) memset(mem, 0, blocklen); } + +void HELPER(unaligned_access)(CPUARMState *env, uint64_t addr, + uint32_t access_type, uint32_t mmu_idx) +{ + arm_cpu_do_unaligned_access(env_cpu(env), addr, access_type, + mmu_idx, GETPC()); +} diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 56c9d63664..78103f723d 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -310,6 +310,77 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, return clean_data_tbi(s, addr); } +/* + * Generate the special alignment check that applies to AccType_ATOMIC + * and AccType_ORDERED insns under FEAT_LSE2: the access need not be + * naturally aligned, but it must not cross a 16-byte boundary. + * See AArch64.CheckAlignment(). + */ +static void check_lse2_align(DisasContext *s, int rn, int imm, + bool is_write, MemOp mop) +{ + TCGv_i32 tmp; + TCGv_i64 addr; + TCGLabel *over_label; + MMUAccessType type; + int mmu_idx; + + tmp = tcg_temp_new_i32(); + tcg_gen_extrl_i64_i32(tmp, cpu_reg_sp(s, rn)); + tcg_gen_addi_i32(tmp, tmp, imm & 15); + tcg_gen_andi_i32(tmp, tmp, 15); + tcg_gen_addi_i32(tmp, tmp, memop_size(mop)); + + over_label = gen_new_label(); + tcg_gen_brcond_i32(TCG_COND_LEU, tmp, tcg_constant_i32(16), over_label); + tcg_temp_free_i32(tmp); + + addr = tcg_temp_new_i64(); + tcg_gen_addi_i64(addr, cpu_reg_sp(s, rn), imm); + + type = is_write ? MMU_DATA_STORE : MMU_DATA_LOAD, + mmu_idx = get_mem_index(s); + gen_helper_unaligned_access(cpu_env, addr, tcg_constant_i32(type), + tcg_constant_i32(mmu_idx)); + tcg_temp_free_i64(addr); + + gen_set_label(over_label); + +} + +/* Handle the alignment check for AccType_ATOMIC instructions. */ +static MemOp check_atomic_align(DisasContext *s, int rn, MemOp mop) +{ + MemOp size = mop & MO_SIZE; + + if (size == MO_8) { + return mop; + } + if (size >= MO_128 || !dc_isar_feature(aa64_lse2, s)) { + return mop | MO_ALIGN | s->be_data; + } + check_lse2_align(s, rn, 0, true, mop); + return mop | s->be_data; +} + +/* Handle the alignment check for AccType_ORDERED instructions. */ +static MemOp check_ordered_align(DisasContext *s, int rn, int imm, + bool is_write, MemOp mop) +{ + MemOp size = mop & MO_SIZE; + + if (size == MO_8) { + return mop; + } + if (size >= MO_128 || !dc_isar_feature(aa64_lse2, s)) { + return mop | MO_ALIGN | s->be_data; + } + if (!s->naa) { + check_lse2_align(s, rn, imm, is_write, mop); + } + return mop | s->be_data; +} + typedef struct DisasCompare64 { TCGCond cond; TCGv_i64 value; @@ -2525,8 +2596,7 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, int rn, if (memop == MO_128) { memop |= MO_ATMAX_8; } - memop |= MO_ALIGN; - memop = finalize_memop(s, memop); + memop = check_atomic_align(s, rn, memop); s->is_ldex = true; dirty_addr = cpu_reg_sp(s, rn); @@ -2663,7 +2733,7 @@ static void gen_compare_and_swap(DisasContext *s, int rs, int rt, if (rn == 31) { gen_check_sp_alignment(s); } - memop = finalize_memop(s, size | MO_ALIGN); + memop = check_atomic_align(s, rn, size); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, memop); tcg_gen_atomic_cmpxchg_i64(tcg_rs, clean_addr, tcg_rs, tcg_rt, memidx, memop); @@ -2685,7 +2755,7 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, } /* This is a single atomic access, despite the "pair". */ - memop = finalize_memop(s, (size + 1) | MO_ALIGN); + memop = check_atomic_align(s, rn, size + 1); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, memop); if (size == 2) { @@ -2809,8 +2879,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) gen_check_sp_alignment(s); } tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); - /* TODO: ARMv8.4-LSE SCTLR.nAA */ - memop = finalize_memop(s, size | MO_ALIGN); + memop = check_ordered_align(s, rn, 0, true, size); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, memop); do_gpr_st(s, cpu_reg(s, rt), clean_addr, memop, true, rt, @@ -2828,8 +2897,7 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) if (rn == 31) { gen_check_sp_alignment(s); } - /* TODO: ARMv8.4-LSE SCTLR.nAA */ - memop = finalize_memop(s, size | MO_ALIGN); + memop = check_ordered_align(s, rn, 0, false, size); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), false, rn != 31, memop); do_gpr_ld(s, cpu_reg(s, rt), clean_addr, memop, false, true, @@ -3510,7 +3578,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, bool a = extract32(insn, 23, 1); TCGv_i64 tcg_rs, tcg_rt, clean_addr; AtomicThreeOpFn *fn = NULL; - MemOp mop = finalize_memop(s, size | MO_ALIGN); + MemOp mop = size; if (is_vector || !dc_isar_feature(aa64_atomics, s)) { unallocated_encoding(s); @@ -3561,6 +3629,8 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, if (rn == 31) { gen_check_sp_alignment(s); } + + mop = check_atomic_align(s, rn, mop); clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), false, rn != 31, mop); if (o3_opc == 014) { @@ -3685,16 +3755,13 @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) bool is_store = false; bool extend = false; bool iss_sf; - MemOp mop; + MemOp mop = size; if (!dc_isar_feature(aa64_rcpc_8_4, s)) { unallocated_encoding(s); return; } - /* TODO: ARMv8.4-LSE SCTLR.nAA */ - mop = finalize_memop(s, size | MO_ALIGN); - switch (opc) { case 0: /* STLURB */ is_store = true; @@ -3726,6 +3793,8 @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) gen_check_sp_alignment(s); } + mop = check_ordered_align(s, rn, offset, is_store, mop); + dirty_addr = read_cpu_reg_sp(s, rn, 1); tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); clean_addr = clean_data_tbi(s, dirty_addr); From patchwork Thu Feb 16 03:08:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 653991 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123175wrr; Wed, 15 Feb 2023 19:10:20 -0800 (PST) X-Google-Smtp-Source: AK7set+kMXUwAk3lZlFa/patoQt5wb7x8rQok0kVZH2KJKNekWG5HKItZtsJiPgyybMA9ZwgTo2O X-Received: by 2002:ac8:5b03:0:b0:3b8:5c86:37ea with SMTP id m3-20020ac85b03000000b003b85c8637eamr7732392qtw.61.1676517020568; Wed, 15 Feb 2023 19:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517020; cv=none; d=google.com; s=arc-20160816; b=pK8aRQUTFGAP6zuM9VxehfoUj47CYDEfPkaKzVRueNBua/nZeOJY2AmrZ4atIJ8wI7 HkiATu/GWwVLoNY7eT8uBRJY5dnSyhndTX0DWzQRMBi1VHiOzezubXqwrN05CypPj0hz 4lIBzn8OH/duYeL8pdSEhHc1h4JbaJ1z22xWPZmyX0tE/fZg9uE3ievWQYwQBtCMWUDL cgxUqIwi1Wn7f5VVgid66duCo/YmNN52qUpOAQZ4WKCTg4WboxoFbVxBarT6ByhAIC82 Co7tZu9ao7LP9LwOuW7umMxH/taNzqNrTgpxGMSXS1DVRr/Ri9cY7VdPHzszxL8lw8Tc Duhw== 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=ZZ+a7/CWiRtlGyB2C1ZyMWD3pj2WVtp3sfwQWKYTYqs=; b=maaxw9Kta3tWSDehq47xuyMv/oE+bWDZsnPkKTDtTvLyiA7LDEK5rwwWP4K+BV0Q0D EhV9SAhu6sVqYvNVYvhhDsFefaBKUnB/OEaw3Ryo4ZMMI0OQJlZFqM9y6Ul1bWKgMeum cyqs0E2EuY+jEPNJzhjbFd6w93dGIcBp8VlPd6gqRxeacN8Hta74LfQvsHB0ql4hz5LE 6v5EyKp/6Pr1CE1KYS0GCY9+PSWYiUIxDW55Z1okLd3tQ8SYF3/cPZT4wjYSeBZx3qRq DPbdL+caDTTL+3OJ9ElIfCZEnxSqLHa6Davn4T6ivHZucKOvJ0tkhNkbFoM5wQIknk3j RN1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gt75eBNA; 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 w5-20020ac857c5000000b003b63fc5da68si522532qta.539.2023.02.15.19.10.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:10:20 -0800 (PST) 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=Gt75eBNA; 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 1pSUeI-0007W6-Is; Wed, 15 Feb 2023 22:09:30 -0500 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 1pSUeD-0007TX-Na for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:25 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUeB-00004w-SI for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:25 -0500 Received: by mail-pg1-x52c.google.com with SMTP id 24so424723pgt.7 for ; Wed, 15 Feb 2023 19:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=ZZ+a7/CWiRtlGyB2C1ZyMWD3pj2WVtp3sfwQWKYTYqs=; b=Gt75eBNAM+k2icyWI7VYQr6JMWJ8Qa9iu1+1CSvYuneochRw+vii9jTaGnq2l+1nt8 bQUqH54ealH5pIskJ/HvKvKuuoTQUxMcIuYgAhgpX0epB5bHXftZ9mmTU83IxaRQAHa1 TUXiQtmLF2YWKiTkvtgGeC7JZtj/eVqkc/4GJQrXI8XxRixiwab6C0EsoU/FajGewtkw JRcirt9ZEm4MiMPthwdiBMIt1TDjZ1Y537pX+IJ5iHOE1SNMbtJlwrHdtQ3kadBz2zvP 24K4P0q4EoyTjv1f4C8dFfYU8yw3XF7t2CmtwDCBvpQHMG9xzAZyENPQbcvwn+V3HnKg Wnmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ZZ+a7/CWiRtlGyB2C1ZyMWD3pj2WVtp3sfwQWKYTYqs=; b=NWJQB9O10wfOAjnk2hI2bGbeEmXUi7nWBHC0XhR1fzzYNgUyHFy1wPHihaV0TlRGIS XJ23NIwz3Ob4D6xPF6zmlWBeoNtZarShwtbSgf1RNP22//gPuZbSkINK4J+kaejvIstR uNK3f9xHQmzrtbnAg5uinfsNWaVJ/uvTBzxKcayR8xa1Z8Y979u/D3qKw9Cg7WQFkDPg sVy96zluwZo/l2H2sTXSo0ehzhCxrn/wo2Mu7dDg786lUOH/X8AvOnLPdoLjiYv6SbJN riNA4ET1Biee5TJrt8qvV6u1+/ze8BFMEubnSQ+uCKxMNCncjXssw7qyMsqgaSYNdF4I re2Q== X-Gm-Message-State: AO0yUKVlsip7zXIQtg0AwOJk8c8KgRxNgjcG+uJ195QW6TzI1MNP4FRV MAym3IL2tlG5IxdBxpWiAzDSLegvq9ANyXtF7+0= X-Received: by 2002:aa7:9d09:0:b0:5a8:abd7:a9e8 with SMTP id k9-20020aa79d09000000b005a8abd7a9e8mr3817285pfp.27.1676516963037; Wed, 15 Feb 2023 19:09:23 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 17/19] target/arm: Move mte check for store-exclusive Date: Wed, 15 Feb 2023 17:08:52 -1000 Message-Id: <20230216030854.1212208-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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.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 Push the mte check behind the exclusive_addr check. Document the several ways that we are still out of spec with this implementation. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.c | 42 ++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 78103f723d..f9fc8ed215 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2654,17 +2654,47 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, */ TCGLabel *fail_label = gen_new_label(); TCGLabel *done_label = gen_new_label(); - TCGv_i64 tmp, dirty_addr, clean_addr; + TCGv_i64 tmp, clean_addr; MemOp memop; - memop = (size + is_pair) | MO_ALIGN; - memop = finalize_memop(s, memop); - - dirty_addr = cpu_reg_sp(s, rn); - clean_addr = gen_mte_check1(s, dirty_addr, true, rn != 31, memop); + /* + * FIXME: We are out of spec here. We have recorded only the address + * from load_exclusive, not the entire range, and we assume that the + * size of the access on both sides match. The architecture allows the + * store to be smaller than the load, so long as the stored bytes are + * within the range recorded by the load. + */ + /* See AArch64.ExclusiveMonitorsPass() and AArch64.IsExclusiveVA(). */ + clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn)); tcg_gen_brcond_i64(TCG_COND_NE, clean_addr, cpu_exclusive_addr, fail_label); + /* + * The write, and any associated faults, only happen if the virtual + * and physical addresses pass the exclusive monitor check. These + * faults are exceedingly unlikely, because normally the guest uses + * the exact same address register for the load_exclusive, and we + * would have recognized these faults there. + * + * It is possible to trigger an alignment fault pre-LSE2, e.g. with an + * unaligned 4-byte write within the range of an aligned 8-byte load. + * With LSE2, the store would need to cross a 16-byte boundary when the + * load did not, which would mean the store is outside the range + * recorded for the monitor, which would have failed a corrected monitor + * check above. For now, we assume no size change and retain the + * MO_ALIGN to let tcg know what we checked in the load_exclusive. + * + * It is possible to trigger an MTE fault, by performing the load with + * a virtual address with a valid tag and performing the store with the + * same virtual address and a different invalid tag. + */ + memop = size + is_pair; + if (memop == MO_128 || !dc_isar_feature(aa64_lse2, s)) { + memop |= MO_ALIGN; + } + memop = finalize_memop(s, memop); + gen_mte_check1(s, cpu_reg_sp(s, rn), true, rn != 31, memop); + tmp = tcg_temp_new_i64(); if (is_pair) { if (size == 2) { From patchwork Thu Feb 16 03:08:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654005 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123722wrr; Wed, 15 Feb 2023 19:11:37 -0800 (PST) X-Google-Smtp-Source: AK7set+9UN0I6noDeFmz9piT11uzuZPAoJJPracXZgPArLMmb2KQ4oN1MAA7stYXSBpws9mJQTh1 X-Received: by 2002:a05:6214:27c7:b0:56b:ed8f:5df with SMTP id ge7-20020a05621427c700b0056bed8f05dfmr7026276qvb.30.1676517097379; Wed, 15 Feb 2023 19:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517097; cv=none; d=google.com; s=arc-20160816; b=mHnfmxQlZZa62m4ngw5Xovho69/rGNTfPkHnIC6c/5ZVqrOja96hqIM/QBkAu/ca8n JPMtpw9UaXt0ItTsfnZYkbpkiGLsiNasZl4/FSKk80fWkngRgMtOh18gnVZ265kg6Mby emZtOB0fEFFrQcMdx4z81z+gPMS2/zvC7EpbiNruNXknoWGaTEHg2irYztCc0IE8q0/L mLXubiNNiBi3pMMjnDbNOH7tVa/W7GIB0PIFjZNe32YNWz5wqe8jDL9AWRqky2U9uYGN xdHc43byKaBsVf6GaVfGY8A7laPgR7b6yUMN5W5La6TFk+AwRMUhqsWeY4TTO+ijBxFM rg/g== 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=0MajgK0PLGz4vagnIHWmbxLdve4d+jZ1hP+nPlzQtEs=; b=TEHUU+SSQileUl/WBP6DLPkrzc69/RvAZw3rT8OBiS9vZwEy0+mAze1hJ/l0qNDhz2 M6b2DdXJOl5KTrltCwZk/oDPRNGW2NbAMjHvCsVnusk58oLqT9gTLUFIix3djRfCEPmW XYtGlX3cnj21Px7WljG325BYjDrv0gHXmdskXkwANrWX+FJ6mGer14i5J1lQOWB3a+Er NTsAgzFWaGG0zTRopKOIs77KlD8FZUKPA8rOBy0PQLBlG8J1HAX7SD84cKEi2wdD1Laa ksoqz45xcmv4Dp7jVnGGzA0c+m8OHp/BxFutnUMEaw7+iRn2WL8MMesV6dzYGT2O8u5+ 2HKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ET5y+7oS; 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 l26-20020a37f91a000000b006c81aa7656bsi394708qkj.128.2023.02.15.19.11.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:11:37 -0800 (PST) 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=ET5y+7oS; 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 1pSUeI-0007WP-NS; Wed, 15 Feb 2023 22:09:30 -0500 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 1pSUeE-0007VQ-Vq for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:27 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUeD-0008WD-92 for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:26 -0500 Received: by mail-pf1-x42f.google.com with SMTP id r17so588120pff.9 for ; Wed, 15 Feb 2023 19:09:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=0MajgK0PLGz4vagnIHWmbxLdve4d+jZ1hP+nPlzQtEs=; b=ET5y+7oSOgKMsIvGXcy5ePPXva6bPq3m2wSLziv7LSfFCvO1agjLE79mpRrogHxOCD jxAWLNTXZx6O6u5n/cbF5tmz7EBtwu4J8oI4lwAuR3AWrdjgp3yCJv9vlQN5a7pQDH06 7sr9DebKwuN8WbhDEi0lbvfnUKSYtx0haotMmoZbFLsuLa0Auwv0ejXFd6MR2bhdSLO5 lgaUw1ekXPYKV4RFBhgusoRy2yk/1nS4RaLzWI2BIhTuNu1hOSbI7naZ4NN0DePlZlnq Ltzty+pn2QCJxLWt/n0s+zGcQyLhRMGruhRBp1kQ9RRM+VVShbgaU2F2X5ZkI21JnV9/ 7LTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=0MajgK0PLGz4vagnIHWmbxLdve4d+jZ1hP+nPlzQtEs=; b=oFAT0QQhPiLDQFyl6nIpuYFKuwTXTCfB91dRb/uKaoNZqnH6NVhHDIExBtR1i2RWBg pR33Z2QA4h9vl3p8eOclLY78MYhliCm4x1DJluoB2KU9jqxqWELsfVBR7dUkYvO8PntH H8bna1QVA9enWMPWh4mjRvCHZvItNAUcvSXOUTJf9ZtKpjpe+1u4qzBSSIkhyw8v0cvD je9MoTHQCnwgErZR4OXV8OKrFlJsnxUhG9sPCAzJHOJE6Zsi8qzVjazTZcLDxb7gXFl0 w05Exp3BvUquR+mAlTb1uMkn4qbnK3CYZaWozbhTdLYa8ZVHfwH9PX6cMt1niFM1QFnm 5f1Q== X-Gm-Message-State: AO0yUKXnnMPX/0D21ut/+xnoVw48t5U/ryAKE0q4YfHBHW7Pj5DT0ntg Igfj9ildAzgYa6w3cfAh2LRYZvRfN2PSea68Gz0= X-Received: by 2002:aa7:9626:0:b0:5a8:c444:d3e5 with SMTP id r6-20020aa79626000000b005a8c444d3e5mr3639432pfg.4.1676516964414; Wed, 15 Feb 2023 19:09:24 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 18/19] test/tcg/multiarch: Adjust sigbus.c Date: Wed, 15 Feb 2023 17:08:53 -1000 Message-Id: <20230216030854.1212208-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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.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 With -cpu max and FEAT_LSE2, the __aarch64__ section will only raise an alignment exception when the load crosses a 16-byte boundary. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- tests/tcg/multiarch/sigbus.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/tcg/multiarch/sigbus.c b/tests/tcg/multiarch/sigbus.c index 8134c5fd56..f47c7390e7 100644 --- a/tests/tcg/multiarch/sigbus.c +++ b/tests/tcg/multiarch/sigbus.c @@ -6,8 +6,13 @@ #include -unsigned long long x = 0x8877665544332211ull; -void * volatile p = (void *)&x + 1; +char x[32] __attribute__((aligned(16))) = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, + 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, +}; +void * volatile p = (void *)&x + 15; void sigbus(int sig, siginfo_t *info, void *uc) { @@ -60,9 +65,9 @@ int main() * We might as well validate the unaligned load worked. */ if (BYTE_ORDER == LITTLE_ENDIAN) { - assert(tmp == 0x55443322); + assert(tmp == 0x13121110); } else { - assert(tmp == 0x77665544); + assert(tmp == 0x10111213); } return EXIT_SUCCESS; } From patchwork Thu Feb 16 03:08:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654001 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp123635wrr; Wed, 15 Feb 2023 19:11:25 -0800 (PST) X-Google-Smtp-Source: AK7set8wrXPttwBAsXNt2fxrSOBLWK7X8HAdiwq6Ek93D8g5/nvuxpuHjvNiE67uNhYI4lo35W6r X-Received: by 2002:a05:6214:f08:b0:53c:14c0:213d with SMTP id gw8-20020a0562140f0800b0053c14c0213dmr9205164qvb.27.1676517085763; Wed, 15 Feb 2023 19:11:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676517085; cv=none; d=google.com; s=arc-20160816; b=PrT9XQdFrNQ6fCIB8uI0ds5TFr4FIsTUe5lBPsoVkjNs5gaJdkdm9FjxlEXXnVGZRa xT4A0h0PXvUhFP522yf/aAS6hupJt4dsCL6HOCNk6JzRPTJ0RE5tAYFnxSr+jSupl+jO hR14TtvswrpoL3+2lTBZcrjU6yPhZ4fMhIf2i0wHRdkqsxXvJnAeLYEXsWDJ89mGXm/l RmGbeoATrmfh1OnUGFiYUZzLDNctQd5CFg3zf22AYisIVQiFd7gqA/8wsRg1zEJUKfQP sXPSGuDpnLj/tRZxZ1IxzTiEsld7nBf+Far4B033QgBHG6mRlM3ptySXNbnS+t5Q8t9O 6IKA== 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=8oTGtji2gFH3RPMGsbULntVwagtctLLdB2UDLnFD4qU=; b=mfm42iPW7Pwpq2GlAi4MLAODQTfVjm/mtGYVu06A64G48T41bPDEqotDFACSuJhCYl X9FQFQ1TYps6UAqEuawTFue/2IhYDAZhEq6iWj5rYFPF31L3kQUM5vCd1uZlhSoFxnkM xYi1RdwpfMlKyczgkEDc33YG/RPhXD/gPklHeJdP5l1POAIVp/x+qbksgj6P/onnJFLd sKHGdTsiXCvnjGwCCQkivGvU+g1P60d8wdpTtkY4LLcUBo9IlXb2mc3Y7G4Tj01UaQdK 1GK4goYGkPQOAhShs/Gmy8CxnofbIwBPAkwe/DISENPI5wlPqXa1IrUT0Fzk/0YzHGaf dg/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fu/XE7oz"; 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 de8-20020a05620a370800b007242a1945a8si406094qkb.693.2023.02.15.19.11.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 19:11:25 -0800 (PST) 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="fu/XE7oz"; 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 1pSUeM-0007YI-CH; Wed, 15 Feb 2023 22:09:34 -0500 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 1pSUeJ-0007X0-Sp for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:31 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSUeE-0000Br-MP for qemu-devel@nongnu.org; Wed, 15 Feb 2023 22:09:31 -0500 Received: by mail-pf1-x436.google.com with SMTP id bd35so594336pfb.6 for ; Wed, 15 Feb 2023 19:09:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=8oTGtji2gFH3RPMGsbULntVwagtctLLdB2UDLnFD4qU=; b=fu/XE7ozh1m1IF2AGnAXm0CwKpYNz7sPFNk1V0BruBVbN3LJzSdHq76glFoyMrsOKH TwkFwrFMNLmmnJM9hO+dpUF7++HucE3R6umH9cod8Gbqhb4IQAqtWggFo4sBptIXCKrm EE8X93ldJkOhMeU12AWfqZkj5T+RpioZChdPIfUuCDUITd7hXogsRTQfmcixyEXILANm lmR/zOEa00K8k/B6h3INQ3KaVyrTGDxrA67P9+vGDvYJnXrAUu9VjM03lxEIh3jDY4xd Fz7//jBnuQk6EzT5HftQtRtRq6tSxAm7F/PPcTgMLaMiSyMw95RKbChLIImNmmCNGhcH M8Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=8oTGtji2gFH3RPMGsbULntVwagtctLLdB2UDLnFD4qU=; b=6eEaBGkseg8cGrFM9vjNPqA3tE+vUF6ajMuqPgJFEgFjTmle/EQ92N7dGrZDJyHw+y rzFuDFi6h/ey2Fw2Ypfaot2sQpSP7wlo67ZJgnaAlink7f82U2rqKiy6x5dnJ0br0k85 eyZH50awVpYC79IGFUrui1Nn5NN9dHZIIM/y2RumLJVhDzCEbzvN/IBroVO7Sx9kelLh lqEZ6MkrtcUeYG1Mzw54AWK+HzfQyNiT2l/Dwf1VvCXwMypb8lSuVK5bun8dr+rJFPEA 0XLSrvzxDj/2YyARXNCx1bXUDvUHKvJOs5euSBh3Ca7XoLxbTHDDwXtXp+jogyO0evdl JGSA== X-Gm-Message-State: AO0yUKVrB39QGpw+svNkArWQHtd2v7s8qWdlSF7v1Fio2tnIGWS7sgVk 3lOwUnev2pKo6Tdy0TAg55+EG2hEjW/PZp5KKMc= X-Received: by 2002:aa7:9402:0:b0:5a8:bf60:fa57 with SMTP id x2-20020aa79402000000b005a8bf60fa57mr3196974pfo.4.1676516965844; Wed, 15 Feb 2023 19:09:25 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b005810a54fdefsm79051pfa.114.2023.02.15.19.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 19:09:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v1 19/19] target/arm: Enable FEAT_LSE2 for -cpu max Date: Wed, 15 Feb 2023 17:08:54 -1000 Message-Id: <20230216030854.1212208-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216030854.1212208-1-richard.henderson@linaro.org> References: <20230216030854.1212208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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=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 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- docs/system/arm/emulation.rst | 1 + target/arm/cpu64.c | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 2062d71261..a97e05e746 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -50,6 +50,7 @@ the following architecture extensions: - FEAT_LRCPC (Load-acquire RCpc instructions) - FEAT_LRCPC2 (Load-acquire RCpc instructions v2) - FEAT_LSE (Large System Extensions) +- FEAT_LSE2 (Large System Extensions v2) - FEAT_LVA (Large Virtual Address space) - FEAT_MTE (Memory Tagging Extension) - FEAT_MTE2 (Memory Tagging Extension) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 4066950da1..ab91b579bc 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -1245,6 +1245,7 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64MMFR2, IESB, 1); /* FEAT_IESB */ t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* FEAT_TTST */ + t = FIELD_DP64(t, ID_AA64MMFR2, AT, 1); /* FEAT_LSE2 */ t = FIELD_DP64(t, ID_AA64MMFR2, IDS, 1); /* FEAT_IDST */ t = FIELD_DP64(t, ID_AA64MMFR2, FWB, 1); /* FEAT_S2FWB */ t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */