xen/arm: add Persistent Map (PMAP) infrastructure
authorWei Liu <wei.liu2@citrix.com>
Sat, 11 Jun 2022 11:20:33 +0000 (12:20 +0100)
committerJulien Grall <julien@xen.org>
Sat, 11 Jun 2022 11:29:06 +0000 (12:29 +0100)
commit4f17357b52f6ea9e76ff2375a6c61e8f43f65723
treec402d5732fdc7bd6ad4e29036c47839b878904cb
parente051b5cd1043cc1aad506faace824e6aacc887bf
xen/arm: add Persistent Map (PMAP) infrastructure

The basic idea is like Persistent Kernel Map (PKMAP) in Linux. We
pre-populate all the relevant page tables before the system is fully
set up.

We will need it on Arm in order to rework the arm64 version of
xenheap_setup_mappings() as we may need to use pages allocated from
the boot allocator before they are effectively mapped.

This infrastructure is not lock-protected therefore can only be used
before smpboot. After smpboot, map_domain_page() has to be used.

This is based on the x86 version [1] that was originally implemented
by Wei Liu.

The PMAP infrastructure is implemented in common code with some
arch helpers to set/clear the page-table entries and convertion
between a fixmap slot to a virtual address...

As mfn_to_xen_entry() now needs to be exported, take the opportunity
to swich the parameter attr from unsigned to unsigned int.

[1] <e92da4ad6015b6089737fcccba3ec1d6424649a5.1588278317.git.hongyxia@amazon.com>

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
[julien: Adapted for Arm]
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Tested-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/Kconfig
xen/arch/arm/include/asm/fixmap.h
xen/arch/arm/include/asm/lpae.h
xen/arch/arm/include/asm/pmap.h [new file with mode: 0644]
xen/arch/arm/mm.c
xen/common/Kconfig
xen/common/Makefile
xen/common/pmap.c [new file with mode: 0644]
xen/include/xen/pmap.h [new file with mode: 0644]