git: de57268b96f2 - stable/13 - LinuxKPI: replace vtophys+PHYS_TO_VM_PAGE with virt_to_page

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 29 Nov 2023 16:37:57 UTC
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=de57268b96f23606eb069d63d4e4bbbc7af779c6

commit de57268b96f23606eb069d63d4e4bbbc7af779c6
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-07-31 05:28:42 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-11-29 16:36:04 +0000

    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
    
    (cherry picked from commit dcb0c54968db10d3c7619f16c4bcfa9284d50ea2)
---
 sys/compat/linuxkpi/common/src/linux_page.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c
index d99d64cac403..d59435ba934f 100644
--- a/sys/compat/linuxkpi/common/src/linux_page.c
+++ b/sys/compat/linuxkpi/common/src/linux_page.c
@@ -136,7 +136,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"));
@@ -524,7 +524,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);
 }