[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xen/arm64: head: Introduce a helper to flush local TLBs


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 8 Aug 2023 13:07:39 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Hi0xi37ivdqnavovEZwHm4E3+cicdkaCXIVkuc06OwA=; b=bxLquCMPOJEsu3UToGYj6I+smSMyevVetq9buA9Qd8dC0Rawv+/KzJujt/1/U1NddOMbFOv71qApArvnGChzb3UZpgzAicpRdcuhGsugce1JuRNtH84+0NMEJSHWcPlpJnviZRtKjuTXHISeDjJxLV59GdvpgnGsX+YeCeNMfnQUjq3zWLREK7SWaw2CXpYPqBXoClMBp21Xjs2ZTq+ejn0wzFLvQmhMeALzW+jfJTEYPXS1CjVho5k5OQkxSp7oV4/380VpkstGSBfg2lTCrttneboRw7tXadoAy12d/hws/xm9cyX0mh7gZyeOnLfyAwNq2cmuRqoEKsjGsEVTDw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l46pOAumjyeX78+zlSS9q2c8A1hOLH0rCZ88GS2nidC0sr9Me5WGMYOvof9LCSpYMtj8nhzYr32hPfRNv8v9QLAzZoTBNpyEvRJ+cQEXPIxa60Ub5Ltp09JBwi3I0ohCzyKf4V+MF0mPQ10124axr3t7oyvys5T9PCFHG6ZTFNsTm8Q4ZNWVATU8Zxco2IM7fM1vReT/h4Qo9T8BZTJ/MdfH/FZ1eHqLS/cexJPorwr5sTbt5ZpurXdbm5qTkB2TQsz6SnTsTU4WSvBJuuz1mkjDQXjzo+I7KpJxRPaOBnbnMC9OIAyLVZQK5MfdeyTPqACcVOPyYoBMVbEC+iZjLg==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 08 Aug 2023 11:08:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Instead of repeating the same sequence of instructions to flush the TLBs
in various places, introduce a macro flush_xen_tlb_local and make use of
it. This is similar to what was done for arm32 by the commit:
dea9dddeceec8a1d68da24b14d5b2396effe555f

This is also making the flush sequence in enable_mmu more clear and
consistent.

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/arm64/head.S | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 31cdb54d74e5..8bca9afa27b2 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -136,6 +136,18 @@
         add \xb, \xb, x20
 .endm
 
+/*
+ * Flush local TLBs
+ *
+ * See asm/arm64/flushtlb.h for the explanation of the sequence.
+ */
+.macro flush_xen_tlb_local
+        dsb   nshst
+        tlbi  alle2
+        dsb   nsh
+        isb
+.endm
+
         .section .text.header, "ax", %progbits
         /*.aarch64*/
 
@@ -721,8 +733,7 @@ enable_mmu:
          * The state of the TLBs is unknown before turning on the MMU.
          * Flush them to avoid stale one.
          */
-        tlbi  alle2                  /* Flush hypervisor TLBs */
-        dsb   nsh
+        flush_xen_tlb_local
 
         /* Write Xen's PT's paddr into TTBR0_EL2 */
         msr   TTBR0_EL2, x4
@@ -786,11 +797,7 @@ remove_identity_mapping:
         str   xzr, [x0, x1, lsl #3]
 
 identity_mapping_removed:
-        /* See asm/arm64/flushtlb.h for the explanation of the sequence. */
-        dsb   nshst
-        tlbi  alle2
-        dsb   nsh
-        isb
+        flush_xen_tlb_local
 
         ret
 ENDPROC(remove_identity_mapping)
@@ -872,14 +879,8 @@ ENTRY(switch_ttbr_id)
         msr    SCTLR_EL2, x1
         isb
 
-        /*
-         * 3) Flush the TLBs.
-         * See asm/arm64/flushtlb.h for the explanation of the sequence.
-         */
-        dsb   nshst
-        tlbi  alle2
-        dsb   nsh
-        isb
+        /* 3) Flush the TLBs */
+        flush_xen_tlb_local
 
         /* 4) Update the TTBR */
         msr   TTBR0_EL2, x0
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.