From nobody Thu Jan 30 17:57:08 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 1731667873027402.13466687996606; Fri, 15 Nov 2024 02:51:13 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.837074.1253007 (Exim 4.92) (envelope-from ) id 1tBtuf-0001H5-79; Fri, 15 Nov 2024 10:50:53 +0000 Received: by outflank-mailman (output) from mailman id 837074.1253007; Fri, 15 Nov 2024 10:50:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tBtuf-0001GJ-2P; Fri, 15 Nov 2024 10:50:53 +0000 Received: by outflank-mailman (input) for mailman id 837074; Fri, 15 Nov 2024 10:50:52 +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 1tBtue-0000jy-1O for xen-devel@lists.xenproject.org; Fri, 15 Nov 2024 10:50:52 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 79cd26b4-a33f-11ef-a0c7-8be0dac302b0; Fri, 15 Nov 2024 11:50:49 +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 E99751A25; Fri, 15 Nov 2024 02:51:18 -0800 (PST) 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 0EB213F6A8; Fri, 15 Nov 2024 02:50:47 -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: 79cd26b4-a33f-11ef-a0c7-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjIxNy4xNDAuMTEwLjE3MiIsImhlbG8iOiJmb3NzLmFybS5jb20ifQ== X-Custom-Transaction: eyJpZCI6Ijc5Y2QyNmI0LWEzM2YtMTFlZi1hMGM3LThiZTBkYWMzMDJiMCIsInRzIjoxNzMxNjY3ODQ5Ljc4MjA0Nywic2VuZGVyIjoibHVjYS5mYW5jZWxsdUBhcm0uY29tIiwicmVjaXBpZW50IjoieGVuLWRldmVsQGxpc3RzLnhlbnByb2plY3Qub3JnIn0= From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Penny Zheng , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH 3/5] xen/arm: only map the init text section RW in free_init_memory Date: Fri, 15 Nov 2024 10:50:34 +0000 Message-Id: <20241115105036.218418-4-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241115105036.218418-1-luca.fancellu@arm.com> References: <20241115105036.218418-1-luca.fancellu@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1731667873943116600 Content-Type: text/plain; charset="utf-8" From: Penny Zheng In free_init_memory, we do not need to map the whole init section RW, as only init text section is mapped RO in boot time. Signed-off-by: Luca Fancellu --- This is this one: https://patchwork.kernel.org/project/xen-devel/patch/2023= 0626033443.2943270-19-Penny.Zheng@arm.com/ --- xen/arch/arm/mmu/setup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c index 9664e85ee6c0..1b1d302c8788 100644 --- a/xen/arch/arm/mmu/setup.c +++ b/xen/arch/arm/mmu/setup.c @@ -7,6 +7,7 @@ =20 #include #include +#include #include #include #include @@ -309,16 +310,17 @@ void *__init arch_vmap_virt_end(void) void free_init_memory(void) { paddr_t pa =3D virt_to_maddr(__init_begin); + unsigned long inittext_end =3D round_pgup((unsigned long)_einittext); unsigned long len =3D __init_end - __init_begin; uint32_t insn; unsigned int i, nr =3D len / sizeof(insn); uint32_t *p; int rc; =20 - rc =3D modify_xen_mappings((unsigned long)__init_begin, - (unsigned long)__init_end, PAGE_HYPERVISOR_RW= ); + rc =3D modify_xen_mappings((unsigned long)__init_begin, inittext_end, + PAGE_HYPERVISOR_RW); if ( rc ) - panic("Unable to map RW the init section (rc =3D %d)\n", rc); + panic("Unable to map RW the init text section (rc =3D %d)\n", rc); =20 /* * From now on, init will not be used for execution anymore, --=20 2.34.1