Skip to content

Commit 8c34704

Browse files
bibo-maochenhuacai
authored andcommitted
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 <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 32d4b99 commit 8c34704

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

arch/loongarch/include/asm/kvm_host.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
#define KVM_GUESTDBG_VALID_MASK \
3838
(KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP | KVM_GUESTDBG_SINGLESTEP)
3939

40+
#define KVM_DIRTY_LOG_MANUAL_CAPS \
41+
(KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | KVM_DIRTY_LOG_INITIALLY_SET)
42+
4043
struct kvm_vm_stat {
4144
struct kvm_vm_stat_generic generic;
4245
u64 pages;

arch/loongarch/kvm/mmu.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,13 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
467467
* kvm_arch_flush_shadow_memslot()
468468
*/
469469
if (!(old_flags & KVM_MEM_LOG_DIRTY_PAGES) && log_dirty_pages) {
470+
/*
471+
* Initially-all-set does not require write protecting any page
472+
* because they're all assumed to be dirty.
473+
*/
474+
if (kvm_dirty_log_manual_protect_and_init_set(kvm))
475+
return;
476+
470477
spin_lock(&kvm->mmu_lock);
471478
/* Write protect GPA page table entries */
472479
needs_flush = kvm_mkclean_gpa_pt(kvm, new->base_gfn,

0 commit comments

Comments
 (0)