From patchwork Fri Sep 6 11:13:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 825939 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp747022wrb; Fri, 6 Sep 2024 04:22:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUSzztDd/ORKJRDIgaebUh1kR0pZWhE691xdtG++dPwmgtMDoB2tusrLct/8FCFwzHaEvtKIg==@linaro.org X-Google-Smtp-Source: AGHT+IHb0LsCZgViz62WiB8WTc99mJf5GqCoKgOUaMOhOsGzNfbF2ffhFtxMnKG34ctBITd1d87u X-Received: by 2002:a05:622a:47cf:b0:458:176f:8b3f with SMTP id d75a77b69052e-458176f8cfcmr5161501cf.18.1725621720668; Fri, 06 Sep 2024 04:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725621720; cv=none; d=google.com; s=arc-20240605; b=jkzdpW/+7Dp0p9t/clxUf3Gu1tNsFkpZAVtw7+kxshuqX2L2eH7EPf76S3YTKeh029 4tfOEhLjopPjTE+RHEU8WtQ9eazIToI+RzofHqvioZev63LERXoqRSHb9HZoGfF4mM5w Rx22JIfB5me10//1E/7Sbl3ULwEHur5E98imUSQ18kV4qdjMnYD+kqO/iRGag5rlHXnP Dm8epyGZvHGB0Er4UGsifNieufzkPyLrGnRVThyQIXbAPt87vTRnDc975ssruyLE59Hm g6WdKqK2Tx0RdOaA4aKQv+E0YHcxh+J1HM1F0CcLgaHkSTwEM3Ygpd9CSoXksvr5VPC5 xgew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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; bh=JrfoACI/mTym/l4G+knHbzvTj28cS+hTZFZ1+Ijd0s0=; fh=GVpxzWVgxCvvCXX3SAS+60z9LiN7Up5XMzFHdPNgzgQ=; b=bjSsJf4oy7RrPIm/mqGtYLwoLnSxc2X+Jzk7FXgybqaqwhbVpnBdmE8dFAqVLtKdjT PfxnJ3yvLJFBTtq8W7gti+FVajQm7I6AB7ytFd470uxIeSFpkK4cTcB0EqctX7VsrP3+ A8vfhzLY+mJPqr1aDMER1nRncjwKJAO/IzXcI4XVl2OHJB359byvmDi/ecPQjb7CBoAD 7CO2/DMLyE4rVrImqAOA8Wx5wJbeQrzPHzfIBQnLH42DffedIMCS3K9kxsZYAki3A/Bw x76BQbJkMqiGNm3H1UiuYDT4bjihjtYrY27MZ5Ahld7EvCY8u579hNuzhKjHHbZYvqXf oilQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45809c8c397si24306591cf.412.2024.09.06.04.22.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Sep 2024 04:22:00 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smWzA-0000Uh-K5; Fri, 06 Sep 2024 07:18:40 -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 1smWz5-00088J-U1; Fri, 06 Sep 2024 07:18:36 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smWz4-0008Gf-3u; Fri, 06 Sep 2024 07:18:35 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 27FF98C4A9; Fri, 6 Sep 2024 14:12:10 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 33806133712; Fri, 6 Sep 2024 14:13:28 +0300 (MSK) Received: (nullmailer pid 353729 invoked by uid 1000); Fri, 06 Sep 2024 11:13:24 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Bernhard Beschow , Richard Henderson , Michael Tokarev Subject: [Stable-9.0.3 56/69] target/arm: Update translation regime comment for new features Date: Fri, 6 Sep 2024 14:13:05 +0300 Message-Id: <20240906111324.353230-56-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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-bounces+patch=linaro.org@nongnu.org From: Peter Maydell We have a long comment describing the Arm architectural translation regimes and how we map them to QEMU MMU indexes. This comment has got a bit out of date: * FEAT_SEL2 allows Secure EL2 and corresponding new regimes * FEAT_RME introduces Realm state and its translation regimes * We now model the Cortex-R52 so that is no longer a hypothetical * We separated Secure Stage 2 and NonSecure Stage 2 MMU indexes * We have an MMU index per physical address spacea Add the missing pieces so that the list of architectural translation regimes matches the Arm ARM, and the list and count of QEMU MMU indexes in the comment matches the enum. Signed-off-by: Peter Maydell Tested-by: Bernhard Beschow Reviewed-by: Richard Henderson Message-id: 20240809160430.1144805-2-peter.maydell@linaro.org (cherry picked from commit 150c24f34e9c3388c0f0ad04ddd997e5559db800) Signed-off-by: Michael Tokarev (Mjt: pick this one for stable-9.0 so the next commit applies cleanly) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index bc0c84873f..7c721f22bd 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2687,8 +2687,14 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); * + NonSecure EL1 & 0 stage 2 * + NonSecure EL2 * + NonSecure EL2 & 0 (ARMv8.1-VHE) - * + Secure EL1 & 0 - * + Secure EL3 + * + Secure EL1 & 0 stage 1 + * + Secure EL1 & 0 stage 2 (FEAT_SEL2) + * + Secure EL2 (FEAT_SEL2) + * + Secure EL2 & 0 (FEAT_SEL2) + * + Realm EL1 & 0 stage 1 (FEAT_RME) + * + Realm EL1 & 0 stage 2 (FEAT_RME) + * + Realm EL2 (FEAT_RME) + * + EL3 * If EL3 is 32-bit: * + NonSecure PL1 & 0 stage 1 * + NonSecure PL1 & 0 stage 2 @@ -2720,10 +2726,12 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); * table over and over. * 6. we need separate EL1/EL2 mmu_idx for handling the Privileged Access * Never (PAN) bit within PSTATE. - * 7. we fold together the secure and non-secure regimes for A-profile, + * 7. we fold together most secure and non-secure regimes for A-profile, * because there are no banked system registers for aarch64, so the * process of switching between secure and non-secure is * already heavyweight. + * 8. we cannot fold together Stage 2 Secure and Stage 2 NonSecure, + * because both are in use simultaneously for Secure EL2. * * This gives us the following list of cases: * @@ -2735,14 +2743,15 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); * EL2 EL2&0 +PAN * EL2 (aka NS PL2) * EL3 (aka S PL1) - * Physical (NS & S) - * Stage2 (NS & S) + * Stage2 Secure + * Stage2 NonSecure + * plus one TLB per Physical address space: S, NS, Realm, Root * - * for a total of 12 different mmu_idx. + * for a total of 14 different mmu_idx. * * R profile CPUs have an MPU, but can use the same set of MMU indexes * as A profile. They only need to distinguish EL0 and EL1 (and - * EL2 if we ever model a Cortex-R52). + * EL2 for cores like the Cortex-R52). * * M profile CPUs are rather different as they do not have a true MMU. * They have the following different MMU indexes: