From nobody Sat Sep 21 01:05:44 2024 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 1673834359012666.9133064824455; Sun, 15 Jan 2023 17:59:19 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.478244.741316 (Exim 4.92) (envelope-from ) id 1pHEm3-0002v4-0o; Mon, 16 Jan 2023 01:58:59 +0000 Received: by outflank-mailman (output) from mailman id 478244.741316; Mon, 16 Jan 2023 01:58:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pHEm2-0002ux-Tu; Mon, 16 Jan 2023 01:58:58 +0000 Received: by outflank-mailman (input) for mailman id 478244; Mon, 16 Jan 2023 01:58:57 +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 1pHEm1-0002to-IH for xen-devel@lists.xenproject.org; Mon, 16 Jan 2023 01:58:57 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 53bf5d3b-9541-11ed-b8d0-410ff93cb8f0; Mon, 16 Jan 2023 02:58:53 +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 88F71AD7; Sun, 15 Jan 2023 17:59:34 -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 215233F71A; Sun, 15 Jan 2023 17:58:49 -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: 53bf5d3b-9541-11ed-b8d0-410ff93cb8f0 From: Henry Wang To: xen-devel@lists.xenproject.org Cc: Henry Wang , Stefano Stabellini , Julien Grall , Bertrand Marquis , Wei Chen , Volodymyr Babchuk Subject: [PATCH 1/3] xen/arm: Reduce redundant clear root pages when teardown p2m Date: Mon, 16 Jan 2023 09:58:18 +0800 Message-Id: <20230116015820.1269387-2-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: 1673834359443100001 Content-Type: text/plain; charset="utf-8" Currently, p2m for a domain will be teardown from two paths: (1) The normal path when a domain is destroyed. (2) The arch_domain_destroy() in the failure path of domain creation. When tearing down p2m from (1), the part to clear and clean the root is only needed to do once rather than for every call of p2m_teardown(). If the p2m teardown is from (2), the clear and clean of the root is unnecessary because the domain is not scheduled. Therefore, this patch introduces a helper `p2m_clear_root_pages()` to do the clear and clean of the root, and move this logic outside of p2m_teardown(). With this movement, the `page_list_empty(&p2m->pages)` check can be dropped. Signed-off-by: Henry Wang Acked-by: Julien Grall Reviewed-by: Michal Orzel --- Was: [PATCH v2] xen/arm: Reduce redundant clear root pages when teardown p2m. Picked to this series with changes in original v1: 1. Introduce a new PROGRESS for p2m_clear_root_pages() to avoid multiple calling when p2m_teardown() is preempted. 2. Move p2m_force_tlb_flush_sync() to p2m_clear_root_pages(). --- xen/arch/arm/domain.c | 12 ++++++++++++ xen/arch/arm/include/asm/p2m.h | 1 + xen/arch/arm/p2m.c | 34 ++++++++++++++-------------------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 99577adb6c..961dab9166 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -959,6 +959,7 @@ enum { PROG_xen, PROG_page, PROG_mapping, + PROG_p2m_root, PROG_p2m, PROG_p2m_pool, PROG_done, @@ -1021,6 +1022,17 @@ int domain_relinquish_resources(struct domain *d) if ( ret ) return ret; =20 + PROGRESS(p2m_root): + /* + * We are about to free the intermediate page-tables, so clear the + * root to prevent any walk to use them. + * The domain will not be scheduled anymore, so in theory we should + * not need to flush the TLBs. Do it for safety purpose. + * Note that all the devices have already been de-assigned. So we = don't + * need to flush the IOMMU TLB here. + */ + p2m_clear_root_pages(&d->arch.p2m); + PROGRESS(p2m): ret =3D p2m_teardown(d, true); if ( ret ) diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h index 91df922e1c..bf5183e53a 100644 --- a/xen/arch/arm/include/asm/p2m.h +++ b/xen/arch/arm/include/asm/p2m.h @@ -281,6 +281,7 @@ int p2m_set_entry(struct p2m_domain *p2m, =20 bool p2m_resolve_translation_fault(struct domain *d, gfn_t gfn); =20 +void p2m_clear_root_pages(struct p2m_domain *p2m); void p2m_invalidate_root(struct p2m_domain *p2m); =20 /* diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 948f199d84..7de7d822e9 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1314,6 +1314,20 @@ static void p2m_invalidate_table(struct p2m_domain *= p2m, mfn_t mfn) p2m->need_flush =3D true; } =20 +void p2m_clear_root_pages(struct p2m_domain *p2m) +{ + unsigned int i; + + p2m_write_lock(p2m); + + for ( i =3D 0; i < P2M_ROOT_PAGES; i++ ) + clear_and_clean_page(p2m->root + i); + + p2m_force_tlb_flush_sync(p2m); + + p2m_write_unlock(p2m); +} + /* * Invalidate all entries in the root page-tables. This is * useful to get fault on entry and do an action. @@ -1698,30 +1712,10 @@ int p2m_teardown(struct domain *d, bool allow_preem= ption) struct p2m_domain *p2m =3D p2m_get_hostp2m(d); unsigned long count =3D 0; struct page_info *pg; - unsigned int i; int rc =3D 0; =20 - if ( page_list_empty(&p2m->pages) ) - return 0; - p2m_write_lock(p2m); =20 - /* - * We are about to free the intermediate page-tables, so clear the - * root to prevent any walk to use them. - */ - for ( i =3D 0; i < P2M_ROOT_PAGES; i++ ) - clear_and_clean_page(p2m->root + i); - - /* - * The domain will not be scheduled anymore, so in theory we should - * not need to flush the TLBs. Do it for safety purpose. - * - * Note that all the devices have already been de-assigned. So we don't - * need to flush the IOMMU TLB here. - */ - p2m_force_tlb_flush_sync(p2m); - while ( (pg =3D page_list_remove_head(&p2m->pages)) ) { p2m_free_page(p2m->domain, pg); --=20 2.25.1 From nobody Sat Sep 21 01:05:44 2024 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 1673834364589992.2603030843188; Sun, 15 Jan 2023 17:59:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.478246.741327 (Exim 4.92) (envelope-from ) id 1pHEm6-0003FH-8P; Mon, 16 Jan 2023 01:59:02 +0000 Received: by outflank-mailman (output) from mailman id 478246.741327; Mon, 16 Jan 2023 01:59:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pHEm6-0003F5-4c; Mon, 16 Jan 2023 01:59:02 +0000 Received: by outflank-mailman (input) for mailman id 478246; Mon, 16 Jan 2023 01:59:00 +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 1pHEm4-0002to-OA for xen-devel@lists.xenproject.org; Mon, 16 Jan 2023 01:59:00 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 56ef3974-9541-11ed-b8d0-410ff93cb8f0; Mon, 16 Jan 2023 02:58:58 +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 105BCAD7; Sun, 15 Jan 2023 17:59:40 -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 9C36C3F71A; Sun, 15 Jan 2023 17:58:55 -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: 56ef3974-9541-11ed-b8d0-410ff93cb8f0 From: Henry Wang To: xen-devel@lists.xenproject.org Cc: Henry Wang , Stefano Stabellini , Julien Grall , Bertrand Marquis , Wei Chen , Volodymyr Babchuk Subject: [PATCH 2/3] xen/arm: Defer GICv2 CPU interface mapping until the first access Date: Mon, 16 Jan 2023 09:58:19 +0800 Message-Id: <20230116015820.1269387-3-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: 1673834365281100001 Content-Type: text/plain; charset="utf-8" Currently, the mapping of the GICv2 CPU interface is created in arch_domain_create(). This causes some troubles in populating and freeing of the domain P2M pages pool. For example, a default 16 P2M pages are required in p2m_init() to cope with the P2M mapping of 8KB GICv2 CPU interface area, and these 16 P2M pages would cause the complexity of P2M destroy in the failure path of arch_domain_create(). As per discussion in [1], similarly as the MMIO access for ACPI, this patch defers the GICv2 CPU interface mapping until the first MMIO access. This is achieved by moving the GICv2 CPU interface mapping code from vgic_v2_domain_init() to the stage-2 data abort trap handling code. The original CPU interface size and virtual CPU interface base address is now saved in `struct vgic_dist` instead of the local variable of vgic_v2_domain_init(). Note that GICv2 changes introduced by this patch is not applied to the "New vGIC" implementation, as the "New vGIC" is not used. Also since the hardware domain (Dom0) has an unlimited size P2M pool, the gicv2_map_hwdom_extra_mappings() is also not touched by this patch. [1] https://lore.kernel.org/xen-devel/e6643bfc-5bdf-f685-1b68-b28d341071c1@= xen.org/ Signed-off-by: Henry Wang --- xen/arch/arm/include/asm/vgic.h | 2 ++ xen/arch/arm/traps.c | 19 ++++++++++++++++--- xen/arch/arm/vgic-v2.c | 25 ++++++------------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgi= c.h index 3d44868039..1d37c291e1 100644 --- a/xen/arch/arm/include/asm/vgic.h +++ b/xen/arch/arm/include/asm/vgic.h @@ -153,6 +153,8 @@ struct vgic_dist { /* Base address for guest GIC */ paddr_t dbase; /* Distributor base address */ paddr_t cbase; /* CPU interface base address */ + paddr_t csize; /* CPU interface size */ + paddr_t vbase; /* virtual CPU interface base address */ #ifdef CONFIG_GICV3 /* GIC V3 addressing */ /* List of contiguous occupied by the redistributors */ diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 061c92acbd..d98f166050 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1787,9 +1787,12 @@ static inline bool hpfar_is_valid(bool s1ptw, uint8_= t fsc) } =20 /* - * When using ACPI, most of the MMIO regions will be mapped on-demand - * in stage-2 page tables for the hardware domain because Xen is not - * able to know from the EFI memory map the MMIO regions. + * Try to map the MMIO regions for some special cases: + * 1. When using ACPI, most of the MMIO regions will be mapped on-demand + * in stage-2 page tables for the hardware domain because Xen is not + * able to know from the EFI memory map the MMIO regions. + * 2. For guests using GICv2, the GICv2 CPU interface mapping is created + * on the first access of the MMIO region. */ static bool try_map_mmio(gfn_t gfn) { @@ -1798,6 +1801,16 @@ static bool try_map_mmio(gfn_t gfn) /* For the hardware domain, all MMIOs are mapped with GFN =3D=3D MFN */ mfn_t mfn =3D _mfn(gfn_x(gfn)); =20 + /* + * Map the GICv2 virtual cpu interface in the gic cpu interface + * region of the guest on the first access of the MMIO region. + */ + if ( d->arch.vgic.version =3D=3D GIC_V2 && + gfn_x(gfn) =3D=3D gfn_x(gaddr_to_gfn(d->arch.vgic.cbase)) ) + return !map_mmio_regions(d, gaddr_to_gfn(d->arch.vgic.cbase), + d->arch.vgic.csize / PAGE_SIZE, + maddr_to_mfn(d->arch.vgic.vbase)); + /* * Device-Tree should already have everything mapped when building * the hardware domain. diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index 0026cb4360..21e14a5a6f 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -644,10 +644,6 @@ static int vgic_v2_vcpu_init(struct vcpu *v) =20 static int vgic_v2_domain_init(struct domain *d) { - int ret; - paddr_t csize; - paddr_t vbase; - /* * The hardware domain and direct-mapped domain both get the hardware * address. @@ -667,8 +663,8 @@ static int vgic_v2_domain_init(struct domain *d) * aligned to PAGE_SIZE. */ d->arch.vgic.cbase =3D vgic_v2_hw.cbase; - csize =3D vgic_v2_hw.csize; - vbase =3D vgic_v2_hw.vbase; + d->arch.vgic.csize =3D vgic_v2_hw.csize; + d->arch.vgic.vbase =3D vgic_v2_hw.vbase; } else if ( is_domain_direct_mapped(d) ) { @@ -683,8 +679,8 @@ static int vgic_v2_domain_init(struct domain *d) */ d->arch.vgic.dbase =3D vgic_v2_hw.dbase; d->arch.vgic.cbase =3D vgic_v2_hw.cbase; - csize =3D GUEST_GICC_SIZE; - vbase =3D vgic_v2_hw.vbase + vgic_v2_hw.aliased_offset; + d->arch.vgic.csize =3D GUEST_GICC_SIZE; + d->arch.vgic.vbase =3D vgic_v2_hw.vbase + vgic_v2_hw.aliased_offse= t; } else { @@ -697,19 +693,10 @@ static int vgic_v2_domain_init(struct domain *d) */ BUILD_BUG_ON(GUEST_GICC_SIZE !=3D SZ_8K); d->arch.vgic.cbase =3D GUEST_GICC_BASE; - csize =3D GUEST_GICC_SIZE; - vbase =3D vgic_v2_hw.vbase + vgic_v2_hw.aliased_offset; + d->arch.vgic.csize =3D GUEST_GICC_SIZE; + d->arch.vgic.vbase =3D vgic_v2_hw.vbase + vgic_v2_hw.aliased_offse= t; } =20 - /* - * Map the gic virtual cpu interface in the gic cpu interface - * region of the guest. - */ - ret =3D map_mmio_regions(d, gaddr_to_gfn(d->arch.vgic.cbase), - csize / PAGE_SIZE, maddr_to_mfn(vbase)); - if ( ret ) - return ret; - register_mmio_handler(d, &vgic_v2_distr_mmio_handler, d->arch.vgic.dba= se, PAGE_SIZE, NULL); =20 --=20 2.25.1 From nobody Sat Sep 21 01:05:44 2024 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