[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2 07/30] target/loongarch: Add MMU support for LoongArch
Re: [RFC PATCH v2 07/30] target/loongarch: Add MMU support for LoongArch CPU.
Wed, 17 Nov 2021 07:59:27 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0
On 11/17/21 7:37 AM, yangxiaojuan wrote:
+ *physical = (tlb_ppn1 << 12) | (address & ((1 << tlb_ps) - 1));
Maybe TARGET_PAGE_SIZE is not fit for a huge page. MAKE_64BIT_MASK(0, tlb_ps)
I meant the first << 12. But, yes, MAKE_64BIT_MASK is a good improvement.
Bit of a shame to have a linear search. I guess it's ok for a start, but
you'll find that this function is critical to the emulation speed of qemu, so
you should think about other ways to organize the data.
The stlb search by the set, the mtlb uses the linear search, I have no other
idea, do you have some advice?
Well, stlb are all the same page size, and duplicate matches are undefined.
A hash table of the valid entries might be workable, with the virtual page and asid taken
into account. I'd imagine that would get you down from 2048 comparisons to just a few.
The mtlb entries may all have different page size, so I don't immediately know how to
search them more efficiently. But there are only 64 of them.
It might be worth having a couple of bitsets that summarize the valid entries. This could
be used to search less than 64 mtlb entries. It could also be used to influence the
"random" selection of a new tlb entry: always select an empty tlb entry first, then evict
a random entry.
[RFC PATCH v2 07/30] target/loongarch: Add MMU support for LoongArch CPU., Xiaojuan Yang, 2021/11/10
[RFC PATCH v2 13/30] target/loongarch: Add gdb support., Xiaojuan Yang, 2021/11/10
[RFC PATCH v2 16/30] hw/loongarch: Add a virt LoongArch 3A5000 board support, Xiaojuan Yang, 2021/11/10
[RFC PATCH v2 01/30] target/loongarch: Update README, Xiaojuan Yang, 2021/11/10
[RFC PATCH v2 10/30] target/loongarch: Add other core instructions support, Xiaojuan Yang, 2021/11/10
[RFC PATCH v2 11/30] target/loongarch: Add LoongArch interrupt and exception handle, Xiaojuan Yang, 2021/11/10
[RFC PATCH v2 15/30] hw/pci-host: Add ls7a1000 PCIe Host bridge support for Loongson Platform, Xiaojuan Yang, 2021/11/10
- Re: [RFC PATCH v2 03/30] target/loongarch: Add basic vmstate description of CPU., (continued)