]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
LoongArch: KVM: Fix VM migration failure with PTW enabled
authorBibo Mao <maobibo@loongson.cn>
Thu, 18 Sep 2025 11:44:22 +0000 (19:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Sep 2025 09:16:48 +0000 (11:16 +0200)
commit1c731284374a5335ee8323c92ab66d7cab5e9f0b
treec7fabc9cc9c330721e5d72ae9c9f791485e9220a
parent960eedb14cafd761dbd14b69d73569686b40dbdc
LoongArch: KVM: Fix VM migration failure with PTW enabled

commit f58c9aa1065f73d243904b267c71f6a9d1e9f90e upstream.

With PTW disabled system, bit _PAGE_DIRTY is a HW bit for page writing.
However with PTW enabled system, bit _PAGE_WRITE is also a "HW bit" for
page writing, because hardware synchronizes _PAGE_WRITE to _PAGE_DIRTY
automatically. Previously, _PAGE_WRITE is treated as a SW bit to record
the page writeable attribute for the fast page fault handling in the
secondary MMU, however with PTW enabled machine, this bit is used by HW
already (so setting it will silence the TLB modify exception).

Here define KVM_PAGE_WRITEABLE with the SW bit _PAGE_MODIFIED, so that
it can work on both PTW disabled and enabled machines. And for HW write
bits, both _PAGE_DIRTY and _PAGE_WRITE are set or clear together.

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/include/asm/kvm_mmu.h
arch/loongarch/kvm/mmu.c