On Wed, Aug 19, 2020 at 09:54:40AM +0100, Steven Price wrote:
> On 18/08/2020 15:41, Marc Zyngier wrote:
> > On 2020-08-17 09:41, Keqian Zhu wrote:
> We are discussing (re-)releasing the spec with the LPT parts added. If you
> have fundamental objections then please me know.
Like Marc, I argued s
The generic page-table walker is pretty useless as it stands, because it
doesn't understand enough to allocate anything. Teach it about stage-1
page-tables, and hook up an API for allocating these for the hypervisor
at EL2.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arc
Hello folks,
This is version three of the KVM page-table rework that I previously posted
here:
v1: https://lore.kernel.org/r/20200730153406.25136-1-w...@kernel.org
v2: https://lore.kernel.org/r/20200818132818.16065-1-w...@kernel.org
Changes since v2 include:
* Rebased onto -rc2, which inc
Add stage-2 mkyoung(), mkold() and is_young() operations to the generic
page-table code.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/include/asm/kvm_pgtable.h | 38
arch/arm64/kvm/hyp/pgtable.c | 86
2 files ch
Add stage-2 map() and unmap() operations to the generic page-table code.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/include/asm/kvm_pgtable.h | 39
arch/arm64/kvm/hyp/pgtable.c | 262 +++
2 files changed, 301 insertions(+
Convert unmap_stage2_range() to use kvm_pgtable_stage2_unmap() instead
of walking the page-table directly.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/kvm/mmu.c | 57 +---
1 file changed, 32 insertions(+), 25 deletions(-
From: Quentin Perret
Convert stage2_flush_memslot() to call the kvm_pgtable_stage2_flush()
function of the generic page-table code instead of walking the page-table
directly.
Cc: Marc Zyngier
Signed-off-by: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/kvm/mmu.c | 13 +
Add support for relaxing the permissions of a stage-2 mapping (i.e.
adding additional permissions) to the generic page-table code.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/include/asm/kvm_pgtable.h | 17 +
arch/arm64/kvm/hyp/pgtable.c
kvm_mmu_free_memory_caches() is only called by kvm_arch_vcpu_destroy(),
so inline the implementation and get rid of the extra function.
Cc: Marc Zyngier
Cc: Quentin Perret
Reviewed-by: Gavin Shan
Signed-off-by: Will Deacon
---
arch/arm64/include/asm/kvm_mmu.h | 2 --
arch/arm64/kvm/arm.c
The KVM page-table code is intricately tied into the kernel page-table
code and re-uses the pte/pmd/pud/p4d/pgd macros directly in an attempt
to reduce code duplication. Unfortunately, the reality is that there is
an awful lot of code required to make this work, and at the end of the
day you're lim
Now that the guest stage-2 page-tables are managed independently from
the host stage-1 page-tables, we can avoid constraining the IPA size
based on the host and instead limit it only based on the PARange field
of the ID_AA64MMFR0 register.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will
The stage-2 page-tables are entirely encapsulated by the 'pgt' field of
'struct kvm_s2_mmu', so remove the unused 'pgd' field.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/include/asm/kvm_host.h | 1 -
arch/arm64/kvm/mmu.c | 2 --
2 files changed,
Convert the page-aging functions and access fault handler to use the
generic page-table code instead of walking the page-table directly.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/kvm/mmu.c | 74 ++--
1 file changed, 16
From: Quentin Perret
Add a stage-2 wrprotect() operation to the generic page-table code.
Cc: Marc Zyngier
Signed-off-by: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/include/asm/kvm_pgtable.h | 15 +++
arch/arm64/kvm/hyp/pgtable.c | 6 ++
2 files changed,
Convert kvm_phys_addr_ioremap() to use kvm_pgtable_stage2_map() instead
of stage2_set_pte().
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/kvm/hyp/pgtable.c | 14 +-
arch/arm64/kvm/mmu.c | 29 -
2 files changed, 13
From: Quentin Perret
Add support for cache flushing a range of the stage-2 address space to
the generic page-table code.
Cc: Marc Zyngier
Signed-off-by: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/include/asm/kvm_pgtable.h | 12
arch/arm64/kvm/hyp/pgtable.c
In preparation for removing the 'pgd' field of 'struct kvm_s2_mmu',
update the few remaining users to check the 'pgt' field instead.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/kvm/mmu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a
From: Quentin Perret
Convert stage2_wp_range() to call the kvm_pgtable_stage2_wrprotect()
function of the generic page-table code instead of walking the page-table
directly.
Cc: Marc Zyngier
Signed-off-by: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/kvm/mmu.c | 25 --
Convert user_mem_abort() to call kvm_pgtable_stage2_relax_perms() when
handling a stage-2 permission fault and kvm_pgtable_stage2_map() when
handling a stage-2 translation fault, rather than walking the page-table
manually.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arc
Now that KVM is using the generic page-table code to manage the guest
stage-2 page-tables, we can remove a bunch of unused macros, #defines
and static inline functions from the old implementation.
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/include/asm/kvm_mmu
Now that we have a shiny new page-table allocator, replace the hyp
page-table code with calls into the new API. This also allows us to
remove the extended idmap code, as we can now simply ensure that the
VA size is large enough to map everything we need.
Cc: Marc Zyngier
Cc: Quentin Perret
Signe
Convert kvm_set_spte_hva() to use kvm_pgtable_stage2_map() instead
of stage2_set_pte().
Cc: Marc Zyngier
Cc: Quentin Perret
Signed-off-by: Will Deacon
---
arch/arm64/kvm/mmu.c | 23 ++-
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/arch/arm64/kvm/mmu.c b/a
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.
Cc: Marc Zyngier
Cc: Quentin Perret
23 matches
Mail list logo