From nobody Thu Oct 23 00:45:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1687750878568326.2591218319071; Sun, 25 Jun 2023 20:41:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.555090.866863 (Exim 4.92) (envelope-from ) id 1qDd5n-0003np-Gk; Mon, 26 Jun 2023 03:40:43 +0000 Received: by outflank-mailman (output) from mailman id 555090.866863; Mon, 26 Jun 2023 03:40:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDd5m-0003fE-4O; Mon, 26 Jun 2023 03:40:42 +0000 Received: by outflank-mailman (input) for mailman id 555090; Mon, 26 Jun 2023 03:40:37 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDd0w-0000HH-M8 for xen-devel@lists.xenproject.org; Mon, 26 Jun 2023 03:35:42 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 85cf78f1-13d2-11ee-8611-37d641c3527e; Mon, 26 Jun 2023 05:35:40 +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 256A01FB; Sun, 25 Jun 2023 20:36:24 -0700 (PDT) Received: from a011292.shanghai.arm.com (a011292.shanghai.arm.com [10.169.190.94]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7DE363F64C; Sun, 25 Jun 2023 20:35:37 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 85cf78f1-13d2-11ee-8611-37d641c3527e From: Penny Zheng To: xen-devel@lists.xenproject.org Cc: Penny Zheng , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Penny Zheng , Wei Chen Subject: [PATCH v3 11/52] xen/arm: mmu: fold FIXMAP into MMU system Date: Mon, 26 Jun 2023 11:34:02 +0800 Message-Id: <20230626033443.2943270-12-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626033443.2943270-1-Penny.Zheng@arm.com> References: <20230626033443.2943270-1-Penny.Zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1687750880173100007 Content-Type: text/plain; charset="utf-8" FIXMAP in MMU system is used to do special-purpose 4K mapping, like mapping early UART, temporarily mapping source codes for copy and paste (copy_from_paddr), etc. As FIXMAP feature is highly dependent on virtual address translation, we introduce a new Kconfig CONFIG_HAS_FIXMAP to wrap all releated codes, then we fold it into MMU system. Since PMAP relies on FIXMAP, so we fold it too into MMU system. Under !CONFIG_HAS_FIXMAP, we provide empty stubbers for not breaking compilation. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v1 -> v2 - new patch --- v3: - fold CONFIG_HAS_FIXMAP into CONFIG_HAS_MMU - change CONFIG_HAS_FIXMAP to an Arm-specific Kconfig --- xen/arch/arm/Kconfig | 7 ++++++- xen/arch/arm/include/asm/fixmap.h | 31 ++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index fb77392b82..22b28b8ba2 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 IOMMU_FORCE_PT_SHARE =20 config ARCH_DEFCONFIG @@ -63,11 +62,17 @@ source "arch/Kconfig" config HAS_MMU bool "Memory Management Unit support in a VMSA system" default y + select HAS_PMAP help In a VMSA system, a Memory Management Unit (MMU) provides fine-grained = control of a memory system through a set of virtual to physical address mappings a= nd associated memory properties held in memory-mapped tables known as translation tables. =20 +config HAS_FIXMAP + bool "Provide special-purpose 4K mapping slots in a VMSA" + depends on HAS_MMU + default y + config ACPI bool "ACPI (Advanced Configuration and Power Interface) Support (UNSUPPOR= TED)" if UNSUPPORTED depends on ARM_64 diff --git a/xen/arch/arm/include/asm/fixmap.h b/xen/arch/arm/include/asm/f= ixmap.h index d0c9a52c8c..1b5b62866b 100644 --- a/xen/arch/arm/include/asm/fixmap.h +++ b/xen/arch/arm/include/asm/fixmap.h @@ -4,9 +4,6 @@ #ifndef __ASM_FIXMAP_H #define __ASM_FIXMAP_H =20 -#include -#include - /* Fixmap slots */ #define FIXMAP_CONSOLE 0 /* The primary UART */ #define FIXMAP_MISC 1 /* Ephemeral mappings of hardware */ @@ -22,6 +19,11 @@ =20 #ifndef __ASSEMBLY__ =20 +#ifdef CONFIG_HAS_FIXMAP + +#include +#include + /* * Direct access to xen_fixmap[] should only happen when {set, * clear}_fixmap() is unusable (e.g. where we would end up to @@ -43,6 +45,29 @@ static inline unsigned int virt_to_fix(vaddr_t vaddr) return ((vaddr - FIXADDR_START) >> PAGE_SHIFT); } =20 +#else /* !CONFIG_HAS_FIXMAP */ + +#include +#include + +static inline void set_fixmap(unsigned int map, mfn_t mfn, + unsigned int attributes) +{ + ASSERT_UNREACHABLE(); +} + +static inline void clear_fixmap(unsigned int map) +{ + ASSERT_UNREACHABLE(); +} + +static inline unsigned int virt_to_fix(vaddr_t vaddr) +{ + ASSERT_UNREACHABLE(); + return -EINVAL; +} +#endif /* !CONFIG_HAS_FIXMAP */ + #endif /* __ASSEMBLY__ */ =20 #endif /* __ASM_FIXMAP_H */ --=20 2.25.1