2020-07-02 13:57:54

by Keqian Zhu

[permalink] [raw]
Subject: [PATCH v2 1/8] KVM: arm64: Set DBM bit for writable PTEs

DBM bit is used by MMU to differentiate a genuinely non-writable
page from a page that is only temporarily non-writable in order
to mark dirty.

Signed-off-by: Keqian Zhu <[email protected]>
Signed-off-by: Peng Liang <[email protected]>
---
arch/arm64/include/asm/kvm_mmu.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index b12bfc1f051a..2700442b0f75 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -169,6 +169,10 @@ void kvm_clear_hyp_idmap(void);
static inline pte_t kvm_s2pte_mkwrite(pte_t pte)
{
pte_val(pte) |= PTE_S2_RDWR;
+
+ if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM))
+ pte_val(pte) |= PTE_DBM;
+
return pte;
}

--
2.19.1