On Mon, Feb 20, 2023 at 02:35:46PM +0800, Shaoqin Huang wrote: > Hi Ricardo, > > On 2/18/23 11:23, Ricardo Koller wrote: > > Add a stage2 helper, kvm_pgtable_stage2_create_unlinked(), for > > creating unlinked tables (which is the opposite of > > kvm_pgtable_stage2_free_unlinked()). Creating an unlinked table is > > useful for splitting PMD and PUD blocks into subtrees of PAGE_SIZE > > PTEs. For example, a PUD can be split into PAGE_SIZE PTEs by first > > creating a fully populated tree, and then use it to replace the PUD in > > a single step. This will be used in a subsequent commit for eager > > huge-page splitting (a dirty-logging optimization). > > > > No functional change intended. This new function will be used in a > > subsequent commit. > > > > Signed-off-by: Ricardo Koller <ricarkol@xxxxxxxxxx> > > --- > > arch/arm64/include/asm/kvm_pgtable.h | 28 +++++++++++++++++ > > arch/arm64/kvm/hyp/pgtable.c | 46 ++++++++++++++++++++++++++++ > > 2 files changed, 74 insertions(+) > > > > diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h > > index dcd3aafd3e6c..b8cde914cca9 100644 > > --- a/arch/arm64/include/asm/kvm_pgtable.h > > +++ b/arch/arm64/include/asm/kvm_pgtable.h > > @@ -460,6 +460,34 @@ void kvm_pgtable_stage2_destroy(struct kvm_pgtable *pgt); > > */ > > void kvm_pgtable_stage2_free_unlinked(struct kvm_pgtable_mm_ops *mm_ops, void *pgtable, u32 level); > > +/** > > + * kvm_pgtable_stage2_create_unlinked() - Create an unlinked stage-2 paging structure. > > + * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*(). > > + * @phys: Physical address of the memory to map. > > + * @level: Starting level of the stage-2 paging structure to be created. > > + * @prot: Permissions and attributes for the mapping. > > + * @mc: Cache of pre-allocated and zeroed memory from which to allocate > > + * page-table pages. > > + * @force_pte: Force mappings to PAGE_SIZE granularity. > > + * > > + * Create an unlinked page-table tree under @new. If @force_pte is > The @new parameter has been deleted, you should update the comments too. > > Thanks, > Shaoqin > Right. Sending a v5 in a bit. Thanks, Ricardo