From patchwork Mon Jun 19 09:19:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 694007 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d91:0:0:0:0:0 with SMTP id b17csp2278632wru; Mon, 19 Jun 2023 02:19:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7UmzOanmz8P3o7PpoP7niMs2IgG4aPfKCRTNzJ6lxMGRI73BB+h2GEegHnKWInIIFll2OD X-Received: by 2002:ac8:7fc3:0:b0:3f6:84ac:659f with SMTP id b3-20020ac87fc3000000b003f684ac659fmr11543834qtk.29.1687166376172; Mon, 19 Jun 2023 02:19:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687166376; cv=none; d=google.com; s=arc-20160816; b=LhMBCnXcmyO+yJxl6hnXSC7jlb0kalrNpXbXCaX7mG42ynH3qlprwbziDa8nQFlIbU aTFHZtmPHKka7w2ohuC49+fwlnS84GsZOhmrthgSq2Jnlmu6ZY+Roa2Rqv2kYOXbJ8um Yl+jKIaP/d96PGGWgM0H1ObDG/pCLSEOKBRX0t8/u9i1vfXK4oFMbwN7hKEeFbLMvBOX ZfWLRpolV/IlKxaWQB6q7vDfpXx9Zt1Yv7+njL0jO3eOnlueeuefdRHzLPCxqwVJPlv9 GXb6vOvjLYmcpi9gSE0fwgCnz29ibawY4JEicdjzxQcktZ9wR0BLiHLIqRPBZhFQXtnV h5zA== 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=VHlHQxlwsOWUk71VYo9wtJBVxxN3mr1x8H8MDl1D0DM=; b=MzoNwfPg1+5VoVM/LR7l/po8CE9qsiRTkIS7zB5aM4ORMHmQj9mDCgqck1Nx67TGOE 3FOmJYM1GChs5iwmZV9TbIph0ve/GXzxJ38eR9KcdMskz1JYuGfyqJVQo6MEUSZk8zC2 jn2cejXA+YsjAm2Wuu3HrGgKwmYxSgXJ+kZJZ1DzdG/W4H51xb+OkiExHpxkuNTSepDB ggtUdVsD/Ktrs7n06PFACtgplxDhy+DTVEMOW+H9Jcf4ieVbOkEhiEmMUpfOI6GRXLwL oRmvcOMiEpc7QYvhamR/L5KSPQBkugZqlwAx67D5w5O9INPvXEuq5JGkPd8vTLwLQ4xX P/gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=imxgGqvO; 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 d19-20020a05622a15d300b003f02ab8a1efsi13208171qty.499.2023.06.19.02.19.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Jun 2023 02:19:36 -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=imxgGqvO; 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 1qBB2e-00039S-7I; Mon, 19 Jun 2023 05:19:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBB2b-00038I-U9 for qemu-devel@nongnu.org; Mon, 19 Jun 2023 05:19:17 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qBB2a-0001yO-Aq for qemu-devel@nongnu.org; Mon, 19 Jun 2023 05:19:17 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4f6283d0d84so4061514e87.1 for ; Mon, 19 Jun 2023 02:19:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687166354; x=1689758354; 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=VHlHQxlwsOWUk71VYo9wtJBVxxN3mr1x8H8MDl1D0DM=; b=imxgGqvOkOFG1f8RZKnvnY7P+BScuqsUEmqwth94f8GDAiqJ3z74o5NSpnt2nhUhq7 KUrGWj+7JKQy+jdT0EStxbc8WlXzgfCSei+y7Mo9iEJaaFkk9L7ZXpi9FkCj2ZCPP1uE I3H3XMd4lbhxj7hnLtUGFQEjP0XTpDG7MQSujWZseOT+1wFCdgvd+JhbIlr2IWca/OMl DX2Syv40GOZogUrcydUec4WZDYWnb6eOsx6dwMaeXM7RDmGrWRes/uuqI9BxKFO9R9PS dRzEmzpcYoriXp4lql+Ua4To0AqXtGzu2A6i4ESg6rarv56nFme4jClkj/lmaZ5VzvKA YynQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687166354; x=1689758354; 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=VHlHQxlwsOWUk71VYo9wtJBVxxN3mr1x8H8MDl1D0DM=; b=LYCpkC9ROkZZhRgiJhtk1P/7yhv5nS4NAXrmOPwkH3OGw1izV9TfTPehzUsBcfzeQt eg7PdlIsAa6LXHI4l0CYq96PWyNZ6y1bE947UAxBsAZs+0D7Ywn/rLM8DPFghV7ZV05V T9KtxouDaLUY5P/vw/obS1MkWsJFQglYJY1zeZyNSb6NNmDtCqiLsfP4pWBxFNs9B98x rJjjPQO0VHdu9+ufUFppeSNAvROqkeRREtzKDcdz3I4zm7NvXjBPEcSzfa3o7bfBWPQo fQNskm0pn+hbPNGK2/izDv+kt7PHRYmpPJk4Rc/aaFQj8xUmVN6vhIKR+9yc8e/7dePG agIw== X-Gm-Message-State: AC+VfDxYbQzkvzKcSdGGDS1+Pq7BFzhDq9vvcMxX5iRUUL5i1H4zdaYg CbN5HwcTBjbmUWIogBnxmeTLGo845U4W2aEdpjEEGQ== X-Received: by 2002:ac2:5b0c:0:b0:4f8:666b:9de8 with SMTP id v12-20020ac25b0c000000b004f8666b9de8mr2580890lfn.13.1687166354401; Mon, 19 Jun 2023 02:19:14 -0700 (PDT) Received: from localhost.localdomain (194.red-95-127-33.staticip.rima-tde.net. [95.127.33.194]) by smtp.gmail.com with ESMTPSA id j15-20020a05600c2b8f00b003f4266965fbsm10101063wmc.5.2023.06.19.02.19.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jun 2023 02:19:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH v2 2/2] accel/tcg: Make probe_access() a generic TCG helper Date: Mon, 19 Jun 2023 11:19:01 +0200 Message-Id: <20230619091901.51607-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230619091901.51607-1-philmd@linaro.org> References: <20230619091901.51607-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=philmd@linaro.org; helo=mail-lf1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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 probe_access() is not ARM specific and can be reused by other targets. Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/tcg-runtime.h | 2 ++ target/arm/helper.h | 2 -- accel/tcg/tcg-runtime.c | 16 ++++++++++++++++ target/arm/tcg/op_helper.c | 16 ---------------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 39e68007f9..a93a5d87a5 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -28,6 +28,8 @@ DEF_HELPER_FLAGS_1(lookup_tb_ptr, TCG_CALL_NO_WG_SE, cptr, env) DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) +DEF_HELPER_FLAGS_5(probe_access, TCG_CALL_NO_WG, void, env, i64, i32, i32, i32) + #ifndef IN_HELPER_PROTO /* * Pass calls to memset directly to libc, without a thunk in qemu. diff --git a/target/arm/helper.h b/target/arm/helper.h index cee9462c73..4336571d88 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -101,8 +101,6 @@ DEF_HELPER_FLAGS_1(rebuild_hflags_a32_newel, TCG_CALL_NO_RWG, void, env) DEF_HELPER_FLAGS_2(rebuild_hflags_a32, TCG_CALL_NO_RWG, void, env, int) DEF_HELPER_FLAGS_2(rebuild_hflags_a64, TCG_CALL_NO_RWG, void, env, int) -DEF_HELPER_FLAGS_5(probe_access, TCG_CALL_NO_WG, void, env, i64, i32, i32, i32) - DEF_HELPER_1(vfp_get_fpscr, i32, env) DEF_HELPER_2(vfp_set_fpscr, void, env, i32) diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 9fa539ad3d..b241a11791 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -152,3 +152,19 @@ void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(env_cpu(env), GETPC()); } + +void HELPER(probe_access)(CPUArchState *env, uint64_t ptr, + uint32_t access_type, uint32_t mmu_idx, + uint32_t size) +{ + uint32_t in_page = -((uint32_t)ptr | TARGET_PAGE_SIZE); + uintptr_t ra = GETPC(); + + if (likely(size <= in_page)) { + probe_access(env, ptr, size, access_type, mmu_idx, ra); + } else { + probe_access(env, ptr, in_page, access_type, mmu_idx, ra); + probe_access(env, ptr + in_page, size - in_page, + access_type, mmu_idx, ra); + } +} diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index 6cb84bc994..d507a3df16 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -1009,22 +1009,6 @@ uint32_t HELPER(ror_cc)(CPUARMState *env, uint32_t x, uint32_t i) } } -void HELPER(probe_access)(CPUArchState *env, uint64_t ptr, - uint32_t access_type, uint32_t mmu_idx, - uint32_t size) -{ - uint32_t in_page = -((uint32_t)ptr | TARGET_PAGE_SIZE); - uintptr_t ra = GETPC(); - - if (likely(size <= in_page)) { - probe_access(env, ptr, size, access_type, mmu_idx, ra); - } else { - probe_access(env, ptr, in_page, access_type, mmu_idx, ra); - probe_access(env, ptr + in_page, size - in_page, - access_type, mmu_idx, ra); - } -} - /* * This function corresponds to AArch64.vESBOperation(). * Note that the AArch32 version is not functionally different.