From nobody Mon Feb 9 20:34:37 2026 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; 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 1768321433635748.1736581705973; Tue, 13 Jan 2026 08:23:53 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1202072.1517743 (Exim 4.92) (envelope-from ) id 1vfhB7-0004kq-Fg; Tue, 13 Jan 2026 16:23:33 +0000 Received: by outflank-mailman (output) from mailman id 1202072.1517743; Tue, 13 Jan 2026 16:23:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vfhB7-0004k0-Ae; Tue, 13 Jan 2026 16:23:33 +0000 Received: by outflank-mailman (input) for mailman id 1202072; Tue, 13 Jan 2026 16:23:32 +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 1vfhB6-0004Qo-0H for xen-devel@lists.xenproject.org; Tue, 13 Jan 2026 16:23:32 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 2ca868df-f09c-11f0-9ccf-f158ae23cfc8; Tue, 13 Jan 2026 17:23: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 364BC497; Tue, 13 Jan 2026 08:23:13 -0800 (PST) Received: from e134099.cambridge.arm.com (e134099.arm.com [10.1.198.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C74453F59E; Tue, 13 Jan 2026 08:23:18 -0800 (PST) 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: 2ca868df-f09c-11f0-9ccf-f158ae23cfc8 From: Harry Ramsey To: xen-devel@lists.xenproject.org Cc: Luca.Fancellu@arm.com, Luca Fancellu , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Hari Limaye Subject: [PATCH v3 1/6] arm/mpu: Implement copy_from_paddr for MPU systems Date: Tue, 13 Jan 2026 16:23:04 +0000 Message-ID: <20260113162309.6766-2-harry.ramsey@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260113162309.6766-1-harry.ramsey@arm.com> References: <20260113162309.6766-1-harry.ramsey@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1768321434912158500 Content-Type: text/plain; charset="utf-8" From: Luca Fancellu Implement the function copy_from_paddr variant for MPU systems, using the map_pages_to_xen/destroy_xen_mappings to temporarily map the memory range to be copied. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye Signed-off-by: Harry Ramsey Reviewed-by: Michal Orzel --- v3: - No changes v2: - add Michal R-by --- xen/arch/arm/mpu/setup.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mpu/setup.c b/xen/arch/arm/mpu/setup.c index 163573b932..ec264f54f2 100644 --- a/xen/arch/arm/mpu/setup.c +++ b/xen/arch/arm/mpu/setup.c @@ -91,7 +91,19 @@ void * __init early_fdt_map(paddr_t fdt_paddr) */ void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) { - BUG_ON("unimplemented"); + paddr_t start_pg =3D round_pgdown(paddr); + paddr_t end_pg =3D round_pgup(paddr + len); + unsigned long nr_mfns =3D (end_pg - start_pg) >> PAGE_SHIFT; + mfn_t mfn =3D maddr_to_mfn(start_pg); + + if ( map_pages_to_xen(start_pg, mfn, nr_mfns, PAGE_HYPERVISOR_WC) ) + panic("Unable to map range for copy_from_paddr\n"); + + memcpy(dst, maddr_to_virt(paddr), len); + clean_dcache_va_range(dst, len); + + if ( destroy_xen_mappings(start_pg, end_pg) ) + panic("Unable to unmap range for copy_from_paddr\n"); } =20 void __init remove_early_mappings(void) --=20 2.43.0