mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
XENMAPSPACE_gmfn_range was found to be buggy with overlapping ranges, and the fix is sufficiently far from clear that yours truly decided a test was in order. XENMAPSPACE_gmfn_range is exposed by xendevicemodel_relocate_memory() so take the opportunity to create a better example for others to copy. The test works as follows. Populate 2M of RAM in the guest, marking the pages so they can be identified later. Then construct four relocation test cases (overlapping vs non-overlapping, forwards vs backwards) using the marks in the guest pages to confirm that the P2M was adjusted correctly. The use of XEN_DOMCTL_CDF_iommu forces xenmem_add_to_physmap() to limit the iteration count to a maximum of 16. Use this to force a continuation and exercise more of the logic. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>