xen: Replace arch_mfn_in_directmap() with arch_mfns_in_directmap()
authorJulien Grall <jgrall@amazon.com>
Wed, 26 Jan 2022 15:59:19 +0000 (15:59 +0000)
committerJulien Grall <jgrall@amazon.com>
Thu, 27 Jan 2022 12:38:31 +0000 (12:38 +0000)
commit0a71ca9ab4c2d9a44f972c517bafa332b1622c10
tree879a389f4136d32ea35362972bdc50a33809d7d6
parent9511120a450420efe8c026b233fe0b3ab7f1bd71
xen: Replace arch_mfn_in_directmap() with arch_mfns_in_directmap()

The name of arch_mfn_in_directmap() suggests that it will check against
that the passed MFN should be in the directmap.

However, the current callers are passing the next MFN and the
implementation will return true for up to one MFN past the directmap.

It would be more meaningful to test the exact MFN rather than the
next one.

That said, the current expectation is the memory will be direct-mapped
from 0 up to a given MFN. This may not be a valid assumption on all
the architectures.

For instance, on Arm32 only the xenheap that will be direct-mapped.
This may not be allocated a the beginning of the RAM.

So take the opportunity to rework the parameters and pass the
number of pages we want to check. This also requires to rename
the helper to better match the implementation.

Note that the implementation of the helper on arm32 is left as-is
for now.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/include/asm/arm32/mm.h
xen/arch/arm/include/asm/arm64/mm.h
xen/arch/x86/include/asm/mm.h
xen/common/page_alloc.c