[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/30] target/arm: Move S1_ptw_translate outside arm_ld[lq]_ptw
From: |
Peter Maydell |
Subject: |
[PULL 11/30] target/arm: Move S1_ptw_translate outside arm_ld[lq]_ptw |
Date: |
Tue, 25 Oct 2022 17:39:33 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Separate S1 translation from the actual lookup.
Will enable lpae hardware updates.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20221024051851.3074715-6-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/ptw.c | 41 ++++++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 3c153f68318..44341a9dbcb 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -300,18 +300,12 @@ static bool S1_ptw_translate(CPUARMState *env,
S1Translate *ptw,
}
/* All loads done in the course of a page table walk go through here. */
-static uint32_t arm_ldl_ptw(CPUARMState *env, S1Translate *ptw, hwaddr addr,
+static uint32_t arm_ldl_ptw(CPUARMState *env, S1Translate *ptw,
ARMMMUFaultInfo *fi)
{
CPUState *cs = env_cpu(env);
uint32_t data;
- if (!S1_ptw_translate(env, ptw, addr, fi)) {
- /* Failure. */
- assert(fi->s1ptw);
- return 0;
- }
-
if (likely(ptw->out_host)) {
/* Page tables are in RAM, and we have the host address. */
if (ptw->out_be) {
@@ -339,18 +333,12 @@ static uint32_t arm_ldl_ptw(CPUARMState *env, S1Translate
*ptw, hwaddr addr,
return data;
}
-static uint64_t arm_ldq_ptw(CPUARMState *env, S1Translate *ptw, hwaddr addr,
+static uint64_t arm_ldq_ptw(CPUARMState *env, S1Translate *ptw,
ARMMMUFaultInfo *fi)
{
CPUState *cs = env_cpu(env);
uint64_t data;
- if (!S1_ptw_translate(env, ptw, addr, fi)) {
- /* Failure. */
- assert(fi->s1ptw);
- return 0;
- }
-
if (likely(ptw->out_host)) {
/* Page tables are in RAM, and we have the host address. */
if (ptw->out_be) {
@@ -507,7 +495,10 @@ static bool get_phys_addr_v5(CPUARMState *env, S1Translate
*ptw,
fi->type = ARMFault_Translation;
goto do_fault;
}
- desc = arm_ldl_ptw(env, ptw, table, fi);
+ if (!S1_ptw_translate(env, ptw, table, fi)) {
+ goto do_fault;
+ }
+ desc = arm_ldl_ptw(env, ptw, fi);
if (fi->type != ARMFault_None) {
goto do_fault;
}
@@ -545,7 +536,10 @@ static bool get_phys_addr_v5(CPUARMState *env, S1Translate
*ptw,
/* Fine pagetable. */
table = (desc & 0xfffff000) | ((address >> 8) & 0xffc);
}
- desc = arm_ldl_ptw(env, ptw, table, fi);
+ if (!S1_ptw_translate(env, ptw, table, fi)) {
+ goto do_fault;
+ }
+ desc = arm_ldl_ptw(env, ptw, fi);
if (fi->type != ARMFault_None) {
goto do_fault;
}
@@ -630,7 +624,10 @@ static bool get_phys_addr_v6(CPUARMState *env, S1Translate
*ptw,
fi->type = ARMFault_Translation;
goto do_fault;
}
- desc = arm_ldl_ptw(env, ptw, table, fi);
+ if (!S1_ptw_translate(env, ptw, table, fi)) {
+ goto do_fault;
+ }
+ desc = arm_ldl_ptw(env, ptw, fi);
if (fi->type != ARMFault_None) {
goto do_fault;
}
@@ -683,7 +680,10 @@ static bool get_phys_addr_v6(CPUARMState *env, S1Translate
*ptw,
ns = extract32(desc, 3, 1);
/* Lookup l2 entry. */
table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc);
- desc = arm_ldl_ptw(env, ptw, table, fi);
+ if (!S1_ptw_translate(env, ptw, table, fi)) {
+ goto do_fault;
+ }
+ desc = arm_ldl_ptw(env, ptw, fi);
if (fi->type != ARMFault_None) {
goto do_fault;
}
@@ -1272,7 +1272,10 @@ static bool get_phys_addr_lpae(CPUARMState *env,
S1Translate *ptw,
ptw->in_ptw_idx &= ~1;
ptw->in_secure = false;
}
- descriptor = arm_ldq_ptw(env, ptw, descaddr, fi);
+ if (!S1_ptw_translate(env, ptw, descaddr, fi)) {
+ goto do_fault;
+ }
+ descriptor = arm_ldq_ptw(env, ptw, fi);
if (fi->type != ARMFault_None) {
goto do_fault;
}
--
2.25.1
- [PULL 00/30] target-arm queue, Peter Maydell, 2022/10/25
- [PULL 01/30] target/arm: Implement FEAT_E0PD, Peter Maydell, 2022/10/25
- [PULL 05/30] hw/hyperv/hyperv.c: Use device_cold_reset() instead of device_legacy_reset(), Peter Maydell, 2022/10/25
- [PULL 02/30] hw/arm/virt: Fix devicetree warnings about the virtio-iommu node, Peter Maydell, 2022/10/25
- [PULL 06/30] target/imx: reload cmp timer outside of the reload ptimer transaction, Peter Maydell, 2022/10/25
- [PULL 09/30] target/arm: Add isar predicates for FEAT_HAFDBS, Peter Maydell, 2022/10/25
- [PULL 08/30] target/arm: Add ptw_idx to S1Translate, Peter Maydell, 2022/10/25
- [PULL 04/30] hw/core/resettable: fix reset level counting, Peter Maydell, 2022/10/25
- [PULL 03/30] target/arm: honor HCR_E2H and HCR_TGE in arm_excp_unmasked(), Peter Maydell, 2022/10/25
- [PULL 10/30] target/arm: Extract HA and HD in aa64_va_parameters, Peter Maydell, 2022/10/25
- [PULL 11/30] target/arm: Move S1_ptw_translate outside arm_ld[lq]_ptw,
Peter Maydell <=
- [PULL 15/30] target/arm: Don't shift attrs in get_phys_addr_lpae, Peter Maydell, 2022/10/25
- [PULL 16/30] target/arm: Consider GP an attribute in get_phys_addr_lpae, Peter Maydell, 2022/10/25
- [PULL 14/30] target/arm: Fix fault reporting in get_phys_addr_lpae, Peter Maydell, 2022/10/25
- [PULL 17/30] target/arm: Tidy merging of attributes from descriptor and table, Peter Maydell, 2022/10/25
- [PULL 12/30] target/arm: Add ARMFault_UnsuppAtomicUpdate, Peter Maydell, 2022/10/25
- [PULL 13/30] target/arm: Remove loop from get_phys_addr_lpae, Peter Maydell, 2022/10/25
- [PULL 18/30] target/arm: Implement FEAT_HAFDBS, access flag portion, Peter Maydell, 2022/10/25
- [PULL 19/30] target/arm: Implement FEAT_HAFDBS, dirty bit portion, Peter Maydell, 2022/10/25
- [PULL 07/30] target/arm: Introduce regime_is_stage2, Peter Maydell, 2022/10/25
- [PULL 21/30] reset: allow registering handlers that aren't called by snapshot loading, Peter Maydell, 2022/10/25