There is some enhance about LoongArch mmu tcg emulation, add new header file cpu-mmu.h and function loongarch_check_pte(). Function loongarch_check_pte() can work on both TLB entry and pte entry.
This patchset mainly is code cleanup and enhancement, its main purpose is to work for hardware page table walk emluation in future. --- v1 ... v2: 1. Rename structure name pte_context with mmu_context, since it can be extended to get DMW or DA mmu idx and window size 2. Add fine-grained tlb flush method 3. Fix some issues in function invalidate_tlb_entry() to flush tlb, such as bitmap method with mmu idx, page size and address calculation --- Bibo Mao (9): target/loongarch: Move some function definition to kvm directory target/loongarch: Define function loongarch_cpu_post_init as static target/loongarch: Set page size in TLB misc with STLB target/loongarch: Add header file cpu-mmu.h target/loongarch: Add common function loongarch_check_pte() target/loongarch: Use loongarch_check_pte() with page table walking target/loongarch: Use mmu idx bitmap method when flush tlb target/loongarch: Use correct page size when flush tlb target/loongarch: Use fine-grained tlb flush method hw/loongarch/virt.c | 1 + target/loongarch/cpu-mmu.h | 38 ++++++ target/loongarch/cpu.c | 181 ++++++++++++++------------- target/loongarch/cpu.h | 11 -- target/loongarch/cpu_helper.c | 98 +++++++++++---- target/loongarch/internals.h | 20 --- target/loongarch/kvm/kvm_loongarch.h | 4 +- target/loongarch/tcg/csr_helper.c | 1 + target/loongarch/tcg/tlb_helper.c | 136 ++++++-------------- 9 files changed, 247 insertions(+), 243 deletions(-) create mode 100644 target/loongarch/cpu-mmu.h base-commit: c079d3a31e45093286c65f8ca5350beb3a4404a9 -- 2.39.3