Commit 7478efba authored by Bibo Mao's avatar Bibo Mao Committed by Xianglai Li
Browse files

LoongArch: KVM: Add dirty bitmap initially all set support

mainline inclusion
from mainline-v6.11-rc1
commit 8c347042527058976e8a1cb10c0ae31e55145f76
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IAZJDO


CVE: NA

--------------------------------

Add KVM_DIRTY_LOG_INITIALLY_SET support on LoongArch system, this
feature comes from other architectures like x86 and arm64.

Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
Signed-off-by: default avatarXianglai Li <lixianglai@loongson.cn>
parent 832cd8eb
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@

#define KVM_GUESTDBG_VALID_MASK		(KVM_GUESTDBG_ENABLE | \
			KVM_GUESTDBG_USE_SW_BP | KVM_GUESTDBG_SINGLESTEP)

#define KVM_DIRTY_LOG_MANUAL_CAPS	\
	(KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | KVM_DIRTY_LOG_INITIALLY_SET)

struct kvm_vm_stat {
	struct kvm_vm_stat_generic generic;
	u64 pages;
+7 −0
Original line number Diff line number Diff line
@@ -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,