All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/18] xen/arm: Don't switch TTBR while the MMU is on
@ 2022-12-12  9:55 Julien Grall
  2022-12-12  9:55 ` [PATCH v3 01/18] xen/arm64: flushtlb: Reduce scope of barrier for local TLB flush Julien Grall
                   ` (18 more replies)
  0 siblings, 19 replies; 48+ messages in thread
From: Julien Grall @ 2022-12-12  9:55 UTC (permalink / raw)
  To: xen-devel
  Cc: michal.orzel, 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 temporary 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-v3

Cheers,

Julien Grall (18):
  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/arm: Enable use of dump_pt_walk() early during boot
  xen/arm64: Rework the memory layout
  xen/arm: mm: Allow xen_pt_update() to work with the current root table
  xen/arm: mm: Allow dump_hyp_walk() to work on the current root table
  xen/arm64: mm: Introduce helpers to prepare/enable/disable the
    identity mapping
  xen/arm: linker: Indent correctly _stext
  xen/arm: linker: The identitymap check should cover the whole
    .text.header
  xen/arm64: mm: Rework switch_ttbr()

 xen/arch/arm/arm32/head.S                 | 285 ++++++++++++++--------
 xen/arch/arm/arm64/Makefile               |   1 +
 xen/arch/arm/arm64/head.S                 |  55 +++--
 xen/arch/arm/arm64/mm.c                   | 160 ++++++++++++
 xen/arch/arm/domain_page.c                |   1 +
 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 |  58 +++--
 xen/arch/arm/include/asm/arm64/mm.h       |  12 +
 xen/arch/arm/include/asm/config.h         |  71 ++++--
 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/mm.c                         | 105 ++++----
 xen/arch/arm/xen.lds.S                    |  12 +-
 15 files changed, 583 insertions(+), 231 deletions(-)
 create mode 100644 xen/arch/arm/arm64/mm.c

-- 
2.38.1



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

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

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12  9:55 [PATCH v3 00/18] xen/arm: Don't switch TTBR while the MMU is on Julien Grall
2022-12-12  9:55 ` [PATCH v3 01/18] xen/arm64: flushtlb: Reduce scope of barrier for local TLB flush Julien Grall
2022-12-13  9:11   ` Michal Orzel
2022-12-13  9:45     ` Julien Grall
2022-12-13  9:50       ` Michal Orzel
2023-01-23 16:19   ` Ayan Kumar Halder
2022-12-12  9:55 ` [PATCH v3 02/18] xen/arm64: flushtlb: Implement the TLBI repeat workaround for TLB flush by VA Julien Grall
2022-12-13  9:23   ` Michal Orzel
2022-12-12  9:55 ` [PATCH v3 03/18] xen/arm32: flushtlb: Reduce scope of barrier for local TLB flush Julien Grall
2022-12-13 10:48   ` Michal Orzel
2022-12-12  9:55 ` [PATCH v3 04/18] xen/arm: flushtlb: Reduce scope of barrier for the TLB range flush Julien Grall
2022-12-13 11:15   ` Michal Orzel
2022-12-12  9:55 ` [PATCH v3 05/18] xen/arm: Clean-up the memory layout Julien Grall
2022-12-13 10:57   ` Michal Orzel
2022-12-13 11:00     ` Michal Orzel
2022-12-12  9:55 ` [PATCH v3 06/18] xen/arm32: head: Replace "ldr rX, =<label>" with "mov_w rX, <label>" Julien Grall
2022-12-13  0:31   ` Stefano Stabellini
2022-12-13 11:10   ` Michal Orzel
2022-12-12  9:55 ` [PATCH v3 07/18] xen/arm32: head: Jump to the runtime mapping in enable_mmu() Julien Grall
2022-12-13  0:46   ` Stefano Stabellini
2022-12-12  9:55 ` [PATCH v3 08/18] xen/arm32: head: Introduce an helper to flush the TLBs Julien Grall
2022-12-14 14:24   ` Michal Orzel
2023-01-12 19:38     ` Julien Grall
2022-12-12  9:55 ` [PATCH v3 09/18] xen/arm32: head: Remove restriction where to load Xen Julien Grall
2022-12-13 18:23   ` Julien Grall
2022-12-12  9:55 ` [PATCH v3 10/18] xen/arm32: head: Widen the use of the temporary mapping Julien Grall
2022-12-12  9:55 ` [PATCH v3 11/18] xen/arm: Enable use of dump_pt_walk() early during boot Julien Grall
2022-12-13  1:06   ` Stefano Stabellini
2022-12-12  9:55 ` [PATCH v3 12/18] xen/arm64: Rework the memory layout Julien Grall
2022-12-13  1:22   ` Stefano Stabellini
2022-12-13 18:31     ` Julien Grall
2022-12-12  9:55 ` [PATCH v3 13/18] xen/arm: mm: Allow xen_pt_update() to work with the current root table Julien Grall
2022-12-13  1:24   ` Stefano Stabellini
2022-12-12  9:55 ` [PATCH v3 14/18] xen/arm: mm: Allow dump_hyp_walk() to work on " Julien Grall
2022-12-13  1:24   ` Stefano Stabellini
2022-12-12  9:55 ` [PATCH v3 15/18] xen/arm64: mm: Introduce helpers to prepare/enable/disable the identity mapping Julien Grall
2022-12-13  1:41   ` Stefano Stabellini
2023-01-12 22:03     ` Julien Grall
2022-12-12  9:55 ` [PATCH v3 16/18] xen/arm: linker: Indent correctly _stext Julien Grall
2022-12-13  1:42   ` Stefano Stabellini
2022-12-12  9:55 ` [PATCH v3 17/18] xen/arm: linker: The identitymap check should cover the whole .text.header Julien Grall
2022-12-13  1:44   ` Stefano Stabellini
2022-12-12  9:55 ` [PATCH v3 18/18] xen/arm64: mm: Rework switch_ttbr() Julien Grall
2022-12-13  2:00   ` Stefano Stabellini
2022-12-13 19:08     ` Julien Grall
2022-12-13 22:56       ` Stefano Stabellini
2022-12-13 23:01         ` Julien Grall
2022-12-15 11:48 ` [PATCH v3 00/18] 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.