mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
xen/arm: Allocate and free P2M pages from the P2M pool
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>
This commit is contained in:
1 parent
cf2a68d2ff
commit
cbea5a1149
5 files changed
+118
-5
No files matched your search
@@ -215,6 +215,14 @@ with the following properties:
|
||||
In the future other possible property values might be added to
|
||||
enable only selected interfaces.
|
||||
|
||||
- xen,domain-p2m-mem-mb
|
||||
|
||||
Optional. A 32-bit integer specifying the amount of megabytes of RAM
|
||||
used for the domain P2M pool. This is in-sync with the shadow_memory
|
||||
option in xl.cfg. Leaving this field empty in device tree will lead to
|
||||
the default size of domain P2M pool, i.e. 1MB per guest vCPU plus 4KB
|
||||
per MB of guest RAM plus 512KB for guest extended regions.
|
||||
|
||||
Under the "xen,domain" compatible node, one or more sub-nodes are present
|
||||
for the DomU kernel and ramdisk.
|
||||
|
||||
|
||||