qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2
@ 2025-09-26  0:11 Richard Henderson
  2025-09-26  0:11 ` [PATCH 01/10] target/arm: Add isar feature test for FEAT_RME_GPC2 Richard Henderson
                   ` (10 more replies)
  0 siblings, 11 replies; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

Note that patch 4 will conflict with patch 5 of the FEAT_GCS patch
set, and I'm inclined to think this cleanup might go first.

This is otherwise a reasonably simple extension.


r~


Richard Henderson (10):
  target/arm: Add isar feature test for FEAT_RME_GPC2
  target/arm: Add GPCCR fields from ARM revision L.b
  target/arm: Enable FEAT_RME_GPC2 bits in gpccr_write
  target/arm: Add cur_space to S1Translate
  target/arm: GPT_Secure is reserved without FEAT_SEL2
  target/arm: Implement GPT_NonSecureOnly
  target/arm: Implement SPAD, NSPAD, RLPAD
  target/arm: Fix GPT fault type for address outside PPS
  target/arm: Implement APPSAA
  target/arm: Enable FEAT_RME_GPC2 for -cpu max with x-rme

 target/arm/cpu-features.h     |  5 ++
 target/arm/cpu.h              |  6 +++
 target/arm/helper.c           |  5 ++
 target/arm/ptw.c              | 95 +++++++++++++++++++++++------------
 target/arm/tcg/cpu64.c        |  3 +-
 docs/system/arm/emulation.rst |  1 +
 6 files changed, 83 insertions(+), 32 deletions(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 01/10] target/arm: Add isar feature test for FEAT_RME_GPC2
  2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
@ 2025-09-26  0:11 ` 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
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/cpu-features.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h
index 512eeaf551..2214b0ee08 100644
--- a/target/arm/cpu-features.h
+++ b/target/arm/cpu-features.h
@@ -676,6 +676,11 @@ static inline bool isar_feature_aa64_rme(const ARMISARegisters *id)
     return FIELD_EX64_IDREG(id, ID_AA64PFR0, RME) != 0;
 }
 
+static inline bool isar_feature_aa64_rme_gpc2(const ARMISARegisters *id)
+{
+    return FIELD_EX64_IDREG(id, ID_AA64PFR0, RME) >= 2;
+}
+
 static inline bool isar_feature_aa64_dit(const ARMISARegisters *id)
 {
     return FIELD_EX64_IDREG(id, ID_AA64PFR0, DIT) != 0;
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 02/10] target/arm: Add GPCCR fields from ARM revision L.b
  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-26  0:11 ` 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
                   ` (8 subsequent siblings)
  10 siblings, 2 replies; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/cpu.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 1c0deb723d..c4235fa5ef 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -2405,13 +2405,19 @@ FIELD(MVFR2, SIMDMISC, 0, 4)
 FIELD(MVFR2, FPMISC, 4, 4)
 
 FIELD(GPCCR, PPS, 0, 3)
+FIELD(GPCCR, RLPAD, 5, 1)
+FIELD(GPCCR, NSPAD, 6, 1)
+FIELD(GPCCR, SPAD, 7, 1)
 FIELD(GPCCR, IRGN, 8, 2)
 FIELD(GPCCR, ORGN, 10, 2)
 FIELD(GPCCR, SH, 12, 2)
 FIELD(GPCCR, PGS, 14, 2)
 FIELD(GPCCR, GPC, 16, 1)
 FIELD(GPCCR, GPCP, 17, 1)
+FIELD(GPCCR, TBGPCD, 18, 1)
+FIELD(GPCCR, NSO, 19, 1)
 FIELD(GPCCR, L0GPTSZ, 20, 4)
+FIELD(GPCCR, APPSAA, 24, 1)
 
 FIELD(MFAR, FPA, 12, 40)
 FIELD(MFAR, NSE, 62, 1)
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 03/10] target/arm: Enable FEAT_RME_GPC2 bits in gpccr_write
  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-26  0:11 ` [PATCH 02/10] target/arm: Add GPCCR fields from ARM revision L.b Richard Henderson
