From patchwork Wed Oct 13 18:22:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515747 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp133668ime; Wed, 13 Oct 2021 11:41:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0T88U6kvdxAmFfwh1pTEcAX/3yYOjM2o48TbzkJNocESeH0TxpE06VRs6KwjMrGcvIOX+ X-Received: by 2002:ac8:5905:: with SMTP id 5mr1098964qty.391.1634150474540; Wed, 13 Oct 2021 11:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634150474; cv=none; d=google.com; s=arc-20160816; b=uOv8JWNtem9ScjN0FvgmgJlkQ6IDQwtGOHoDFbPIq5MmvJQEjd4pl/SRYiu677QQ+5 NR9Pkud6B4YfmKg52KGZ/QnGLvLP9bSZv5YX0y3pibASGlL58ZhfGDT1sMgonyP/WcwM Zle8YkoWufz41kYs8m9m+basveJKNkwO9gGDJkCVPXyQvDLO8WPBirIOI/oePHu1/xaR lZTN/lGt21SAYwq9lsmTNRCVrSA/CG/vXgeE7AoHS+eQIiwgqKUezntdOKKObDfQ6ue7 0jnSSGsviudVJZAruZU+0dt+epFaQuWUkzdDMd2qY4G+SofS4wEZ7RykQFM4xmRlutC/ lCrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=56pglvy67AYwWdSDilcVWIN0xfuG/5o2eEFwbxuVXXQ=; b=pk0uyLJzB77HzdiM7Ed91luy9rlYZQ1tUN0kEDtDDuR6qFjkgQj3AsETe8W10vNH+e qkQgUDbTPRy//ZlvhuITpCul0rUm8rbtNxSLIJZGGH8fgdKPz9sGRaxicr1FxG6vt6FD pUYJe380ZDlsh6/Iuu4yKYK5VjVar7stPLJoFYlKnt/pULY1q+1k/18HUHZj4L7qquOP X5eyzTxScSEJF4heHGwUV6pXdKG1SfMI6jSTyFM8b622gUgQ2TzcBKVKn3e+VCDRx50e JnlJCaHTrSo5IU6JOrE49lwDs5HQDl4TGv1DINreaTLhTbAOdAqElEMIz4FXvZaoEwMD LKuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SSXRDsZn; 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 u10si263756qtg.296.2021.10.13.11.41.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Oct 2021 11:41:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SSXRDsZn; 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]:49048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1majBi-0001Ow-1u for patch@linaro.org; Wed, 13 Oct 2021 14:41:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maiu5-0004Du-LM for qemu-devel@nongnu.org; Wed, 13 Oct 2021 14:23:01 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:39804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maiu2-00038H-JU for qemu-devel@nongnu.org; Wed, 13 Oct 2021 14:23:01 -0400 Received: by mail-pg1-x531.google.com with SMTP id g184so3142103pgc.6 for ; Wed, 13 Oct 2021 11:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=56pglvy67AYwWdSDilcVWIN0xfuG/5o2eEFwbxuVXXQ=; b=SSXRDsZn264P/rWpUOoftMdyJO6C2kEpAc/xGX12fiqP6wrLPWbPf+AKD6WTBPrMd/ WNL+21nv90HtiJZubI5lkWuJN+hakS0D2x/eu1UuR/H73tN2izgQNJ3QSG0x1kQhnGor 9uPcYNmlfNHM6S8P0KiXH0Kek5zWPJ2XYcM3Fkc2AsSUUjd2Ddv1U37ic4Xd9CKF2fwm +G8hrVT0OsvjCQsi8TCSzdxwOzjs6mnV6FAyx6I+V3QzjUZtqxZbX0dJt3GHZdj7qlRt kqifxxHqps0Am8X8BGrJQRvuEOSSf1EZ0ZmXoYWG7WREPEoWaC/V/o0DhP7tA6J7cvnh 6Krw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=56pglvy67AYwWdSDilcVWIN0xfuG/5o2eEFwbxuVXXQ=; b=pyui5QSpJZQDiyGYM3cWBY3jQeiuTE0te+Ud/7mslQUMcKNinslSMfey40nPd/r6G/ rJgIGqrAgLUoEwgCN0d42JZ6Qrth5mtecI5URPcjdlNdyIb7kezV+PKIpoD0CbSLQoxB wvq/Hp1Pd2wvdwut3UBrchkrGsTr8gC1ARm1LgaiQLdtrlRlGOALWhmaUzEQevrJaSMd 7h6gzRJ0Z5W2lLal5i1AAFbRDrbrS0Iu3AsUUKe2fxhMaFW4SmHm8ym2BQdGdYajEiMW kJQnFiG+VqiDawSuDoUD+TGdrFBjPE4/Ayq/zfaB5xoCNBVV6jrH0o8uLDIx9rhHmdRR BvtA== X-Gm-Message-State: AOAM530I5vklK4j/4NsG0+jgmqqgDuo2ltc6VvSZZgQk5I6HUqSitrH2 xDKGuEsIkiy5YMGUFsVS1nQqrL3XcWgStg== X-Received: by 2002:a63:d94b:: with SMTP id e11mr559496pgj.295.1634149377007; Wed, 13 Oct 2021 11:22:57 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id z2sm177140pfe.210.2021.10.13.11.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 11:22:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 13/15] target/arm: Use cpu_*_mmu instead of helper_*_mmu Date: Wed, 13 Oct 2021 11:22:37 -0700 Message-Id: <20211013182239.991127-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013182239.991127-1-richard.henderson@linaro.org> References: <20211013182239.991127-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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The helper_*_mmu functions were the only thing available when this code was written. This could have been adjusted when we added cpu_*_mmuidx_ra, but now we can most easily use the newest set of interfaces. Cc: qemu-arm@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/helper-a64.c | 52 +++++++---------------------------------- target/arm/m_helper.c | 6 ++--- 2 files changed, 11 insertions(+), 47 deletions(-) -- 2.25.1 diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index b110c57956..5ae2ecb0f3 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -512,37 +512,19 @@ uint64_t HELPER(paired_cmpxchg64_le)(CPUARMState *env, uint64_t addr, uintptr_t ra = GETPC(); uint64_t o0, o1; bool success; - -#ifdef CONFIG_USER_ONLY - /* ??? Enforce alignment. */ - uint64_t *haddr = g2h(env_cpu(env), addr); - - set_helper_retaddr(ra); - o0 = ldq_le_p(haddr + 0); - o1 = ldq_le_p(haddr + 1); - oldv = int128_make128(o0, o1); - - success = int128_eq(oldv, cmpv); - if (success) { - stq_le_p(haddr + 0, int128_getlo(newv)); - stq_le_p(haddr + 1, int128_gethi(newv)); - } - clear_helper_retaddr(); -#else int mem_idx = cpu_mmu_index(env, false); MemOpIdx oi0 = make_memop_idx(MO_LEQ | MO_ALIGN_16, mem_idx); MemOpIdx oi1 = make_memop_idx(MO_LEQ, mem_idx); - o0 = helper_le_ldq_mmu(env, addr + 0, oi0, ra); - o1 = helper_le_ldq_mmu(env, addr + 8, oi1, ra); + o0 = cpu_ldq_le_mmu(env, addr + 0, oi0, ra); + o1 = cpu_ldq_le_mmu(env, addr + 8, oi1, ra); oldv = int128_make128(o0, o1); success = int128_eq(oldv, cmpv); if (success) { - helper_le_stq_mmu(env, addr + 0, int128_getlo(newv), oi1, ra); - helper_le_stq_mmu(env, addr + 8, int128_gethi(newv), oi1, ra); + cpu_stq_le_mmu(env, addr + 0, int128_getlo(newv), oi1, ra); + cpu_stq_le_mmu(env, addr + 8, int128_gethi(newv), oi1, ra); } -#endif return !success; } @@ -582,37 +564,19 @@ uint64_t HELPER(paired_cmpxchg64_be)(CPUARMState *env, uint64_t addr, uintptr_t ra = GETPC(); uint64_t o0, o1; bool success; - -#ifdef CONFIG_USER_ONLY - /* ??? Enforce alignment. */ - uint64_t *haddr = g2h(env_cpu(env), addr); - - set_helper_retaddr(ra); - o1 = ldq_be_p(haddr + 0); - o0 = ldq_be_p(haddr + 1); - oldv = int128_make128(o0, o1); - - success = int128_eq(oldv, cmpv); - if (success) { - stq_be_p(haddr + 0, int128_gethi(newv)); - stq_be_p(haddr + 1, int128_getlo(newv)); - } - clear_helper_retaddr(); -#else int mem_idx = cpu_mmu_index(env, false); MemOpIdx oi0 = make_memop_idx(MO_BEQ | MO_ALIGN_16, mem_idx); MemOpIdx oi1 = make_memop_idx(MO_BEQ, mem_idx); - o1 = helper_be_ldq_mmu(env, addr + 0, oi0, ra); - o0 = helper_be_ldq_mmu(env, addr + 8, oi1, ra); + o1 = cpu_ldq_be_mmu(env, addr + 0, oi0, ra); + o0 = cpu_ldq_be_mmu(env, addr + 8, oi1, ra); oldv = int128_make128(o0, o1); success = int128_eq(oldv, cmpv); if (success) { - helper_be_stq_mmu(env, addr + 0, int128_gethi(newv), oi1, ra); - helper_be_stq_mmu(env, addr + 8, int128_getlo(newv), oi1, ra); + cpu_stq_be_mmu(env, addr + 0, int128_gethi(newv), oi1, ra); + cpu_stq_be_mmu(env, addr + 8, int128_getlo(newv), oi1, ra); } -#endif return !success; } diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index 62aa12c9d8..2c9922dc29 100644 --- a/target/arm/m_helper.c +++ b/target/arm/m_helper.c @@ -1947,9 +1947,9 @@ static bool do_v7m_function_return(ARMCPU *cpu) * do them as secure, so work out what MMU index that is. */ mmu_idx = arm_v7m_mmu_idx_for_secstate(env, true); - oi = make_memop_idx(MO_LE, arm_to_core_mmu_idx(mmu_idx)); - newpc = helper_le_ldul_mmu(env, frameptr, oi, 0); - newpsr = helper_le_ldul_mmu(env, frameptr + 4, oi, 0); + oi = make_memop_idx(MO_LEUL, arm_to_core_mmu_idx(mmu_idx)); + newpc = cpu_ldl_le_mmu(env, frameptr, oi, 0); + newpsr = cpu_ldl_le_mmu(env, frameptr + 4, oi, 0); /* Consistency checks on new IPSR */ newpsr_exc = newpsr & XPSR_EXCP;