Skip to contentSkip to conversation

Fix SEGFAULT on getting physical address of MMIO region.

PATCH New Mikhail Tyutin 1 participant 1 message Jul 3, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix SEGFAULT on getting physical address of MMIO region.

The fix is to clear TLB_INVALID_MASK bit in tlb_addr, as it happens in other places e.g. load_helper().

---
 accel/tcg/cputlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
accel/tcg/cputlb.c +1 -0
index 5b51eff5a4..9045b6330a 100644
@@ -1708,7 +1708,7 @@ bool tlb_plugin_lookup(CPUState *cpu, vaddr addr, int mmu_idx,
     uintptr_t index = tlb_index(env, mmu_idx, addr);
     uint64_t tlb_addr = is_store ? tlb_addr_write(tlbe) : tlbe->addr_read;
 -    if (likely(tlb_hit(tlb_addr, addr))) {
+    if (likely(tlb_hit(tlb_addr & ~TLB_INVALID_MASK, addr))) {
         /* We must have an iotlb entry for MMIO */
         if (tlb_addr & TLB_MMIO) {
             CPUTLBEntryFull *full;
Signature · 1 line
2.34.1