Skip to contentSkip to conversation

xen: arm: Split MMU code in preparation for MPU work (part 2)

PATCH In review Ayan Kumar Halder 4 participants 11 messages Aug 21, 2024 – Aug 29, 2024 RISC-V

lore
Share & tools
lore
#0 lore raw

v4 cover xen: arm: Split MMU code in preparation for MPU work (part 2)

Hi,

In https://patchew.org/Xen/[email protected]/, Henry has reorganized some of the code between the MMU specific and generic files.

In this patch serie, we address the remaining code reorg so that MMU specific code is cleanly separated and we have added stubs wherever necessary to avoid introducing if-def.

Changes from :-

v1..v2 - mentioned in individual patches.
v3 - Reordered the patches so that first 3 can be committed (as they have been reviewed).

Ayan Kumar Halder (4):
xen: arm: Add a new helper update_boot_mapping()
xen: arm: Move domain_page.c to MMU specific
xen: arm: Enclose access to EL2 MMU specific registers under
CONFIG_MMU
xen: make VMAP support in MMU system only

 xen/arch/arm/Kconfig                 |  4 +++-
 xen/arch/arm/Makefile                |  1 -
 xen/arch/arm/arm64/mmu/mm.c          | 14 +++++++++++++-
 xen/arch/arm/arm64/smpboot.c         |  6 +++---
 xen/arch/arm/include/asm/arm64/mm.h  |  9 +--------
 xen/arch/arm/mmu/Makefile            |  1 +
 xen/arch/arm/{ => mmu}/domain_page.c |  0
 xen/arch/arm/setup.c                 |  2 ++
 xen/arch/arm/traps.c                 | 10 ++++++++++
 xen/arch/ppc/Kconfig                 |  1 +
 xen/arch/riscv/Kconfig               |  1 +
 xen/arch/x86/Kconfig                 |  1 +
 xen/common/Kconfig                   |  3 +++
 xen/common/Makefile                  |  2 +-
 xen/common/vmap.c                    |  2 --
 xen/include/xen/vmap.h               |  2 ++
 16 files changed, 42 insertions(+), 17 deletions(-)
 rename xen/arch/arm/{ => mmu}/domain_page.c (100%)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/4 xen: arm: Add a new helper update_boot_mapping()

update_boot_mapping() invokes update_identity_mapping() for the MMU specific code.
Later when the MPU code is added, update_boot_mapping() will 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".

update_identity_mapping() is now marked as static as it is called from xen/arch/arm/arm64/mmu/mm.c only. Also, amend the prototype to update_boot_mapping() which is now invoked from other files.

---
Changes from :-

v1 - 1. Introduced update_boot_mapping() which invokes update_identity_mapping() in MMU specific code.

v2 - 1. Make update_identity_mapping() static and update the prototype.

v3 - 1. The comment for "update_identity_mapping()" is moved to the correct place.
2. Added R-b.

 xen/arch/arm/arm64/mmu/mm.c         | 14 +++++++++++++-
 xen/arch/arm/arm64/smpboot.c        |  6 +++---
 xen/arch/arm/include/asm/arm64/mm.h |  9 +--------
 3 files changed, 17 insertions(+), 12 deletions(-)
xen/arch/arm/arm64/mmu/mm.c +13 -1
index 293acb67e0..0de4f3c079 100644
@@ -111,7 +111,14 @@ void __init arch_setup_page_tables(void)
     prepare_runtime_identity_mapping();
 }
 
-void update_identity_mapping(bool enable)
+/*
+ * Enable/disable the identity mapping in the live page-tables (i.e.
+ * the one pointed by TTBR_EL2).
+ *
+ * Note that nested call (e.g. enable=true, enable=true) is not
+ * supported.
+ */
+static void update_identity_mapping(bool enable)
 {
     paddr_t id_addr = virt_to_maddr(_start);
     int rc;
@@ -125,6 +132,11 @@ void update_identity_mapping(bool enable)
     BUG_ON(rc);
 }
 
+void update_boot_mapping(bool enable)
+{
+    update_identity_mapping(enable);
+}
+
 extern void switch_ttbr_id(uint64_t ttbr);
 
 typedef void (switch_ttbr_fn)(uint64_t ttbr);
