From patchwork Mon Aug 14 04:25:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henry Wang X-Patchwork-Id: 13352339 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 A4AA6C04A6A for ; Mon, 14 Aug 2023 04:26:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.583073.913147 (Exim 4.92) (envelope-from ) id 1qVP9y-0005FZ-5p; Mon, 14 Aug 2023 04:26:30 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 583073.913147; Mon, 14 Aug 2023 04:26:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qVP9y-0005FL-2C; Mon, 14 Aug 2023 04:26:30 +0000 Received: by outflank-mailman (input) for mailman id 583073; Mon, 14 Aug 2023 04:26:28 +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 1qVP9w-0002FE-Oh for xen-devel@lists.xenproject.org; Mon, 14 Aug 2023 04:26:28 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id bc838aec-3a5a-11ee-b288-6b7b168915f2; Mon, 14 Aug 2023 06:26:28 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1A7B41063; Sun, 13 Aug 2023 21:27:10 -0700 (PDT) Received: from a015966.shanghai.arm.com (a015966.shanghai.arm.com [10.169.190.5]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D5F703F64C; Sun, 13 Aug 2023 21:26:24 -0700 (PDT) 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: bc838aec-3a5a-11ee-b288-6b7b168915f2 From: Henry Wang To: xen-devel@lists.xenproject.org Cc: Penny Zheng , Stefano Stabellini , Julien Grall , Bertrand Marquis , Wei Chen , Volodymyr Babchuk , Henry Wang Subject: [PATCH v5 08/13] xen/arm: Fold pmap and fixmap into MMU system Date: Mon, 14 Aug 2023 12:25:31 +0800 Message-Id: <20230814042536.878720-9-Henry.Wang@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230814042536.878720-1-Henry.Wang@arm.com> References: <20230814042536.878720-1-Henry.Wang@arm.com> MIME-Version: 1.0 From: Penny Zheng fixmap and pmap are MMU-specific features, so fold them to MMU system. Do the folding for pmap by moving the HAS_PMAP Kconfig selection under HAS_MMU. Do the folding for fixmap by moving the implementation of virt_to_fix() to mmu/mm.c, so that unnecessary stubs can be avoided. Signed-off-by: Penny Zheng Signed-off-by: Henry Wang --- v5: - Rebase on top of xen/arm: Introduce CONFIG_MMU Kconfig option v4: - Rework "[v3,11/52] xen/arm: mmu: fold FIXMAP into MMU system", change the order of this patch and avoid introducing stubs. --- xen/arch/arm/Kconfig | 2 +- xen/arch/arm/include/asm/fixmap.h | 7 +------ xen/arch/arm/mmu/mm.c | 7 +++++++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index eb0413336b..8a7b79b4b5 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -15,7 +15,6 @@ config ARM select HAS_DEVICE_TREE select HAS_PASSTHROUGH select HAS_PDX - select HAS_PMAP select HAS_UBSAN select IOMMU_FORCE_PT_SHARE @@ -61,6 +60,7 @@ config PADDR_BITS config MMU def_bool y + select HAS_PMAP source "arch/Kconfig" diff --git a/xen/arch/arm/include/asm/fixmap.h b/xen/arch/arm/include/asm/fixmap.h index 734eb9b1d4..5d5de6995a 100644 --- a/xen/arch/arm/include/asm/fixmap.h +++ b/xen/arch/arm/include/asm/fixmap.h @@ -36,12 +36,7 @@ extern void clear_fixmap(unsigned int map); #define fix_to_virt(slot) ((void *)FIXMAP_ADDR(slot)) -static inline unsigned int virt_to_fix(vaddr_t vaddr) -{ - BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); - - return ((vaddr - FIXADDR_START) >> PAGE_SHIFT); -} +extern unsigned int virt_to_fix(vaddr_t vaddr); #endif /* __ASSEMBLY__ */ diff --git a/xen/arch/arm/mmu/mm.c b/xen/arch/arm/mmu/mm.c index b70982e9d6..1d6267e6c5 100644 --- a/xen/arch/arm/mmu/mm.c +++ b/xen/arch/arm/mmu/mm.c @@ -1136,6 +1136,13 @@ int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns) return xen_pt_update(virt, INVALID_MFN, nr_mfns, _PAGE_POPULATE); } +unsigned int virt_to_fix(vaddr_t vaddr) +{ + BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); + + return ((vaddr - FIXADDR_START) >> PAGE_SHIFT); +} + /* * Local variables: * mode: C