[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 13/14] target/arm: Implement FEAT_HAFDBS, dirty bit portion
From: |
Richard Henderson |
Subject: |
[PATCH v6 13/14] target/arm: Implement FEAT_HAFDBS, dirty bit portion |
Date: |
Mon, 24 Oct 2022 15:18:50 +1000 |
Perform the atomic update for hardware management of the dirty bit.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
v5: Move the DB update before attributes are extracted and merged.
---
target/arm/cpu64.c | 2 +-
target/arm/ptw.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index fe1369fe96..0732796559 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -1165,7 +1165,7 @@ static void aarch64_max_initfn(Object *obj)
cpu->isar.id_aa64mmfr0 = t;
t = cpu->isar.id_aa64mmfr1;
- t = FIELD_DP64(t, ID_AA64MMFR1, HAFDBS, 1); /* FEAT_HAFDBS, AF only */
+ t = FIELD_DP64(t, ID_AA64MMFR1, HAFDBS, 2); /* FEAT_HAFDBS */
t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* FEAT_VMID16 */
t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); /* FEAT_VHE */
t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* FEAT_HPDS */
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index d9f89b6105..d87757a700 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -1463,6 +1463,22 @@ static bool get_phys_addr_lpae(CPUARMState *env,
S1Translate *ptw,
goto do_fault;
}
}
+
+ /*
+ * Dirty Bit.
+ * If HD is enabled, pre-emptively set/clear the appropriate AP/S2AP
+ * bit for writeback. The actual write protection test may still be
+ * overridden by tableattrs, to be merged below.
+ */
+ if (param.hd
+ && extract64(descriptor, 51, 1) /* DBM */
+ && access_type == MMU_DATA_STORE) {
+ if (regime_is_stage2(mmu_idx)) {
+ new_descriptor |= 1ull << 7; /* set S2AP[1] */
+ } else {
+ new_descriptor &= ~(1ull << 7); /* clear AP[2] */
+ }
+ }
}
/*
--
2.34.1
- [PATCH v6 00/14] target/arm: Implement FEAT_HAFDBS, Richard Henderson, 2022/10/24
- [PATCH v6 01/14] target/arm: Introduce regime_is_stage2, Richard Henderson, 2022/10/24
- [PATCH v6 02/14] target/arm: Add ptw_idx to S1Translate, Richard Henderson, 2022/10/24
- [PATCH v6 05/14] target/arm: Move S1_ptw_translate outside arm_ld[lq]_ptw, Richard Henderson, 2022/10/24
- [PATCH v6 04/14] target/arm: Extract HA and HD in aa64_va_parameters, Richard Henderson, 2022/10/24
- [PATCH v6 03/14] target/arm: Add isar predicates for FEAT_HAFDBS, Richard Henderson, 2022/10/24
- [PATCH v6 13/14] target/arm: Implement FEAT_HAFDBS, dirty bit portion,
Richard Henderson <=
- [PATCH v6 06/14] target/arm: Add ARMFault_UnsuppAtomicUpdate, Richard Henderson, 2022/10/24
- [PATCH v6 11/14] target/arm: Tidy merging of attributes from descriptor and table, Richard Henderson, 2022/10/24
- [PATCH v6 12/14] target/arm: Implement FEAT_HAFDBS, access flag portion, Richard Henderson, 2022/10/24
- [PATCH v6 07/14] target/arm: Remove loop from get_phys_addr_lpae, Richard Henderson, 2022/10/24
- [PATCH v6 08/14] target/arm: Fix fault reporting in get_phys_addr_lpae, Richard Henderson, 2022/10/24
- [PATCH v6 09/14] target/arm: Don't shift attrs in get_phys_addr_lpae, Richard Henderson, 2022/10/24