]> git.apps.os.sepia.ceph.com Git - ceph-client.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)
committerHuacai Chen <chenhuacai@loongson.cn>
Thu, 18 Sep 2025 11:44:22 +0000 (19:44 +0800)
commitf58c9aa1065f73d243904b267c71f6a9d1e9f90e
tree287638a1d1576b5e122b5badf9ef645173b8dfab
parent091b29d53fe645781c5c1f405bc9fcd50ce5792b
LoongArch: KVM: Fix VM migration failure with PTW enabled

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