From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C513C433DB for ; Thu, 4 Mar 2021 14:07:59 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D548B64EEC for ; Thu, 4 Mar 2021 14:07:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D548B64EEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=z/nyKkCGF7tYvlGFALva/s2fgwkAGBp9nl0m9ldCPos=; b=lyP+nWdVXa45dHRgmtRIHD4kk lUra8qEGGb6mWtkYr7wLc3s46kM9tF7RLkoAzD/HMhA3jl02n/HafQcLtZl1nPRnWLDypvxXArZwP FjzPRBc/GQw0NJIO9FLZ5sWYfMhVH2gKoDH0+J+L/TPQBrNbATmz6yNtuG7ploG0pD1wWCrtJzVLv 7h47zbKBCATyLfRLZQexv7ehBz+32o98cfnPW/kNu9I6kBB8v8nhcedWZQf63xuHSsFaAsPoWhZWl MRcoY7N4/gVVQ80FEMJVi2j+yvMqGWBERC7H9OJMj53LFvukxPAdKSvsbsHazrnW6QZjKz5uCL2Gq F2nYZD/9g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHocN-008qGo-MU; Thu, 04 Mar 2021 14:06:19 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHocF-008qEs-QV for linux-arm-kernel@lists.infradead.org; Thu, 04 Mar 2021 14:06:14 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E38AB64EEC; Thu, 4 Mar 2021 14:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614866768; bh=1dXhPHcdLiOgxzEHJx0A7ZK7YsqkFUlqYImM4D6WVdg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NlGpZRnGSxPTSr+AY8pgAiSms8x+YYKquffA2x0ApYgl6yRgalGYhrmrc37OzlIzp VZ2GtuxlvDh6p9HWHthhiPHMU0iIZ3SvZdMa3NP70IeJpkoKEPAdVh9+ZSR/eK9UV1 iv5u1/Lh692rC4Lb0j4PJvNC0anvYYeEXaTlFNkM7m8fbX1lWrYBQX/gfqqvrXOBfv 9BB0kxeL3AfbJ1jApFr0Q8sUP0dwn7Tyl2stprU0dST8dGjtdlLlo4Eh3++eXZ2MB6 872gei5nFmauoLJYvc1deoe8SvrJMPjWQrpfBRVajyPmOU6MFyMJAJzaMobejqYHuk RRRgyPIJzCFTw== Date: Thu, 4 Mar 2021 14:06:02 +0000 From: Will Deacon To: Quentin Perret Cc: catalin.marinas@arm.com, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, android-kvm@google.com, linux-kernel@vger.kernel.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, tabba@google.com, mark.rutland@arm.com, dbrazdil@google.com, mate.toth-pal@arm.com, seanjc@google.com, robh+dt@kernel.org Subject: Re: [PATCH v3 06/32] KVM: arm64: Factor memory allocation out of pgtable.c Message-ID: <20210304140602.GC21229@willie-the-truck> References: <20210302150002.3685113-1-qperret@google.com> <20210302150002.3685113-7-qperret@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210302150002.3685113-7-qperret@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 02, 2021 at 02:59:36PM +0000, Quentin Perret wrote: > In preparation for enabling the creation of page-tables at EL2, factor > all memory allocation out of the page-table code, hence making it > re-usable with any compatible memory allocator. > > No functional changes intended. > > Signed-off-by: Quentin Perret > --- > arch/arm64/include/asm/kvm_pgtable.h | 41 +++++++++++- > arch/arm64/kvm/hyp/pgtable.c | 98 +++++++++++++++++----------- > arch/arm64/kvm/mmu.c | 66 ++++++++++++++++++- > 3 files changed, 163 insertions(+), 42 deletions(-) Just a few nits: > diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h > index 8886d43cfb11..3c306f90f7da 100644 > --- a/arch/arm64/include/asm/kvm_pgtable.h > +++ b/arch/arm64/include/asm/kvm_pgtable.h > @@ -13,17 +13,50 @@ > > typedef u64 kvm_pte_t; > > +/** > + * struct kvm_pgtable_mm_ops - Memory management callbacks. > + * @zalloc_page: Allocate a single zeroed memory page. The @arg parameter > + * can be used by the walker to pass a memcache. The > + * initial refcount of the page is 1. > + * @zalloc_pages_exact: Allocate an exact number of zeroed memory pages. The > + * @size parameter is in bytes, it is automatically rounded > + * to PAGE_SIZE and the resulting allocation is physically > + * contiguous. It's not clear to me whether "it is automatically rounded to PAGE_SIZE" means that the caller or the callee does the rounding. If it's the caller, maybe it would be better to pass the number of pages as an 'npages' argument instead of the size in bytes? > + * @free_pages_exact: Free an exact number of memory pages, to free memory > + * allocated with zalloc_pages_exact. "Free an exact number of memory pages previously allocated by zalloc_pages_exact()" > + * @get_page: Increment the refcount on a page. > + * @put_page: Decrement the refcount on a page. When the refcount > + * reaches 0 the page is automatically freed. > + * @page_count: Return the refcount of a page. > + * @phys_to_virt: Convert a physical address into a virtual address as > + * accessible in the current context. s/as accessible/mapped/ With those changes: Acked-by: Will Deacon Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel