[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/4] xen: arm: Add a new helper update_boot_mapping()
- To: Michal Orzel <michal.orzel@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, sstabellini@xxxxxxxxxx, bertrand.marquis@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, julien@xxxxxxx
- From: Ayan Kumar Halder <ayankuma@xxxxxxx>
- Date: Mon, 12 Aug 2024 16:29:11 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y/Pyqx72+rNdyVv2ciWhmulfauCoIWBrhRr7N3Qtwww=; b=bjurMallLpmFaUGb0tS9HKVqHhDw0sRzdXDqlLiNwo6o3tUSrBcEsdKmndjGweVWCZz19AbdEGoRKKFHT1lZSCXO8KLzlEUgtYh5R3KARR+hgaHZ47+z/6di0Huoe2yzB5cYDmWqfZCao3Y+5Dks7ETwjMtHCLlDt4p+O1esKIG1uwBrzgwMmsQyg6tSLDz2g/dxRoCVQGVifuTuIpr1e7Kqmyr2Hvy70/YhGNdioBELi9pAkd/4jw6NZqOb7FzL3n3oqKRsmKgWCRPT8qbzqQYHFbxsvdIR9zUW6DWanqXz702omPBJ8/wCirAilpo/Bvj5qun0gGkiZOv6NX+0UQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AZwEOp2MT/ZZf/lYOlXa+8U2/DTs/7/ihe6qOLPHSAbm7NJ6zzQy7sByAfCvx83S1IQTwtZO9br+6T7i7+37R7lAjB7lHOkQbSi+EDQl/Z9G3gLvgZSXK6RRFPavUzQSahebfKPQni3klNuizxZlVRiKNlkpd4UT8S7jfxLM1sfEGbYXqGEID29c/rpzniTtbhbmyeA9gSXgrS1GdYhfama5DUjLx+mYDjVRrxmtwPJ6DFH2psIlYlb/KnA1ioO7gK4SwRUBJ3MJabkZD5Rd8t/xPQ5PvcxbvnIlATUtMdm2TkHytPsuU2E//8Ow2hdvt3b0bNNo/tlu9gkZP1XPAQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
- Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Mon, 12 Aug 2024 15:29:29 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 09/08/2024 13:01, Michal Orzel wrote:
Hi Ayan,
Hi Michal,
On 08/08/2024 14:09, Ayan Kumar Halder wrote:
update_boot_mapping() invokes update_identity_mapping() for the MMU specific
code.
Later when the MPU code is added, update_boot_mapping() would invoke the
equivalent.
The common code now invokes update_boot_mapping() instead of
update_identity_mapping(). So, that there is clear abstraction between the
common and MMU/MPU specific logic.
This is in continuation to commit
f661a20aa880: "Extract MMU-specific MM code".
Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
---
Changes from :-
v1 - 1. Introduced update_boot_mapping() which invokes
update_identity_mapping() in MMU specific code.
xen/arch/arm/arm64/mmu/mm.c | 5 +++++
xen/arch/arm/arm64/smpboot.c | 6 +++---
xen/arch/arm/include/asm/mm.h | 2 ++
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
index 293acb67e0..72e089a339 100644
--- a/xen/arch/arm/arm64/mmu/mm.c
+++ b/xen/arch/arm/arm64/mmu/mm.c
@@ -125,6 +125,11 @@ void update_identity_mapping(bool enable)
BUG_ON(rc);
}
+void update_boot_mapping(bool enable)
+{
+ update_identity_mapping(enable);
With your approach, update_identity_mapping() would only be called from within
this file,
therefore it should be marked as static and the prototype removed.
yes, agreed.
+}
+
extern void switch_ttbr_id(uint64_t ttbr);
typedef void (switch_ttbr_fn)(uint64_t ttbr);
diff --git a/xen/arch/arm/arm64/smpboot.c b/xen/arch/arm/arm64/smpboot.c
index a225fae64d..789f352ab6 100644
--- a/xen/arch/arm/arm64/smpboot.c
+++ b/xen/arch/arm/arm64/smpboot.c
@@ -112,18 +112,18 @@ int arch_cpu_up(int cpu)
if ( !smp_enable_ops[cpu].prepare_cpu )
return -ENODEV;
- update_identity_mapping(true);
+ update_boot_mapping(true);
rc = smp_enable_ops[cpu].prepare_cpu(cpu);
if ( rc )
- update_identity_mapping(false);
+ update_boot_mapping(false);
return rc;
}
void arch_cpu_up_finish(void)
{
- update_identity_mapping(false);
+ update_boot_mapping(false);
}
/*
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index f6ba611f01..e769d2d3b3 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -426,6 +426,8 @@ static inline void page_set_xenheap_gfn(struct page_info
*p, gfn_t gfn)
} while ( (y = cmpxchg(&p->u.inuse.type_info, x, nx)) != x );
}
+void update_boot_mapping(bool enable);
The definition is only present for arm64. Shouldn't the prototype be moved to
arm64 header?
Yes, I have replaced the prototype
update_identity_mapping() with update_boot_mapping() in
xen/arch/arm/include/asm/arm64/mm.h
- Ayan
|