Skip to content

xen/arm: Add Armv8-R64 MPU support to Xen - Part#1

Penny Zheng xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest52 patches 107 repliesIn review
  2. v240 patches 76 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/52xen/arm: remove xen_phys_start and xenheap_phys_end from config.hxen/arch/arm/include/asm/config.h+0 -20 replies
2/52xen/arm: make ARM_EFI selectable for Arm64xen/arch/arm/Kconfig xen/arch/arm/arm64/head.S+20 -44 replies
3/52xen/arm: add an option to define Xen start address for Armv8-Rxen/arch/arm/Kconfig xen/arch/arm/platforms/Kconfig+13 -37 replies
4/52xen/arm: add .text.idmap in ld script for Xen identity map sectionsxen/arch/arm/xen.lds.S+1 -01 reply
5/52xen/arm64: head: Introduce enable_boot_mmu and enable_runtime_mmuxen/arch/arm/arm64/head.S+70 -173 replies
6/52xen/arm: introduce CONFIG_HAS_MMUxen/arch/arm/Kconfig+8 -04 replies
7/52xen/arm64: prepare for moving MMU related code from head.Sxen/arch/arm/arm64/head.S+21 -212 replies
8/52xen/arm64: move MMU related code from head.S to mmu/head.Sxen/arch/arm/arm64/Makefile xen/arch/arm/arm64/head.S xen/arch/arm/arm64/mmu/head.S +1 more+509 -4676 replies
9/52xen/arm: use PA == VA for EARLY_UART_VIRTUAL_ADDRESS on MPU systemsxen/arch/arm/include/asm/early_printk.h+12 -02 replies
10/52xen/arm: Move MMU related definitions from config.h to mmu/layout.hxen/arch/arm/include/asm/config.h xen/arch/arm/include/asm/mmu/layout.h+143 -1255 replies
11/52xen/arm: mmu: fold FIXMAP into MMU systemxen/arch/arm/Kconfig xen/arch/arm/include/asm/fixmap.h+34 -44 replies
12/52xen/mmu: extract early uart mapping from setup_fixmapxen/arch/arm/arm64/head.S xen/arch/arm/arm64/mmu/head.S+20 -74 replies
13/52xen/mmu: extract mmu-specific codes from mm.c/mm.hxen/arch/arm/Makefile xen/arch/arm/arm32/head.S xen/arch/arm/arm64/Makefile +11 more+1216 -11490 replies
14/52xen/mmu: move MMU-specific setup_mm to mmu/setup.cxen/arch/arm/Makefile xen/arch/arm/include/asm/setup.h xen/arch/arm/mmu/setup.c +1 more+362 -3220 replies
15/52xen: make VMAP only support in MMU systemxen/arch/arm/Kconfig xen/arch/arm/Makefile xen/arch/arm/setup.c +7 more+32 -106 replies
16/52xen/mmu: relocate copy_from_paddr into setup.cxen/arch/arm/kernel.c xen/arch/arm/mmu/setup.c+27 -270 replies
17/52xen/arm: do not give memory back to static heapxen/arch/arm/bootfdt.c xen/arch/arm/include/asm/setup.h xen/arch/arm/kernel.c +3 more+35 -190 replies
18/52xen/arm: only map the init text section RW in free_init_memoryxen/arch/arm/mm.c+4 -30 replies
19/52xen/arm: switch to use ioremap_xxx in common filexen/arch/arm/kernel.c+8 -40 replies
20/52xen/mmu: move MMU specific P2M code to mmu/p2m.c and mmu/p2m.hxen/arch/arm/Makefile xen/arch/arm/include/asm/mmu/p2m.h xen/arch/arm/include/asm/p2m.h +2 more+1744 -16870 replies
21/52xen: introduce CONFIG_HAS_PAGING_MEMPOOLxen/arch/arm/Kconfig xen/arch/arm/domain.c xen/arch/arm/domain_build.c +4 more+13 -02 replies
22/52xen/mmu: enable SMMU subsystem only in MMUxen/drivers/passthrough/Kconfig+2 -10 replies
23/52xen/arm: create mpu/layout.h for MPU related address definitionsxen/arch/arm/include/asm/config.h xen/arch/arm/include/asm/mpu/layout.h+34 -00 replies
24/52xen/mpu: build up start-of-day Xen MPU memory region mapxen/arch/arm/Makefile xen/arch/arm/arm64/Makefile xen/arch/arm/arm64/mpu/head.S +3 more+292 -09 replies
25/52xen/mpu: introduce helpers for MPU enablementxen/arch/arm/arm64/mpu/head.S xen/arch/arm/include/asm/processor.h+47 -00 replies
26/52xen/mpu: map early uart when earlyprintk onxen/arch/arm/Kconfig.debug xen/arch/arm/arm64/mpu/head.S xen/arch/arm/include/asm/arm64/mpu.h +1 more+48 -00 replies
27/52xen/mpu: introduce setup_mm_mappingsxen/arch/arm/include/asm/arm64/mpu.h xen/arch/arm/include/asm/arm64/sysregs.h xen/arch/arm/include/asm/mm.h +3 more+43 -44 replies
28/52xen/mpu: plump virt/maddr conversion in MPU systemxen/arch/arm/include/asm/mm.h+15 -05 replies
29/52xen/mpu: introduce a pair helper read_protection_region()/write_protection_region()xen/arch/arm/include/asm/arm64/sysregs.h xen/arch/arm/mpu/mm.c+205 -00 replies
30/52xen/mpu: populate a new region in Xen MPU mapping tablexen/arch/arm/include/asm/arm64/mpu.h xen/arch/arm/include/asm/mm.h xen/arch/arm/include/asm/mpu/mm.h +4 more+381 -83 replies
31/52xen/mpu: make early_fdt_map support in MPU systemsxen/arch/arm/include/asm/arm64/mpu.h xen/arch/arm/include/asm/page.h xen/arch/arm/mm.c +2 more+32 -810 replies
32/52xen/mpu: implement MPU version of setup_mm in mpu/setup.cxen/arch/arm/Makefile xen/arch/arm/include/asm/mpu/mm.h xen/arch/arm/mpu/mm.c +1 more+99 -00 replies
33/52xen/mpu: initialize frametable in MPU systemxen/arch/arm/include/asm/mm.h xen/arch/arm/include/asm/mpu/mm.h xen/arch/arm/mpu/mm.c+44 -06 replies
34/52xen/mpu: destroy an existing entry in Xen MPU memory mapping tablexen/arch/arm/include/asm/arm64/mpu.h xen/arch/arm/include/asm/arm64/sysregs.h xen/arch/arm/mm.c +1 more+84 -02 replies
35/52xen/arm: map static memory on demandxen/arch/arm/include/asm/mm.h xen/arch/arm/mmu/mm.c xen/arch/arm/mpu/mm.c +1 more+43 -04 replies
36/52xen/mpu: implememt ioremap_xxx in MPUxen/arch/arm/include/asm/arm64/mpu.h xen/arch/arm/include/asm/mm.h xen/arch/arm/mpu/mm.c+195 -02 replies
37/52xen/mpu: implement MPU version of copy_from_paddrxen/arch/arm/include/asm/mpu/mm.h xen/arch/arm/mpu/mm.c xen/arch/arm/mpu/setup.c+38 -30 replies
38/52xen/mpu: map domain page in MPU systemxen/arch/arm/Makefile xen/arch/arm/include/asm/mpu/mm.h xen/arch/arm/mpu/domain_page.c +1 more+90 -00 replies
39/52xen/mpu: support free_init_memory in MPU systemxen/arch/arm/mm.c xen/arch/arm/mpu/mm.c+45 -20 replies
40/52xen/mpu: implement remove_early_mappings in MPU systemxen/arch/arm/include/asm/mm.h xen/arch/arm/mmu/mm.c xen/arch/arm/mpu/mm.c +1 more+18 -40 replies
41/52xen/mpu: Use secure hypervisor timer in MPU systemxen/arch/arm/Kconfig xen/arch/arm/include/asm/arm64/sysregs.h+19 -00 replies
42/52xen/mpu: implement setup_virt_paging for MPU systemxen/arch/arm/Makefile xen/arch/arm/include/asm/cpufeature.h xen/arch/arm/include/asm/p2m.h +2 more+121 -02 replies
43/52xen/mpu: configure VSTCR_EL2 in MPU systemxen/arch/arm/include/asm/arm64/sysregs.h xen/arch/arm/mpu/p2m.c+22 -12 replies
44/52xen/mpu: P2M initialization in MPU systemxen/arch/arm/include/asm/mpu/mm.h xen/arch/arm/include/asm/p2m.h xen/arch/arm/mpu/mm.c +1 more+99 -02 replies
45/52xen/mpu: insert an new entry into guest physmap in MPU systemxen/arch/arm/include/asm/arm64/mpu.h xen/arch/arm/include/asm/mpu/mm.h xen/arch/arm/include/asm/p2m.h +2 more+185 -31 reply
46/52xen/mpu: look up entry in p2m tablexen/arch/arm/include/asm/mpu/p2m.h xen/arch/arm/include/asm/p2m.h xen/arch/arm/mpu/p2m.c+93 -00 replies
47/52xen/mpu: support vcpu context switch in MPU systemxen/arch/arm/include/asm/arm64/sysregs.h xen/arch/arm/include/asm/page.h xen/arch/arm/mpu/mm.c +1 more+73 -10 replies
48/52xen/mpu: enable MMIO region trap in MPU systemxen/arch/arm/traps.c+54 -270 replies
49/52xen/mpu: enable device passthrough in MPU systemxen/arch/arm/mpu/p2m.c+10 -10 replies
50/52xen/mpu: dump debug message in MPU systemxen/arch/arm/include/asm/mpu/mm.h xen/arch/arm/mpu/mm.c xen/arch/arm/mpu/p2m.c +2 more+69 -00 replies
51/52xen/mpu: create stubs of function/variables for UNSUPPORTED featuresxen/arch/arm/arm64/mpu/head.S xen/arch/arm/mpu/mm.c xen/arch/arm/mpu/p2m.c+38 -00 replies
52/52xen/arm: add Kconfig option CONFIG_HAS_MPU to enable MPU system supportxen/arch/arm/Kconfig+13 -12 replies

