]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/loongarch: check tlb_ps
authorSong Gao <gaosong@loongson.cn>
Wed, 5 Mar 2025 06:33:11 +0000 (14:33 +0800)
committerSong Gao <gaosong@loongson.cn>
Fri, 7 Mar 2025 02:15:08 +0000 (10:15 +0800)
commitd882c284a3d4472d827e49a7357198b611900b08
tree37cb8a90ba5f27b26a6cd2a02c28c3dba5d2bfd8
parent089fa3d7302b38285ae146de8bbe5cf6ecc04f34
target/loongarch: check tlb_ps

For LoongArch th min tlb_ps is 12(4KB), for TLB code,
the tlb_ps may be 0,this may case UndefinedBehavior
Add a check-tlb_ps fuction to check tlb_ps,
to make sure the tlb_ps is avalablie. we check tlb_ps
when get the tlb_ps from tlb->misc or CSR bits.
1. cpu reset
   set CSR_PWCL.PTBASE and CSR_STLBPS.PS bits a default value
   from CSR_PRCFG2;
2. tlb instructions.
   some tlb instructions get  the tlb_ps from tlb->misc but the
   value may  has been initialized to 0. we need just check the tlb_ps
   skip the function and write a guest log.
3. csrwr instructions.
   to make sure CSR_PWCL.PTBASE and CSR_STLBPS.PS bits are avalable,
   cheke theses bits and set a default value from CSR_PRCFG2.

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Message-Id: <20250305063311.830674-3-gaosong@loongson.cn>
target/loongarch/cpu.c
target/loongarch/helper.h
target/loongarch/internals.h
target/loongarch/tcg/csr_helper.c
target/loongarch/tcg/insn_trans/trans_privileged.c.inc
target/loongarch/tcg/tlb_helper.c