x86/vmap: handle superpages in vmap_to_mfn()
authorHongyan Xia <hongyxia@amazon.com>
Mon, 7 Dec 2020 13:54:44 +0000 (14:54 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 7 Dec 2020 13:54:44 +0000 (14:54 +0100)
commit3ec53aa79905edc3891b8267123d88a221553370
tree3abc83b907d43ce2c9008363ac30356079f44eb9
parent826a6dd030fe7d2a62b019e7d6e51ab79227f4aa
x86/vmap: handle superpages in vmap_to_mfn()

There is simply no guarantee that vmap won't return superpages to the
caller. It can happen if the list of MFNs are contiguous, or we simply
have a large granularity. Although rare, if such things do happen, we
will simply hit BUG_ON() and crash.

Introduce xen_map_to_mfn() to translate any mapped Xen address to mfn
regardless of page size, and wrap vmap_to_mfn() around it.

Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm.c
xen/include/asm-x86/page.h
xen/include/xen/mm.h