[PATCH] accel/tcg: Fix TLB_MMIO check in tlb_plugin_lookup()

Anton Blanchard posted 1 patch 1 week, 3 days ago
There is a newer version of this series
accel/tcg/cputlb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] accel/tcg: Fix TLB_MMIO check in tlb_plugin_lookup()
Posted by Anton Blanchard 1 week, 3 days ago
Update tlb_plugin_lookup() to check TLB_MMIO in slow_flags when
TLB_FORCE_SLOW is set.

Signed-off-by: Anton Blanchard <antonb@tenstorrent.com>
---
 accel/tcg/cputlb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 7f7c208ba1..7150d6d126 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1593,7 +1593,8 @@ bool tlb_plugin_lookup(CPUState *cpu, vaddr addr, int mmu_idx,
     data->phys_addr = full->phys_addr | (addr & ~TARGET_PAGE_MASK);
 
     /* We must have an iotlb entry for MMIO */
-    if (tlb_addr & TLB_MMIO) {
+    if ((tlb_addr & TLB_FORCE_SLOW) &&
+        (full->slow_flags[access_type] & TLB_MMIO)) {
         MemoryRegionSection *section = full->section;
         data->is_io = true;
         data->mr = section->mr;
-- 
2.34.1
Re: [PATCH] accel/tcg: Fix TLB_MMIO check in tlb_plugin_lookup()
Posted by Richard Henderson 1 week, 3 days ago
On 9/15/26 21:32, Anton Blanchard wrote:
> Update tlb_plugin_lookup() to check TLB_MMIO in slow_flags when
> TLB_FORCE_SLOW is set.
> 
> Signed-off-by: Anton Blanchard <antonb@tenstorrent.com>
> ---
>   accel/tcg/cputlb.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index 7f7c208ba1..7150d6d126 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -1593,7 +1593,8 @@ bool tlb_plugin_lookup(CPUState *cpu, vaddr addr, int mmu_idx,
>       data->phys_addr = full->phys_addr | (addr & ~TARGET_PAGE_MASK);
>   
>       /* We must have an iotlb entry for MMIO */
> -    if (tlb_addr & TLB_MMIO) {
> +    if ((tlb_addr & TLB_FORCE_SLOW) &&
> +        (full->slow_flags[access_type] & TLB_MMIO)) {
>           MemoryRegionSection *section = full->section;
>           data->is_io = true;
>           data->mr = section->mr;

Mm.  Missed when doing the conversion.

You don't actually need to test vs FORCE_SLOW; that's just there for the 
fast path to notice.  Just test slow_flags unconditionally.


r~
Re: [EXT] Re: [PATCH] accel/tcg: Fix TLB_MMIO check in tlb_plugin_lookup()
Posted by Anton Blanchard 1 week, 3 days ago
Hi rth,

On Wed, Sep 16, 2026 at 8:19 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Mm.  Missed when doing the conversion.
>
> You don't actually need to test vs FORCE_SLOW; that's just there for the
> fast path to notice.  Just test slow_flags unconditionally.

Thanks, I'll resubmit with the test removed.

Anton