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

[PATCH v6 04/11] xen/arm: adjust Xen TLB helpers for Armv8-R64 PMSA


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Fri, 4 Nov 2022 18:07:34 +0800
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=2; 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=oCd70HB+Ye/vhd/9W0lE5d6TeJM/wcz47Dx4Zx5CnmE=; b=AdOTaDZb0/rrzdMse5C1z5teK1mlWSvgHipDoGUrPd6QqPLO8PEr56hKi5J/BGNI2sHeQk9gFWpmAIlvMFb4o0SLUpE72GskLLNoZNICM5/idsymfJSiVwWQU+ZDib3HIJVIGbXPK1S/qVvitEYz8E8zZnL15bwljFo/ymXixZxDxmm/Dip2VKGnSpgCFmK6I+a2dzY5/byXMV3UNjpBmINSvy9b/UXLInsIa95oj8reVvhoRvp+ut+eyky/YZ5/DyWLbVjDSKART1VTW3XoUR9L52SPuwQCOvjE5gufMGXfSDq0TC54yqbAcMsDmOw9R6xDH3j67MOfWaTdBLocNw==
  • 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=oCd70HB+Ye/vhd/9W0lE5d6TeJM/wcz47Dx4Zx5CnmE=; b=ZIZ3Db7AGfWuzjcQq38Hpk1UYpCkJd/HJh/+HmZjZiQFF2qOWEmzkCCFwhzyo1Ok97M0ou4KmfHGTrAm1CflLicmSWbjl8vvXU6mx7t93RpcsqNRP1aH0viN3bldfusH27XKkJ4POA+GOGPh/fSZjn5czHuHYA40RUZvYlD59Hv4bhcFNdWGfXViUKTfoEBtyjkuntIz6odbp1wG6xgPgN+2z6zUE89COR9/JLFX7jXWUI4BcmQ5eaqQLc/B8eOEdtsH22eoVda4A0Swd7SK0lvmuHxc+1cSv/oqxE43F2m7RpbQFDJ8f6bmAWV1WGHKblEMDyYN4WnJfgNrl8JnPg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=TfByFkQGrSdhPJG24VveoaKZgpx0sU9JD+bARs8qaKgPBIY3qQZhIOmlldLqGoYI6+bQEvtob+o07JOs9n1mOBi5joSgPwt3Sarn5d8iFPUGXZxs1UnQ/DBMSzc7k+053tg6Il9l20hEbS1TfCZ4dnidbK9nnMegSC0JKyuD8GJLiFQqiNVbDzeSKQGPz4zEkPt3ac8nw3CvSr/Ne9MqEWj6E4bhtRA/RPGa/3vQsf6Jfs6izPJIpKn7HttlvtgbqxPIsFRPPOfTFe/FTkJRzalt7zIhAr2/QeOg2qfiC/p9f2m0quyUV/86HAtZ1M3+VI3LqqKCHgLGN3FLUfXw+g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W8Rztg9IsZ9E3yxJb884z+TenrY4rlNBpNuHeNHncZuF53UmgF3KqDqIeehbLMKmEN25yqfp2aO8P8qHFEGZObP3k+8OvigxGYfBgk+IOq+8nkngcgGXYm1DgfUk06p8O51778NSuf8Gh9TITqVoFL3Qhqc0QAB8kIdZADYPgTm2rA9761PciVSN1kyZMhN/XHJ0ENXFWBv3tuvvV9wLUh1glOFU5aYzeC4fKZpGsZSASYM+GNGbzfuw7ViNEcjgYhmB/oAJG319Xt69PKM08EFsT2HtYy5905hN459WxPYbXv/xPJUAlaCDzhk3dyAX/IgKttaLgr498T58qsKIeA==
  • Cc: <nd@xxxxxxx>, Wei Chen <wei.chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 04 Nov 2022 10:08:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

>From Arm ARM Supplement of Armv8-R AArch64 (DDI 0600A) [1],
section D1.6.2 TLB maintenance instructions. We know that
Armv8-R AArch64 permits an implementation to cache stage 1
VMSAv8-64 and stage 2 PMSAv8-64 attributes as a common entry
for the Secure EL1&0 translation regime. But for Xen itself,
it's running with stage 1 PMSAv8-64 on Armv8-R AArch64. The
EL2 MPU updates for stage1 PMSAv8-64 will not be cached in
TLB entries. So we don't need any TLB invalidation for Xen
itself in EL2.

