From nobody Tue Feb 10 12:59:10 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1656838376; cv=none; d=zohomail.com; s=zohoarc; b=RQBAAXKbrKsUdJPNyjVoyqd8Z0K6pecctH4IP+8WGOT2ekXvJO3yx1fPTUaJdxbFn8fyTil4+qEUNLgeRdmvLHlaZgwo0F6PiaCgI8I5rd3EHJxH7l/6O3HYtCJdPwUUFoIWnYiqul3cxcNMspTqWzTA8Ltr9tFX0CFGDrhRJ2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656838376; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HoZLv2+HUiSgRn8yhxEf96NQZLTisYlzO31dNJIvCns=; b=C/SIKWF1egaxiWok8qAzQZZUF2x6X2n+0kVpiNXhHX4Peb9shK0HaPOagPbJkJON1g5floGFYqswrl6hP4D8oHFDH2/O1YeyDkYX3VftpyAqnEErDjtYYDbfWSdoYSBSoqSsC8NpsUKSRHwg49+YxJEXETajt5iS0vBlr1+gFEY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165683837592852.885470075032; Sun, 3 Jul 2022 01:52:55 -0700 (PDT) Received: from localhost ([::1]:49084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7vLa-0008Ff-Ma for importer@patchew.org; Sun, 03 Jul 2022 04:52:54 -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) 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) 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-Google-Smtp-Source: AGRyM1vhNwJIhVNsdevKpfHGf1YRZmeDz96vptyG1XjcTpMFw02m4ktNJV4QnyMN2UOTw/A/oHSulw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1656838377060100001 Content-Type: text/plain; charset="utf-8" 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; =20 +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_id= x, + bool is_secure, GetPhysAddrResult *result, + ARMMMUFaultInfo *fi) { ARMMMUIdx s1_mmu_idx =3D stage_1_mmu_idx(mmu_idx); - bool is_secure =3D regime_is_secure(env, mmu_idx); =20 if (mmu_idx !=3D s1_mmu_idx) { /* @@ -2300,8 +2300,8 @@ bool get_phys_addr(CPUARMState *env, target_ulong add= ress, ARMMMUIdx s2_mmu_idx; bool is_el0; =20 - ret =3D get_phys_addr(env, address, access_type, s1_mmu_idx, - result, fi); + ret =3D get_phys_addr_with_secure(env, address, access_type, + s1_mmu_idx, is_secure, result,= fi); =20 /* 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 ad= dress, } } =20 +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) { --=20 2.34.1