On ARM, mfn_to_gfn() is defined as an identity macro that unconditionally
returns the MFN as the GFN. This is incorrect for any non-direct-mapped domain.
It only has two call sites: getdomaininfo() and memory_exchange().
It causes getdomaininfo() to report the wrong shared_info_frame on ARM,
breaking any toolstack or test that relies on it. While as steal_page() is not
supported on arm, the error does not propagate to memory_exchange().
This series fixes the problem in the following steps:
- Generalize the existing per-page GFN storage in type_info so it is
usable beyond xenheap pages.
- Introduce a shared_info_to_gfn() macro so getdomaininfo() switches to
use page_get_xenheap_gfn() on ARM and still mfn_to_gfn() on x86
- Fix memory_exchange() to use page_set_gfn()/page_get_gfn(), which generalize
the existing page_set_xenheap_gfn()/page_get_xenheap_gfn() from xenheap
pages, instead of mfn_to_gfn() on ARM for stolen pages.
With all the above modification, we could remove the now-unused mfn_to_gfn()
macro on ARM.
Penny Zheng (3):
xen/arm: generalize per-page GFN storage beyond xenheap pages
xen: introduce shared_info_to_gfn()
xen/arm: fix mfn_to_gfn() usage in memory_exchange()
xen/arch/arm/include/asm/mm.h | 40 +++++++++++++++++++++++-----------
xen/arch/x86/include/asm/p2m.h | 3 +++
xen/common/domctl.c | 3 +--
xen/common/memory.c | 11 ++++++++++
4 files changed, 42 insertions(+), 15 deletions(-)
--
2.34.1