Commit 3910023fb7 for qemu.org
commit 3910023fb7a418c94ad7584de16b420fa60cfdf7
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Tue Sep 1 11:43:27 2026 +0200
target/loongarch: Constify LoongArchTLB
The pointed LoongArchTLB is only read, not modified: mark it const.
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-Id: <20260901095229.72018-11-philmd@oss.qualcomm.com>
diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c
index a4b90beca6..40cc076424 100644
--- a/target/loongarch/tcg/tlb_helper.c
+++ b/target/loongarch/tcg/tlb_helper.c
@@ -238,11 +238,11 @@ static uint32_t get_random_tlb(uint32_t low, uint32_t high)
* field in tlb entry contains bit[47:13], so need adjust.
* virt_vpn = vaddr[47:13]
*/
-static LoongArchTLB *loongarch_tlb_search_cb(CPULoongArchState *env,
- vaddr vaddr, int csr_asid,
- tlb_match func)
+static const LoongArchTLB *
+loongarch_tlb_search_cb(CPULoongArchState *env, vaddr vaddr,
+ int csr_asid, tlb_match func)
{
- LoongArchTLB *tlb;
+ const LoongArchTLB *tlb;
uint16_t tlb_asid, stlb_idx;
uint8_t tlb_e, tlb_ps, stlb_ps;
bool tlb_g;
@@ -296,7 +296,7 @@ static bool loongarch_tlb_search(CPULoongArchState *env, vaddr vaddr,
{
int csr_asid;
tlb_match func;
- LoongArchTLB *tlb;
+ const LoongArchTLB *tlb;
CPUSysState *sys = env_sys(env);
func = tlb_match_any;
@@ -594,7 +594,7 @@ void helper_invtlb_page_asid(CPULoongArchState *env, target_ulong info,
target_ulong addr)
{
int asid = info & 0x3ff;
- LoongArchTLB *tlb;
+ const LoongArchTLB *tlb;
tlb_match func;
func = tlb_match_asid;
@@ -608,7 +608,7 @@ void helper_invtlb_page_asid_or_g(CPULoongArchState *env,
target_ulong info, target_ulong addr)
{
int asid = info & 0x3ff;
- LoongArchTLB *tlb;
+ const LoongArchTLB *tlb;
tlb_match func;
func = tlb_match_any;
@@ -842,7 +842,7 @@ static TLBRet loongarch_map_tlb_entry(CPULoongArchState *env,
MMUAccessType access_type, int index,
int mmu_idx)
{
- LoongArchTLB *tlb = &env->tlb[index];
+ const LoongArchTLB *tlb = &env->tlb[index];
uint8_t tlb_ps, n;
tlb_ps = FIELD_EX64(tlb->tlb_misc, TLB_MISC, PS);