summaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/kvm_pgtable.h
diff options
context:
space:
mode:
authorWill Deacon <will@kernel.org>2020-09-11 14:25:13 +0100
committerMarc Zyngier <maz@kernel.org>2020-09-11 15:51:13 +0100
commit71233d05f4b5e3560f0d3d5607d01e9beff8dcbd (patch)
tree59f6a7ef8bf7a35cc48c4a8c0180e0aea25cefa5 /arch/arm64/include/asm/kvm_pgtable.h
parent0f9d09b8e29bc8166f6584279aedc4a7a4038f68 (diff)
downloadlinux-stable-71233d05f4b5e3560f0d3d5607d01e9beff8dcbd.tar.gz
linux-stable-71233d05f4b5e3560f0d3d5607d01e9beff8dcbd.tar.bz2
linux-stable-71233d05f4b5e3560f0d3d5607d01e9beff8dcbd.zip
KVM: arm64: Add support for creating kernel-agnostic stage-2 page tables
Introduce alloc() and free() functions to the generic page-table code for guest stage-2 page-tables and plumb these into the existing KVM page-table allocator. Subsequent patches will convert other operations within the KVM allocator over to the generic code. Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Gavin Shan <gshan@redhat.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Quentin Perret <qperret@google.com> Link: https://lore.kernel.org/r/20200911132529.19844-6-will@kernel.org
Diffstat (limited to 'arch/arm64/include/asm/kvm_pgtable.h')
-rw-r--r--arch/arm64/include/asm/kvm_pgtable.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h
index ff5d7d27eb39..21d71395a377 100644
--- a/arch/arm64/include/asm/kvm_pgtable.h
+++ b/arch/arm64/include/asm/kvm_pgtable.h
@@ -123,6 +123,24 @@ int kvm_pgtable_hyp_map(struct kvm_pgtable *pgt, u64 addr, u64 size, u64 phys,
enum kvm_pgtable_prot prot);
/**
+ * kvm_pgtable_stage2_init() - Initialise a guest stage-2 page-table.
+ * @pgt: Uninitialised page-table structure to initialise.
+ * @kvm: KVM structure representing the guest virtual machine.
+ *
+ * Return: 0 on success, negative error code on failure.
+ */
+int kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm *kvm);
+
+/**
+ * kvm_pgtable_stage2_destroy() - Destroy an unused guest stage-2 page-table.
+ * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init().
+ *
+ * The page-table is assumed to be unreachable by any hardware walkers prior
+ * to freeing and therefore no TLB invalidation is performed.
+ */
+void kvm_pgtable_stage2_destroy(struct kvm_pgtable *pgt);
+
+/**
* kvm_pgtable_walk() - Walk a page-table.
* @pgt: Page-table structure initialised by kvm_pgtable_*_init().
* @addr: Input address for the start of the walk.