xen/arch/arm/arm64/smpboot.c +3 -3
index a225fae64d..789f352ab6 100644
@@ -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);
 }
 
 /*
xen/arch/arm/include/asm/arm64/mm.h +1 -8
index e0bd23a6ed..b4f7545d2c 100644
@@ -14,14 +14,7 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 
 void arch_setup_page_tables(void);
 
-/*
- * Enable/disable the identity mapping in the live page-tables (i.e.
- * the one pointed by TTBR_EL2).
- *
- * Note that nested call (e.g. enable=true, enable=true) is not
- * supported.
- */
-void update_identity_mapping(bool enable);
+void update_boot_mapping(bool enable);
 
 #endif /* __ARM_ARM64_MM_H__ */
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH v4 2/4 xen: arm: Move domain_page.c to MMU specific

In reply to Ayan Kumar Halder

domain_page.c is moved to mmu/domain_page.c. The reason being this file implements MMU specific logic for mapping, unmapping, etc domain page.

---
Changes from :-

v1 - Moved domain_page.c to mmu/domain_page.c.

v2 - Updated arm/Makefile.

v3 - 1. Used the same commit message as v2.
2. Added R-b.

 xen/arch/arm/Makefile                | 1 -
 xen/arch/arm/mmu/Makefile            | 1 +
 xen/arch/arm/{ => mmu}/domain_page.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename xen/arch/arm/{ => mmu}/domain_page.c (100%)
xen/arch/arm/Makefile +0 -1
index da9c979dc4..7792bff597 100644
@@ -18,7 +18,6 @@ obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.init.o
 obj-y += domain.o
 obj-y += domain_build.init.o
-obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
 obj-y += domctl.o
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-y += efi/
xen/arch/arm/mmu/Makefile +1 -0
index 67475fcd80..2cb44b857d 100644
@@ -2,3 +2,4 @@ obj-y += p2m.o
 obj-y += pt.o
 obj-y += setup.o
 obj-y += smpboot.o
+obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
xen/arch/arm/mmu/domain_page.c renamed from xen/arch/arm/domain_page.c +0 -0
similarity index 100%
rename from xen/arch/arm/domain_page.c
rename to xen/arch/arm/mmu/domain_page.c
Signature · 1 line
2.25.1
#3 lore raw

PATCH v4 3/4 xen: arm: Enclose access to EL2 MMU specific registers under CONFIG_MMU

In reply to Ayan Kumar Halder

All the EL2 MMU specific registers are enclosed within CONFIG_MMU. Also, protect vttbr_el2 field of struct reg_ctxt and accesses to it.

---
Changes from :

v1 -
1. 'vttbr_el2' field is enclosed with ifdef.
2. No movement of code.

v2 -
1. Enclosed 'vttbr_el2' access in show_registers() and vcpu_show_registers().

v3 -
1. Updated the commit message.
2. Added R-b.

 xen/arch/arm/traps.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
xen/arch/arm/traps.c +10 -0
index aac6c599f8..737f4d65e3 100644
@@ -720,8 +720,10 @@ struct reg_ctxt {
     uint32_t ifsr32_el2;
 #endif
 
+#ifdef CONFIG_MMU
     /* Hypervisor-side state */
     uint64_t vttbr_el2;
+#endif
 };
 
 static const char *mode_string(register_t cpsr)
@@ -919,12 +921,16 @@ static void _show_registers(const struct cpu_user_regs *regs,
 #endif
     }
     printk("  VTCR_EL2: %"PRIregister"\n", READ_SYSREG(VTCR_EL2));
+#ifdef CONFIG_MMU
     printk(" VTTBR_EL2: %016"PRIx64"\n", ctxt->vttbr_el2);
+#endif
     printk("\n");
 
     printk(" SCTLR_EL2: %"PRIregister"\n", READ_SYSREG(SCTLR_EL2));
     printk("   HCR_EL2: %"PRIregister"\n", READ_SYSREG(HCR_EL2));
+#ifdef CONFIG_MMU
     printk(" TTBR0_EL2: %016"PRIx64"\n", READ_SYSREG64(TTBR0_EL2));
+#endif
     printk("\n");
     printk("   ESR_EL2: %"PRIregister"\n", regs->hsr);
     printk(" HPFAR_EL2: %"PRIregister"\n", READ_SYSREG(HPFAR_EL2));
@@ -956,7 +962,9 @@ void show_registers(const struct cpu_user_regs *regs)
     if ( guest_mode(regs) && is_32bit_domain(current->domain) )
         ctxt.ifsr32_el2 = READ_SYSREG(IFSR32_EL2);
 #endif