@ 2025-09-26  0:11 ` 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
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

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

diff --git a/target/arm/helper.c b/target/arm/helper.c
index c44294711f..bfc40c505e 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -5109,6 +5109,11 @@ static void gpccr_write(CPUARMState *env, const ARMCPRegInfo *ri,
         R_GPCCR_ORGN_MASK | R_GPCCR_SH_MASK | R_GPCCR_PGS_MASK |
         R_GPCCR_GPC_MASK | R_GPCCR_GPCP_MASK;
 
+    if (cpu_isar_feature(aa64_rme_gpc2, env_archcpu(env))) {
+        rw_mask |= R_GPCCR_APPSAA_MASK | R_GPCCR_NSO_MASK |
+                   R_GPCCR_SPAD_MASK | R_GPCCR_NSPAD_MASK | R_GPCCR_RLPAD_MASK;
+    }
+
     env->cp15.gpccr_el3 = (value & rw_mask) | (env->cp15.gpccr_el3 & ~rw_mask);
 }
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 04/10] target/arm: Add cur_space to S1Translate
  2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
                   ` (2 preceding siblings ...)
  2025-09-26  0:11 ` [PATCH 03/10] target/arm: Enable FEAT_RME_GPC2 bits in gpccr_write Richard Henderson
@ 2025-09-26  0:11 ` 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
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

