From patchwork Tue Jan 24 00:00:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 645979 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2470748pvb; Mon, 23 Jan 2023 16:04:24 -0800 (PST) X-Google-Smtp-Source: AK7set+bgVWXnVCksrTINmJ8tERsE1o3qhNppi/i/p9h7LfDS3j1zAlOVGLiNFgmA7sW/DEFvkv8 X-Received: by 2002:a81:17cf:0:b0:506:3a76:f4af with SMTP id 198-20020a8117cf000000b005063a76f4afmr605461ywx.45.1674518664096; Mon, 23 Jan 2023 16:04:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674518664; cv=none; d=google.com; s=arc-20160816; b=0nyywfZlBNs2RhGEKffU24l9Qb2SwrS1wG2aFG+CcU5bof8AINbr3rwqVAwJ3ZgzFN 2x2VkLCSoIDD7acFVb5v58RUb+27xrCOCbQ6MrZX1S8CmGhh939o4t5RT8UTy2BVqP2c xuV3K80xE88P17YAPeTOEupdWwmxGG+vzBosN1Zq+KtC6qwBqmZFLbn6SUR5rJ3ia2gV mjqq1oDFk1AIKiLW8phaX/epAWC/hxOH1yTuvE8y9C+0FAugE6wYIMIrN8upSUd8lzo7 4hdJRAmic4l8WZVjZ9EjNX6GkT/I3RhBbFjcE327q0wzHQQDCN543t0u8agZm5vcEa8T WsXg== 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=iCmbkLa0yYr0QBg1CfQR5sNbcMWAWJk89TMhy0bc8HA=; b=eKLHtykKNFqsrVjBqBnrywRmWnIipCv/VKhym6yv8WF0LT5V1J/SGISjYO5zyaLFbQ o+Z3uRMEN64UrlYlRbmZ08w4dhEBa1RzvpQNYBNtnCgcADSOt+srQ2qdaKK0XYT/hZBG vhDkfCPel9Sq1g+WYPCGKfFGMTf9NqSs2sCq0Eu+oSj4OZxRkwrasQALln2vaYddTiK3 7VMuWmd49Yy63aRSzgEQrM1VGqYD5jEKE+4yzdWrvV4vPFr7cVuEcfUKjbuHX7mDbzb0 bAjrHI8/fPHAkik1h1JUD7nwbzgPkq5HxAKhwJPL9jt+qvsVstneHs4KoqyCKVhA5hGh MGYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W1QFLQHU; 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 pe8-20020a05620a850800b007067155f91csi417672qkn.678.2023.01.23.16.04.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 16:04:24 -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=W1QFLQHU; 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 1pK6kc-0001F3-Hx; Mon, 23 Jan 2023 19:01: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 1pK6kZ-00010G-T2 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 19:01:20 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pK6kT-0001xa-Rp for qemu-devel@nongnu.org; Mon, 23 Jan 2023 19:01:19 -0500 Received: by mail-pf1-x42e.google.com with SMTP id 200so10108948pfx.7 for ; Mon, 23 Jan 2023 16:01: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=iCmbkLa0yYr0QBg1CfQR5sNbcMWAWJk89TMhy0bc8HA=; b=W1QFLQHUNk4auQyvGViV6iqYI7eysC7CXKLkFOJFx0wc+v8K6cqxnFf5WJ2Xif9tdd cNApj9VkWMtNMeV9obPZwB//Hjahx62jn9hGY/knjuPi1C26E+1yKAlrQKJ1ANvtVjaV Tuy6OZnV6H2gNV8sMqi2zpWDZ0ISD5GyNjyr4WryiO+pnFPjA8jFiSlPV7Y8pqgVX8A8 K0iSfdBmgHK7VuVdVhZhMmcJayycmXjqQ840R53TihEASppUWa3RnRFOhRQV5mp/1ZyU iA44pNlcOH6xX07Q0iJnhYbRC/4UlBBCGekES3vV4NZ7LDq6/becB5VWTukxT6iItn3D iPjA== 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=iCmbkLa0yYr0QBg1CfQR5sNbcMWAWJk89TMhy0bc8HA=; b=JMzWPtgC2G3m9/IgLBw6IuDzz6F8pPq8gBh9mvPQ9CPkl/2ViBBJMTe5hoE/S8Q0IP sQjCfGrkWJ9BnTBYK09fenMVEbFmL1gzZe2XNh4rN/jFlMFxCQ7WnlXJ40kT81QSDkjp hRvZo0JhJ6ydhYyJgFogAaDR0pLdRG8t0olOexFWwho91IToMx9V2Sf3pnCd0f90zmnd /2RGH0rtV97NeMyzgveZaFfNl38E8fgfLhMwjwzRtsmzbb577eJmsSZuGWyaCe9AsTxS vESda1RXQegc9O1YGPvuVAOdmXk897t93G/oyFViGG9qTTzbdrdn2cEnsjVREuYEfhXH pQCw== X-Gm-Message-State: AFqh2kqV8/3NBCCAXjfyLEhHEp7qZi7SK1C5E8aX4ePXyqxgYo0xXk6k ZfHTRUb10eUV9DieWdLhl2DwFoY3EYV164cv X-Received: by 2002:a62:1ac9:0:b0:57a:7b74:4ec5 with SMTP id a192-20020a621ac9000000b0057a7b744ec5mr26366412pfa.13.1674518472501; Mon, 23 Jan 2023 16:01:12 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id x21-20020a056a00189500b0058bc37f3d13sm174104pfh.43.2023.01.23.16.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 16:01:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, yier.jin@huawei.com, jonathan.cameron@huawei.com, leonardo.garcia@linaro.org Subject: [PATCH 15/22] target/arm: Use get_phys_addr_with_struct in S1_ptw_translate Date: Mon, 23 Jan 2023 14:00:20 -1000 Message-Id: <20230124000027.3565716-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230124000027.3565716-1-richard.henderson@linaro.org> References: <20230124000027.3565716-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 Do not provide a fast-path for physical addresses, as those will need to be validated for GPC. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/ptw.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 6b6f8195eb..37f5ff220c 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -234,29 +234,22 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, * From gdbstub, do not use softmmu so that we don't modify the * state of the cpu at all, including softmmu tlb contents. */ - if (regime_is_stage2(s2_mmu_idx)) { - S1Translate s2ptw = { - .in_mmu_idx = s2_mmu_idx, - .in_ptw_idx = arm_space_to_phys(space), - .in_space = space, - .in_secure = is_secure, - .in_debug = true, - }; - GetPhysAddrResult s2 = { }; + S1Translate s2ptw = { + .in_mmu_idx = s2_mmu_idx, + .in_ptw_idx = arm_space_to_phys(space), + .in_space = space, + .in_secure = is_secure, + .in_debug = true, + }; + GetPhysAddrResult s2 = { }; - if (get_phys_addr_lpae(env, &s2ptw, addr, MMU_DATA_LOAD, - false, &s2, fi)) { - goto fail; - } - ptw->out_phys = s2.f.phys_addr; - pte_attrs = s2.cacheattrs.attrs; - pte_secure = s2.f.attrs.secure; - } else { - /* Regime is physical. */ - ptw->out_phys = addr; - pte_attrs = 0; - pte_secure = is_secure; + if (get_phys_addr_with_struct(env, &s2ptw, addr, + MMU_DATA_LOAD, &s2, fi)) { + goto fail; } + ptw->out_phys = s2.f.phys_addr; + pte_attrs = s2.cacheattrs.attrs; + pte_secure = s2.f.attrs.secure; ptw->out_host = NULL; ptw->out_rw = false; } else {