Skip to contentSkip to conversation

target/arm: Fix physical address resolution for Stage2

PATCH Applied Richard Henderson 3 participants 3 messages Jan 26, 2023 – Feb 2, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/arm: Fix physical address resolution for Stage2

Conversion to probe_access_full missed applying the page offset.

Fixes f3639a64f602 ("target/arm: Use softmmu tlbs for page table walking")
---
 target/arm/ptw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/ptw.c +1 -1
index 57f3615a66..2b125fff44 100644
@@ -266,7 +266,7 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
         if (unlikely(flags & TLB_INVALID_MASK)) {
             goto fail;
         }
-        ptw->out_phys = full->phys_addr;
+        ptw->out_phys = full->phys_addr | (addr & ~TARGET_PAGE_MASK);
         ptw->out_rw = full->prot & PAGE_WRITE;
         pte_attrs = full->pte_attrs;
         pte_secure = full->attrs.secure;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Richard Henderson

Conversion to probe_access_full missed applying the page offset.

Fixes f3639a64f602 ("target/arm: Use softmmu tlbs for page table walking")
---
  target/arm/ptw.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/ptw.c +0 -0
index 57f3615a66..2b125fff44 100644

target/arm/ptw.c static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, · line 272

Quoted 8 lines
target/arm/ptw.c +1 -1
@@ -266,7 +266,7 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
          if (unlikely(flags & TLB_INVALID_MASK)) {
              goto fail;
          }
-        ptw->out_phys = full->phys_addr;
+        ptw->out_phys = full->phys_addr | (addr & ~TARGET_PAGE_MASK);
          ptw->out_rw = full->prot & PAGE_WRITE;
          pte_attrs = full->pte_attrs;
          pte_secure = full->attrs.secure;