From patchwork Sun Jul 3 08:23:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 586823 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2922052mab; Sun, 3 Jul 2022 01:52:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s2b+94zUX70H/A5XfT4w+c8J9EAW99ShXUy7iJaRrx5Dvax2wk+VF04bas3GWIAGpMZGMN X-Received: by 2002:a25:d381:0:b0:66e:2943:1c9d with SMTP id e123-20020a25d381000000b0066e29431c9dmr5555350ybf.67.1656838323156; Sun, 03 Jul 2022 01:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656838323; cv=none; d=google.com; s=arc-20160816; b=tTiltTjQ44z0zRI8re/+bQvN/nI2iKL4262sn4mYsyxvfK75XbfBpaTcD0bMoFJHQJ 3Sc/8L5FgbmJB+IEwU7A6OxcC8zVkkfbxISwS1/p48yRTDBWmqsmGs0PP6sq77BBgSrg fxJb6puWABAgQAjrNxdeHrWLv5nBbhOtD1ttUlOS8VX17C7mkzGnbu8uVcLVh72RmKnu q0nnsz8KPTOwgHql1jJASjQVhgoVK3pOc9QMt/OUt4ZSLmrKxa1MXJogGbplEQGeTNKy Jm8MlZ1FVm3L5xZ1OCoEd7AIwQgJJqhFSg1gWi97XWnQpoJJnFKP6M3Lxl5U8KW2rkwt tVHg== 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=HoZLv2+HUiSgRn8yhxEf96NQZLTisYlzO31dNJIvCns=; b=nIH6qNwp0yZrd/LOZEShE00oGd5opdMVeIMJyYwMlzWiEaCFtXPYNcOFfUASOT32kY 0FLwJCimSbNdDEPmsw2vayokkakQ1pgrFKHFs7PLjFdBSOapwL78BbUPzCNX2u3BZt2r cFtw1puA4cpNRySLRAFFxFSyo90kfas+AG4EmcQXwuC4BeSa/yaWDCl0WY6PNwC72SLD Mhg0OgWYkkZ6FJbUFYHdUgGiCoMDqpkQ+loZ5igZtpJp+r9DWukx8P9v4f0uUDYtddci gabzQIZRfjJLzdaV8ZSyIcdU2trzlVmBJBSDjSIFtgGHojbwJecWEj6us9tEEXqkJi/x lkxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F3xXxFbS; 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 141-20020a810693000000b0031c8544113dsi4217942ywg.471.2022.07.03.01.52.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Jul 2022 01:52:03 -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=F3xXxFbS; 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]:45062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7vKk-0005Tq-M3 for patch@linaro.org; Sun, 03 Jul 2022 04:52:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7uvR-0008R8-JA for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:25:53 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:44817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7uvP-00068p-To for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:25:53 -0400 Received: by mail-pl1-x634.google.com with SMTP id l6so6001679plg.11 for ; Sun, 03 Jul 2022 01:25:51 -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=HoZLv2+HUiSgRn8yhxEf96NQZLTisYlzO31dNJIvCns=; b=F3xXxFbSkfqe1hxOLk3LUcYR/RR44tqnVAH5Ot5sr4R+iiKg7xdXdIOMPxOgXNcThC OWSjmyScf4UQBVp/BWF0c8AfoF3yz1IzgzGtuXZJnrnlBGNncfGRn6bNsSP8LZ6/CB60 TCUXvEDRKu4FDmg+yZBECMowZ7QELYw6EaMb0/Scj6JY8EurTnAYvBX3Vuem13pyowpf FZBHusbMw4tq2qbFKjRzRMMrhlgwDTbHbTQGnNwYl3diI6YuODx3+fZ6iWlTSxPAMVJG Ij1ot5uo1YlKaynDcrniKnPjeJ0VEsaVOb9HUNEDTEmcbtxzVbZooXEEC2OorvSqaPIR utdg== 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=HoZLv2+HUiSgRn8yhxEf96NQZLTisYlzO31dNJIvCns=; b=Ezflh0dPlxRgFrna6B1BsT0uBAl2n1fg7IUEaaVGIzntJ9sp+yWMoMOPUi0YZD+IBO OPSa/rF06olSKEVWTOrSI1Cvlp8rfTBKLUL4KPWxGerVAYGKIONOh7/bRy3cut2zBx6P V0Un7qzml39yczZhaBO711Zf9VnJjfBresapKSCoIW5L0466gBZNfw12SJlBYSGJn5hZ lhBdNuhq1LNP+k99rSem4gDEj3FBJp46oEuM5f+LwopvNjLCKE+nNc+A5Dj/raL52/te fwOd76q4dDhMH2paI8bM+Mvlk56FEANT0nanjfvrU7gJzIYaxyRAE+poBjyS7I/SbQYA uWaw== X-Gm-Message-State: AJIora8l1T0aQPI/1NvHawCKnqnzqlKu6Y+8BoHyS+AQIUw2lJIPWVJv jshuDFBL02RL1NQRUAew8X8kV4LQx4sqWb6X X-Received: by 2002:a17:90a:4f0f:b0:1ee:f746:eca7 with SMTP id p15-20020a17090a4f0f00b001eef746eca7mr28693718pjh.122.1656836751140; Sun, 03 Jul 2022 01:25:51 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id im22-20020a170902bb1600b0016a3f9e528asm13569112plb.57.2022.07.03.01.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 01:25:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 28/62] target/arm: Split out get_phys_addr_with_secure Date: Sun, 3 Jul 2022 13:53:45 +0530 Message-Id: <20220703082419.770989-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220703082419.770989-1-richard.henderson@linaro.org> References: <20220703082419.770989-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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=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" Retain the existing get_phys_addr interface using the security state derived from mmu_idx. Signed-off-by: Richard Henderson --- target/arm/internals.h | 6 ++++++ target/arm/ptw.c | 21 +++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index f75ac2e1b7..81c386ee15 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1136,6 +1136,12 @@ typedef struct GetPhysAddrResult { ARMCacheAttrs cacheattrs; } GetPhysAddrResult; +bool get_phys_addr_with_secure(CPUARMState *env, target_ulong address, + MMUAccessType access_type, + ARMMMUIdx mmu_idx, bool is_secure, + GetPhysAddrResult *result, ARMMMUFaultInfo *fi) + __attribute__((nonnull)); + bool get_phys_addr(CPUARMState *env, target_ulong address, MMUAccessType access_type, ARMMMUIdx mmu_idx, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 340f73997a..b25e3a8c87 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2279,12 +2279,12 @@ static ARMCacheAttrs combine_cacheattrs(CPUARMState *env, * @result: set on translation success. * @fi: set to fault info if the translation fails */ -bool get_phys_addr(CPUARMState *env, target_ulong address, - MMUAccessType access_type, ARMMMUIdx mmu_idx, - GetPhysAddrResult *result, ARMMMUFaultInfo *fi) +bool get_phys_addr_with_secure(CPUARMState *env, target_ulong address, + MMUAccessType access_type, ARMMMUIdx mmu_idx, + bool is_secure, GetPhysAddrResult *result, + ARMMMUFaultInfo *fi) { ARMMMUIdx s1_mmu_idx = stage_1_mmu_idx(mmu_idx); - bool is_secure = regime_is_secure(env, mmu_idx); if (mmu_idx != s1_mmu_idx) { /* @@ -2300,8 +2300,8 @@ bool get_phys_addr(CPUARMState *env, target_ulong address, ARMMMUIdx s2_mmu_idx; bool is_el0; - ret = get_phys_addr(env, address, access_type, s1_mmu_idx, - result, fi); + ret = get_phys_addr_with_secure(env, address, access_type, + s1_mmu_idx, is_secure, result, fi); /* If S1 fails or S2 is disabled, return early. */ if (ret || regime_translation_disabled(env, ARMMMUIdx_Stage2, @@ -2511,6 +2511,15 @@ bool get_phys_addr(CPUARMState *env, target_ulong address, } } +bool get_phys_addr(CPUARMState *env, target_ulong address, + MMUAccessType access_type, ARMMMUIdx mmu_idx, + GetPhysAddrResult *result, ARMMMUFaultInfo *fi) +{ + return get_phys_addr_with_secure(env, address, access_type, mmu_idx, + regime_is_secure(env, mmu_idx), + result, fi); +} + hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, MemTxAttrs *attrs) {