From nobody Tue Feb 10 06:27:52 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; 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 1673834367123681.5788173135352; Sun, 15 Jan 2023 17:59:27 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.478247.741338 (Exim 4.92) (envelope-from ) id 1pHEm9-0003ae-Hp; Mon, 16 Jan 2023 01:59:05 +0000 Received: by outflank-mailman (output) from mailman id 478247.741338; Mon, 16 Jan 2023 01:59:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pHEm9-0003aT-EP; Mon, 16 Jan 2023 01:59:05 +0000 Received: by outflank-mailman (input) for mailman id 478247; Mon, 16 Jan 2023 01:59:04 +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 1pHEm8-0002bj-22 for xen-devel@lists.xenproject.org; Mon, 16 Jan 2023 01:59:04 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 597b134c-9541-11ed-91b6-6bf2151ebd3b; Mon, 16 Jan 2023 02:59:02 +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 85C51AD7; Sun, 15 Jan 2023 17:59:44 -0800 (PST) Received: from a015966.shanghai.arm.com (a015966.shanghai.arm.com [10.169.190.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1D86A3F71A; Sun, 15 Jan 2023 17:58:59 -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: 597b134c-9541-11ed-91b6-6bf2151ebd3b From: Henry Wang To: xen-devel@lists.xenproject.org Cc: Henry Wang , Stefano Stabellini , Julien Grall , Wei Chen , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 3/3] xen/arm: Clean-up in p2m_init() and p2m_final_teardown() Date: Mon, 16 Jan 2023 09:58:20 +0800 Message-Id: <20230116015820.1269387-4-Henry.Wang@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230116015820.1269387-1-Henry.Wang@arm.com> References: <20230116015820.1269387-1-Henry.Wang@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1673834369284100001 Content-Type: text/plain; charset="utf-8" With the change in previous patch, the initial 16 pages in the P2M pool is not necessary anymore. Drop them for code simplification. Also the call to p2m_teardown() from arch_domain_destroy() is not necessary anymore since the movement of the P2M allocation out of arch_domain_create(). Drop the code and the above in-code comment mentioning it. Signed-off-by: Henry Wang Reviewed-by: Michal Orzel --- I am not entirely sure if I should also drop the "TODO" on top of the p2m_set_entry(). Because although we are sure there is no p2m pages populated in domain_create() stage now, but we are not sure if anyone will add more in the future...Any comments? --- xen/arch/arm/include/asm/p2m.h | 4 ---- xen/arch/arm/p2m.c | 20 +------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h index bf5183e53a..cf06d3cc21 100644 --- a/xen/arch/arm/include/asm/p2m.h +++ b/xen/arch/arm/include/asm/p2m.h @@ -200,10 +200,6 @@ int p2m_init(struct domain *d); * - p2m_final_teardown() will be called when domain struct is been * freed. This *cannot* be preempted and therefore one small * resources should be freed here. - * Note that p2m_final_teardown() will also call p2m_teardown(), to prope= rly - * free the P2M when failures happen in the domain creation with P2M pages - * already in use. In this case p2m_teardown() is called non-preemptively= and - * p2m_teardown() will always return 0. */ int p2m_teardown(struct domain *d, bool allow_preemption); void p2m_final_teardown(struct domain *d); diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 7de7d822e9..d41a316d18 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1744,13 +1744,9 @@ void p2m_final_teardown(struct domain *d) /* * No need to call relinquish_p2m_mapping() here because * p2m_final_teardown() is called either after domain_relinquish_resou= rces() - * where relinquish_p2m_mapping() has been called, or from failure pat= h of - * domain_create()/arch_domain_create() where mappings that require - * p2m_put_l3_page() should never be created. For the latter case, als= o see - * comment on top of the p2m_set_entry() for more info. + * where relinquish_p2m_mapping() has been called. */ =20 - BUG_ON(p2m_teardown(d, false)); ASSERT(page_list_empty(&p2m->pages)); =20 while ( p2m_teardown_allocation(d) =3D=3D -ERESTART ) @@ -1821,20 +1817,6 @@ int p2m_init(struct domain *d) if ( rc ) return rc; =20 - /* - * Hardware using GICv2 needs to create a P2M mapping of 8KB GICv2 area - * when the domain is created. Considering the worst case for page - * tables and keep a buffer, populate 16 pages to the P2M pages pool h= ere. - * For GICv3, the above-mentioned P2M mapping is not necessary, but si= nce - * the allocated 16 pages here would not be lost, hence populate these - * pages unconditionally. - */ - spin_lock(&d->arch.paging.lock); - rc =3D p2m_set_allocation(d, 16, NULL); - spin_unlock(&d->arch.paging.lock); - if ( rc ) - return rc; - return 0; } =20 --=20 2.25.1