[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1556703867-22396-2-git-send-email-yuzenghui@huawei.com>
Date: Wed, 1 May 2019 09:44:23 +0000
From: Zenghui Yu <yuzenghui@...wei.com>
To: <linux-arm-kernel@...ts.infradead.org>,
<kvmarm@...ts.cs.columbia.edu>, <linux-kernel@...r.kernel.org>,
<kvm@...r.kernel.org>
CC: <marc.zyngier@....com>, <christoffer.dall@....com>,
<linux@...linux.org.uk>, <catalin.marinas@....com>,
<will.deacon@....com>, <james.morse@....com>,
<julien.thierry@....com>, <suzuki.poulose@....com>,
<steve.capper@....com>, <wanghaibin.wang@...wei.com>,
Zenghui Yu <yuzenghui@...wei.com>
Subject: [PATCH 1/5] KVM: arm/arm64: Introduce helpers for page table enties with contiguous bit
Introduce helpers to manipulate stage2 page table entries - set contiguous
bit in the entry and say whether this entry points to a contiguous block.
The helpers are introduced in preparation for supporting contiguous
hugepages at stage2.
Signed-off-by: Zenghui Yu <yuzenghui@...wei.com>
---
arch/arm/include/asm/kvm_mmu.h | 22 ++++++++++++++++++++++
arch/arm64/include/asm/kvm_mmu.h | 20 ++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 31de4ab..80d73ae 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -143,6 +143,28 @@ static inline bool kvm_s2pud_young(pud_t pud)
return false;
}
+static inline pte_t kvm_s2pte_mkcont(pte_t pte)
+{
+ BUG();
+ return pte;
+}
+
+static inline bool kvm_s2pte_cont(pte_t pte)
+{
+ return false;
+}
+
+static inline pmd_t kvm_s2pmd_mkcont(pmd_t pmd)
+{
+ BUG();
+ return pmd;
+}
+
+static inline bool kvm_s2pmd_cont(pmd_t pmd)
+{
+ return false;
+}
+
static inline pte_t kvm_s2pte_mkwrite(pte_t pte)
{
pte_val(pte) |= L_PTE_S2_RDWR;
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index ebeefcf..4afdad9 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -295,6 +295,26 @@ static inline bool kvm_s2pud_young(pud_t pud)
return pud_young(pud);
}
+static inline pte_t kvm_s2pte_mkcont(pte_t pte)
+{
+ return pte_mkcont(pte);
+}
+
+static inline bool kvm_s2pte_cont(pte_t pte)
+{
+ return pte_cont(pte);
+}
+
+static inline pmd_t kvm_s2pmd_mkcont(pmd_t pmd)
+{
+ return pmd_mkcont(pmd);
+}
+
+static inline bool kvm_s2pmd_cont(pmd_t pmd)
+{
+ return !!(pmd_val(pmd) & PMD_SECT_CONT);
+}
+
#define hyp_pte_table_empty(ptep) kvm_page_empty(ptep)
#ifdef __PAGETABLE_PMD_FOLDED
--
1.8.3.1
Powered by blists - more mailing lists