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

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


  • To: Penny Zheng <Penny.Zheng@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Tue, 4 Jul 2023 15:17:06 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • 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=NC0QtpFwKtnzvqPqYL1Q9UUuDbyf8nbwSb4gLzA1xhw=; b=ELIBtYU0gAzeJ9tO8UiJuUuS6wCuluuuLgStxosTt3Hj2ZF68JDME1vmVKqZTfUFkzLDaLjEjIuCj5iZrKZ27c5ll350XjNorCrue1y4sWFhUUkZwRM13YSLLORr9FBAyRFlUu7o5OsGgFvtcFBA1tIU4iCJk/DFP2ZvHcFQVA77HAHaQ7ylllqSIrlZYrx87+JTlWwAmSBO2/S6KHcEvCJK6mTizYnzrnS3+phknZQcYLEKk1Ekz774VTXhQED0AxoenO5TDOw2m/51+5/GuaFnxtHNxcVw2V0TA62IHc9O6T4cJBFDWA9NWHWGAMa8T3P3U43TwKR7pGXsk+lhkQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=enSzB7C+LshLhSkdk39NI2sA19LfKuFPkImqUsLN0MquQT9bJPI1JF9CyxUrcI2dS5EmXX8gQEIuPN3vxUT0KTH2ZpxUnUSxGAt8vtnbRkgKMm9BRgOMYSLzs2nKOyjVdVjnxYChCkyDXIa7uAJWgEjiJq+DUQXpuwhtajZ2D3hwjsZWlYxbL/kMdWjhIMxuurC3fUwI4tKa59/h5V6BoJ67FxVjZe7MBTJVyiwN+TZbKFQeywoHHR+KMp9DeRsnWsHSoAnCKjuTPLuEC9RXm2svBkKRkCYAjKiBfVEjG28UjSEkqaMWMtfC8LH/NyWGcSQqlIdtKyiQnlz+mImt0g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Tue, 04 Jul 2023 14:17:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 26/06/2023 04:33, Penny Zheng wrote:
CAUTION: This message has originated from an External Source. Please use proper 
judgment and caution when opening attachments, clicking links, or responding to 
this email.


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

Hi All,

I had a look at the first 22 patches (which touch the MMU code) and I did not find anything which will impact the R52 work directly.

- Ayan


  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

--
2.25.1





 


Rackspace

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