Reviews trailers per patch

2 of 52 patches have a Reviewed-by or Acked-by.

PatchJulien Grall
1/52A-b
2/52R-b
3/52
4/52
5/52
6/52
7/52
8/52
9/52
10/52
11/52
12/52
13/52
14/52
15/52
16/52
17/52
18/52
19/52
20/52
21/52
22/52
23/52
24/52
25/52
26/52
27/52
28/52
29/52
30/52
31/52
32/52
33/52
34/52
35/52
36/52
37/52
38/52
39/52
40/52
41/52
42/52
43/52
44/52
45/52
46/52
47/52
48/52
49/52
50/52
51/52
52/52

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/52] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1

So sorry for the long long wait before v3 serie, since I got sidetracked to a new high priority internal project for quite a time.

The Armv8-R architecture profile was designed to support use cases that have a high sensitivity to deterministic execution. (e.g. Fuel Injection, Brake control, Drive trains, Motor control etc)

Arm announced Armv8-R in 2013, it is the latest generation Arm architecture targeted at the Real-time profile. It introduces virtualization at the highest security level while retaining the Protected Memory System Architecture (PMSA) based on a Memory Protection Unit (MPU). In 2020, Arm announced Cortex-R82, which is the first Arm 64-bit Cortex-R processor based on Armv8-R64. The latest Armv8-R64 document can be found [1]. And the features of Armv8-R64 architecture:
- An exception model that is compatible with the Armv8-A model
- Virtualization with support for guest operating systems
- PMSA virtualization using MPUs In EL2.
- Adds support for the 64-bit A64 instruction set.
- Supports up to 48-bit physical addressing.
- Supports three Exception Levels (ELs)
- Secure EL2 - The Highest Privilege
- Secure EL1 - RichOS (MMU) or RTOS (MPU)
- Secure EL0 - Application Workloads
- Supports only a single Security state - Secure.
- MPU in EL1 & EL2 is configurable, MMU in EL1 is configurable.

