[PATCH 7/8] KVM: arm64: enable hardware dirty state management for stage-2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enable hardware management of dirty state for stage-2 (VTCR_EL2.HD)
translations. Set VTCR_EL2.HD unconditionally. This won't allow hardware
dirty state management yet as page descriptors are considered as
candidates for hardware dirty state updates when DBM (51) bit is set
and by default page descriptors are created with DBM = 0.

Signed-off-by: Lilit Janpoladyan <lilitj@xxxxxxxxxx>
---
 arch/arm64/kvm/hyp/pgtable.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
index 9e2bbee77491..d507931ab10c 100644
--- a/arch/arm64/kvm/hyp/pgtable.c
+++ b/arch/arm64/kvm/hyp/pgtable.c
@@ -658,7 +658,7 @@ u64 kvm_get_vtcr(u64 mmfr0, u64 mmfr1, u32 phys_shift)
 
 #ifdef CONFIG_ARM64_HW_AFDBM
 	/*
-	 * Enable the Hardware Access Flag management, unconditionally
+	 * Enable the Hardware Access Flag and Dirty State management, unconditionally
 	 * on all CPUs. In systems that have asymmetric support for the feature
 	 * this allows KVM to leverage hardware support on the subset of cores
 	 * that implement the feature.
@@ -669,8 +669,10 @@ u64 kvm_get_vtcr(u64 mmfr0, u64 mmfr1, u32 phys_shift)
 	 * happen to be running on a design that has unadvertised support for
 	 * HAFDBS. Here be dragons.
 	 */
-	if (!cpus_have_final_cap(ARM64_WORKAROUND_AMPERE_AC03_CPU_38))
+	if (!cpus_have_final_cap(ARM64_WORKAROUND_AMPERE_AC03_CPU_38)) {
 		vtcr |= VTCR_EL2_HA;
+		vtcr |= VTCR_EL2_HD;
+	}
 #endif /* CONFIG_ARM64_HW_AFDBM */
 
 	if (kvm_lpa2_is_enabled())
-- 
2.40.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux