From patchwork Tue Aug 3 04:14:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 490885 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp318338jap; Mon, 2 Aug 2021 21:41:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6S9C3y1TcHAF3j+KrpWeSejtncFLcMoiVzDBJiyCqloAQ7M1vhDIaPywngfgGqHrvAXoJ X-Received: by 2002:a25:186:: with SMTP id 128mr25505009ybb.434.1627965661796; Mon, 02 Aug 2021 21:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627965661; cv=none; d=google.com; s=arc-20160816; b=Vp0dvUgKydOmUBE8ikPl5gz6b9i78GTiB3z+x7iPlV/J4Zu5MenhtLcuEZgG331AT8 YY4O6D3sS8WBwDkNFQ8C4MU+cgzSiLZCz+gZHZhAqF5t9mvOyK6FUAqp5iEEOzlzxMKT 5h5c3H7wzU0HAy38WnMhkO8vMMXgrpDWtNoJ1rPIoA/7dcvFEpbUF4tz17xV2YkHhbCx o0TtJOZWrQsHHi7TLFNx5j0rxT2O+1881+B5fmKIvvedWu+Dkl/SqQe0A3SNNVgntcHd WsgfXSM4979S0pjE3orDCxQa4Kw8rCvuHTti9EwbwgM6Mp9hDk9Lt+CH1bSs9MOdwVw4 B6sA== 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=Vcey1IaftmTAFoPi1JXk0SLrU7sPrAiRY1q5NRBsbUE=; b=SD9yIkK9919+0BfEhUuIIVQ97Dbx/og7ie4bffcwcDXYKMN3YM5WiT8WiMBlJexnHB ieUG+HqZHWPi3guSG288yDbHDf6Q/27jIuU0i84Ld6PPmN0cDSKb/DHCh1cPdwHTeC8g vjXwGXYrJwCmqvyzugojhRnDD2+hLKhZEgXlhIJpl1MaaPTJalMmqJYQau5BddSJLYpg 3HBgrTjK7Ei84vUa5Ujn9b7U9BikbTRNAyZ2kFoDaTMOzvQQDjBvNGKtNibzV2jyI3L/ qrLiO/1/g5a8AMlLfZPj9YrZfQmlzNr6UJVn0fH/diWOvXe1zPZoyVI8pr/DSFotP2WE /OtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IwIK7SU0; 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 k14si8568700ybd.405.2021.08.02.21.41.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Aug 2021 21:41:01 -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=IwIK7SU0; 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]:39970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAmEf-0008D8-6O for patch@linaro.org; Tue, 03 Aug 2021 00:41:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAlt0-0005Df-EX for qemu-devel@nongnu.org; Tue, 03 Aug 2021 00:18:38 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:44647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAlsy-0005BC-7W for qemu-devel@nongnu.org; Tue, 03 Aug 2021 00:18:38 -0400 Received: by mail-pj1-x1034.google.com with SMTP id e2-20020a17090a4a02b029016f3020d867so2990652pjh.3 for ; Mon, 02 Aug 2021 21:18:35 -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=Vcey1IaftmTAFoPi1JXk0SLrU7sPrAiRY1q5NRBsbUE=; b=IwIK7SU0lS+HAmE1XdJLzfwZ5E1H+p2TCGZnkm7qHZaCOET9m4ooQVfijL3IIccpv3 Mj8A8LaZc0vZEYY6iszCf/bUJRicuRSCXcg0HE+rEWhxYg2+7Nv/QWM3nvh4nKY2/lM6 48ZCCMFFFKBbUgDyTKJeamocSLl9Y864cg6pw3uIT3WDqt9mpc7HgqhCiKqU2SOMFT7Y nb6HbYoBF5LMyMBRNBnFZ9PZVCJCFLl7qsrh1ndGVLntWo72ex6PG4+7wtGa/PuZ16FY 7IYQId1dLvWI129UCgzhdbDgyeYkn1Sax1VGGJ0qa1NZ/PZzS50x+OSSJGcsIYE7sqSq O14Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vcey1IaftmTAFoPi1JXk0SLrU7sPrAiRY1q5NRBsbUE=; b=G+ghUhW726xNK5/6B5MjcQFSrpjeOF6pbbAtaUjTQGYh7IUwO1ZeyKpq5v9rg3zGP1 2zHtqQWOjN2DHk5NK18WHpih2OxSQhfgkYH9XYv2LSK9haAR/RwdpxVyCsFrl5NvViNH 4hqe4tPGWrElWxVA4gwerUBZhRwVXH0h7dl6jp/tU7R+mGZSiHqYK6Fe8G0AQ4WVFhB2 tr/ZH4vg6uMoFz0eHC9MTzdJhugKNdqIBIY7/2rHuvSTodmAz46MJBbIZ47DdazIiIhO hqqLqGqz0FQwnMY8LhT0l9IAwZPMFppQo+OFp89FTKQXAEU7t1QvhTSAkjZ8U8InjX5I erFw== X-Gm-Message-State: AOAM530JMIIAa9i/kcTXn/0n8HJMEITI/IHQnCdOMFCJfTxbFxKWuQgg bXEbMuFsFuSAUvyvmTzW9zCDUSJ4p7+C5A== X-Received: by 2002:a17:90a:b10f:: with SMTP id z15mr11309931pjq.56.1627964314910; Mon, 02 Aug 2021 21:18:34 -0700 (PDT) Received: from localhost.localdomain (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id ns18sm12091020pjb.31.2021.08.02.21.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 21:18:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 40/55] target/arm: Use cpu_*_mmu instead of helper_*_mmu Date: Mon, 2 Aug 2021 18:14:28 -1000 Message-Id: <20210803041443.55452-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210803041443.55452-1-richard.henderson@linaro.org> References: <20210803041443.55452-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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 f1a4089a4f..17c0ebebb2 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 efb522dc44..b6019595f5 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;