On 8/11/25 2:50 PM, Jan Beulich wrote:
On 31.07.2025 17:58, Oleksii Kurochko wrote:
Implement the mfn_valid() macro to verify whether a given MFN is valid by
checking that it falls within the range [start_page, max_page).
These bounds are initialized based on the start and end addresses of RAM.

As part of this patch, start_page is introduced and initialized with the
PFN of the first RAM page.
Also, initialize pdx_group_valid() by calling set_pdx_range() when
memory banks are being mapped.

Also, after providing a non-stub implementation of the mfn_valid() macro,
the following compilation errors started to occur:
   riscv64-linux-gnu-ld: prelink.o: in function `__next_node':
   /build/xen/./include/xen/nodemask.h:202: undefined reference to 
`page_is_ram_type'
   riscv64-linux-gnu-ld: prelink.o: in function `get_free_buddy':
   /build/xen/common/page_alloc.c:881: undefined reference to `page_is_ram_type'
   riscv64-linux-gnu-ld: prelink.o: in function `alloc_heap_pages':
   /build/xen/common/page_alloc.c:1043: undefined reference to 
`page_get_owner_and_reference'
   riscv64-linux-gnu-ld: /build/xen/common/page_alloc.c:1098: undefined 
reference to `page_is_ram_type'
   riscv64-linux-gnu-ld: prelink.o: in function `ns16550_interrupt':
   /build/xen/drivers/char/ns16550.c:205: undefined reference to `get_page'
   riscv64-linux-gnu-ld: ./.xen-syms.0: hidden symbol 
`page_get_owner_and_reference' isn't defined
   riscv64-linux-gnu-ld: final link failed: bad value
   make[2]: *** [arch/riscv/Makefile:35: xen-syms] Error 1
To resolve these errors, the following functions have also been introduced,
based on their Arm counterparts:
- page_get_owner_and_reference() and its variant to safely acquire a
   reference to a page and retrieve its owner.
- A stub for page_is_ram_type() that currently always returns 0 and asserts
   unreachable, as RAM type checking is not yet implemented.
For this latter part I can only repeat that the code is reachable, and hence it
is wrong to put ASSERT_UNREACHABLE() there. That's true for Arm's code as well.

I will drop this stuff in the next patch version.


Signed-off-by: Oleksii Kurochko<oleksii.kuroc...@gmail.com>
With said line dropped:
Acked-by: Jan Beulich<jbeul...@suse.com>

Thanks.

~ Oleksii

Reply via email to