summaryrefslogtreecommitdiff
path: root/arch/loongarch/kvm
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2024-07-09 16:25:51 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2024-07-09 16:25:51 +0800
commit8c347042527058976e8a1cb10c0ae31e55145f76 (patch)
tree9cb0cf63544db78ea3651accb43f55d6a4c66e4c /arch/loongarch/kvm
parent32d4b999dadee0a84ac7fe709cae21d29364e1d1 (diff)
LoongArch: KVM: Add dirty bitmap initially all set support
Add KVM_DIRTY_LOG_INITIALLY_SET support on LoongArch system, this feature comes from other architectures like x86 and arm64. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kvm')
-rw-r--r--arch/loongarch/kvm/mmu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/loongarch/kvm/mmu.c b/arch/loongarch/kvm/mmu.c
index f1ed1c5296cf..1057bb984ba0 100644
--- a/arch/loongarch/kvm/mmu.c
+++ b/arch/loongarch/kvm/mmu.c
@@ -467,6 +467,13 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
* kvm_arch_flush_shadow_memslot()
*/
if (!(old_flags & KVM_MEM_LOG_DIRTY_PAGES) && log_dirty_pages) {
+ /*
+ * Initially-all-set does not require write protecting any page
+ * because they're all assumed to be dirty.
+ */
+ if (kvm_dirty_log_manual_protect_and_init_set(kvm))
+ return;
+
spin_lock(&kvm->mmu_lock);
/* Write protect GPA page table entries */
needs_flush = kvm_mkclean_gpa_pt(kvm, new->base_gfn,