x86/dom0: attempt to fixup p2m page-faults for PVH dom0

When building a PVH dom0 Xen attempts to map all (relevant) MMIO regions
into the p2m for dom0 access.  However the information Xen has about the
host memory map is limited.  Xen doesn't have access to any resources
described in ACPI dynamic tables, and hence the p2m mappings provided might
not be complete.

PV doesn't suffer from this issue because a PV dom0 is capable of mapping
into it's page-tables any address not explicitly banned in d->iomem_caps.

Introduce a new command line options that allows Xen to attempt to fixup
the p2m page-faults, by creating p2m identity maps in response to p2m
page-faults.

This is aimed as a workaround to small ACPI regions Xen doesn't know about.
Note that missing large MMIO regions mapped in this way will lead to
slowness due to the VM exit processing, plus the mappings will always use
small pages.

The ultimate aim is to attempt to bring better parity with a classic PV
dom0.

Note such fixup rely on the CPU doing the access to the unpopulated
address.  If the access is attempted from a device instead there's no
possible way to fixup, as IOMMU page-fault are asynchronous.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Only slightly tested on my local PVH dom0 deployment.
---
Changes since v1:
 - Make the fixup function static.
 - Print message in case mapping already exists.
This commit is contained in:
Roger Pau Monne committed 2025-03-05 10:26:46 +01:00
1 parent 43d8a80a0c
commit 104591f5dd
5 files changed
+97 -3

No files matched your search

+15 -1
View File
@@ -822,7 +822,8 @@ Specify the bit width of the DMA heap.
### dom0
= List of [ pv | pvh, shadow=<bool>, verbose=<bool>,
cpuid-faulting=<bool>, msr-relaxed=<bool> ] (x86)
cpuid-faulting=<bool>, msr-relaxed=<bool>,
pf-fixup=<bool> ] (x86)
= List of [ sve=<integer> ] (Arm64)
@@ -883,6 +884,19 @@ Controls for how dom0 is constructed on x86 systems.
If using this option is necessary to fix an issue, please report a bug.
* The `pf-fixup` boolean is only applicable when using a PVH dom0 and
defaults to false.
When running dom0 in PVH mode the dom0 kernel has no way to map MMIO
regions into its physical memory map, such mode relies on Xen dom0 builder
populating the physical memory map with all MMIO regions that dom0 should
access. However Xen doesn't have a complete picture of the host memory
map, due to not being able to process ACPI dynamic tables.
The `pf-fixup` option allows Xen to attempt to add missing MMIO regions
to the dom0 physical memory map in response to page-faults generated by
dom0 trying to access unpopulated entries in the memory map.
Enables features on dom0 on Arm systems.
* The `sve` integer parameter enables Arm SVE usage for Dom0 and sets the
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.