Hi Pierrick,
On 2025/12/16 08:01, Pierrick Bouvier wrote:
By removing cpu details and use a config struct, we can use the
same granule_protection_check with other devices, like SMMU.
Signed-off-by: Pierrick Bouvier <[email protected]>
---
target/arm/cpu.h | 34 ++++++++++++++++++++++++++++
target/arm/ptw.c | 59 +++++++++++++++++++++++++++++++-----------------
2 files changed, 72 insertions(+), 21 deletions(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index efbef0341da..5752e1f58fb 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -1216,6 +1216,40 @@ void arm_v7m_cpu_do_interrupt(CPUState *cpu);
hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
MemTxAttrs *attrs);
+
+typedef struct ARMGranuleProtectionConfig {
+ /* GPCCR_EL3 */
+ uint64_t gpccr;
+ /* GPTBR_EL3 */
+ uint64_t gptbr;
+ /* ID_AA64MMFR0_EL1.PARange */
+ uint8_t parange;
+ /* FEAT_SEL2 */
+ bool support_sel2;
+ /* Address space to access Granule Protection Table */
+ AddressSpace *gpt_as;
+} ARMGranuleProtectionConfig;
Would it make sense to add brief comments explaining how the fields in
ARMGranuleProtectionConfig map to SMMU registers? This could help
clarify that arm_granule_protection_check() is intended as a shared
abstraction for both CPU MMU and SMMU.
That said, I’m also happy to defer this until we actually add the SMMU
RME support.
Regards,
Tao