These patch series are implementing the Armv8-R64 MPU support for Xen, which are based on the discussion of "Proposal for Porting Xen to Armv8-R64 - DraftC" [2].

We will implement the Armv8-R64 and MPU support in three stages:
1. Support to boot MMU domains on Armv8-R64 Xen.
2. Support to boot MPU domains on Armv8-R64 Xen.
3. SMP and other advanced features of Xen support on Armv8-R64.

For having a overall undestanding for reviewers about MPU framework on Xen, we have introduced a large patch serie here, including 52 commits. At this stage, we could successfully boot a linux guest on FVP_BaseR_AEMv8R model[3].

We will split these patches to several parts, this series is the part#1, v1 is in [4], the full PoC can be found in [5]. More software for Armv8-R64 can be found in [6];

[1] https://developer.arm.com/documentation/ddi0600/latest
[2] https://lists.xenproject.org/archives/html/xen-devel/2022-05/msg00643.html
[3] https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms/arm-ecosystem-models
[4] https://lists.xenproject.org/archives/html/xen-devel/2022-11/msg00289.html
[5] https://gitlab.com/xen-project/people/weic/xen/-/tree/integration/mpu_v3
[6] https://armv8r64-refstack.docs.arm.com/en/v5.0/

Penny Zheng (41):
xen/arm: introduce CONFIG_HAS_MMU
xen/arm: mmu: fold FIXMAP into MMU system
xen/mmu: extract early uart mapping from setup_fixmap xen/mmu: move MMU-specific setup_mm to mmu/setup.c
xen: make VMAP only support in MMU system
xen/mmu: relocate copy_from_paddr into setup.c
xen/arm: do not give memory back to static heap
xen/arm: only map the init text section RW in free_init_memory xen/arm: switch to use ioremap_xxx in common file xen/mmu: move MMU specific P2M code to mmu/p2m.c and mmu/p2m.h
xen: introduce CONFIG_HAS_PAGING_MEMPOOL
xen/mmu: enable SMMU subsystem only in MMU
xen/mpu: build up start-of-day Xen MPU memory region map xen/mpu: introduce helpers for MPU enablement
xen/mpu: map early uart when earlyprintk on
xen/mpu: introduce setup_mm_mappings
xen/mpu: plump virt/maddr conversion in MPU system xen/mpu: introduce a pair helper
read_protection_region()/write_protection_region()
xen/mpu: populate a new region in Xen MPU mapping table xen/mpu: make early_fdt_map support in MPU systems xen/mpu: implement MPU version of setup_mm in mpu/setup.c xen/mpu: initialize frametable in MPU system
xen/mpu: destroy an existing entry in Xen MPU memory mapping table xen/arm: map static memory on demand
xen/mpu: implememt ioremap_xxx in MPU
xen/mpu: implement MPU version of copy_from_paddr xen/mpu: map domain page in MPU system
xen/mpu: support free_init_memory in MPU system
xen/mpu: implement remove_early_mappings in MPU system xen/mpu: Use secure hypervisor timer in MPU system xen/mpu: implement setup_virt_paging for MPU system xen/mpu: configure VSTCR_EL2 in MPU system
xen/mpu: P2M initialization in MPU system
xen/mpu: insert an new entry into guest physmap in MPU system xen/mpu: look up entry in p2m table
xen/mpu: support vcpu context switch in MPU system xen/mpu: enable MMIO region trap in MPU system
xen/mpu: enable device passthrough in MPU system
xen/mpu: dump debug message in MPU system
xen/mpu: create stubs of function/variables for UNSUPPORTED features xen/arm: add Kconfig option CONFIG_HAS_MPU to enable MPU system
support

