All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/14] xen/arm: Don't switch TTBR while the MMU is on
@ 2023-01-13 10:11 Julien Grall
  2023-01-13 10:11 ` [PATCH v4 01/14] xen/arm64: flushtlb: Reduce scope of barrier for local TLB flush Julien Grall
                   ` (14 more replies)
  0 siblings, 15 replies; 52+ messages in thread
From: Julien Grall @ 2023-01-13 10:11 UTC (permalink / raw)
  To: xen-devel
  Cc: Luca.Fancellu, Julien Grall, Stefano Stabellini, Julien Grall,
	Bertrand Marquis, Volodymyr Babchuk

From: Julien Grall <jgrall@amazon.com>

Hi all,

Currently, Xen on Arm will switch TTBR whilst the MMU is on. This is
similar to replacing existing mappings with new ones. So we need to
follow a break-before-make sequence.

When switching the TTBR, we need to temporarily disable the MMU
before updating the TTBR. This means the page-tables must contain an
identity mapping.

The current memory layout is not very flexible and has an higher chance
to clash with the identity mapping.

On Arm64, we have plenty of unused virtual address space Therefore, we can
simply reshuffle the layout to leave the first part of the virtual
address space empty.

On Arm32, the virtual address space is already quite full. Even if we
find space, it would be necessary to have a dynamic layout. So a
different approach will be necessary. The chosen one is to have
a temporary mapping that will be used to jumped from the ID mapping
to the runtime mapping (or vice versa). The temporary mapping will
be overlapping with the domheap area as it should not be used when
switching on/off the MMU.

The Arm32 part is not yet addressed and will be handled in a follow-up
series.

After this series, most of Xen page-table code should be compliant
with the Arm Arm. The last two issues I am aware of are:
 - domheap: Mappings are replaced without using the Break-Before-Make
   approach.
 - The cache is not cleaned/invalidated when updating the page-tables
   with Data cache off (like during early boot).

The long term plan is to get rid of boot_* page tables and then
directly use the runtime pages. This means for coloring, we will
need to build the pages in the relocated Xen rather than the current
Xen.

For convience, I pushed a branch with everything applied:

https://xenbits.xen.org/git-http/people/julieng/xen-unstable.git
branch boot-pt-rework-v4

Cheers,

Julien Grall (14):
  xen/arm64: flushtlb: Reduce scope of barrier for local TLB flush
  xen/arm64: flushtlb: Implement the TLBI repeat workaround for TLB
    flush by VA
  xen/arm32: flushtlb: Reduce scope of barrier for local TLB flush
  xen/arm: flushtlb: Reduce scope of barrier for the TLB range flush
  xen/arm: Clean-up the memory layout
  xen/arm32: head: Replace "ldr rX, =<label>" with "mov_w rX, <label>"
  xen/arm32: head: Jump to the runtime mapping in enable_mmu()
  xen/arm32: head: Introduce an helper to flush the TLBs
  xen/arm32: head: Remove restriction where to load Xen
  xen/arm32: head: Widen the use of the temporary mapping
  xen/arm64: Rework the memory layout
  xen/arm64: mm: Introduce helpers to prepare/enable/disable the
    identity mapping
  xen/arm64: mm: Rework switch_ttbr()
  xen/arm64: smpboot: Directly switch to the runtime page-tables

 xen/arch/arm/arm32/head.S                 | 283 ++++++++++++++--------
 xen/arch/arm/arm32/smpboot.c              |   4 +
 xen/arch/arm/arm64/Makefile               |   1 +
 xen/arch/arm/arm64/head.S                 |  82 ++++---
 xen/arch/arm/arm64/mm.c                   | 160 ++++++++++++
 xen/arch/arm/arm64/smpboot.c              |  15 +-
 xen/arch/arm/include/asm/arm32/flushtlb.h |  27 ++-
 xen/arch/arm/include/asm/arm32/mm.h       |   4 +
 xen/arch/arm/include/asm/arm64/flushtlb.h |  56 +++--
 xen/arch/arm/include/asm/arm64/mm.h       |  13 +
 xen/arch/arm/include/asm/config.h         |  72 ++++--
 xen/arch/arm/include/asm/flushtlb.h       |  10 +-
 xen/arch/arm/include/asm/mm.h             |   2 +
 xen/arch/arm/include/asm/setup.h          |  11 +
 xen/arch/arm/include/asm/smp.h            |   1 +
 xen/arch/arm/mm.c                         |  33 ++-
 xen/arch/arm/smpboot.c                    |   1 +
 17 files changed, 566 insertions(+), 209 deletions(-)
 create mode 100644 xen/arch/arm/arm64/mm.c

