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=-16.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 4DEEFC433E6 for ; Tue, 2 Mar 2021 15:01:07 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id E4EBA64F3C for ; Tue, 2 Mar 2021 15:01:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4EBA64F3C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 998D54B65C; Tue, 2 Mar 2021 10:01:06 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n9-CZ1FTMuUq; Tue, 2 Mar 2021 10:01:01 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A18B24B637; Tue, 2 Mar 2021 10:01:01 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9CB1A4B42B for ; Tue, 2 Mar 2021 10:01:00 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rotxI2woa070 for ; Tue, 2 Mar 2021 10:00:59 -0500 (EST) Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 8DF564B68B for ; Tue, 2 Mar 2021 10:00:59 -0500 (EST) Received: by mail-wr1-f73.google.com with SMTP id v13so10265319wrs.21 for ; Tue, 02 Mar 2021 07:00:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=eue23Q78bOa6+/qbv0+6w883I/AngR/tMntsoJXpnuQ=; b=nXDl1eBiQI2Aja03chUT9gTykyTfm89UeBlE5QXB1z3z62rESZY1NMmtIQrrBv8WOF Ass0zOOFiuM+77TewQc5zQ9f+75XlVxMT9kaHRSFP5pdy5PGn8GGHcVrFZ/Dn8X0pSDl zAxJ+7yMDdHK5Hubnm4RtSb+mytr0rfVYMT0DDBLLEV2kdB3bjFW48XozEWVs1ckcr3N dDr5smJaj/nTDAeNxI35YfwpklQwX+z7ZLIMRdSwDbzl0Vce1qAdeTeoJb2lQi68my3Y yyWI94ahVEOhCs2D1coNOmWYjpek8J80PGFS3oGu7r+aS3BF/QiUyFoyeeaOb2T+gs2+ HY0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=eue23Q78bOa6+/qbv0+6w883I/AngR/tMntsoJXpnuQ=; b=GD8Vp44tRgny0nYba7SRBmH+rzk8phsxxLJFqXHxMvBnQglJce1SIoyFbJ89aEE9Oj ksB5Dbe84VUqIYpDrQvx8JEg5sOlsDv3p3CkzLR+msH6TnkRUSLgk/PLxM5P97AFaVvG yJN/UGp7Alko5hoJngp9eAUAszed/PwGorJgDPAItYAPwCRm+e1qllKQUsGU2SsbGlHU AZUXGj9ca2BwRyV0JNM9/hvSSd6PtmwCCxkh6zX1h5dXmSlIcFwWJQ8IqEtHFLaDzrlH RtiGB4OeVpB4m36etre2BW1Zsdk8STSAcEKAXBUK3kOxFXQ3MtuIs/tzUmsh0VniNsIM dx/w== X-Gm-Message-State: AOAM530w5idNbdDAVuibF9iu4i1xAFzrc49mN6dRdEejmppmyC80eO4z FmEu4kj4yQmaNSCYuh2YiwejyjxVT0eH X-Google-Smtp-Source: ABdhPJxEqIQZb2BYYx4oJbXqcI8pQfBowRyHhxZCpcsx84Q/DAuukPbVQiX0S9b4CaaJzjpiugoRR377rmIT X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:a1c:b6d7:: with SMTP id g206mr4472055wmf.123.1614697257976; Tue, 02 Mar 2021 07:00:57 -0800 (PST) Date: Tue, 2 Mar 2021 14:59:53 +0000 In-Reply-To: <20210302150002.3685113-1-qperret@google.com> Message-Id: <20210302150002.3685113-24-qperret@google.com> Mime-Version: 1.0 References: <20210302150002.3685113-1-qperret@google.com> X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [PATCH v3 23/32] KVM: arm64: Make memcache anonymous in pgtable allocator From: Quentin Perret To: catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com Cc: android-kvm@google.com, seanjc@google.com, mate.toth-pal@arm.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, tabba@google.com X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu The current stage2 page-table allocator uses a memcache to get pre-allocated pages when it needs any. To allow re-using this code at EL2 which uses a concept of memory pools, make the memcache argument of kvm_pgtable_stage2_map() anonymous, and let the mm_ops zalloc_page() callbacks use it the way they need to. Signed-off-by: Quentin Perret --- arch/arm64/include/asm/kvm_pgtable.h | 6 +++--- arch/arm64/kvm/hyp/pgtable.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h index 21e0985d2e00..9935dbae2cc1 100644 --- a/arch/arm64/include/asm/kvm_pgtable.h +++ b/arch/arm64/include/asm/kvm_pgtable.h @@ -213,8 +213,8 @@ void kvm_pgtable_stage2_destroy(struct kvm_pgtable *pgt); * @size: Size of the mapping. * @phys: Physical address of the memory to map. * @prot: Permissions and attributes for the mapping. - * @mc: Cache of pre-allocated GFP_PGTABLE_USER memory from which to - * allocate page-table pages. + * @mc: Cache of pre-allocated and zeroed memory from which to allocate + * page-table pages. * * The offset of @addr within a page is ignored, @size is rounded-up to * the next page boundary and @phys is rounded-down to the previous page @@ -236,7 +236,7 @@ void kvm_pgtable_stage2_destroy(struct kvm_pgtable *pgt); */ int kvm_pgtable_stage2_map(struct kvm_pgtable *pgt, u64 addr, u64 size, u64 phys, enum kvm_pgtable_prot prot, - struct kvm_mmu_memory_cache *mc); + void *mc); /** * kvm_pgtable_stage2_unmap() - Remove a mapping from a guest stage-2 page-table. diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index 296675e5600d..bdd6e3d4eeb6 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -445,7 +445,7 @@ struct stage2_map_data { kvm_pte_t *anchor; struct kvm_s2_mmu *mmu; - struct kvm_mmu_memory_cache *memcache; + void *memcache; struct kvm_pgtable_mm_ops *mm_ops; }; @@ -669,7 +669,7 @@ static int stage2_map_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, int kvm_pgtable_stage2_map(struct kvm_pgtable *pgt, u64 addr, u64 size, u64 phys, enum kvm_pgtable_prot prot, - struct kvm_mmu_memory_cache *mc) + void *mc) { int ret; struct stage2_map_data map_data = { -- 2.30.1.766.gb4fecdf3b7-goog _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm