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

[PATCH v2 2/4] xen: arm: make VMAP only support in MMU system


  • To: <sstabellini@xxxxxxxxxx>, <bertrand.marquis@xxxxxxx>, <michal.orzel@xxxxxxx>, <ayan.kumar.halder@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <julien@xxxxxxx>
  • From: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Date: Thu, 8 Aug 2024 13:09:34 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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 (0)
  • 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=BwnutoGseyOzPvX5xpU7euJ358TBpCesIKsrFcbDnqU=; b=ugiShT6dDzYiTlOynD3opqKpHmCuXow995k/4PbLHW+QbhWYGHQxMwcRKSvq80ylVEQnnzkfAxcOCYnKlkSMD9QaY4DxjT7FSKp02OeS6d0ZDt+XSTKLGXJfqVYBU8bWLaqTmobVeJvepdYY+xwcK/Hfzl5JdG47sMekWIzQ+nO7jehGPH2fwk/3puRbqzN4a3mXOeEM6WoDZsW8KZOwxWPCS651nGLp+2hib1b7OIrDwaBXmOix4LJ+RbgWSWJtlYCoZPpq7neNaH6LUY56WXKlwawGLBqMboGBvNod0H7nWqEc1sGfty548UmfJaLP8aHp1Hi+NkJQkGVRitDxDQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r45nxc5ioOZfh+axUX0eSv5kIqMvcqbSZMOJtkKbx5eH/lehbCQQaMeXTMuhSGZyOIDrXT6fE4DvcYAuPJHpmgt3bPWC99XAocT9cjUJrTuSaDQl6hetXXDKDTJ32rhRBg34nWvLrDcUjBwQXcFWZMJq6WOGG0io9M+cYJt8B+tjV4IIXM1N4xJXRecdQmUr4pF0CWfDBb+fUcxY0fnPoK9zn5dLZTCYPquA+wERigOWm3A59n2AncoaQ352FenJL31nlfs9M5gakS/Z+2SUMDJUfw64XsEet7bt9gmVzhj5uSBts0/Ew5egpbPd94nH2gd/5kEGOgnFSd/IaCv/bg==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Penny Zheng <penny.zheng@xxxxxxx>, "Wei Chen" <wei.chen@xxxxxxx>
  • Delivery-date: Thu, 08 Aug 2024 12:09:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Penny Zheng <penny.zheng@xxxxxxx>

VMAP is widely used in ALTERNATIVE feature to remap a range of memory
with new memory attributes. Since this is highly dependent on virtual
address translation, we choose to fold VMAP in MMU system.

In this patch, we introduce a new Kconfig CONFIG_HAS_VMAP, and make it
only support in MMU system on ARM architecture. And ALTERNATIVE now
depend on VMAP.

HARDEN_BRANCH_PREDICTOR is now gated on HAS_VMAP as speculative
attacks are not possible on non MMU based systems (ie Cortex-R52, R82).
See 
https://developer.arm.com/Arm%20Security%20Center/Speculative%20Processor%20Vulnerability.

Split 
"https://patchwork.kernel.org/project/xen-devel/patch/20230626033443.2943270-16-Penny.Zheng@xxxxxxx/";
into Arm specific

Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
---
Changes from :-

v1 - 1. HARDEN_BRANCH_PREDICTOR is now gated on HAS_VMAP.
2. cpuerrata.c is not gated on HAS_VMAP.

 xen/arch/arm/Kconfig   | 7 ++++++-
 xen/arch/arm/setup.c   | 2 ++
 xen/include/xen/vmap.h | 2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 21d03d9f44..7d1dde89d7 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -12,7 +12,7 @@ config ARM_64
 config ARM
        def_bool y
        select FUNCTION_ALIGNMENT_4B
-       select HAS_ALTERNATIVE
+       select HAS_ALTERNATIVE if HAS_VMAP
        select HAS_DEVICE_TREE
        select HAS_PASSTHROUGH
        select HAS_UBSAN
@@ -58,9 +58,13 @@ config PADDR_BITS
        default 40 if ARM_PA_BITS_40
        default 48 if ARM_64
 
+config HAS_VMAP
+       def_bool y
+
 config MMU
        def_bool y
        select HAS_PMAP
+       select HAS_VMAP
 
 source "arch/Kconfig"
 
@@ -171,6 +175,7 @@ config ARM_SSBD
 
 config HARDEN_BRANCH_PREDICTOR
        bool "Harden the branch predictor against aliasing attacks" if EXPERT
+       depends on HAS_VMAP
        default y
        help
          Speculation attacks against some high-performance processors rely on
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index cb2c0a16b8..7f686d2cca 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -447,7 +447,9 @@ void asmlinkage __init start_xen(unsigned long 
boot_phys_offset,
      * It needs to be called after do_initcalls to be able to use
      * stop_machine (tasklets initialized via an initcall).
      */
+#ifdef CONFIG_HAS_ALTERNATIVE
     apply_alternatives_all();
+#endif
     enable_errata_workarounds();
     enable_cpu_features();
 
diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
index fdae37e950..4c7dfe58ba 100644
--- a/xen/include/xen/vmap.h
+++ b/xen/include/xen/vmap.h
@@ -141,7 +141,9 @@ void *arch_vmap_virt_end(void);
 /* Initialises the VMAP_DEFAULT virtual range */
 static inline void vm_init(void)
 {
+#ifdef CONFIG_MMU
     vm_init_type(VMAP_DEFAULT, (void *)VMAP_VIRT_START, arch_vmap_virt_end());
+#endif
 }
 
 #endif /* __XEN_VMAP_H__ */
-- 
2.25.1




 


Rackspace

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