On 06.09.2022 09:39, Penny Zheng wrote: > When a static domain populates memory through populate_physmap at runtime, > it shall retrieve reserved pages from resv_page_list to make sure that > guest RAM is still restricted in statically configured memory regions. > This commit also introduces a new helper acquire_reserved_page to make it > work. > > Signed-off-by: Penny Zheng <penny.zh...@arm.com>
Just FTR: I have no further comments here, but I'm also not going to ack this change with ... > --- a/xen/common/memory.c > +++ b/xen/common/memory.c > @@ -245,6 +245,29 @@ static void populate_physmap(struct memop_args *a) > > mfn = _mfn(gpfn); > } > + else if ( is_domain_using_staticmem(d) ) > + { > + /* > + * No easy way to guarantee the retrieved pages are > contiguous, > + * so forbid non-zero-order requests here. > + */ > + if ( a->extent_order != 0 ) > + { > + gdprintk(XENLOG_WARNING, > + "Cannot allocate static order-%u pages for > %pd\n", > + a->extent_order, d); > + goto out; > + } > + > + mfn = acquire_reserved_page(d, a->memflags); > + if ( mfn_eq(mfn, INVALID_MFN) ) > + { > + gdprintk(XENLOG_WARNING, > + "%pd: failed to retrieve a reserved page\n", > + d); > + goto out; > + } > + } > else > { > page = alloc_domheap_pages(d, a->extent_order, a->memflags); ... the gdprintk() left in here. I'm sure someone else (Julien?) will provide the necessary ack. Jan