diff options
author | Bibo Mao <maobibo@loongson.cn> | 2025-07-29 17:06:05 +0800 |
---|---|---|
committer | Bibo Mao <maobibo@loongson.cn> | 2025-08-29 10:05:02 +0800 |
commit | 35fc0ec73c3264b67ba2c8d5e39d5897dca2c891 (patch) | |
tree | 9025de244b5248b058f7a26b2d3a7188157247ca | |
parent | 36055cf414b591ce2467631dbd5d8c32d4350263 (diff) | |
download | qemu-35fc0ec73c3264b67ba2c8d5e39d5897dca2c891.zip qemu-35fc0ec73c3264b67ba2c8d5e39d5897dca2c891.tar.gz qemu-35fc0ec73c3264b67ba2c8d5e39d5897dca2c891.tar.bz2 |
target/loongarch: Use MMUContext in loongarch_get_addr_from_tlb
With function loongarch_get_addr_from_tlb(), parameter MMUContext
is added and remove parameter physical, prot and address.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r-- | target/loongarch/cpu_helper.c | 7 | ||||
-rw-r--r-- | target/loongarch/tcg/tcg_loongarch.h | 4 | ||||
-rw-r--r-- | target/loongarch/tcg/tlb_helper.c | 18 |
3 files changed, 12 insertions, 17 deletions
diff --git a/target/loongarch/cpu_helper.c b/target/loongarch/cpu_helper.c index cd61b33..0cc01a0 100644 --- a/target/loongarch/cpu_helper.c +++ b/target/loongarch/cpu_helper.c @@ -173,9 +173,12 @@ static TLBRet loongarch_map_address(CPULoongArchState *env, hwaddr *physical, context.addr = address; if (tcg_enabled()) { - ret = loongarch_get_addr_from_tlb(env, physical, prot, address, - access_type, mmu_idx); + ret = loongarch_get_addr_from_tlb(env, &context, access_type, mmu_idx); if (ret != TLBRET_NOMATCH) { + if (ret == TLBRET_MATCH) { + *physical = context.physical; + *prot = context.prot; + } return ret; } } diff --git a/target/loongarch/tcg/tcg_loongarch.h b/target/loongarch/tcg/tcg_loongarch.h index 488700c..4770289 100644 --- a/target/loongarch/tcg/tcg_loongarch.h +++ b/target/loongarch/tcg/tcg_loongarch.h @@ -15,8 +15,8 @@ bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr); -TLBRet loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical, - int *prot, target_ulong address, +TLBRet loongarch_get_addr_from_tlb(CPULoongArchState *env, + MMUContext *context, MMUAccessType access_type, int mmu_idx); #endif /* TARGET_LOONGARCH_TCG_LOONGARCH_H */ diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c index 703ab9c..64a4e82 100644 --- a/target/loongarch/tcg/tlb_helper.c +++ b/target/loongarch/tcg/tlb_helper.c @@ -663,24 +663,16 @@ static TLBRet loongarch_map_tlb_entry(CPULoongArchState *env, return loongarch_check_pte(env, context, access_type, mmu_idx); } -TLBRet loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical, - int *prot, vaddr address, +TLBRet loongarch_get_addr_from_tlb(CPULoongArchState *env, + MMUContext *context, MMUAccessType access_type, int mmu_idx) { int index, match; - MMUContext context; - TLBRet ret; - context.addr = address; - match = loongarch_tlb_search(env, address, &index); + match = loongarch_tlb_search(env, context->addr, &index); if (match) { - ret = loongarch_map_tlb_entry(env, &context, access_type, index, - mmu_idx); - if (ret == TLBRET_MATCH) { - *physical = context.physical; - *prot = context.prot; - } - return ret; + return loongarch_map_tlb_entry(env, context, access_type, index, + mmu_idx); } return TLBRET_NOMATCH; |