We've been updating in_space and then using hacks to access
the original space.  Instead, update cur_space and leave
in_space unchanged.

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

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 6344971fa6..1cafe8f4f7 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -36,8 +36,6 @@ typedef struct S1Translate {
     /*
      * in_space: the security space for this walk. This plus
      * the in_mmu_idx specify the architectural translation regime.
-     * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
-     * this field is updated accordingly.
      *
      * Note that the security space for the in_ptw_idx may be different
      * from that for the in_mmu_idx. We do not need to explicitly track
@@ -52,6 +50,11 @@ typedef struct S1Translate {
      *    value being Stage2 vs Stage2_S distinguishes those.
      */
     ARMSecuritySpace in_space;
+    /*
+     * Like in_space, except this may be "downgraded" to NonSecure
+     * by an NSTable bit.
+     */
+    ARMSecuritySpace cur_space;
     /*
      * in_debug: is this a QEMU debug access (gdbstub, etc)? Debug
      * accesses will not update the guest page table access flags
@@ -587,7 +590,8 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
          * From gdbstub, do not use softmmu so that we don't modify the
          * state of the cpu at all, including softmmu tlb contents.
          */
-        ARMSecuritySpace s2_space = S2_security_space(ptw->in_space, s2_mmu_idx);
+        ARMSecuritySpace s2_space
+            = S2_security_space(ptw->cur_space, s2_mmu_idx);
         S1Translate s2ptw = {
             .in_mmu_idx = s2_mmu_idx,
             .in_ptw_idx = ptw_idx_for_stage_2(env, s2_mmu_idx),
@@ -630,7 +634,7 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
     }
 
     if (regime_is_stage2(s2_mmu_idx)) {
-        uint64_t hcr = arm_hcr_el2_eff_secstate(env, ptw->in_space);
+        uint64_t hcr = arm_hcr_el2_eff_secstate(env, ptw->cur_space);
 
         if ((hcr & HCR_PTW) && S2_attrs_are_device(hcr, pte_attrs)) {
             /*
@@ -641,7 +645,7 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
             fi->s2addr = addr;
             fi->stage2 = true;
             fi->s1ptw = true;
-            fi->s1ns = fault_s1ns(ptw->in_space, s2_mmu_idx);
+            fi->s1ns = fault_s1ns(ptw->cur_space, s2_mmu_idx);
             return false;
         }
     }
@@ -657,7 +661,7 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
     fi->s2addr = addr;
     fi->stage2 = regime_is_stage2(s2_mmu_idx);
     fi->s1ptw = fi->stage2;
-    fi->s1ns = fault_s1ns(ptw->in_space, s2_mmu_idx);
+    fi->s1ns = fault_s1ns(ptw->cur_space, s2_mmu_idx);
     return false;
 }
 
@@ -844,7 +848,7 @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
             fi->s2addr = ptw->out_virt;
             fi->stage2 = true;
             fi->s1ptw = true;
-            fi->s1ns = fault_s1ns(ptw->in_space, ptw->in_ptw_idx);
+            fi->s1ns = fault_s1ns(ptw->cur_space, ptw->in_ptw_idx);
             return 0;
         }
 
@@ -1224,7 +1228,7 @@ static bool get_phys_addr_v6(CPUARMState *env, S1Translate *ptw,
             g_assert_not_reached();
         }
     }
-    out_space = ptw->in_space;
+    out_space = ptw->cur_space;
     if (ns) {
         /*
          * The NS bit will (as required by the architecture) have no effect if
@@ -1254,7 +1258,7 @@ static bool get_phys_addr_v6(CPUARMState *env, S1Translate *ptw,
         }
 
         result->f.prot = get_S1prot(env, mmu_idx, false, user_rw, prot_rw,
-                                    xn, pxn, result->f.attrs.space, out_space);
+                                    xn, pxn, ptw->in_space, out_space);
         if (ptw->in_prot_check & ~result->f.prot) {
             /* Access permission fault.  */
             fi->type = ARMFault_Permission;
@@ -1857,7 +1861,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
      * NonSecure.  With RME, the EL3 translation regime does not change
      * from Root to NonSecure.
      */
-    if (ptw->in_space == ARMSS_Secure
+    if (ptw->cur_space == ARMSS_Secure
         && !regime_is_stage2(mmu_idx)
         && extract32(tableattrs, 4, 1)) {
         /*
@@ -1867,7 +1871,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
         QEMU_BUILD_BUG_ON(ARMMMUIdx_Phys_S + 1 != ARMMMUIdx_Phys_NS);
         QEMU_BUILD_BUG_ON(ARMMMUIdx_Stage2_S + 1 != ARMMMUIdx_Stage2);
         ptw->in_ptw_idx += 1;
-        ptw->in_space = ARMSS_NonSecure;
+        ptw->cur_space = ARMSS_NonSecure;
     }
 
     if (!S1_ptw_translate(env, ptw, descaddr, fi)) {
@@ -1991,7 +1995,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
     }
 
     ap = extract32(attrs, 6, 2);
-    out_space = ptw->in_space;
+    out_space = ptw->cur_space;
     if (regime_is_stage2(mmu_idx)) {
         /*
          * R_GYNXY: For stage2 in Realm security state, bit 55 is NS.
@@ -2089,12 +2093,8 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
 
         user_rw = simple_ap_to_rw_prot_is_user(ap, true);
         prot_rw = simple_ap_to_rw_prot_is_user(ap, false);
-        /*
-         * Note that we modified ptw->in_space earlier for NSTable, but
-         * result->f.attrs retains a copy of the original security space.
-         */
         result->f.prot = get_S1prot(env, mmu_idx, aarch64, user_rw, prot_rw,
-                                    xn, pxn, result->f.attrs.space, out_space);
+                                    xn, pxn, ptw->in_space, out_space);
 
         /* Index into MAIR registers for cache attributes */
         attrindx = extract32(attrs, 2, 3);
@@ -2192,7 +2192,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
         fi->level = level;
         fi->stage2 = regime_is_stage2(mmu_idx);
     }
-    fi->s1ns = fault_s1ns(ptw->in_space, mmu_idx);
+    fi->s1ns = fault_s1ns(ptw->cur_space, mmu_idx);
     return true;
 }
 
@@ -3413,6 +3413,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
      * cannot upgrade a NonSecure translation regime's attributes
      * to Secure or Realm.
      */
+    ptw->cur_space = ptw->in_space;
     result->f.attrs.space = ptw->in_space;
     result->f.attrs.secure = arm_space_is_secure(ptw->in_space);
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 05/10] target/arm: GPT_Secure is reserved without FEAT_SEL2
  2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
                   ` (3 preceding siblings ...)
  2025-09-26  0:11 ` [PATCH 04/10] target/arm: Add cur_space to S1Translate Richard Henderson
@ 2025-09-26  0:11 ` Richard Henderson
  2025-09-29 23:03   ` Pierrick Bouvier
  2025-09-26  0:11 ` [PATCH 06/10] target/arm: Implement GPT_NonSecureOnly Richard Henderson
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

For GPT_Secure, if SEL2 is not enabled, raise a GPCF_Walk exception.

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

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 1cafe8f4f7..3df5d4da12 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -478,10 +478,14 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress,
         break;
     case 0b1111: /* all access */
         return true;
-    case 0b1000:
-    case 0b1001:
-    case 0b1010:
-    case 0b1011:
+    case 0b1000: /* secure */
+        if (!cpu_isar_feature(aa64_sel2, cpu)) {
+            goto fault_walk;
+        }
+        /* fall through */
+    case 0b1001: /* non-secure */
+    case 0b1010: /* root */
+    case 0b1011: /* realm */
         if (pspace == (gpi & 3)) {
             return true;
         }
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 06/10] target/arm: Implement GPT_NonSecureOnly
  2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
                   ` (4 preceding siblings ...)
  2025-09-26  0:11 ` [PATCH 05/10] target/arm: GPT_Secure is reserved without FEAT_SEL2 Richard Henderson
@ 2025-09-26  0:11 ` Richard Henderson
  2025-09-29 23:04   ` Pierrick Bouvier
  2025-09-26  0:11 ` [PATCH 07/10] target/arm: Implement SPAD, NSPAD, RLPAD Richard Henderson
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

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

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 3df5d4da12..56a3cd8fa0 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -318,6 +318,7 @@ static bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx,
 
 static bool granule_protection_check(CPUARMState *env, uint64_t paddress,
                                      ARMSecuritySpace pspace,
+                                     ARMSecuritySpace ss,
                                      ARMMMUFaultInfo *fi)
 {
     MemTxAttrs attrs = {
@@ -490,6 +491,13 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress,
             return true;
         }
         break;
+    case 0b1101: /* non-secure only */
+        /* aa64_rme_gpc2 was checked in gpccr_write */
+        if (FIELD_EX64(gpccr, GPCCR, NSO)) {
+            return (pspace == ARMSS_NonSecure &&
+                    (ss == ARMSS_NonSecure || ss == ARMSS_Root));
+        }
+        goto fault_walk;
     default:
         goto fault_walk; /* reserved */
     }
@@ -3553,7 +3561,7 @@ static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw,
         return true;
     }
     if (!granule_protection_check(env, result->f.phys_addr,
-                                  result->f.attrs.space, fi)) {
+                                  result->f.attrs.space, ptw->in_space, fi)) {
         fi->type = ARMFault_GPCFOnOutput;
         return true;
     }
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 07/10] target/arm: Implement SPAD, NSPAD, RLPAD
  2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
                   ` (5 preceding siblings ...)
  2025-09-26  0:11 ` [PATCH 06/10] target/arm: Implement GPT_NonSecureOnly Richard Henderson
@ 2025-09-26  0:11 ` Richard Henderson
  2025-09-29 23:04   ` Pierrick Bouvier
  2025-09-26  0:11 ` [PATCH 08/10] target/arm: Fix GPT fault type for address outside PPS Richard Henderson
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

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



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 08/10] target/arm: Fix GPT fault type for address outside PPS
  2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
                   ` (6 preceding siblings ...)
  2025-09-26  0:11 ` [PATCH 07/10] target/arm: Implement SPAD, NSPAD, RLPAD Richard Henderson
@ 2025-09-26  0:11 ` Richard Henderson
  2025-09-29 23:04   ` Pierrick Bouvier
  2025-09-26  0:11 ` [PATCH 09/10] target/arm: Implement APPSAA Richard Henderson
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

The GPT address size fault is for the table itself.  The physical
address being checked gets Granule protection fault at Level 0 (R_JFFHB).

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

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 36917be83e..236c3a9569 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -413,7 +413,7 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress,
         if (pspace == ARMSS_NonSecure) {
             return true;
         }
-        goto fault_size;
+        goto fault_fail;
     }
 
     /* GPC Priority 4: the base address of GPTBR_EL3 exceeds PPS. */
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 09/10] target/arm: Implement APPSAA
  2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
                   ` (7 preceding siblings ...)
  2025-09-26  0:11 ` [PATCH 08/10] target/arm: Fix GPT fault type for address outside PPS Richard Henderson