-- 
2.38.1



^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2023-01-27 19:40 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 10:11 [PATCH v4 00/14] xen/arm: Don't switch TTBR while the MMU is on Julien Grall
2023-01-13 10:11 ` [PATCH v4 01/14] xen/arm64: flushtlb: Reduce scope of barrier for local TLB flush Julien Grall
2023-01-13 11:36   ` Henry Wang
2023-01-13 10:11 ` [PATCH v4 02/14] xen/arm64: flushtlb: Implement the TLBI repeat workaround for TLB flush by VA Julien Grall
2023-01-13 13:22   ` Henry Wang
2023-01-13 17:56   ` Luca Fancellu
2023-01-16  8:36     ` Julien Grall
2023-01-13 10:11 ` [PATCH v4 03/14] xen/arm32: flushtlb: Reduce scope of barrier for local TLB flush Julien Grall
2023-01-13 13:46   ` Henry Wang
2023-01-13 10:11 ` [PATCH v4 04/14] xen/arm: flushtlb: Reduce scope of barrier for the TLB range flush Julien Grall
2023-01-13 13:53   ` Henry Wang
2023-01-13 10:11 ` [PATCH v4 05/14] xen/arm: Clean-up the memory layout Julien Grall
2023-01-13 13:57   ` Henry Wang
2023-01-24 19:30   ` Julien Grall
2023-01-13 10:11 ` [PATCH v4 06/14] xen/arm32: head: Replace "ldr rX, =<label>" with "mov_w rX, <label>" Julien Grall
2023-01-13 10:45   ` Michal Orzel
2023-01-13 10:47     ` Julien Grall
2023-01-14  0:51   ` Henry Wang
2023-01-13 10:11 ` [PATCH v4 07/14] xen/arm32: head: Jump to the runtime mapping in enable_mmu() Julien Grall
2023-01-14  1:33   ` Henry Wang
2023-01-13 10:11 ` [PATCH v4 08/14] xen/arm32: head: Introduce an helper to flush the TLBs Julien Grall
2023-01-13 10:46   ` Michal Orzel
2023-01-14  2:16   ` Henry Wang
2023-01-13 10:11 ` [PATCH v4 09/14] xen/arm32: head: Remove restriction where to load Xen Julien Grall
2023-01-13 14:58   ` Luca Fancellu
2023-01-16  8:43     ` Julien Grall
2023-01-16  8:14   ` Michal Orzel
2023-01-16  8:55     ` Julien Grall
2023-01-16  9:32       ` Michal Orzel
2023-01-13 10:11 ` [PATCH v4 10/14] xen/arm32: head: Widen the use of the temporary mapping Julien Grall
2023-01-13 15:37   ` Luca Fancellu
2023-01-16  8:20   ` Michal Orzel
2023-01-24 19:43     ` Julien Grall
2023-01-27 19:19       ` Julien Grall
2023-01-13 10:11 ` [PATCH v4 11/14] xen/arm64: Rework the memory layout Julien Grall
2023-01-13 15:58   ` Luca Fancellu
2023-01-16  8:46   ` Michal Orzel
2023-01-16  9:29     ` Julien Grall
2023-01-16 10:59       ` Michal Orzel
2023-01-13 10:11 ` [PATCH v4 12/14] xen/arm64: mm: Introduce helpers to prepare/enable/disable the identity mapping Julien Grall
2023-01-13 16:26   ` Luca Fancellu
2023-01-16  8:53   ` Michal Orzel
2023-01-27 19:30     ` Julien Grall
2023-01-13 10:11 ` [PATCH v4 13/14] xen/arm64: mm: Rework switch_ttbr() Julien Grall
2023-01-13 16:50   ` Luca Fancellu
2023-01-16  9:23   ` Michal Orzel
2023-01-16  9:32     ` Julien Grall
2023-01-13 10:11 ` [PATCH v4 14/14] xen/arm64: smpboot: Directly switch to the runtime page-tables Julien Grall
2023-01-13 17:42   ` Luca Fancellu
2023-01-16  9:06     ` Luca Fancellu
2023-01-27 19:39       ` Julien Grall
2023-01-24 19:35 ` [PATCH v4 00/14] xen/arm: Don't switch TTBR while the MMU is on Julien Grall

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.