[PATCH RFC 0/3] MAP_POPULATE for device memory

From: Jarkko Sakkinen
Date: Sun Mar 06 2022 - 00:33:13 EST


For device memory (aka VM_IO | VM_PFNMAP) MAP_POPULATE does nothing. Allow
to use that for initializing the device memory by providing a new callback
f_ops->populate() for the purpose.

SGX patches are provided to show the callback in context.

An obvious alternative is a ioctl but it is less elegant and requires
two syscalls (mmap + ioctl) per memory range, instead of just one
(mmap).

Jarkko Sakkinen (3):
mm: Add f_ops->populate()
x86/sgx: Export sgx_encl_page_alloc()
x86/sgx: Implement EAUG population with MAP_POPULATE

arch/mips/kernel/vdso.c | 2 +-
arch/x86/kernel/cpu/sgx/driver.c | 129 +++++++++++++++++++++
arch/x86/kernel/cpu/sgx/encl.c | 38 ++++++
arch/x86/kernel/cpu/sgx/encl.h | 3 +
arch/x86/kernel/cpu/sgx/ioctl.c | 38 ------
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 2 +-
fs/coda/file.c | 2 +-
fs/overlayfs/file.c | 2 +-
include/linux/fs.h | 12 +-
include/linux/mm.h | 2 +-
ipc/shm.c | 2 +-
mm/mmap.c | 10 +-
mm/nommu.c | 4 +-
13 files changed, 193 insertions(+), 53 deletions(-)

--
2.35.1