qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org
Subject: [PATCH 07/10] target/arm: Implement SPAD, NSPAD, RLPAD
Date: Thu, 25 Sep 2025 17:11:31 -0700	[thread overview]
Message-ID: <20250926001134.295547-8-richard.henderson@linaro.org> (raw)
In-Reply-To: <20250926001134.295547-1-richard.henderson@linaro.org>

These bits disable all access to a particular address space.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/ptw.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 56a3cd8fa0..36917be83e 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -387,7 +387,25 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress,
     l0gptsz = 30 + FIELD_EX64(gpccr, GPCCR, L0GPTSZ);
 
     /*
-     * GPC Priority 2: Secure, Realm or Root address exceeds PPS.
+     * GPC Priority 2: Access to Secure, NonSecure or Realm is prevented
+     * by one of the GPCCR_EL3 address space disable bits (R_TCWMD).
+     * All of these bits are checked vs aa64_rme_gpc2 in gpccr_write.
+     */
+    {
+        static const uint8_t disable_masks[4] = {
+            [ARMSS_Secure] = R_GPCCR_SPAD_MASK,
+            [ARMSS_NonSecure] = R_GPCCR_NSPAD_MASK,
+            [ARMSS_Root] = 0,
+            [ARMSS_Realm] = R_GPCCR_RLPAD_MASK,
+        };
+
+        if (gpccr & disable_masks[pspace]) {
+            goto fault_fail;
+        }
+    }
+
+    /*
+     * GPC Priority 3: Secure, Realm or Root address exceeds PPS.
      * R_CPDSB: A NonSecure physical address input exceeding PPS
      * does not experience any fault.
      */
@@ -398,7 +416,7 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress,
         goto fault_size;
     }
 
-    /* GPC Priority 3: the base address of GPTBR_EL3 exceeds PPS. */
+    /* GPC Priority 4: the base address of GPTBR_EL3 exceeds PPS. */
     tableaddr = env->cp15.gptbr_el3 << 12;
     if (tableaddr & ~pps_mask) {
         goto fault_size;
@@ -502,6 +520,7 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress,
         goto fault_walk; /* reserved */
     }
 
+ fault_fail:
     fi->gpcf = GPCF_Fail;
     goto fault_common;
  fault_eabt:
-- 
2.43.0



  parent reply	other threads:[~2025-09-26  0:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
2025-09-26  0:11 ` [PATCH 01/10] target/arm: Add isar feature test for FEAT_RME_GPC2 Richard Henderson
2025-09-29 23:00   ` Pierrick Bouvier
2025-09-26  0:11 ` [PATCH 02/10] target/arm: Add GPCCR fields from ARM revision L.b Richard Henderson
2025-09-29 23:00   ` Pierrick Bouvier
2025-09-29 23:01   ` Pierrick Bouvier
2025-09-26  0:11 ` [PATCH 03/10] target/arm: Enable FEAT_RME_GPC2 bits in gpccr_write Richard Henderson
2025-09-29 23:02   ` Pierrick Bouvier
2025-09-26  0:11 ` [PATCH 04/10] target/arm: Add cur_space to S1Translate Richard Henderson
2025-09-29 23:03   ` Pierrick Bouvier
2025-09-26  0:11 ` [PATCH 05/10] target/arm: GPT_Secure is reserved without FEAT_SEL2 Richard Henderson
2025-09-29 23:03   ` Pierrick Bouvier
2025-09-26  0:11 ` [PATCH 06/10] target/arm: Implement GPT_NonSecureOnly Richard Henderson
2025-09-29 23:04   ` Pierrick Bouvier
2025-09-26  0:11 ` Richard Henderson [this message]
2025-09-29 23:04   ` [PATCH 07/10] target/arm: Implement SPAD, NSPAD, RLPAD Pierrick Bouvier
2025-09-26  0:11 ` [PATCH 08/10] target/arm: Fix GPT fault type for address outside PPS Richard Henderson
2025-09-29 23:04   ` Pierrick Bouvier
2025-09-26  0:11 ` [PATCH 09/10] target/arm: Implement APPSAA Richard Henderson
2025-09-29 23:05   ` Pierrick Bouvier
2025-09-26  0:11 ` [PATCH 10/10] target/arm: Enable FEAT_RME_GPC2 for -cpu max with x-rme Richard Henderson
2025-09-29 23:05   ` Pierrick Bouvier
2025-10-07 10:26 ` [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250926001134.295547-8-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).