xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages
authorPenny Zheng <penny.zheng@arm.com>
Fri, 10 Sep 2021 02:52:14 +0000 (02:52 +0000)
committerStefano Stabellini <stefano.stabellini@xilinx.com>
Mon, 13 Sep 2021 21:15:03 +0000 (14:15 -0700)
commitc7fe462c0d274ffa30c9448c0a80affa075d789d
tree38b2b09d8d31b53e63da5bb8a429e61eceb5fbad
parent5260e8fb93f0e1f094de4142b2abad45844ab89c
xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages

New function acquire_staticmem_pages aims to acquire nr_mfns contiguous pages
of static memory, starting at #smfn. And it is the equivalent of
alloc_heap_pages for static memory.

For each page, it shall check if the page is reserved(PGC_reserved)
and free. It shall also do a set of necessary initialization, which are
mostly the same ones in alloc_heap_pages, like, following the same
cache-coherency policy and turning page status into PGC_state_inuse, etc.

New function acquire_domstatic_pages is the equivalent of alloc_domheap_pages
for static memory, and it is to acquire nr_mfns contiguous pages of
static memory and assign them to one specific domain.

It uses acquire_staticmem_pages to acquire nr_mfns pages of static memory.
Then on success, it will use assign_pages to assign those pages to one
specific domain.

In order to differentiate pages of static memory from those allocated from
heap, this patch introduces a new page flag PGC_reserved, then mark pages of
static memory PGC_reserved when initializing them.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/common/page_alloc.c
xen/include/asm-arm/mm.h
xen/include/xen/mm.h