From patchwork Fri Mar 4 17:46:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Solieri X-Patchwork-Id: 12769751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E964C433EF for ; Fri, 4 Mar 2022 18:17:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.284440.483829 (Exim 4.92) (envelope-from ) id 1nQCUR-00078H-QN; Fri, 04 Mar 2022 18:17:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 284440.483829; Fri, 04 Mar 2022 18:17:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nQCUP-0006zY-To; Fri, 04 Mar 2022 18:17:17 +0000 Received: by outflank-mailman (input) for mailman id 284440; Fri, 04 Mar 2022 17:48:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nQC2I-0005R4-OZ for xen-devel@lists.xenproject.org; Fri, 04 Mar 2022 17:48:14 +0000 Received: from radon.xt3.it (radon.xt3.it [2a01:4f8:190:4055::2]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 43c46fe5-9be3-11ec-8eba-a37418f5ba1a; Fri, 04 Mar 2022 18:48:14 +0100 (CET) Received: from nb2assolieri.mat.unimo.it ([155.185.4.56] helo=localhost) by radon.xt3.it with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1nQC2H-0000Av-9l; Fri, 04 Mar 2022 18:48:13 +0100 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 43c46fe5-9be3-11ec-8eba-a37418f5ba1a From: Marco Solieri To: xen-devel@lists.xenproject.org Cc: Marco Solieri , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , Marco Solieri , Andrea Bastoni , Luca Miccio , Stefano Stabellini Subject: [PATCH 26/36] xen/arm: add argument to remove_early_mappings Date: Fri, 4 Mar 2022 18:46:51 +0100 Message-Id: <20220304174701.1453977-27-marco.solieri@minervasys.tech> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220304174701.1453977-1-marco.solieri@minervasys.tech> References: <20220304174701.1453977-1-marco.solieri@minervasys.tech> MIME-Version: 1.0 From: Luca Miccio Upcoming patches will need to remove temporary mappings created during Xen coloring process. The function remove_early_mappings does what we need but it is case-specific. Parametrize the function to avoid code replication. Signed-off-by: Luca Miccio Signed-off-by: Marco Solieri Acked-by: Stefano Stabellini --- xen/arch/arm/include/asm/mm.h | 2 +- xen/arch/arm/mm.c | 8 ++++---- xen/arch/arm/setup.c | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h index 9ac1767595..041ec4ee70 100644 --- a/xen/arch/arm/include/asm/mm.h +++ b/xen/arch/arm/include/asm/mm.h @@ -184,7 +184,7 @@ extern void setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr); /* Map FDT in boot pagetable */ extern void *early_fdt_map(paddr_t fdt_paddr); /* Remove early mappings */ -extern void remove_early_mappings(void); +extern void remove_early_mappings(unsigned long va, unsigned long size); /* Allocate and initialise pagetables for a secondary CPU. Sets init_ttbr to the * new page table */ extern int init_secondary_pagetables(int cpu); diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index fd7a313d88..d69f18b5d2 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -597,13 +597,13 @@ void * __init early_fdt_map(paddr_t fdt_paddr) return fdt_virt; } -void __init remove_early_mappings(void) +void __init remove_early_mappings(unsigned long va, unsigned long size) { lpae_t pte = {0}; - write_pte(xen_second + second_table_offset(BOOT_FDT_VIRT_START), pte); - write_pte(xen_second + second_table_offset(BOOT_FDT_VIRT_START + SZ_2M), + write_pte(xen_second + second_table_offset(va), pte); + write_pte(xen_second + second_table_offset(va + size), pte); - flush_xen_tlb_range_va(BOOT_FDT_VIRT_START, BOOT_FDT_SLOT_SIZE); + flush_xen_tlb_range_va(va, size); } /* diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 8d980ce18d..13b10515a8 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -426,7 +427,7 @@ void __init discard_initial_modules(void) mi->nr_mods = 0; - remove_early_mappings(); + remove_early_mappings(BOOT_FDT_VIRT_START, SZ_2M); } /* Relocate the FDT in Xen heap */