From nobody Thu Oct 23 00:42:53 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 1687750879198288.6600745764616; Sun, 25 Jun 2023 20:41:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.555104.866893 (Exim 4.92) (envelope-from ) id 1qDd5t-0005X5-MQ; Mon, 26 Jun 2023 03:40:49 +0000 Received: by outflank-mailman (output) from mailman id 555104.866893; Mon, 26 Jun 2023 03:40:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDd5s-0005Sx-Q0; Mon, 26 Jun 2023 03:40:48 +0000 Received: by outflank-mailman (input) for mailman id 555104; Mon, 26 Jun 2023 03:40:46 +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 1qDd2t-0000HH-NL for xen-devel@lists.xenproject.org; Mon, 26 Jun 2023 03:37:43 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id ce34796e-13d2-11ee-8611-37d641c3527e; Mon, 26 Jun 2023 05:37:42 +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 A525B1FB; Sun, 25 Jun 2023 20:38:25 -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 DE5633F64C; Sun, 25 Jun 2023 20:37:38 -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: ce34796e-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 49/52] xen/mpu: enable device passthrough in MPU system Date: Mon, 26 Jun 2023 11:34:40 +0800 Message-Id: <20230626033443.2943270-50-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: 1687750880179100008 Content-Type: text/plain; charset="utf-8" In order to enable device passthrough in MPU system, we only need to provide p2m_mmio_direct_dev permission set up. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- v3: - new commit --- xen/arch/arm/mpu/p2m.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mpu/p2m.c b/xen/arch/arm/mpu/p2m.c index e21b76813d..a68a06105f 100644 --- a/xen/arch/arm/mpu/p2m.c +++ b/xen/arch/arm/mpu/p2m.c @@ -185,11 +185,15 @@ static void p2m_set_permission(pr_t *region, p2m_type= _t t) region->prbar.reg.ap =3D AP_RO_ALL; break; =20 + case p2m_mmio_direct_dev: + region->prbar.reg.xn =3D XN_P2M_ENABLED; + region->prbar.reg.ap =3D AP_RW_ALL; + break; + case p2m_max_real_type: BUG(); break; =20 - case p2m_mmio_direct_dev: case p2m_mmio_direct_nc: case p2m_mmio_direct_c: case p2m_iommu_map_ro: @@ -233,6 +237,11 @@ static inline pr_t region_to_p2m_entry(mfn_t smfn, uns= igned long nr_mfn, prlar.reg.ai =3D MT_NORMAL; break; =20 + case p2m_mmio_direct_dev: + prbar.reg.sh =3D LPAE_SH_OUTER; + prlar.reg.ai =3D MT_DEVICE_nGnRE; + break; + default: panic(XENLOG_G_ERR "p2m: UNIMPLEMENTED p2m type in MPU system\n"); break; --=20 2.25.1