mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
This commit sets/tearsdown of p2m pages pool for non-privileged Arm guests by calling `p2m_set_allocation` and `p2m_teardown_allocation`. - For dom0, P2M pages should come from heap directly instead of p2m pool, so that the kernel may take advantage of the extended regions. - For xl guests, the setting of the p2m pool is called in `XEN_DOMCTL_shadow_op` and the p2m pool is destroyed in `domain_relinquish_resources`. Note that domctl->u.shadow_op.mb is updated with the new size when setting the p2m pool. - For dom0less domUs, the setting of the p2m pool is called before allocating memory during domain creation. Users can specify the p2m pool size by `xen,domain-p2m-mem-mb` dts property. To actually allocate/free pages from the p2m pool, this commit adds two helper functions namely `p2m_alloc_page` and `p2m_free_page` to `struct p2m_domain`. By replacing the `alloc_domheap_page` and `free_domheap_page` with these two helper functions, p2m pages can be added/removed from the list of p2m pool rather than from the heap. Since page from `p2m_alloc_page` is cleaned, take the opportunity to remove the redundant `clean_page` in `p2m_create_table`. This is part of CVE-2022-33747 / XSA-409. Signed-off-by: Henry Wang <Henry.Wang@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>