+#ifdef CONFIG_MMU
     ctxt.vttbr_el2 = READ_SYSREG64(VTTBR_EL2);
+#endif
 
     _show_registers(regs, &ctxt, guest_mode(regs), current);
 }
@@ -979,7 +987,9 @@ void vcpu_show_registers(const struct vcpu *v)
     ctxt.ifsr32_el2 = v->arch.ifsr;
 #endif
 
+#ifdef CONFIG_MMU
     ctxt.vttbr_el2 = v->domain->arch.p2m.vttbr;
+#endif
 
     _show_registers(&v->arch.cpu_info->guest_cpu_user_regs, &ctxt, 1, v);
 }
Signature · 1 line
2.25.1
#4 lore raw

PATCH 1/1 xen: make VMAP support in MMU system only

In reply to Ayan Kumar Halder

From: Penny Zheng <[email protected]>

Introduce 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 MMU 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.

Also took the opportunity to remove "#ifdef VMAP_VIRT_START .. endif" from vmap.c. Instead vmap.c is compiled when HAS_VMAP is enabled. Thus, HAS_VMAP is now enabled from x86, ppc and riscv architectures as all of them use MMU and has VMAP_VIRT_START defined.

---
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.

v3 - 1. HARDEN_BRANCH_PREDICTOR is now gated on MMU.
2. vmap.c is compiled when CONFIG_HAS_VMAP is enabled.
3. HAS_VMAP is enabled from x86, ppc and riscv architectures.

 xen/arch/arm/Kconfig   | 4 +++-
 xen/arch/arm/setup.c   | 2 ++
 xen/arch/ppc/Kconfig   | 1 +
 xen/arch/riscv/Kconfig | 1 +
 xen/arch/x86/Kconfig   | 1 +
 xen/common/Kconfig     | 3 +++
 xen/common/Makefile    | 2 +-
 xen/common/vmap.c      | 2 --
 xen/include/xen/vmap.h | 2 ++
 9 files changed, 14 insertions(+), 4 deletions(-)
xen/arch/arm/Kconfig +3 -1
index 21d03d9f44..323c967361 100644
@@ -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 MMU
 	default y
 	help
 	  Speculation attacks against some high-performance processors rely on
xen/arch/arm/setup.c +2 -0
index cb2c0a16b8..7f686d2cca 100644
@@ -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();
 
xen/arch/ppc/Kconfig +1 -0
index f6a77a8200..6db575a48d 100644
@@ -2,6 +2,7 @@ config PPC
 	def_bool y
 	select FUNCTION_ALIGNMENT_4B
 	select HAS_DEVICE_TREE
+	select HAS_VMAP
 
 config PPC64
 	def_bool y
xen/arch/riscv/Kconfig +1 -0
index 259eea8d3b..7a113c7774 100644
@@ -3,6 +3,7 @@ config RISCV
 	select FUNCTION_ALIGNMENT_16B
 	select GENERIC_BUG_FRAME
 	select HAS_DEVICE_TREE
+	select HAS_VMAP
 
 config RISCV_64
 	def_bool y
xen/arch/x86/Kconfig +1 -0
index 7ef5c8bc48..1784f01aad 100644
@@ -29,6 +29,7 @@ config X86
 	select HAS_PIRQ
 	select HAS_SCHED_GRANULARITY
 	select HAS_UBSAN
+	select HAS_VMAP
 	select HAS_VPCI if HVM
 	select NEEDS_LIBELF
 
xen/common/Kconfig +3 -0
index 565ceda741..90268d9249 100644
@@ -83,6 +83,9 @@ config HAS_SCHED_GRANULARITY
 config HAS_UBSAN
 	bool
 
+config HAS_VMAP
+	bool
+
 config MEM_ACCESS_ALWAYS_ON
 	bool
 
xen/common/Makefile +1 -1
index 7e66802a9e..fc52e0857d 100644
@@ -52,7 +52,7 @@ obj-$(CONFIG_TRACEBUFFER) += trace.o
 obj-y += version.o
 obj-y += virtual_region.o
 obj-y += vm_event.o
-obj-y += vmap.o
+obj-$(CONFIG_HAS_VMAP) += vmap.o
 obj-y += vsprintf.o
 obj-y += wait.o
 obj-bin-y += warning.init.o
xen/common/vmap.c +0 -2
index ced9cbf26f..47225fecc0 100644
@@ -1,4 +1,3 @@
-#ifdef VMAP_VIRT_START
 #include <xen/bitmap.h>
 #include <xen/sections.h>
 #include <xen/init.h>
