[PATCH v4 11/13] target/loongarch: Invalid tlb entry in invalidate_tlb()

Bibo Mao posted 13 patches 5 months, 1 week ago
Maintainers: Song Gao <gaosong@loongson.cn>
[PATCH v4 11/13] target/loongarch: Invalid tlb entry in invalidate_tlb()
Posted by Bibo Mao 5 months, 1 week ago
Invalid tlb entry in function invalidate_tlb(), and its usage is
simple and easy to use.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 target/loongarch/tcg/tlb_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c
index 7a85d9ca55..b777f68f71 100644
--- a/target/loongarch/tcg/tlb_helper.c
+++ b/target/loongarch/tcg/tlb_helper.c
@@ -123,6 +123,7 @@ static void invalidate_tlb_entry(CPULoongArchState *env, int index)
         return;
     }
 
+    tlb->tlb_misc = FIELD_DP64(tlb->tlb_misc, TLB_MISC, E, 0);
     tlb_ps = FIELD_EX64(tlb->tlb_misc, TLB_MISC, PS);
     pagesize = MAKE_64BIT_MASK(tlb_ps, 1);
     mask = MAKE_64BIT_MASK(0, tlb_ps + 1);
@@ -338,7 +339,6 @@ void helper_tlbwr(CPULoongArchState *env)
     old = env->tlb + index;
     if (FIELD_EX64(env->CSR_TLBIDX, CSR_TLBIDX, NE)) {
         invalidate_tlb(env, index);
-        old->tlb_misc = FIELD_DP64(old->tlb_misc, TLB_MISC, E, 0);
         return;
     }
 
-- 
2.39.3
Re: [PATCH v4 11/13] target/loongarch: Invalid tlb entry in invalidate_tlb()
Posted by gaosong 4 months, 2 weeks ago
在 2025/9/6 下午3:10, Bibo Mao 写道:
> Invalid tlb entry in function invalidate_tlb(), and its usage is
> simple and easy to use.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>   target/loongarch/tcg/tlb_helper.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao
> diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c
> index 7a85d9ca55..b777f68f71 100644
> --- a/target/loongarch/tcg/tlb_helper.c
> +++ b/target/loongarch/tcg/tlb_helper.c
> @@ -123,6 +123,7 @@ static void invalidate_tlb_entry(CPULoongArchState *env, int index)
>           return;
>       }
>   
> +    tlb->tlb_misc = FIELD_DP64(tlb->tlb_misc, TLB_MISC, E, 0);
>       tlb_ps = FIELD_EX64(tlb->tlb_misc, TLB_MISC, PS);
>       pagesize = MAKE_64BIT_MASK(tlb_ps, 1);
>       mask = MAKE_64BIT_MASK(0, tlb_ps + 1);
> @@ -338,7 +339,6 @@ void helper_tlbwr(CPULoongArchState *env)
>       old = env->tlb + index;
>       if (FIELD_EX64(env->CSR_TLBIDX, CSR_TLBIDX, NE)) {
>           invalidate_tlb(env, index);
> -        old->tlb_misc = FIELD_DP64(old->tlb_misc, TLB_MISC, E, 0);
>           return;
>       }
>