@ 2025-09-26  0:11 ` 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-10-07 10:26 ` [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Peter Maydell
  10 siblings, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

This bit allows all spaces to access memory above PPS.

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

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 236c3a9569..e03657f309 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -408,9 +408,10 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress,
      * GPC Priority 3: Secure, Realm or Root address exceeds PPS.
      * R_CPDSB: A NonSecure physical address input exceeding PPS
      * does not experience any fault.
+     * R_PBPSH: Other address spaces have fault suppressed by APPSAA.
      */
     if (paddress & ~pps_mask) {
-        if (pspace == ARMSS_NonSecure) {
+        if (pspace == ARMSS_NonSecure || FIELD_EX64(gpccr, GPCCR, APPSAA)) {
             return true;
         }
         goto fault_fail;
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 10/10] target/arm: Enable FEAT_RME_GPC2 for -cpu max with x-rme
  2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
                   ` (8 preceding siblings ...)
  2025-09-26  0:11 ` [PATCH 09/10] target/arm: Implement APPSAA Richard Henderson
@ 2025-09-26  0:11 ` 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
  10 siblings, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2025-09-26  0:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/tcg/cpu64.c        | 3 ++-
 docs/system/arm/emulation.rst | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c
index abef6a246e..3e30d693b5 100644
--- a/target/arm/tcg/cpu64.c
+++ b/target/arm/tcg/cpu64.c
@@ -159,7 +159,8 @@ static void cpu_arm_set_rme(Object *obj, bool value, Error **errp)
 {
     ARMCPU *cpu = ARM_CPU(obj);
 
-    FIELD_DP64_IDREG(&cpu->isar, ID_AA64PFR0, RME, value);
+    /* Enable FEAT_RME_GPC2 */
+    FIELD_DP64_IDREG(&cpu->isar, ID_AA64PFR0, RME, value ? 2 : 0);
 }
 
 static void cpu_max_set_l0gptsz(Object *obj, Visitor *v, const char *name,
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
index 6b04c96c8c..1aa0a6e4c3 100644
--- a/docs/system/arm/emulation.rst
+++ b/docs/system/arm/emulation.rst
@@ -120,6 +120,7 @@ the following architecture extensions:
 - FEAT_RASv1p1 (RAS Extension v1.1)
 - FEAT_RDM (Advanced SIMD rounding double multiply accumulate instructions)
 - FEAT_RME (Realm Management Extension) (NB: support status in QEMU is experimental)
+- FEAT_RME_GPC2 (RME Granule Protection Check 2 Extension)
 - FEAT_RNG (Random number generator)
 - FEAT_RPRES (Increased precision of FRECPE and FRSQRTE)
 - FEAT_S2FWB (Stage 2 forced Write-Back)
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 01/10] target/arm: Add isar feature test for FEAT_RME_GPC2
  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
  0 siblings, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:00 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/cpu-features.h | 5 +++++
>   1 file changed, 5 insertions(+)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 02/10] target/arm: Add GPCCR fields from ARM revision L.b
  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
  1 sibling, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:00 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/cpu.h | 6 ++++++
>   1 file changed, 6 insertions(+)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 02/10] target/arm: Add GPCCR fields from ARM revision L.b
  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
  1 sibling, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:01 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/cpu.h | 6 ++++++
>   1 file changed, 6 insertions(+)

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 03/10] target/arm: Enable FEAT_RME_GPC2 bits in gpccr_write
  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
  0 siblings, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:02 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/helper.c | 5 +++++
>   1 file changed, 5 insertions(+)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 04/10] target/arm: Add cur_space to S1Translate
  2025-09-26  0:11 ` [PATCH 04/10] target/arm: Add cur_space to S1Translate Richard Henderson
@ 2025-09-29 23:03   ` Pierrick Bouvier
  0 siblings, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:03 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> We've been updating in_space and then using hacks to access
> the original space.  Instead, update cur_space and leave
> in_space unchanged.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/ptw.c | 37 +++++++++++++++++++------------------
>   1 file changed, 19 insertions(+), 18 deletions(-)   

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 05/10] target/arm: GPT_Secure is reserved without FEAT_SEL2
  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
  0 siblings, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:03 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> For GPT_Secure, if SEL2 is not enabled, raise a GPCF_Walk exception.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/ptw.c | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/10] target/arm: Implement GPT_NonSecureOnly
  2025-09-26  0:11 ` [PATCH 06/10] target/arm: Implement GPT_NonSecureOnly Richard Henderson
@ 2025-09-29 23:04   ` Pierrick Bouvier
  0 siblings, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:04 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/ptw.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 07/10] target/arm: Implement SPAD, NSPAD, RLPAD
  2025-09-26  0:11 ` [PATCH 07/10] target/arm: Implement SPAD, NSPAD, RLPAD Richard Henderson
@ 2025-09-29 23:04   ` Pierrick Bouvier
  0 siblings, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:04 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> 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(-)

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/10] target/arm: Fix GPT fault type for address outside PPS
  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
  0 siblings, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:04 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> The GPT address size fault is for the table itself.  The physical
> address being checked gets Granule protection fault at Level 0 (R_JFFHB).
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/ptw.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 09/10] target/arm: Implement APPSAA
  2025-09-26  0:11 ` [PATCH 09/10] target/arm: Implement APPSAA Richard Henderson
@ 2025-09-29 23:05   ` Pierrick Bouvier
  0 siblings, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:05 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> This bit allows all spaces to access memory above PPS.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/ptw.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 10/10] target/arm: Enable FEAT_RME_GPC2 for -cpu max with x-rme
  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
  0 siblings, 0 replies; 23+ messages in thread
From: Pierrick Bouvier @ 2025-09-29 23:05 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 9/25/25 5:11 PM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/tcg/cpu64.c        | 3 ++-
>   docs/system/arm/emulation.rst | 1 +
>   2 files changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2
  2025-09-26  0:11 [PATCH 00/10] target/arm: Implement FEAT_RME_GPC2 Richard Henderson
                   ` (9 preceding siblings ...)
  2025-09-26  0:11 ` [PATCH 10/10] target/arm: Enable FEAT_RME_GPC2 for -cpu max with x-rme Richard Henderson
@ 2025-10-07 10:26 ` Peter Maydell
  10 siblings, 0 replies; 23+ messages in thread
From: Peter Maydell @ 2025-10-07 10:26 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, qemu-arm

On Fri, 26 Sept 2025 at 01:12, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Note that patch 4 will conflict with patch 5 of the FEAT_GCS patch
> set, and I'm inclined to think this cleanup might go first.
>
> This is otherwise a reasonably simple extension.
>



Applied to target-arm.next, thanks.

-- PMM


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2025-10-07 10:27 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 07/10] target/arm: Implement SPAD, NSPAD, RLPAD Richard Henderson
2025-09-29 23:04   ` 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

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).