So in this patch, we use empty macros to stub Xen TLB helpers
for MPU system (PMSA), but still keep the Guest TLB helpers.
Because when a guest running in EL1 with VMSAv8-64 (MMU), guest
TLB invalidation is still needed. But we need some policy to
distinguish MPU and MMU guest, this will be done in guest
support of Armv8-R64 later.

[1] https://developer.arm.com/documentation/ddi0600/ac

Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
---
 xen/arch/arm/include/asm/arm64/flushtlb.h | 25 +++++++++++++++++++++++
 xen/arch/arm/include/asm/flushtlb.h       | 22 ++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/xen/arch/arm/include/asm/arm64/flushtlb.h 
b/xen/arch/arm/include/asm/arm64/flushtlb.h
index 7c54315187..fe445f6831 100644
--- a/xen/arch/arm/include/asm/arm64/flushtlb.h
+++ b/xen/arch/arm/include/asm/arm64/flushtlb.h
@@ -51,6 +51,8 @@ TLB_HELPER(flush_all_guests_tlb_local, alle1);
 /* Flush innershareable TLBs, all VMIDs, non-hypervisor mode */
 TLB_HELPER(flush_all_guests_tlb, alle1is);
 
+#ifndef CONFIG_HAS_MPU
+
 /* Flush all hypervisor mappings from the TLB of the local processor. */
 TLB_HELPER(flush_xen_tlb_local, alle2);
 
@@ -66,6 +68,29 @@ static inline void __flush_xen_tlb_one(vaddr_t va)
     asm volatile("tlbi vae2is, %0;" : : "r" (va>>PAGE_SHIFT) : "memory");
 }
 
+#else
+
+/*
+ * When Xen is running with stage 1 PMSAv8-64 on MPU systems. The EL2 MPU
+ * updates for stage1 PMSAv8-64 will not be cached in TLB entries. So we
+ * don't need any TLB invalidation for Xen itself in EL2. See Arm ARM
+ * Supplement of Armv8-R AArch64 (DDI 0600A), section D1.6.2 TLB maintenance
+ * instructions for more details.
+ */
+static inline void flush_xen_tlb_local(void)
+{
+}
+
+static inline void  __flush_xen_tlb_one_local(vaddr_t va)
+{
+}
+
+static inline void __flush_xen_tlb_one(vaddr_t va)
+{
+}
+
+#endif /* CONFIG_HAS_MPU */
+
 #endif /* __ASM_ARM_ARM64_FLUSHTLB_H__ */
 /*
  * Local variables:
diff --git a/xen/arch/arm/include/asm/flushtlb.h 
b/xen/arch/arm/include/asm/flushtlb.h
index 125a141975..4b8bf65281 100644
--- a/xen/arch/arm/include/asm/flushtlb.h
+++ b/xen/arch/arm/include/asm/flushtlb.h
@@ -28,6 +28,7 @@ static inline void page_set_tlbflush_timestamp(struct 
page_info *page)
 /* Flush specified CPUs' TLBs */
 void arch_flush_tlb_mask(const cpumask_t *mask);
 
+#ifndef CONFIG_HAS_MPU
 /*
  * Flush a range of VA's hypervisor mappings from the TLB of the local
  * processor.
@@ -66,6 +67,27 @@ static inline void flush_xen_tlb_range_va(vaddr_t va,
     isb();
 }
 
+#else
+
+/*
+ * When Xen is running with stage 1 PMSAv8-64 on MPU systems. The EL2 MPU
+ * updates for stage1 PMSAv8-64 will not be cached in TLB entries. So we
+ * don't need any TLB invalidation for Xen itself in EL2. See Arm ARM
+ * Supplement of Armv8-R AArch64 (DDI 0600A), section D1.6.2 TLB maintenance
+ * instructions for more details.
+ */
+static inline void flush_xen_tlb_range_va_local(vaddr_t va,
+                                                unsigned long size)
+{
+}
+
+static inline void flush_xen_tlb_range_va(vaddr_t va,
+                                          unsigned long size)
+{
+}
+
+#endif /* CONFIG_HAS_MPU */
+
 #endif /* __ASM_ARM_FLUSHTLB_H__ */
 /*
  * Local variables:
-- 
2.25.1




 


Rackspace

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