]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
LoongArch: KVM: Fix GPA size issue about VM
authorBibo Mao <maobibo@loongson.cn>
Sat, 8 Mar 2025 05:52:04 +0000 (13:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:01:50 +0000 (13:01 +0100)
commit52532c6c6c6967fdc63b696e613a1d4932a9efe8
treef4fb178f390f13520a5bf4b0008402d9b2c61d08
parent3700cd7c171b2d782be9597cf3db573b28ffb78d
LoongArch: KVM: Fix GPA size issue about VM

commit 6bdbb73dc8d99fbb77f5db79dbb6f108708090b4 upstream.

Physical address space is 48 bit on Loongson-3A5000 physical machine,
however it is 47 bit for VM on Loongson-3A5000 system. Size of physical
address space of VM is the same with the size of virtual user space (a
half) of physical machine.

Variable cpu_vabits represents user address space, kernel address space
is not included (user space and kernel space are both a half of total).
Here cpu_vabits, rather than cpu_vabits - 1, is to represent the size of
guest physical address space.

Also there is strict checking about page fault GPA address, inject error
if it is larger than maximum GPA address of VM.

Cc: stable@vger.kernel.org
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/loongarch/kvm/exit.c
arch/loongarch/kvm/vm.c