LoongArch: KVM: Optimization for memslot hugepage checking
authorBibo Mao <maobibo@loongson.cn>
Tue, 19 Dec 2023 02:48:27 +0000 (10:48 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Tue, 19 Dec 2023 02:48:27 +0000 (10:48 +0800)
commit7ab6fb505b2a7447c4a7237a12c59e3ad0c7298c
treeef5aba12fcdba621d75b04e9027c54206bea7bd7
parentceb6a6f023fd3e8b07761ed900352ef574010bcb
LoongArch: KVM: Optimization for memslot hugepage checking

During shadow mmu page fault, there is checking for huge page for
specified memslot. Page fault is hot path, check logic can be done
when memslot is created. Here two flags are added for huge page
checking, KVM_MEM_HUGEPAGE_CAPABLE and KVM_MEM_HUGEPAGE_INCAPABLE.
Indeed for an optimized qemu, memslot for DRAM is always huge page
aligned. The flag is firstly checked during hot page fault path.

Now only huge page flag is supported, there is a long way for super
page support in LoongArch system. Since super page size is 64G for
16K pagesize and 1G for 4K pagesize, 64G physical address is rarely
used and LoongArch kernel needs support super page for 4K. Also memory
layout of LoongArch qemu VM should be 1G aligned.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/kvm_host.h
arch/loongarch/kvm/mmu.c