From: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
To: <sstabellini@kernel.org>, <bertrand.marquis@arm.com>,
<michal.orzel@amd.com>, <ayan.kumar.halder@amd.com>,
<Volodymyr_Babchuk@epam.com>, <julien@xen.org>,
<jbeulich@suse.com>
Cc: <xen-devel@lists.xenproject.org>,
Penny Zheng <penny.zheng@arm.com>, "Wei Chen" <wei.chen@arm.com>
Subject: [PATCH v3 2/4] xen: make VMAP only support in MMU system
Date: Tue, 13 Aug 2024 18:13:54 +0100 [thread overview]
Message-ID: <20240813171356.46760-3-ayan.kumar.halder@amd.com> (raw)
In-Reply-To: <20240813171356.46760-1-ayan.kumar.halder@amd.com>
From: Penny Zheng <penny.zheng@arm.com>
Introduced CONFIG_VMAP which is selected by the architectures that use
MMU. vm_init() does not do anything if CONFIG_VMAP is not enabled.
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
depends 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.
Signed-off-by: Penny Zheng <penny.zheng@arm.com>
Signed-off-by: Wei Chen <wei.chen@arm.com>
Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
Changes from :-
v1 - 1. HARDEN_BRANCH_PREDICTOR is now gated on HAS_VMAP.
2. cpuerrata.c is not gated on HAS_VMAP.
v2 - 1. Introduced CONFIG_VMAP in common/Kconfig.
2. Architectures using MMU select this config.
3. vm_init() now uses CONFIG_VMAP.
xen/arch/arm/Kconfig | 4 +++-
xen/arch/arm/setup.c | 2 ++
xen/arch/x86/Kconfig | 2 ++
xen/common/Kconfig | 3 +++
xen/include/xen/vmap.h | 2 ++
5 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 21d03d9f44..e30a7da186 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
@@ -61,6 +61,7 @@ config PADDR_BITS
config MMU
def_bool y
select HAS_PMAP
+ select HAS_VMAP
source "arch/Kconfig"
@@ -171,6 +172,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/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 7ef5c8bc48..32be057978 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -1,6 +1,7 @@
config X86_64
def_bool y
select 64BIT
+ select HAS_VMAP
config X86
def_bool y
@@ -31,6 +32,7 @@ config X86
select HAS_UBSAN
select HAS_VPCI if HVM
select NEEDS_LIBELF
+ select HAS_VMAP
config ARCH_DEFCONFIG
string
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 565ceda741..188918ec5c 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -77,6 +77,9 @@ config HAS_PIRQ
config HAS_PMAP
bool
+config HAS_VMAP
+ bool
+
config HAS_SCHED_GRANULARITY
bool
diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
index fdae37e950..c1dd7ac22f 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_HAS_VMAP
vm_init_type(VMAP_DEFAULT, (void *)VMAP_VIRT_START, arch_vmap_virt_end());
+#endif
}
#endif /* __XEN_VMAP_H__ */
--
2.25.1
next prev parent reply other threads:[~2024-08-13 17:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 17:13 [PATCH v3 0/4] xen: arm: Split MMU code in preparation for MPU work (part 2) Ayan Kumar Halder
2024-08-13 17:13 ` [PATCH v3 1/4] xen: arm: Add a new helper update_boot_mapping() Ayan Kumar Halder
2024-08-14 12:50 ` Michal Orzel
2024-08-20 11:27 ` Ayan Kumar Halder
2024-08-13 17:13 ` Ayan Kumar Halder [this message]
2024-08-14 6:37 ` [PATCH v3 2/4] xen: make VMAP only support in MMU system Jan Beulich
2024-08-14 10:55 ` Ayan Kumar Halder
2024-08-14 11:35 ` Jan Beulich
2024-08-14 12:33 ` Ayan Kumar Halder
2024-08-14 13:04 ` Jan Beulich
2024-08-16 9:28 ` Michal Orzel
2024-08-16 16:00 ` Ayan Kumar Halder
2024-08-16 16:40 ` Julien Grall
2024-08-19 9:45 ` Ayan Kumar Halder
2024-08-19 9:55 ` Julien Grall
2024-08-19 9:58 ` Julien Grall
2024-08-20 11:48 ` Ayan Kumar Halder
2024-08-20 12:51 ` Jan Beulich
2024-08-19 11:39 ` Jan Beulich
2024-08-19 12:12 ` Julien Grall
2024-08-19 12:24 ` Jan Beulich
2024-08-19 13:01 ` Julien Grall
2024-08-13 17:13 ` [PATCH v3 3/4] xen: arm: Move the functions of domain_page to MMU specific Ayan Kumar Halder
2024-08-14 12:59 ` Michal Orzel
2024-08-13 17:13 ` [PATCH v3 4/4] xen: arm: Enclose access to EL2 MMU specific registers under CONFIG_MMU Ayan Kumar Halder
2024-08-14 13:07 ` Michal Orzel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240813171356.46760-3-ayan.kumar.halder@amd.com \
--to=ayan.kumar.halder@amd.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=penny.zheng@arm.com \
--cc=sstabellini@kernel.org \
--cc=wei.chen@arm.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.