From patchwork Mon Oct 10 14:27:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 613744 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2020831pvb; Mon, 10 Oct 2022 07:45:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6l9dNZed9YxiNJRDAjE5Au71T1O8/3ucW+k7ZtzJ7tEyzbvTSjpmwKIEJj0oFXrdxESjc7 X-Received: by 2002:a05:620a:178b:b0:6ce:7f8e:63b4 with SMTP id ay11-20020a05620a178b00b006ce7f8e63b4mr12280149qkb.686.1665413152695; Mon, 10 Oct 2022 07:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665413152; cv=none; d=google.com; s=arc-20160816; b=koq9asMw7XXj0uJIm4UMQSsa5Cwqg+kH+fX223iVOYY7MlbfZxWfwJzJ6KQcMine5o 5eOTLbwNRWOOSlMzRQa3e1YNc15F1HtfS76348e8agpBE8EkHe9qN22IpCuVyNJG0Xw1 YVjuBpjNTYYaEJIUqvDaNMDQuyV9LX2rUR7vWJi9Gdi1MCK2WG5Y7MYZS93Sm/15IAWc duNfAubAEL+BJiWc6a/4HTe8W5aXeeKyd/cnWmTjVqDGJCtt7VsI+m04qOJhF6Yi7tw+ DnpBpQCCCbx+jkoPKkQJ5F9drEUA/OO2lK86wN5E5rK1IMJCeQCfUiKyfaPjJe17mG+P ckhA== 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:to:from :dkim-signature; bh=2Cbe2RL9yMwjYDxnJ88DM/XvOfa2sAnKZm5Pr+E4U18=; b=fGMwTK7wsemgt0PXw/1DNvVOmf8kN8hor7fg/IPHLOYW0ccLF5uqMwRgjX91J/YVBp t/K8pe3s5lkXTRxT0VjRVvgA95qpivOiaibQgseLCcmG3twWKUfyEroYpp2tW08PPs1Q bd7ON3EbXjfZQg1mRe9wZN9PTRR/tl8Jn6uOGGAyPrhm2yfmmks3bNz3UcFgznc7gcH1 /ylW1PS2LbQIdsbzuXkktb/QQB9I5TQ7itZXzg3Aw/+yPixzje7/Gua8NqKPG16XmEoV 4Tk2/bMcfUsH/0fM9BVpjUcyyvr000mq9zDOIFd0UC4TYLAdyP58j4CW9aF+LZ5YVjGC GNyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I8AO2BQl; 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 cj5-20020a05622a258500b0033c616d2192si2099976qtb.713.2022.10.10.07.45.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Oct 2022 07:45:52 -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=I8AO2BQl; 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]:53090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohu2S-0003Lt-42 for patch@linaro.org; Mon, 10 Oct 2022 10:45:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohtkz-0006M0-0Z for qemu-devel@nongnu.org; Mon, 10 Oct 2022 10:27:49 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:38835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohtkx-0005Z2-AK for qemu-devel@nongnu.org; Mon, 10 Oct 2022 10:27:48 -0400 Received: by mail-wm1-x32e.google.com with SMTP id r8-20020a1c4408000000b003c47d5fd475so3428373wma.3 for ; Mon, 10 Oct 2022 07:27:46 -0700 (PDT) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2Cbe2RL9yMwjYDxnJ88DM/XvOfa2sAnKZm5Pr+E4U18=; b=I8AO2BQlGi0OFo2JbvQC05h1uDBvy1KJkfrLsqU61mW9L8CfUsboHqtDEUTDWtFYAY 5UZdOZU0jkixWiW2CmOnYjkAnC8RcixZJVQY/VVlgVvsqE+iJQLQY356MHDauGDz0Vp/ XSKkUU8ntXKUezIM911+uhVusEXxxs/76Eo6vwtRHTI4t9htPt5r8wTHlF7AH5zCBomy hd/3LiSFg3AEopbnBGT600GN34IEwYdLMBMMbjU7ulEfrlxr72b1Dtnvavm9Ju3k7t04 r/v6yPaS5/5AGvuGHxXakrwjrCh5+kqbSwkO5tEQc5TTXq0ecifsqwYwU0XgNuLYCYPW Q74g== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Cbe2RL9yMwjYDxnJ88DM/XvOfa2sAnKZm5Pr+E4U18=; b=at8o/sNQg3GfYXYkj1vbp2pmf1lQNW+JfCN+4PE0b1IdazWQC+KQep9Io2DZ3QDknh SqPM4QXklguEbFn8EGkfbMqynArvnDVyCTyuwpmyG5tzLEYS5rS3Fs7wCh5rHu12Fykp xicsh4eo5yb13swpM+EpZ4XxOEyix83cp5U2EdaDFPHxUIPKdbkHwwosAJh8pNscda2X WjkUYoxRA2TXwbKMF9bM04WQRGLtLgGpFmCVqxLGt7DTnehuup7CUvSiOizgEqBUj0Sq sL0fUoVN/KZ3+vRAnBWLK7EwRN7NLITzvctlw55RHsORqtf4i7bYhX9OauBSxLJ4pgAM WOTw== X-Gm-Message-State: ACrzQf0QKPm63DWeMU9woS6m7eJ6yFeEGoVrV1T1ghn+sTd0aaQcZZAA 5A99jKTbUvEyI13lLV2Z10OO7qsTL9ExNg== X-Received: by 2002:a7b:c455:0:b0:3c6:bd0e:f9b0 with SMTP id l21-20020a7bc455000000b003c6bd0ef9b0mr2272212wmi.21.1665412066330; Mon, 10 Oct 2022 07:27:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfed46000000b0022e04bfa661sm9037054wro.59.2022.10.10.07.27.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 07:27:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/28] target/arm: Add is_secure parameter to do_ats_write Date: Mon, 10 Oct 2022 15:27:15 +0100 Message-Id: <20221010142730.502083-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221010142730.502083-1-peter.maydell@linaro.org> References: <20221010142730.502083-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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.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" From: Richard Henderson Use get_phys_addr_with_secure directly. For a-profile, this is the one place where the value of is_secure may not equal arm_is_secure(env). Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20221001162318.153420-10-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 8d82c147623..fd4663a9467 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3191,7 +3191,8 @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri, #ifdef CONFIG_TCG static uint64_t do_ats_write(CPUARMState *env, uint64_t value, - MMUAccessType access_type, ARMMMUIdx mmu_idx) + MMUAccessType access_type, ARMMMUIdx mmu_idx, + bool is_secure) { bool ret; uint64_t par64; @@ -3199,7 +3200,8 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, ARMMMUFaultInfo fi = {}; GetPhysAddrResult res = {}; - ret = get_phys_addr(env, value, access_type, mmu_idx, &res, &fi); + ret = get_phys_addr_with_secure(env, value, access_type, mmu_idx, + is_secure, &res, &fi); /* * ATS operations only do S1 or S1+S2 translations, so we never @@ -3371,6 +3373,7 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) switch (el) { case 3: mmu_idx = ARMMMUIdx_SE3; + secure = true; break; case 2: g_assert(!secure); /* ARMv8.4-SecEL2 is 64-bit only */ @@ -3392,6 +3395,7 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) switch (el) { case 3: mmu_idx = ARMMMUIdx_SE10_0; + secure = true; break; case 2: g_assert(!secure); /* ARMv8.4-SecEL2 is 64-bit only */ @@ -3407,16 +3411,18 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) case 4: /* stage 1+2 NonSecure PL1: ATS12NSOPR, ATS12NSOPW */ mmu_idx = ARMMMUIdx_E10_1; + secure = false; break; case 6: /* stage 1+2 NonSecure PL0: ATS12NSOUR, ATS12NSOUW */ mmu_idx = ARMMMUIdx_E10_0; + secure = false; break; default: g_assert_not_reached(); } - par64 = do_ats_write(env, value, access_type, mmu_idx); + par64 = do_ats_write(env, value, access_type, mmu_idx, secure); A32_BANKED_CURRENT_REG_SET(env, par, par64); #else @@ -3432,7 +3438,8 @@ static void ats1h_write(CPUARMState *env, const ARMCPRegInfo *ri, MMUAccessType access_type = ri->opc2 & 1 ? MMU_DATA_STORE : MMU_DATA_LOAD; uint64_t par64; - par64 = do_ats_write(env, value, access_type, ARMMMUIdx_E2); + /* There is no SecureEL2 for AArch32. */ + par64 = do_ats_write(env, value, access_type, ARMMMUIdx_E2, false); A32_BANKED_CURRENT_REG_SET(env, par, par64); #else @@ -3475,6 +3482,7 @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri, break; case 6: /* AT S1E3R, AT S1E3W */ mmu_idx = ARMMMUIdx_SE3; + secure = true; break; default: g_assert_not_reached(); @@ -3493,7 +3501,8 @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri, g_assert_not_reached(); } - env->cp15.par_el[1] = do_ats_write(env, value, access_type, mmu_idx); + env->cp15.par_el[1] = do_ats_write(env, value, access_type, + mmu_idx, secure); #else /* Handled by hardware accelerator. */ g_assert_not_reached();