@@ -427,4 +426,3 @@ void *_xvrealloc(void *va, size_t size, unsigned int align)
 
     return ptr;
 }
-#endif
xen/include/xen/vmap.h +2 -0
index fdae37e950..c1dd7ac22f 100644
@@ -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__ */
Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH] xen: make VMAP support in MMU system only

Quoted 5 lines · Ayan Kumar Halder

From: Penny Zheng <[email protected]>

Introduce CONFIG_VMAP which is selected by the architectures that use MMU. vm_init() does not do anything if CONFIG_VMAP is not enabled.

Quoted 7 lines

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.

There is a mix of VMAP and HAS_VMAP throughout here. Once that's sorted I think there'll be redundancy in what is being said, which likely will want consolidating then, too.

Quoted 3 lines

HARDEN_BRANCH_PREDICTOR is now gated on MMU 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.

I think that increasingly this wants to be a separate change. It's entirely unrelated to what the patch's purpose is (or else the connection isn't clear to me, and also isn't being made in the description).

Apart from this the code changes look okay to me now.

Jan

Acked-by on v1 1/1
#6 lore raw

Re: [PATCH] xen: make VMAP support in MMU system only

In reply to Ayan Kumar Halder

Hi Ayan,

Quoted 9 lines · Ayan Kumar Halder

From: Penny Zheng <[email protected]>

Introduce 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.

Quoted 7 lines

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 MMU 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.

I don't have a strong opinion on whether it should be split. But I do agree this deserves a bit more explanation.

Also, as I mentioned before, speculative attacks may be possible on non-MMU based systems. In fact some the Cortex-R are in the affected list... The R82 and R52 are not listed, but note:

"For information about any unlisted processors please contact Arm".

So how about the following explanation:

"At the moment, the users of HARDEN_BRANCH_PREDICTOR requires to use the vmap() to update the exceptions vectors. While it might be possible to rework the code, it is believed that speculative attackes would be difficult to exploit on non-MMU because the software is tightly controlled. So for now make HARDEN_PREDICTOR to depend on the !MMU.

Quoted 9 lines

Also took the opportunity to remove "#ifdef VMAP_VIRT_START .. endif" from vmap.c. Instead vmap.c is compiled when HAS_VMAP is enabled. Thus, HAS_VMAP is now enabled from x86, ppc and riscv architectures as all of them use MMU and has VMAP_VIRT_START defined.

With the typo pointed out by Jan:

Cheers,

Signature · 1 line
Julien Grall
#7 lore raw

Re: [PATCH] xen: make VMAP support in MMU system only

Quoted 1 line · Julien Grall

Hi Ayan,

Hi Julien,

Quoted 21 lines · Ayan Kumar Halder
Quoted 9 lines

From: Penny Zheng <[email protected]>

Introduce 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.

Quoted 7 lines

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 MMU 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.

I don't have a strong opinion on whether it should be split. But I do agree this deserves a bit more explanation.

Quoted 7 lines

Also, as I mentioned before, speculative attacks may be possible on non-MMU based systems. In fact some the Cortex-R are in the affected list... The R82 and R52 are not listed, but note:

"For information about any unlisted processors please contact Arm".

So how about the following explanation:

"At the moment, the users of HARDEN_BRANCH_PREDICTOR requires to use the vmap() to update the exceptions vectors. While it might be possible to rework the code, it is believed that speculative attackes would be difficult to exploit on non-MMU because the software is tightly controlled. So for now make HARDEN_PREDICTOR to depend on the !MMU.

This makes sense. However, I think you mean

..... make HARDEN_BRANCH_PREDICTOR to depend on the **MMU**.

Quoted 7 lines
Quoted 7 lines

Also took the opportunity to remove "#ifdef VMAP_VIRT_START .. endif" from vmap.c. Instead vmap.c is compiled when HAS_VMAP is enabled. Thus, HAS_VMAP is now enabled from x86, ppc and riscv architectures as all of them use MMU and has VMAP_VIRT_START defined.

Quoted 5 lines
Quoted 3 lines

With the typo pointed out by Jan:

Yes, I will use HAS_VMAP.

 I will update the commit message as below. Let me know if this makes sense.