Wei Chen (11):
xen/arm: remove xen_phys_start and xenheap_phys_end from config.h xen/arm: make ARM_EFI selectable for Arm64
xen/arm: add an option to define Xen start address for Armv8-R xen/arm: add .text.idmap in ld script for Xen identity map sections xen/arm64: head: Introduce enable_boot_mmu and enable_runtime_mmu xen/arm64: prepare for moving MMU related code from head.S xen/arm64: move MMU related code from head.S to mmu/head.S xen/arm: use PA == VA for EARLY_UART_VIRTUAL_ADDRESS on MPU systems xen/arm: Move MMU related definitions from config.h to mmu/layout.h xen/mmu: extract mmu-specific codes from mm.c/mm.h xen/arm: create mpu/layout.h for MPU related address definitions

 xen/arch/arm/Kconfig                     |   52 +-
 xen/arch/arm/Kconfig.debug               |    7 +
 xen/arch/arm/Makefile                    |   15 +-
 xen/arch/arm/arm32/head.S                |    2 +-
 xen/arch/arm/arm64/Makefile              |    7 +-
 xen/arch/arm/arm64/head.S                |  472 +-----
 xen/arch/arm/arm64/mmu/head.S            |  463 ++++++
 xen/arch/arm/arm64/{ => mmu}/mm.c        |    7 +-
 xen/arch/arm/arm64/mpu/head.S            |  255 ++++
 xen/arch/arm/arm64/smpboot.c             |    6 +-
 xen/arch/arm/bootfdt.c                   |    2 +-
 xen/arch/arm/domain.c                    |    2 +
 xen/arch/arm/domain_build.c              |    2 +
 xen/arch/arm/include/asm/arm64/macros.h  |   51 +
 xen/arch/arm/include/asm/arm64/mm.h      |    7 +-
 xen/arch/arm/include/asm/arm64/mpu.h     |  140 ++
 xen/arch/arm/include/asm/arm64/sysregs.h |   76 +
 xen/arch/arm/include/asm/config.h        |  129 +-
 xen/arch/arm/include/asm/cpufeature.h    |    7 +
 xen/arch/arm/include/asm/early_printk.h  |   20 +
 xen/arch/arm/include/asm/fixmap.h        |   31 +-
 xen/arch/arm/include/asm/mm.h            |   79 +-
 xen/arch/arm/include/asm/mmu/layout.h    |  141 ++
 xen/arch/arm/include/asm/mmu/mm.h        |   54 +
 xen/arch/arm/include/asm/mmu/p2m.h       |   18 +
 xen/arch/arm/include/asm/mpu/layout.h    |   32 +
 xen/arch/arm/include/asm/mpu/mm.h        |   36 +
 xen/arch/arm/include/asm/mpu/p2m.h       |   18 +
 xen/arch/arm/include/asm/p2m.h           |   48 +-
 xen/arch/arm/include/asm/page.h          |   46 +-
 xen/arch/arm/include/asm/processor.h     |   14 +
 xen/arch/arm/include/asm/setup.h         |   16 +-
 xen/arch/arm/kernel.c                    |   42 +-
 xen/arch/arm/mm.c                        | 1160 +-------------
 xen/arch/arm/mmu/mm.c                    | 1133 ++++++++++++++
 xen/arch/arm/mmu/p2m.c                   | 1612 +++++++++++++++++++
 xen/arch/arm/mmu/setup.c                 |  379 +++++
 xen/arch/arm/mpu/domain_page.c           |   68 +
 xen/arch/arm/mpu/mm.c                    |  959 ++++++++++++
 xen/arch/arm/mpu/p2m.c                   |  518 +++++++
 xen/arch/arm/mpu/setup.c                 |  102 ++
 xen/arch/arm/p2m.c                       | 1782 ++--------------------
 xen/arch/arm/platforms/Kconfig           |    8 +-
 xen/arch/arm/setup.c                     |  388 +----
 xen/arch/arm/smpboot.c                   |    6 +-
 xen/arch/arm/traps.c                     |   97 +-
 xen/arch/arm/xen.lds.S                   |    6 +-
 xen/arch/x86/Kconfig                     |    2 +
 xen/arch/x86/setup.c                     |    2 +
 xen/common/Kconfig                       |    8 +
 xen/common/Makefile                      |    2 +-
 xen/common/domctl.c                      |    2 +
 xen/common/vmap.c                        |    7 +
 xen/drivers/passthrough/Kconfig          |    3 +-
 xen/include/xen/vmap.h                   |   11 +-
 55 files changed, 6730 insertions(+), 3822 deletions(-)
 create mode 100644 xen/arch/arm/arm64/mmu/head.S
 rename xen/arch/arm/arm64/{ => mmu}/mm.c (97%)
 create mode 100644 xen/arch/arm/arm64/mpu/head.S
 create mode 100644 xen/arch/arm/include/asm/arm64/mpu.h
 create mode 100644 xen/arch/arm/include/asm/mmu/layout.h
 create mode 100644 xen/arch/arm/include/asm/mmu/mm.h
 create mode 100644 xen/arch/arm/include/asm/mmu/p2m.h
 create mode 100644 xen/arch/arm/include/asm/mpu/layout.h
 create mode 100644 xen/arch/arm/include/asm/mpu/mm.h
 create mode 100644 xen/arch/arm/include/asm/mpu/p2m.h
 create mode 100644 xen/arch/arm/mmu/mm.c
 create mode 100644 xen/arch/arm/mmu/p2m.c
 create mode 100644 xen/arch/arm/mmu/setup.c
 create mode 100644 xen/arch/arm/mpu/domain_page.c
 create mode 100644 xen/arch/arm/mpu/mm.c
 create mode 100644 xen/arch/arm/mpu/p2m.c
 create mode 100644 xen/arch/arm/mpu/setup.c
Signature · 1 line
2.25.1