LinuxKPI: replace vtophys+PHYS_TO_VM_PAGE with virt_to_page

Rather than using the FreeBSD internal calls vtophys() and
PHYS_TO_VM_PAGE() use the already existing LinuxKPI abstraction for
this called virt_to_page().  This reduces the amount of compat code
to maintain and will allow further work on struct [vm_]page.

This should be a NOP.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D41257
This commit is contained in:
Bjoern A. Zeeb 2023-07-31 05:28:42 +00:00
parent d1ea07642c
commit dcb0c54968

View file

@ -138,7 +138,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order)
if (vaddr == 0)
return (NULL);
page = PHYS_TO_VM_PAGE(vtophys((void *)vaddr));
page = virt_to_page((void *)vaddr);
KASSERT(vaddr == (vm_offset_t)page_address(page),
("Page address mismatch"));
@ -526,7 +526,7 @@ linuxkpi_page_frag_free(void *addr)
{
vm_page_t page;
page = PHYS_TO_VM_PAGE(vtophys(addr));
page = virt_to_page(addr);
linux_free_pages(page, 0);
}