From patchwork Wed Mar 12 13:52:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013587 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 3A180C28B28 for ; Wed, 12 Mar 2025 13:53:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910336.1317081 (Exim 4.92) (envelope-from ) id 1tsMWF-0006yU-4W; Wed, 12 Mar 2025 13:53:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910336.1317081; Wed, 12 Mar 2025 13:53:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tsMWE-0006xv-Ul; Wed, 12 Mar 2025 13:53:10 +0000 Received: by outflank-mailman (input) for mailman id 910336; Wed, 12 Mar 2025 13:53:10 +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 1tsMWE-0006ux-4E for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:10 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 54a406a4-ff49-11ef-9ab9-95dc52dad729; Wed, 12 Mar 2025 14:53:09 +0100 (CET) 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 470F41595; Wed, 12 Mar 2025 06:53:19 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2DAD13F5A1; Wed, 12 Mar 2025 06:53:07 -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: 54a406a4-ff49-11ef-9ab9-95dc52dad729 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Julien Grall Subject: [v5,01/10] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH Date: Wed, 12 Mar 2025 13:52:49 +0000 Message-Id: <20250312135258.1815706-2-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 When Xen is built without HAS_PASSTHROUGH, there are some parts in arm where iommu_* functions are called in the codebase, but their implementation is under xen/drivers/passthrough that is not built. So provide some stub for these functions in order to build Xen when !HAS_PASSTHROUGH, which is the case for example on systems with MPU support. For gnttab_need_iommu_mapping() in the Arm part, modify the macro to use IS_ENABLED for the HAS_PASSTHROUGH Kconfig. Fixes: 0388a5979b21 ("xen/arm: mpu: Introduce choice between MMU and MPU") Signed-off-by: Luca Fancellu Acked-by: Julien Grall Acked-by: Jan Beulich --- https://patchwork.kernel.org/project/xen-devel/patch/20250307075818.740649-2-luca.fancellu@arm.com/ v5 changes: - Add Ack-by Julien and Jan - Add comment in iommu_add_dt_device - adjusted aligment for iommu_use_hap_pt v4 changes: - re-introduced stub for iommu_use_hap_pt, Stefano suggested it is ok to have it in iommu.h. - Reworded comment in iommu_domain_init from Jan suggestion v3 Changes: - removed stub for iommu_use_hap_pt, another solution will be done for the instance in common arm code. - Moved a comment close to the macro it was referred to - add comment to iommu_domain_init() stub - modified commit message - Add fixes tag v2 Changes: - modify gnttab_need_iommu_mapping to use IS_ENABLED - removed macro that didn't allow some of the parameter to be evaluated - Changed commit message --- --- xen/arch/arm/include/asm/grant_table.h | 5 ++- xen/include/xen/iommu.h | 54 +++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/include/asm/grant_table.h b/xen/arch/arm/include/asm/grant_table.h index d3c518a926b9..c5d87b60c4df 100644 --- a/xen/arch/arm/include/asm/grant_table.h +++ b/xen/arch/arm/include/asm/grant_table.h @@ -73,8 +73,9 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame, #define gnttab_status_gfn(d, t, i) \ page_get_xenheap_gfn(gnttab_status_page(t, i)) -#define gnttab_need_iommu_mapping(d) \ - (is_domain_direct_mapped(d) && is_iommu_enabled(d)) +#define gnttab_need_iommu_mapping(d) \ + (IS_ENABLED(CONFIG_HAS_PASSTHROUGH) && is_domain_direct_mapped(d) && \ + is_iommu_enabled(d)) #endif /* __ASM_GRANT_TABLE_H__ */ /* diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 77a514019cc6..b634da2c7256 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -110,6 +110,8 @@ extern int8_t iommu_hwdom_reserved; extern unsigned int iommu_dev_iotlb_timeout; +#ifdef CONFIG_HAS_PASSTHROUGH + int iommu_setup(void); int iommu_hardware_setup(void); @@ -122,6 +124,28 @@ int arch_iommu_domain_init(struct domain *d); void arch_iommu_check_autotranslated_hwdom(struct domain *d); void arch_iommu_hwdom_init(struct domain *d); +#else + +static inline int iommu_setup(void) +{ + return -ENODEV; +} + +static inline int iommu_domain_init(struct domain *d, unsigned int opts) +{ + /* + * Return as the real iommu_domain_init() would: Success when + * !is_iommu_enabled(), following from !iommu_enabled when !HAS_PASSTHROUGH + */ + return 0; +} + +static inline void iommu_hwdom_init(struct domain *d) {} + +static inline void iommu_domain_destroy(struct domain *d) {} + +#endif /* HAS_PASSTHROUGH */ + /* * The following flags are passed to map (applicable ones also to unmap) * operations, while some are passed back by lookup operations. @@ -209,6 +233,8 @@ struct msi_msg; #ifdef CONFIG_HAS_DEVICE_TREE #include +#ifdef CONFIG_HAS_PASSTHROUGH + int iommu_assign_dt_device(struct domain *d, struct dt_device_node *dev); int iommu_deassign_dt_device(struct domain *d, struct dt_device_node *dev); int iommu_dt_domain_init(struct domain *d); @@ -238,6 +264,30 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, */ int iommu_remove_dt_device(struct dt_device_node *np); +#else + +static inline int iommu_assign_dt_device(struct domain *d, + struct dt_device_node *dev) +{ + return -EINVAL; +} + +static inline int iommu_add_dt_device(struct dt_device_node *np) +{ + /* + * !HAS_PASSTHROUGH => !iommu_enabled (see the non-stub + * iommu_add_dt_device()) + */ + return 1; +} + +static inline int iommu_release_dt_devices(struct domain *d) +{ + return 0; +} + +#endif /* HAS_PASSTHROUGH */ + #endif /* HAS_DEVICE_TREE */ struct page_info; @@ -383,17 +433,19 @@ struct domain_iommu { #define iommu_set_feature(d, f) set_bit(f, dom_iommu(d)->features) #define iommu_clear_feature(d, f) clear_bit(f, dom_iommu(d)->features) +#ifdef CONFIG_HAS_PASSTHROUGH /* Are we using the domain P2M table as its IOMMU pagetable? */ #define iommu_use_hap_pt(d) (IS_ENABLED(CONFIG_HVM) && \ dom_iommu(d)->hap_pt_share) /* Does the IOMMU pagetable need to be kept synchronized with the P2M */ -#ifdef CONFIG_HAS_PASSTHROUGH #define need_iommu_pt_sync(d) (dom_iommu(d)->need_sync) int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); #else +#define iommu_use_hap_pt(d) ({ (void)(d); false; }) + #define need_iommu_pt_sync(d) ({ (void)(d); false; }) static inline int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d, From patchwork Wed Mar 12 13:52:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013591 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 48B47C28B28 for ; Wed, 12 Mar 2025 13:53:46 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910338.1317104 (Exim 4.92) (envelope-from ) id 1tsMWI-0007d4-HO; Wed, 12 Mar 2025 13:53:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910338.1317104; Wed, 12 Mar 2025 13:53:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tsMWI-0007cv-EH; Wed, 12 Mar 2025 13:53:14 +0000 Received: by outflank-mailman (input) for mailman id 910338; Wed, 12 Mar 2025 13:53:12 +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 1tsMWG-0007NP-Oi for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:12 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 555dad2c-ff49-11ef-9898-31a8f345e629; Wed, 12 Mar 2025 14:53:10 +0100 (CET) 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 8B621152B; Wed, 12 Mar 2025 06:53:20 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CEFF53F5A1; Wed, 12 Mar 2025 06:53:08 -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: 555dad2c-ff49-11ef-9898-31a8f345e629 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [v5,02/10] xen/arm: Restrict Kconfig configuration for LLC coloring Date: Wed, 12 Mar 2025 13:52:50 +0000 Message-Id: <20250312135258.1815706-3-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 Xen LLC coloring feature can be used only on the MMU subsystem, move the code that selects it from ARM_64 to MMU and add the ARM_64 dependency. Signed-off-by: Luca Fancellu Reviewed-by: Michal Orzel --- https://patchwork.kernel.org/project/xen-devel/patch/20250307075818.740649-3-luca.fancellu@arm.com/ v5 changes: - no changes v4 changes: - clarified that it's the Xen feature LLC coloring that is not applicable to the MPU subsystem, not the generic cache coloring method. - Add R-by Michal v3 changes: - Dropped comment on top of boot_fdt_info() v2 changes: - dropped part of the v1 code, now this one is simpler, I will discuss better how to design a common boot flow for MPU and implement on another patch. --- --- xen/arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index a26d3e11827c..ffdff1f0a36c 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -8,7 +8,6 @@ config ARM_64 depends on !ARM_32 select 64BIT select HAS_FAST_MULTIPLY - select HAS_LLC_COLORING if !NUMA config ARM def_bool y @@ -76,6 +75,7 @@ choice config MMU bool "MMU" + select HAS_LLC_COLORING if !NUMA && ARM_64 select HAS_PMAP select HAS_VMAP select HAS_PASSTHROUGH From patchwork Wed Mar 12 13:52:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013588 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 ACDE7C28B28 for ; Wed, 12 Mar 2025 13:53:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910337.1317095 (Exim 4.92) (envelope-from ) id 1tsMWH-0007No-CA; Wed, 12 Mar 2025 13:53:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910337.1317095; Wed, 12 Mar 2025 13:53:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tsMWH-0007Nh-7Y; Wed, 12 Mar 2025 13:53:13 +0000 Received: by outflank-mailman (input) for mailman id 910337; Wed, 12 Mar 2025 13:53:12 +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 1tsMWF-0006ux-Uj for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:11 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 5606bdaa-ff49-11ef-9ab9-95dc52dad729; Wed, 12 Mar 2025 14:53:11 +0100 (CET) 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 CEF0F1691; Wed, 12 Mar 2025 06:53:21 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1EAB73F5A1; Wed, 12 Mar 2025 06:53:09 -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: 5606bdaa-ff49-11ef-9ab9-95dc52dad729 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH 03/10] arm/mpu: Add HYPERVISOR_VIRT_START and avoid a check in xen.lds.S Date: Wed, 12 Mar 2025 13:52:51 +0000 Message-Id: <20250312135258.1815706-4-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 The define HYPERVISOR_VIRT_START is required by the common code, even if MPU system doesn't use virtual memory, define it in mpu/layout.h in order to reuse existing code. Disable a check in the linker script for arm for !MMU systems. Signed-off-by: Luca Fancellu --- xen/arch/arm/include/asm/mpu/layout.h | 2 ++ xen/arch/arm/xen.lds.S | 2 ++ 2 files changed, 4 insertions(+) diff --git a/xen/arch/arm/include/asm/mpu/layout.h b/xen/arch/arm/include/asm/mpu/layout.h index d6d397f4c2ac..248e55f8882d 100644 --- a/xen/arch/arm/include/asm/mpu/layout.h +++ b/xen/arch/arm/include/asm/mpu/layout.h @@ -22,6 +22,8 @@ */ #define XEN_VIRT_START _AT(paddr_t, XEN_START_ADDRESS) +#define HYPERVISOR_VIRT_START XEN_VIRT_START + #endif /* __ARM_MPU_LAYOUT_H__ */ /* * Local variables: diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index bbccff1a0350..4342e54422a7 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -239,4 +239,6 @@ ASSERT(IS_ALIGNED(__bss_start, POINTER_ALIGN), "__bss_start is misaligned") ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned") /* To simplify the logic in head.S, we want to _end to be page aligned */ ASSERT(IS_ALIGNED(_end, PAGE_SIZE), "_end is not page aligned") +#ifdef CONFIG_MMU ASSERT((_end - _start) <= XEN_VIRT_SIZE, "Xen is too big") +#endif From patchwork Wed Mar 12 13:52:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013590 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 01A63C28B2F for ; Wed, 12 Mar 2025 13:53:39 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910339.1317114 (Exim 4.92) (envelope-from ) id 1tsMWK-0007uY-Ot; Wed, 12 Mar 2025 13:53:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910339.1317114; Wed, 12 Mar 2025 13:53:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tsMWK-0007uP-MB; Wed, 12 Mar 2025 13:53:16 +0000 Received: by outflank-mailman (input) for mailman id 910339; Wed, 12 Mar 2025 13:53:15 +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 1tsMWJ-0007NP-7l for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:15 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 5721bf00-ff49-11ef-9898-31a8f345e629; Wed, 12 Mar 2025 14:53:13 +0100 (CET) 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 7C4FD1595; Wed, 12 Mar 2025 06:53:23 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 635193F5A1; Wed, 12 Mar 2025 06:53:11 -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: 5721bf00-ff49-11ef-9898-31a8f345e629 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Penny Zheng , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Penny Zheng , Wei Chen Subject: [PATCH 04/10] arm/mpu: Implement virt/maddr conversion in MPU system Date: Wed, 12 Mar 2025 13:52:52 +0000 Message-Id: <20250312135258.1815706-5-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 From: Penny Zheng virt_to_maddr and maddr_to_virt are used widely in Xen code. So even there is no VMSA in MPU system, we keep the interface in MPU to don't change the existing common code. In order to do that, move the virt_to_maddr() definition to mmu/mm.h, instead for maddr_to_virt() it's more difficult to isolate it under mmu/ so it will be protected by #ifdef CONFIG_MMU. Finally implement virt_to_maddr() and maddr_to_virt() for MPU systems under mpu/mm.h, the MPU version of virt/maddr conversion is simple since VA==PA. While there, take the occasion to add emacs footer to mpu/mm.c. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu --- xen/arch/arm/include/asm/mm.h | 13 +++++++------ xen/arch/arm/include/asm/mmu/mm.h | 7 +++++++ xen/arch/arm/include/asm/mpu/mm.h | 27 +++++++++++++++++++++++++++ xen/arch/arm/mpu/mm.c | 9 +++++++++ 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 xen/arch/arm/include/asm/mpu/mm.h diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h index a0d8e5afe977..e7767cdab493 100644 --- a/xen/arch/arm/include/asm/mm.h +++ b/xen/arch/arm/include/asm/mm.h @@ -16,8 +16,10 @@ #if defined(CONFIG_MMU) # include -#elif !defined(CONFIG_MPU) -# error "Unknown memory management layout" +#elif defined(CONFIG_MPU) +# include +#else +#error "Unknown memory management layout" #endif /* Align Xen to a 2 MiB boundary. */ @@ -261,10 +263,7 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len) /* Page-align address and convert to frame number format */ #define paddr_to_pfn_aligned(paddr) paddr_to_pfn(PAGE_ALIGN(paddr)) -#define virt_to_maddr(va) ({ \ - vaddr_t va_ = (vaddr_t)(va); \ - (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \ -}) +#if defined(CONFIG_MMU) #ifdef CONFIG_ARM_32 /** @@ -310,6 +309,8 @@ static inline void *maddr_to_virt(paddr_t ma) } #endif +#endif /* CONFIG_MMU */ + /* * Translate a guest virtual address to a machine address. * Return the fault information if the translation has failed else 0. diff --git a/xen/arch/arm/include/asm/mmu/mm.h b/xen/arch/arm/include/asm/mmu/mm.h index f5a00558c47b..5ff2071133ee 100644 --- a/xen/arch/arm/include/asm/mmu/mm.h +++ b/xen/arch/arm/include/asm/mmu/mm.h @@ -2,6 +2,8 @@ #ifndef __ARM_MMU_MM_H__ #define __ARM_MMU_MM_H__ +#include + /* Non-boot CPUs use this to find the correct pagetables. */ extern uint64_t init_ttbr; @@ -14,6 +16,11 @@ extern unsigned long directmap_base_pdx; #define frame_table ((struct page_info *)FRAMETABLE_VIRT_START) +#define virt_to_maddr(va) ({ \ + vaddr_t va_ = (vaddr_t)(va); \ + (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \ +}) + /* * Print a walk of a page table or p2m * diff --git a/xen/arch/arm/include/asm/mpu/mm.h b/xen/arch/arm/include/asm/mpu/mm.h new file mode 100644 index 000000000000..57f1e558fd44 --- /dev/null +++ b/xen/arch/arm/include/asm/mpu/mm.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ARM_MPU_MM__ +#define __ARM_MPU_MM__ + +#include + +#define virt_to_maddr(va) ({ \ + (paddr_t)va; \ +}) + +/* On MPU systems there is no translation, ma == va. */ +static inline void *maddr_to_virt(paddr_t ma) +{ + return _p(ma); +} + +#endif /* __ARM_MPU_MM__ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c index 0b8748e57598..a11e017d8a96 100644 --- a/xen/arch/arm/mpu/mm.c +++ b/xen/arch/arm/mpu/mm.c @@ -13,3 +13,12 @@ static void __init __maybe_unused build_assertions(void) */ BUILD_BUG_ON(PAGE_SIZE != SZ_4K); } + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ From patchwork Wed Mar 12 13:52:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013592 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 CDD94C28B28 for ; Wed, 12 Mar 2025 13:53:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910340.1317119 (Exim 4.92) (envelope-from ) id 1tsMWL-0007xX-4o; Wed, 12 Mar 2025 13:53:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910340.1317119; Wed, 12 Mar 2025 13:53:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tsMWK-0007wX-UH; Wed, 12 Mar 2025 13:53:16 +0000 Received: by outflank-mailman (input) for mailman id 910340; Wed, 12 Mar 2025 13:53:15 +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 1tsMWJ-0006ux-EH for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:15 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 57e1c12b-ff49-11ef-9ab9-95dc52dad729; Wed, 12 Mar 2025 14:53:14 +0100 (CET) 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 C05D8152B; Wed, 12 Mar 2025 06:53:24 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 100F63F5A1; Wed, 12 Mar 2025 06:53:12 -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: 57e1c12b-ff49-11ef-9ab9-95dc52dad729 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH 05/10] arm/mpu: Introduce frame_table, virt_to_page, maddr_to_virt Date: Wed, 12 Mar 2025 13:52:53 +0000 Message-Id: <20250312135258.1815706-6-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 Introduce variables and functions used in the common Arm code by MPU memory management subsystem, provide struct page_info and the MPU implementation for helpers and macros used in the common arm code. Moving virt_to_page helper to mmu/mpu part is not easy as it needs visibility of 'struct page_info', so protect it with CONFIG_MMU and provide the MPU variant in the #else branch. Introduce FRAMETABLE_NR that is required for 'pdx_group_valid' in pdx.c. Signed-off-by: Luca Fancellu --- xen/arch/arm/include/asm/mm.h | 18 ++++++++++++++++++ xen/arch/arm/include/asm/mpu/layout.h | 3 +++ xen/arch/arm/include/asm/mpu/mm.h | 3 +++ xen/arch/arm/mpu/mm.c | 4 ++++ 4 files changed, 28 insertions(+) diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h index e7767cdab493..c96d33aceaf0 100644 --- a/xen/arch/arm/include/asm/mm.h +++ b/xen/arch/arm/include/asm/mm.h @@ -341,6 +341,8 @@ static inline uint64_t gvirt_to_maddr(vaddr_t va, paddr_t *pa, #define virt_to_mfn(va) __virt_to_mfn(va) #define mfn_to_virt(mfn) __mfn_to_virt(mfn) +#ifdef CONFIG_MMU + /* Convert between Xen-heap virtual addresses and page-info structures. */ static inline struct page_info *virt_to_page(const void *v) { @@ -355,6 +357,22 @@ static inline struct page_info *virt_to_page(const void *v) return frame_table + pdx - frametable_base_pdx; } +#else /* !CONFIG_MMU */ + +/* Convert between virtual address to page-info structure. */ +static inline struct page_info *virt_to_page(const void *v) +{ + unsigned long pdx; + + pdx = paddr_to_pdx(virt_to_maddr(v)); + ASSERT(pdx >= frametable_base_pdx); + ASSERT(pdx < frametable_pdx_end); + + return frame_table + pdx - frametable_base_pdx; +} + +#endif /* CONFIG_MMU */ + static inline void *page_to_virt(const struct page_info *pg) { return mfn_to_virt(mfn_x(page_to_mfn(pg))); diff --git a/xen/arch/arm/include/asm/mpu/layout.h b/xen/arch/arm/include/asm/mpu/layout.h index 248e55f8882d..c46b634c9c15 100644 --- a/xen/arch/arm/include/asm/mpu/layout.h +++ b/xen/arch/arm/include/asm/mpu/layout.h @@ -3,6 +3,9 @@ #ifndef __ARM_MPU_LAYOUT_H__ #define __ARM_MPU_LAYOUT_H__ +#define FRAMETABLE_SIZE GB(32) +#define FRAMETABLE_NR (FRAMETABLE_SIZE / sizeof(*frame_table)) + #define XEN_START_ADDRESS CONFIG_XEN_START_ADDRESS /* diff --git a/xen/arch/arm/include/asm/mpu/mm.h b/xen/arch/arm/include/asm/mpu/mm.h index 57f1e558fd44..2219c9979548 100644 --- a/xen/arch/arm/include/asm/mpu/mm.h +++ b/xen/arch/arm/include/asm/mpu/mm.h @@ -5,6 +5,9 @@ #include +extern struct page_info *frame_table; +extern unsigned long frametable_pdx_end; + #define virt_to_maddr(va) ({ \ (paddr_t)va; \ }) diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c index a11e017d8a96..4036dd62eeeb 100644 --- a/xen/arch/arm/mpu/mm.c +++ b/xen/arch/arm/mpu/mm.c @@ -3,6 +3,10 @@ #include #include #include +#include + +struct page_info *frame_table; +unsigned long __read_mostly frametable_pdx_end; static void __init __maybe_unused build_assertions(void) { From patchwork Wed Mar 12 13:52:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013594 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 06667C28B2F for ; Wed, 12 Mar 2025 13:53:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910341.1317132 (Exim 4.92) (envelope-from ) id 1tsMWM-0008KV-BT; Wed, 12 Mar 2025 13:53:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910341.1317132; Wed, 12 Mar 2025 13:53:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tsMWM-0008JQ-73; Wed, 12 Mar 2025 13:53:18 +0000 Received: by outflank-mailman (input) for mailman id 910341; Wed, 12 Mar 2025 13:53:17 +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 1tsMWL-0007NP-FY for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:17 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 589d9d72-ff49-11ef-9898-31a8f345e629; Wed, 12 Mar 2025 14:53:15 +0100 (CET) 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 100CE1595; Wed, 12 Mar 2025 06:53:26 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5417B3F5A1; Wed, 12 Mar 2025 06:53:14 -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: 589d9d72-ff49-11ef-9898-31a8f345e629 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH 06/10] arm/mpu: Kconfig symbols for MPU build Date: Wed, 12 Mar 2025 13:52:54 +0000 Message-Id: <20250312135258.1815706-7-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 Currently the MPU system requires static memory to work, select that when building this memory management subsystem. While there, provide a restriction for the ARM_EFI Kconfig parameter to be built only when !MPU, the EFI stub is not used as there are no implementation of UEFI services for armv8-r. Signed-off-by: Luca Fancellu --- xen/arch/arm/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index ffdff1f0a36c..5ac6ec0212d2 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -85,6 +85,7 @@ config MMU config MPU bool "MPU" if UNSUPPORTED + select STATIC_MEMORY help Memory Protection Unit (MPU). Select if you plan to run Xen on ARMv8-R systems supporting EL2. (UNSUPPORTED) @@ -102,7 +103,7 @@ config ACPI config ARM_EFI bool "UEFI boot service support" - depends on ARM_64 + depends on ARM_64 && !MPU default y help This option provides support for boot services through From patchwork Wed Mar 12 13:52:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013593 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 5B33EC28B28 for ; Wed, 12 Mar 2025 13:53:54 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910343.1317143 (Exim 4.92) (envelope-from ) id 1tsMWN-0000DI-M2; Wed, 12 Mar 2025 13:53:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910343.1317143; Wed, 12 Mar 2025 13:53: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 1tsMWN-0000CS-HY; Wed, 12 Mar 2025 13:53:19 +0000 Received: by outflank-mailman (input) for mailman id 910343; Wed, 12 Mar 2025 13:53:17 +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 1tsMWL-0006ux-O1 for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:17 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 596329fd-ff49-11ef-9ab9-95dc52dad729; Wed, 12 Mar 2025 14:53:17 +0100 (CET) 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 544F3152B; Wed, 12 Mar 2025 06:53:27 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 97F2C3F5A1; Wed, 12 Mar 2025 06:53:15 -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: 596329fd-ff49-11ef-9ab9-95dc52dad729 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH 07/10] arm/mpu: Implement stubs for ioremap_attr on MPU Date: Wed, 12 Mar 2025 13:52:55 +0000 Message-Id: <20250312135258.1815706-8-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 Implement ioremap_attr() stub for MPU system; the implementation of ioremap() is the same between MMU and MPU system, and it relies on ioremap_attr(), so move the definition from mmu/pt.c to arm/mm.c. Signed-off-by: Luca Fancellu --- xen/arch/arm/mm.c | 5 +++++ xen/arch/arm/mmu/pt.c | 5 ----- xen/arch/arm/mpu/mm.c | 6 ++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index a56e20ba2bdc..5a52f0c623e5 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -395,6 +395,11 @@ unsigned long get_upper_mfn_bound(void) return max_page - 1; } +void *ioremap(paddr_t pa, size_t len) +{ + return ioremap_attr(pa, len, PAGE_HYPERVISOR_NOCACHE); +} + /* * Local variables: * mode: C diff --git a/xen/arch/arm/mmu/pt.c b/xen/arch/arm/mmu/pt.c index da28d669e796..11cb1c66dac8 100644 --- a/xen/arch/arm/mmu/pt.c +++ b/xen/arch/arm/mmu/pt.c @@ -223,11 +223,6 @@ void *ioremap_attr(paddr_t start, size_t len, unsigned int attributes) return ptr + offs; } -void *ioremap(paddr_t pa, size_t len) -{ - return ioremap_attr(pa, len, PAGE_HYPERVISOR_NOCACHE); -} - static int create_xen_table(lpae_t *entry) { mfn_t mfn; diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c index 4036dd62eeeb..b196661a2312 100644 --- a/xen/arch/arm/mpu/mm.c +++ b/xen/arch/arm/mpu/mm.c @@ -18,6 +18,12 @@ static void __init __maybe_unused build_assertions(void) BUILD_BUG_ON(PAGE_SIZE != SZ_4K); } +void __iomem *ioremap_attr(paddr_t start, size_t len, unsigned int flags) +{ + BUG_ON("unimplemented"); + return NULL; +} + /* * Local variables: * mode: C From patchwork Wed Mar 12 13:52:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013595 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 2F514C28B28 for ; Wed, 12 Mar 2025 13:54:10 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910346.1317154 (Exim 4.92) (envelope-from ) id 1tsMWQ-0000dl-3f; Wed, 12 Mar 2025 13:53:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910346.1317154; Wed, 12 Mar 2025 13:53:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tsMWP-0000d1-VQ; Wed, 12 Mar 2025 13:53:21 +0000 Received: by outflank-mailman (input) for mailman id 910346; Wed, 12 Mar 2025 13:53:20 +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 1tsMWO-0007NP-9v for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:20 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 5a25673b-ff49-11ef-9898-31a8f345e629; Wed, 12 Mar 2025 14:53:18 +0100 (CET) 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 9AB751595; Wed, 12 Mar 2025 06:53:28 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DC3F23F5A1; Wed, 12 Mar 2025 06:53:16 -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: 5a25673b-ff49-11ef-9898-31a8f345e629 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH 08/10] xen/arm: Rename setup_pagetables with a more generic name Date: Wed, 12 Mar 2025 13:52:56 +0000 Message-Id: <20250312135258.1815706-9-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 Rename the setup_pagetables function to setup_mappings in order to be implemented also for MPU system that does not have page tables. Introduce a stub implementation for MPU in order to allow the compilation. Signed-off-by: Luca Fancellu --- xen/arch/arm/include/asm/mm.h | 2 +- xen/arch/arm/mmu/setup.c | 2 +- xen/arch/arm/mpu/Makefile | 1 + xen/arch/arm/mpu/setup.c | 18 ++++++++++++++++++ xen/arch/arm/setup.c | 6 +++--- 5 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 xen/arch/arm/mpu/setup.c diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h index c96d33aceaf0..9bf5c846c86c 100644 --- a/xen/arch/arm/include/asm/mm.h +++ b/xen/arch/arm/include/asm/mm.h @@ -206,7 +206,7 @@ extern unsigned long frametable_base_pdx; #define PDX_GROUP_SHIFT SECOND_SHIFT /* Boot-time pagetable setup */ -extern void setup_pagetables(void); +extern void setup_mappings(void); /* Map FDT in boot pagetable */ extern void *early_fdt_map(paddr_t fdt_paddr); /* Remove early mappings */ diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c index 30afe9778194..35ffa5479dd3 100644 --- a/xen/arch/arm/mmu/setup.c +++ b/xen/arch/arm/mmu/setup.c @@ -354,7 +354,7 @@ static void __init create_llc_coloring_mappings(void) * Boot-time pagetable setup. * Changes here may need matching changes in head.S */ -void __init setup_pagetables(void) +void __init setup_mappings(void) { uint64_t ttbr; lpae_t pte, *p; diff --git a/xen/arch/arm/mpu/Makefile b/xen/arch/arm/mpu/Makefile index b18cec483671..04df0b2ee760 100644 --- a/xen/arch/arm/mpu/Makefile +++ b/xen/arch/arm/mpu/Makefile @@ -1 +1,2 @@ obj-y += mm.o +obj-y += setup.init.o diff --git a/xen/arch/arm/mpu/setup.c b/xen/arch/arm/mpu/setup.c new file mode 100644 index 000000000000..45214bfeb661 --- /dev/null +++ b/xen/arch/arm/mpu/setup.c @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +void __init setup_mappings(void) +{ + BUG_ON("unimplemented"); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index ffcae900d72e..4c9ed747f9a8 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -338,10 +338,10 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr) llc_coloring_init(); /* - * Page tables must be setup after LLC coloring initialization because - * coloring info are required in order to create colored mappings + * On MMU, page tables must be setup after LLC coloring initialization + * because coloring info are required in order to create colored mappings */ - setup_pagetables(); + setup_mappings(); /* Device-tree was mapped in boot page tables, remap it in the new tables */ device_tree_flattened = early_fdt_map(fdt_paddr); From patchwork Wed Mar 12 13:52:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013596 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 3590AC28B28 for ; Wed, 12 Mar 2025 13:54:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910352.1317164 (Exim 4.92) (envelope-from ) id 1tsMWR-000102-Ur; Wed, 12 Mar 2025 13:53:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910352.1317164; Wed, 12 Mar 2025 13:53:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tsMWR-0000y8-Os; Wed, 12 Mar 2025 13:53:23 +0000 Received: by outflank-mailman (input) for mailman id 910352; Wed, 12 Mar 2025 13:53:22 +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 1tsMWQ-0007NP-G7 for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:22 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 5b2b9233-ff49-11ef-9898-31a8f345e629; Wed, 12 Mar 2025 14:53:20 +0100 (CET) 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 476E8152B; Wed, 12 Mar 2025 06:53:30 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2EDBB3F5A1; Wed, 12 Mar 2025 06:53:18 -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: 5b2b9233-ff49-11ef-9898-31a8f345e629 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Penny Zheng , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Penny Zheng , Wei Chen Subject: [PATCH 09/10] xen/arm: introduce Kconfig HAS_PAGING_MEMPOOL Date: Wed, 12 Mar 2025 13:52:57 +0000 Message-Id: <20250312135258.1815706-10-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 From: Penny Zheng ARM MPU system doesn't need to use paging memory pool, as MPU memory mapping table at most takes only one 4KB page, which is enough to manage the maximum 255 MPU memory regions, for all EL2 stage 1 translation and EL1 stage 2 translation. Introduce HAS_PAGING_MEMPOOL Kconfig symbol for Arm, selected for MMU systems. Wrap code accessing the 'struct paging_domain' paging member with the new Kconfig, introduce arch_{get,set}_paging_mempool_size implementation for MPU system, provide stubs for p2m_teardown and p2m_teardown_allocation because they will not be used for MPU systems, remove 'struct paging_domain' from Arm 'struct arch_domain' when the field is not required. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu --- xen/arch/arm/Kconfig | 4 ++++ xen/arch/arm/dom0less-build.c | 2 ++ xen/arch/arm/include/asm/domain.h | 2 ++ xen/arch/arm/mpu/Makefile | 1 + xen/arch/arm/mpu/p2m.c | 36 +++++++++++++++++++++++++++++++ 5 files changed, 45 insertions(+) create mode 100644 xen/arch/arm/mpu/p2m.c diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 5ac6ec0212d2..89c099ff464b 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -76,6 +76,7 @@ choice config MMU bool "MMU" select HAS_LLC_COLORING if !NUMA && ARM_64 + select HAS_PAGING_MEMPOOL select HAS_PMAP select HAS_VMAP select HAS_PASSTHROUGH @@ -158,6 +159,9 @@ config VGICV2 config HVM def_bool y +config HAS_PAGING_MEMPOOL + bool + config NEW_VGIC bool "Use new VGIC implementation" select GICV2 diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 31f31c38da3f..feaba576198b 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -865,11 +865,13 @@ static int __init construct_domU(struct domain *d, p2m_mem_mb << (20 - PAGE_SHIFT) : domain_p2m_pages(mem, d->max_vcpus); +#ifdef CONFIG_HAS_PAGING_MEMPOOL spin_lock(&d->arch.paging.lock); rc = p2m_set_allocation(d, p2m_pages, NULL); spin_unlock(&d->arch.paging.lock); if ( rc != 0 ) return rc; +#endif printk("*** LOADING DOMU cpus=%u memory=%#"PRIx64"KB ***\n", d->max_vcpus, mem); diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h index 50b6a4b00982..fadec7d8fa9e 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -75,7 +75,9 @@ struct arch_domain struct hvm_domain hvm; +#ifdef CONFIG_HAS_PAGING_MEMPOOL struct paging_domain paging; +#endif struct vmmio vmmio; diff --git a/xen/arch/arm/mpu/Makefile b/xen/arch/arm/mpu/Makefile index 04df0b2ee760..f1417cd1b9db 100644 --- a/xen/arch/arm/mpu/Makefile +++ b/xen/arch/arm/mpu/Makefile @@ -1,2 +1,3 @@ obj-y += mm.o +obj-y += p2m.o obj-y += setup.init.o diff --git a/xen/arch/arm/mpu/p2m.c b/xen/arch/arm/mpu/p2m.c new file mode 100644 index 000000000000..7525d9b00bcb --- /dev/null +++ b/xen/arch/arm/mpu/p2m.c @@ -0,0 +1,36 @@ + +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +/* Not used on MPU system */ +int p2m_teardown(struct domain *d) +{ + return 0; +} + +/* Not used on MPU system */ +int p2m_teardown_allocation(struct domain *d) +{ + return 0; +} + +int arch_get_paging_mempool_size(struct domain *d, uint64_t *size) +{ + return -EOPNOTSUPP; +} + +int arch_set_paging_mempool_size(struct domain *d, uint64_t size) +{ + return -EOPNOTSUPP; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ From patchwork Wed Mar 12 13:52:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 14013597 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 C25C9C28B28 for ; Wed, 12 Mar 2025 13:54:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.910353.1317173 (Exim 4.92) (envelope-from ) id 1tsMWT-0001JL-88; Wed, 12 Mar 2025 13:53:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 910353.1317173; Wed, 12 Mar 2025 13:53:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tsMWT-0001J7-1g; Wed, 12 Mar 2025 13:53:25 +0000 Received: by outflank-mailman (input) for mailman id 910353; Wed, 12 Mar 2025 13:53:23 +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 1tsMWR-0007NP-GO for xen-devel@lists.xenproject.org; Wed, 12 Mar 2025 13:53:23 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 5be64399-ff49-11ef-9898-31a8f345e629; Wed, 12 Mar 2025 14:53:21 +0100 (CET) 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 8B3EE1691; Wed, 12 Mar 2025 06:53:31 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CF9B63F5A1; Wed, 12 Mar 2025 06:53:19 -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: 5be64399-ff49-11ef-9898-31a8f345e629 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH 10/10] arm/mpu: Create the skeleton for MPU compilation Date: Wed, 12 Mar 2025 13:52:58 +0000 Message-Id: <20250312135258.1815706-11-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312135258.1815706-1-luca.fancellu@arm.com> References: <20250312135258.1815706-1-luca.fancellu@arm.com> MIME-Version: 1.0 This commit introduces the skeleton for the MPU memory management subsystem that allows the compilation. Signed-off-by: Luca Fancellu --- The implementation of setup_virt_paging() is under arm64/mpu because it will have a different implementation from arm32. --- --- xen/arch/arm/arm64/mpu/Makefile | 2 ++ xen/arch/arm/arm64/mpu/p2m.c | 18 ++++++++++ xen/arch/arm/arm64/mpu/smpboot.c | 23 ++++++++++++ xen/arch/arm/include/asm/mpu/p2m.h | 20 +++++++++++ xen/arch/arm/include/asm/p2m.h | 2 +- xen/arch/arm/mpu/Makefile | 1 + xen/arch/arm/mpu/mm.c | 22 ++++++++++++ xen/arch/arm/mpu/p2m.c | 58 ++++++++++++++++++++++++++++++ xen/arch/arm/mpu/setup.c | 24 +++++++++++++ xen/arch/arm/mpu/vmap-mpu.c | 24 +++++++++++++ 10 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 xen/arch/arm/arm64/mpu/p2m.c create mode 100644 xen/arch/arm/arm64/mpu/smpboot.c create mode 100644 xen/arch/arm/include/asm/mpu/p2m.h create mode 100644 xen/arch/arm/mpu/vmap-mpu.c diff --git a/xen/arch/arm/arm64/mpu/Makefile b/xen/arch/arm/arm64/mpu/Makefile index 3340058c08c6..cf0540aecc84 100644 --- a/xen/arch/arm/arm64/mpu/Makefile +++ b/xen/arch/arm/arm64/mpu/Makefile @@ -1 +1,3 @@ obj-y += head.o +obj-y += p2m.o +obj-y += smpboot.o diff --git a/xen/arch/arm/arm64/mpu/p2m.c b/xen/arch/arm/arm64/mpu/p2m.c new file mode 100644 index 000000000000..df8de5c7d823 --- /dev/null +++ b/xen/arch/arm/arm64/mpu/p2m.c @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +void __init setup_virt_paging(void) +{ + BUG_ON("unimplemented"); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/arm64/mpu/smpboot.c b/xen/arch/arm/arm64/mpu/smpboot.c new file mode 100644 index 000000000000..3f3e54294e54 --- /dev/null +++ b/xen/arch/arm/arm64/mpu/smpboot.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +int prepare_secondary_mm(int cpu) +{ + BUG_ON("unimplemented"); + return -EINVAL; +} + +void update_boot_mapping(bool enable) +{ + BUG_ON("unimplemented"); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/include/asm/mpu/p2m.h b/xen/arch/arm/include/asm/mpu/p2m.h new file mode 100644 index 000000000000..e5c0e302167c --- /dev/null +++ b/xen/arch/arm/include/asm/mpu/p2m.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __ARM_MPU_P2M_H__ +#define __ARM_MPU_P2M_H__ + +/* Not used on MPU system */ +static inline void p2m_clear_root_pages(struct p2m_domain *p2m) {} + +/* Not used on MPU system */ +static inline void p2m_tlb_flush_sync(struct p2m_domain *p2m) {} + +#endif /* __ARM_MPU_P2M_H__ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h index 594dc4004138..2d53bf9b6177 100644 --- a/xen/arch/arm/include/asm/p2m.h +++ b/xen/arch/arm/include/asm/p2m.h @@ -168,7 +168,7 @@ typedef enum { #if defined(CONFIG_MMU) # include #else -# error "Unknown memory management layout" +# include #endif static inline bool arch_acquire_resource_check(struct domain *d) diff --git a/xen/arch/arm/mpu/Makefile b/xen/arch/arm/mpu/Makefile index f1417cd1b9db..a963b35db88d 100644 --- a/xen/arch/arm/mpu/Makefile +++ b/xen/arch/arm/mpu/Makefile @@ -1,3 +1,4 @@ obj-y += mm.o obj-y += p2m.o obj-y += setup.init.o +obj-y += vmap-mpu.o diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c index b196661a2312..12703c4f3d4f 100644 --- a/xen/arch/arm/mpu/mm.c +++ b/xen/arch/arm/mpu/mm.c @@ -18,6 +18,28 @@ static void __init __maybe_unused build_assertions(void) BUILD_BUG_ON(PAGE_SIZE != SZ_4K); } +void __init setup_mm(void) +{ + BUG_ON("unimplemented"); +} + +int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) +{ + BUG_ON("unimplemented"); + return -EINVAL; +} + +void dump_hyp_walk(vaddr_t addr) +{ + BUG_ON("unimplemented"); +} + +/* Release all __init and __initdata ranges to be reused */ +void free_init_memory(void) +{ + BUG_ON("unimplemented"); +} + void __iomem *ioremap_attr(paddr_t start, size_t len, unsigned int flags) { BUG_ON("unimplemented"); diff --git a/xen/arch/arm/mpu/p2m.c b/xen/arch/arm/mpu/p2m.c index 7525d9b00bcb..b059c86bde43 100644 --- a/xen/arch/arm/mpu/p2m.c +++ b/xen/arch/arm/mpu/p2m.c @@ -4,6 +4,64 @@ #include #include +int p2m_set_entry(struct p2m_domain *p2m, gfn_t sgfn, unsigned long nr, + mfn_t smfn, p2m_type_t t, p2m_access_t a) +{ + BUG_ON("unimplemented"); + return -EINVAL; +} + +mfn_t p2m_get_entry(struct p2m_domain *p2m, gfn_t gfn, p2m_type_t *t, + p2m_access_t *a, unsigned int *page_order, bool *valid) +{ + BUG_ON("unimplemented"); + return INVALID_MFN; +} + +void p2m_dump_info(struct domain *d) +{ + BUG_ON("unimplemented"); +} + +int p2m_init(struct domain *d) +{ + BUG_ON("unimplemented"); + return -EINVAL; +} + +void p2m_save_state(struct vcpu *p) +{ + BUG_ON("unimplemented"); +} + +void p2m_restore_state(struct vcpu *n) +{ + BUG_ON("unimplemented"); +} + +void p2m_final_teardown(struct domain *d) +{ + BUG_ON("unimplemented"); +} + +/* Not used on MPU system */ +void p2m_flush_vm(struct vcpu *v) {} + +bool p2m_resolve_translation_fault(struct domain *d, gfn_t gfn) +{ + BUG_ON("unimplemented"); + return false; +} + +/* Not used on MPU system */ +int relinquish_p2m_mapping(struct domain *d) +{ + return 0; +} + +/* Not used on MPU system */ +void p2m_domain_creation_finished(struct domain *d) {} + /* Not used on MPU system */ int p2m_teardown(struct domain *d) { diff --git a/xen/arch/arm/mpu/setup.c b/xen/arch/arm/mpu/setup.c index 45214bfeb661..28119e008341 100644 --- a/xen/arch/arm/mpu/setup.c +++ b/xen/arch/arm/mpu/setup.c @@ -2,12 +2,36 @@ #include #include +#include +#include void __init setup_mappings(void) { BUG_ON("unimplemented"); } +void * __init early_fdt_map(paddr_t fdt_paddr) +{ + BUG_ON("unimplemented"); + return NULL; +} + +/* + * copy_from_paddr - copy data from a physical address + * @dst: destination virtual address + * @paddr: source physical address + * @len: length to copy + */ +void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) +{ + BUG_ON("unimplemented"); +} + +void __init remove_early_mappings(void) +{ + BUG_ON("unimplemented"); +} + /* * Local variables: * mode: C diff --git a/xen/arch/arm/mpu/vmap-mpu.c b/xen/arch/arm/mpu/vmap-mpu.c new file mode 100644 index 000000000000..cb92407476de --- /dev/null +++ b/xen/arch/arm/mpu/vmap-mpu.c @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +void *vmap_contig(mfn_t mfn, unsigned int nr) +{ + BUG_ON("unimplemented"); + return NULL; +} + +void vunmap(const void *va) +{ + BUG_ON("unimplemented"); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */