Currently we have no good mechanism for resolving userspace virtual
addresses to physical addresses. In principle one could use /dev/kmem
to walk page tables from userspace but this seems fraught. This diff
adds a privileged ioctl to provide this functionality.
The intended use-case is DPDK, which performs DMA from userspace and
also wants to be able to determine whether a set of large pages is
physically contiguous. Currently it uses contigmem.ko (shipped with
DPDK) to both allocate and create superpage mappings, and provide the
physical address of each large page. The aim is to replace this module
with the POSIX shm-based interface that Kostik wrote.
Note, DPDK operates in one of two modes: "IOVA as PA" and "IOVA as VA".
The former is for devices not behind an IOMMU and is the mode that
requires MEM_EXTRACT_PADDR. "IOVA as VA" mode makes use of a custom kernel
driver which provides an interface to program the IOMMU in front of a
device, and does not need to be able to resolve UVAs. However, this
kernel driver is not implemented for FreeBSD at the moment.