```
xen: make VMAP support in MMU system only

Introduce CONFIG_HAS_VMAP which is selected by the architectures that
use MMU. vm_init() does not do anything if CONFIG_HAS_VMAP is not
enabled.

HAS_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 HAS_VMAP in MMU. And
ALTERNATIVE depends on HAS_VMAP.

At the moment, the users of HARDEN_BRANCH_PREDICTOR requires to use the
vmap() to update the exceptions vectors. While it might be possible to
rework the code, it is believed that speculative attackes would be
difficult to exploit on non-MMU because the software is tightly
controlled. So for now make HARDEN_BRANCH_PREDICTOR to depend on the
MMU.

Also took the opportunity to remove "#ifdef VMAP_VIRT_START .. endif"
from vmap.c. Instead vmap.c is compiled when HAS_VMAP is enabled. Thus,
HAS_VMAP is now enabled from x86, ppc and riscv architectures as all of
them use MMU and has VMAP_VIRT_START defined.

```

- Ayan

Quoted 5 lines

Cheers,

#8 lore raw

Re: [PATCH] xen: make VMAP support in MMU system only

Quoted 2 lines · Ayan Kumar Halder

 I will update the commit message as below. Let me know if this makes
sense.

Certainly better. One more question though:

Quoted 11 lines

```
xen: make VMAP support in MMU system only

Introduce CONFIG_HAS_VMAP which is selected by the architectures that use MMU. vm_init() does not do anything if CONFIG_HAS_VMAP is not enabled.

HAS_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 HAS_VMAP in MMU. And ALTERNATIVE depends on HAS_VMAP.

What is "fold HAS_VMAP in MMU"? I see no folding anywhere. My only guess is that this means to describe the "select HAS_VMAP" being added to MMU. But then why the word "fold"?

Jan

Quoted 21 lines

At the moment, the users of HARDEN_BRANCH_PREDICTOR requires to use the vmap() to update the exceptions vectors. While it might be possible to rework the code, it is believed that speculative attackes would be difficult to exploit on non-MMU because the software is tightly controlled. So for now make HARDEN_BRANCH_PREDICTOR to depend on the MMU.

Also took the opportunity to remove "#ifdef VMAP_VIRT_START .. endif" from vmap.c. Instead vmap.c is compiled when HAS_VMAP is enabled. Thus, HAS_VMAP is now enabled from x86, ppc and riscv architectures as all of them use MMU and has VMAP_VIRT_START defined.

```

- Ayan

Quoted 5 lines

Cheers,

#9 lore raw

Re: [PATCH] xen: make VMAP support in MMU system only

Hi Jan,

Quoted 12 lines · Jan Beulich
Quoted 2 lines · Ayan Kumar Halder

 I will update the commit message as below. Let me know if this makes
sense.

Certainly better. One more question though:

Quoted 7 lines

```
xen: make VMAP support in MMU system only

Introduce CONFIG_HAS_VMAP which is selected by the architectures that use MMU. vm_init() does not do anything if CONFIG_HAS_VMAP is not enabled.

Quoted 7 lines
Quoted 4 lines

HAS_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 HAS_VMAP in MMU. And ALTERNATIVE depends on HAS_VMAP.

What is "fold HAS_VMAP in MMU"? I see no folding anywhere. My only guess is that this means to describe the "select HAS_VMAP" being added to MMU. But then why the word "fold"?

Sorry, I used the incorrect word. Rather I should say

"... we choose to make HAS_VMAP selected by MMU. And ALTERNATIVE depends ..."

- Ayan

#10 lore raw
In reply to Ayan Kumar Halder

Hi Ayan,

Quoted 15 lines · Ayan Kumar Halder

Hi,

In https://patchew.org/Xen/[email protected]/, Henry has reorganized some of the code between the MMU specific and generic files.

In this patch serie, we address the remaining code reorg so that MMU specific code is cleanly separated and we have added stubs wherever necessary to avoid introducing if-def.

Changes from :-

v1..v2 - mentioned in individual patches.
v3 - Reordered the patches so that first 3 can be committed (as they have been reviewed).

Quoted 5 lines

Ayan Kumar Halder (4):
xen: arm: Add a new helper update_boot_mapping()
xen: arm: Move domain_page.c to MMU specific
xen: arm: Enclose access to EL2 MMU specific registers under
CONFIG_MMU

I have committed the above 3 patches. AFAICT...

Quoted 1 line

xen: make VMAP support in MMU system only

... this patch may require a respin and definitely needs more acks.

Cheers,

Signature · 1 line
Julien Grall