* [PATCH v2 00/13] mm: convert further simple mmap hooks to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm,
Kameron Carr, Michael Kelley, Jan Kara, Abel Vesa, Jens Wiklander,
David Woodhouse
Continue the conversion of users of the deprecated f_op->mmap callback to
f_op->mmap_prepare. Keep things gentle this cycle by targeting simple
cases.
No functional change intended.
Build tested on x86-64 (allmodconfig, each patch individually), i386,
arm64 and ppc64le.
Andrew - could you take this through your tree as it's a kernel-wide
change? Thanks!
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
v2:
* Added tags, thanks everybody!
* cc'd linux-mm, Andrew.
* Dropped the vduse patch (was 4/14), as commit bb2e6f166547 ("vduse: fix
VA/PA confusion in the coherent page fault path") completely broke the
driver and was merged without testing as a hotfix. Conversion can wait
for that to get fixed.
v1:
https://lore.kernel.org/r/20261105-late-2026-mmap_prepare-v1-0-c56aadfbab8a@kernel.org
---
Lorenzo Stoakes (ARM) (13):
xen/privcmd: convert mmap hook to mmap_prepare
KVM: PPC: Book3S: convert spapr TCE mmap hook to mmap_prepare
mshv_vtl: convert mmap hooks to mmap_prepare
x86/sgx: convert vepc mmap hook to mmap_prepare
udf: convert mmap hook to mmap_prepare
selinuxfs: convert mmap hooks to mmap_prepare
xen: convert xenstore interface mmap hooks to mmap_prepare
soc: aspeed: convert LPC and P2A control mmap hooks to mmap_prepare
soc: qcom: rmtfs_mem: convert mmap hook to mmap_prepare
tee: convert shm mmap hook to mmap_prepare
misc: bcm-vk: convert mmap hook to mmap_prepare
ptp: vmclock: convert mmap hook to mmap_prepare
vhost-vdpa: convert mmap hook to mmap_prepare
arch/powerpc/kvm/book3s_64_vio.c | 6 +++---
arch/x86/kernel/cpu/sgx/virt.c | 15 ++++++++-------
drivers/hv/mshv_vtl_main.c | 14 +++++++-------
drivers/misc/bcm-vk/bcm_vk_dev.c | 20 ++++++++++----------
drivers/ptp/ptp_vmclock.c | 19 +++++++++----------
drivers/soc/aspeed/aspeed-lpc-ctrl.c | 20 +++++++++-----------
drivers/soc/aspeed/aspeed-p2a-ctrl.c | 22 ++++++++--------------
drivers/soc/qcom/rmtfs_mem.c | 22 ++++++++++------------
drivers/tee/tee_shm.c | 14 +++++++-------
drivers/vhost/vdpa.c | 23 ++++++++++++-----------
drivers/xen/privcmd.c | 11 +++++------
drivers/xen/xenbus/xenbus_dev_backend.c | 14 ++++++--------
drivers/xen/xenfs/xenstored.c | 14 ++++++--------
fs/udf/file.c | 8 ++++----
security/selinux/selinuxfs.c | 24 +++++++++++-------------
15 files changed, 115 insertions(+), 131 deletions(-)
---
base-commit: 5bd93e4b0b357e9d0a13199887aacbf04d1ce216
change-id: 20261101-late-2026-mmap_prepare-02c87d23101e
Cheers,
--
Lorenzo Stoakes (ARM) <ljs@kernel.org>
^ permalink raw reply [flat|nested] 58+ messages in thread* [PATCH v2 01/13] xen/privcmd: convert mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook.
The hook only sets VMA flags and operations. The VMA private data is
already NULL at this point, so we no longer explicitly clear it.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/xen/privcmd.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 221b31611343..6d9e1fe03337 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -1645,14 +1645,13 @@ static const struct vm_operations_struct privcmd_vm_ops = {
.fault = privcmd_fault
};
-static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
+static int privcmd_mmap_prepare(struct vm_area_desc *desc)
{
/* DONTCOPY is essential for Xen because copy_page_range doesn't know
* how to recreate these mappings */
- vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTCOPY |
- VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &privcmd_vm_ops;
- vma->vm_private_data = NULL;
+ vma_desc_set_flags(desc, VMA_IO_BIT, VMA_PFNMAP_BIT, VMA_DONTCOPY_BIT,
+ VMA_DONTEXPAND_BIT, VMA_DONTDUMP_BIT);
+ desc->vm_ops = &privcmd_vm_ops;
return 0;
}
@@ -1681,7 +1680,7 @@ const struct file_operations xen_privcmd_fops = {
.unlocked_ioctl = privcmd_ioctl,
.open = privcmd_open,
.release = privcmd_release,
- .mmap = privcmd_mmap,
+ .mmap_prepare = privcmd_mmap_prepare,
};
EXPORT_SYMBOL_GPL(xen_privcmd_fops);
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 01/13] xen/privcmd: convert mmap hook to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook.
The hook only sets VMA flags and operations. The VMA private data is
already NULL at this point, so we no longer explicitly clear it.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/xen/privcmd.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 221b31611343..6d9e1fe03337 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -1645,14 +1645,13 @@ static const struct vm_operations_struct privcmd_vm_ops = {
.fault = privcmd_fault
};
-static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
+static int privcmd_mmap_prepare(struct vm_area_desc *desc)
{
/* DONTCOPY is essential for Xen because copy_page_range doesn't know
* how to recreate these mappings */
- vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTCOPY |
- VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &privcmd_vm_ops;
- vma->vm_private_data = NULL;
+ vma_desc_set_flags(desc, VMA_IO_BIT, VMA_PFNMAP_BIT, VMA_DONTCOPY_BIT,
+ VMA_DONTEXPAND_BIT, VMA_DONTDUMP_BIT);
+ desc->vm_ops = &privcmd_vm_ops;
return 0;
}
@@ -1681,7 +1680,7 @@ const struct file_operations xen_privcmd_fops = {
.unlocked_ioctl = privcmd_ioctl,
.open = privcmd_open,
.release = privcmd_release,
- .mmap = privcmd_mmap,
+ .mmap_prepare = privcmd_mmap_prepare,
};
EXPORT_SYMBOL_GPL(xen_privcmd_fops);
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* Re: [PATCH v2 01/13] xen/privcmd: convert mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 15:13 ` Jürgen Groß via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Jürgen Groß @ 2026-11-24 15:13 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM), Andrew Morton, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
[-- Attachment #1.1: Type: text/plain, Size: 378 bytes --]
On 24.11.26 15:02, Lorenzo Stoakes (ARM) wrote:
> Move from the deprecated mmap hook to the new mmap_prepare hook.
>
> The hook only sets VMA flags and operations. The VMA private data is
> already NULL at this point, so we no longer explicitly clear it.
>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 01/13] xen/privcmd: convert mmap hook to mmap_prepare
@ 2026-11-24 15:13 ` Jürgen Groß via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Jürgen Groß via OP-TEE @ 2026-11-24 15:13 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM), Andrew Morton, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
[-- Attachment #1.1: Type: text/plain, Size: 378 bytes --]
On 24.11.26 15:02, Lorenzo Stoakes (ARM) wrote:
> Move from the deprecated mmap hook to the new mmap_prepare hook.
>
> The hook only sets VMA flags and operations. The VMA private data is
> already NULL at this point, so we no longer explicitly clear it.
>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 58+ messages in thread
* + xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
(?)
@ 2026-11-24 19:08 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:08 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7587 bytes --]
The patch titled
Subject: xen/privcmd: convert mmap hook to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: xen/privcmd: convert mmap hook to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:44 +0000
Patch series "mm: convert further simple mmap hooks to mmap_prepare", v2.
Continue the conversion of users of the deprecated f_op->mmap callback to
f_op->mmap_prepare. Keep things gentle this cycle by targeting simple
cases.
No functional change intended.
This patch (of 13):
Move from the deprecated mmap hook to the new mmap_prepare hook.
The hook only sets VMA flags and operations. The VMA private data is
already NULL at this point, so we no longer explicitly clear it.
Link: https://lore.kernel.org/20261124-late-2026-mmap_prepare-v2-0-0b0d99d655f9@kernel.org
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-1-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
drivers/xen/privcmd.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
--- a/drivers/xen/privcmd.c~xen-privcmd-convert-mmap-hook-to-mmap_prepare
+++ a/drivers/xen/privcmd.c
@@ -1645,14 +1645,13 @@ static const struct vm_operations_struct
.fault = privcmd_fault
};
-static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
+static int privcmd_mmap_prepare(struct vm_area_desc *desc)
{
/* DONTCOPY is essential for Xen because copy_page_range doesn't know
* how to recreate these mappings */
- vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTCOPY |
- VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &privcmd_vm_ops;
- vma->vm_private_data = NULL;
+ vma_desc_set_flags(desc, VMA_IO_BIT, VMA_PFNMAP_BIT, VMA_DONTCOPY_BIT,
+ VMA_DONTEXPAND_BIT, VMA_DONTDUMP_BIT);
+ desc->vm_ops = &privcmd_vm_ops;
return 0;
}
@@ -1681,7 +1680,7 @@ const struct file_operations xen_privcmd
.unlocked_ioctl = privcmd_ioctl,
.open = privcmd_open,
.release = privcmd_release,
- .mmap = privcmd_mmap,
+ .mmap_prepare = privcmd_mmap_prepare,
};
EXPORT_SYMBOL_GPL(xen_privcmd_fops);
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 02/13] KVM: PPC: Book3S: convert spapr TCE mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only sets the VMA operations.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
arch/powerpc/kvm/book3s_64_vio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index c5f3f5b29d89..05f6f2c9a432 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -247,9 +247,9 @@ static const struct vm_operations_struct kvm_spapr_tce_vm_ops = {
.fault = kvm_spapr_tce_fault,
};
-static int kvm_spapr_tce_mmap(struct file *file, struct vm_area_struct *vma)
+static int kvm_spapr_tce_mmap_prepare(struct vm_area_desc *desc)
{
- vma->vm_ops = &kvm_spapr_tce_vm_ops;
+ desc->vm_ops = &kvm_spapr_tce_vm_ops;
return 0;
}
@@ -282,7 +282,7 @@ static int kvm_spapr_tce_release(struct inode *inode, struct file *filp)
}
static const struct file_operations kvm_spapr_tce_fops = {
- .mmap = kvm_spapr_tce_mmap,
+ .mmap_prepare = kvm_spapr_tce_mmap_prepare,
.release = kvm_spapr_tce_release,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 02/13] KVM: PPC: Book3S: convert spapr TCE mmap hook to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only sets the VMA operations.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
arch/powerpc/kvm/book3s_64_vio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index c5f3f5b29d89..05f6f2c9a432 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -247,9 +247,9 @@ static const struct vm_operations_struct kvm_spapr_tce_vm_ops = {
.fault = kvm_spapr_tce_fault,
};
-static int kvm_spapr_tce_mmap(struct file *file, struct vm_area_struct *vma)
+static int kvm_spapr_tce_mmap_prepare(struct vm_area_desc *desc)
{
- vma->vm_ops = &kvm_spapr_tce_vm_ops;
+ desc->vm_ops = &kvm_spapr_tce_vm_ops;
return 0;
}
@@ -282,7 +282,7 @@ static int kvm_spapr_tce_release(struct inode *inode, struct file *filp)
}
static const struct file_operations kvm_spapr_tce_fops = {
- .mmap = kvm_spapr_tce_mmap,
+ .mmap_prepare = kvm_spapr_tce_mmap_prepare,
.release = kvm_spapr_tce_release,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* + kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 19:08 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:08 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 6880 bytes --]
The patch titled
Subject: KVM: PPC: Book3S: convert spapr TCE mmap hook to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: KVM: PPC: Book3S: convert spapr TCE mmap hook to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:45 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only sets the VMA operations.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-2-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
arch/powerpc/kvm/book3s_64_vio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/arch/powerpc/kvm/book3s_64_vio.c~kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare
+++ a/arch/powerpc/kvm/book3s_64_vio.c
@@ -247,9 +247,9 @@ static const struct vm_operations_struct
.fault = kvm_spapr_tce_fault,
};
-static int kvm_spapr_tce_mmap(struct file *file, struct vm_area_struct *vma)
+static int kvm_spapr_tce_mmap_prepare(struct vm_area_desc *desc)
{
- vma->vm_ops = &kvm_spapr_tce_vm_ops;
+ desc->vm_ops = &kvm_spapr_tce_vm_ops;
return 0;
}
@@ -282,7 +282,7 @@ static int kvm_spapr_tce_release(struct
}
static const struct file_operations kvm_spapr_tce_fops = {
- .mmap = kvm_spapr_tce_mmap,
+ .mmap_prepare = kvm_spapr_tce_mmap_prepare,
.release = kvm_spapr_tce_release,
};
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 03/13] mshv_vtl: convert mmap hooks to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm,
Kameron Carr, Michael Kelley
Move from the deprecated mmap hook to the new mmap_prepare hook for both
the mshv_vtl and mshv_vtl_low devices. These only set VMA operations and
flags.
Tested-by: Kameron Carr <kameroncarr@linux.microsoft.com>
Reviewed-by: Kameron Carr <kameroncarr@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/hv/mshv_vtl_main.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/hv/mshv_vtl_main.c b/drivers/hv/mshv_vtl_main.c
index 2d4fe24cecbf..9bfe808f71ed 100644
--- a/drivers/hv/mshv_vtl_main.c
+++ b/drivers/hv/mshv_vtl_main.c
@@ -873,9 +873,9 @@ static const struct vm_operations_struct mshv_vtl_vm_ops = {
.fault = mshv_vtl_fault,
};
-static int mshv_vtl_mmap(struct file *filp, struct vm_area_struct *vma)
+static int mshv_vtl_mmap_prepare(struct vm_area_desc *desc)
{
- vma->vm_ops = &mshv_vtl_vm_ops;
+ desc->vm_ops = &mshv_vtl_vm_ops;
return 0;
}
@@ -893,7 +893,7 @@ static const struct file_operations mshv_vtl_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = mshv_vtl_ioctl,
.release = mshv_vtl_release,
- .mmap = mshv_vtl_mmap,
+ .mmap_prepare = mshv_vtl_mmap_prepare,
};
static void mshv_vtl_synic_mask_vmbus_sint(void *info)
@@ -1324,10 +1324,10 @@ static const struct vm_operations_struct mshv_vtl_low_vm_ops = {
.huge_fault = mshv_vtl_low_huge_fault,
};
-static int mshv_vtl_low_mmap(struct file *filp, struct vm_area_struct *vma)
+static int mshv_vtl_low_mmap_prepare(struct vm_area_desc *desc)
{
- vma->vm_ops = &mshv_vtl_low_vm_ops;
- vm_flags_set(vma, VM_HUGEPAGE | VM_MIXEDMAP);
+ desc->vm_ops = &mshv_vtl_low_vm_ops;
+ vma_desc_set_flags(desc, VMA_HUGEPAGE_BIT, VMA_MIXEDMAP_BIT);
return 0;
}
@@ -1335,7 +1335,7 @@ static int mshv_vtl_low_mmap(struct file *filp, struct vm_area_struct *vma)
static const struct file_operations mshv_vtl_low_file_ops = {
.owner = THIS_MODULE,
.open = mshv_vtl_low_open,
- .mmap = mshv_vtl_low_mmap,
+ .mmap_prepare = mshv_vtl_low_mmap_prepare,
};
static struct miscdevice mshv_vtl_low = {
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 03/13] mshv_vtl: convert mmap hooks to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm,
Kameron Carr, Michael Kelley
Move from the deprecated mmap hook to the new mmap_prepare hook for both
the mshv_vtl and mshv_vtl_low devices. These only set VMA operations and
flags.
Tested-by: Kameron Carr <kameroncarr@linux.microsoft.com>
Reviewed-by: Kameron Carr <kameroncarr@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/hv/mshv_vtl_main.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/hv/mshv_vtl_main.c b/drivers/hv/mshv_vtl_main.c
index 2d4fe24cecbf..9bfe808f71ed 100644
--- a/drivers/hv/mshv_vtl_main.c
+++ b/drivers/hv/mshv_vtl_main.c
@@ -873,9 +873,9 @@ static const struct vm_operations_struct mshv_vtl_vm_ops = {
.fault = mshv_vtl_fault,
};
-static int mshv_vtl_mmap(struct file *filp, struct vm_area_struct *vma)
+static int mshv_vtl_mmap_prepare(struct vm_area_desc *desc)
{
- vma->vm_ops = &mshv_vtl_vm_ops;
+ desc->vm_ops = &mshv_vtl_vm_ops;
return 0;
}
@@ -893,7 +893,7 @@ static const struct file_operations mshv_vtl_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = mshv_vtl_ioctl,
.release = mshv_vtl_release,
- .mmap = mshv_vtl_mmap,
+ .mmap_prepare = mshv_vtl_mmap_prepare,
};
static void mshv_vtl_synic_mask_vmbus_sint(void *info)
@@ -1324,10 +1324,10 @@ static const struct vm_operations_struct mshv_vtl_low_vm_ops = {
.huge_fault = mshv_vtl_low_huge_fault,
};
-static int mshv_vtl_low_mmap(struct file *filp, struct vm_area_struct *vma)
+static int mshv_vtl_low_mmap_prepare(struct vm_area_desc *desc)
{
- vma->vm_ops = &mshv_vtl_low_vm_ops;
- vm_flags_set(vma, VM_HUGEPAGE | VM_MIXEDMAP);
+ desc->vm_ops = &mshv_vtl_low_vm_ops;
+ vma_desc_set_flags(desc, VMA_HUGEPAGE_BIT, VMA_MIXEDMAP_BIT);
return 0;
}
@@ -1335,7 +1335,7 @@ static int mshv_vtl_low_mmap(struct file *filp, struct vm_area_struct *vma)
static const struct file_operations mshv_vtl_low_file_ops = {
.owner = THIS_MODULE,
.open = mshv_vtl_low_open,
- .mmap = mshv_vtl_low_mmap,
+ .mmap_prepare = mshv_vtl_low_mmap_prepare,
};
static struct miscdevice mshv_vtl_low = {
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* + mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 19:08 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:08 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7686 bytes --]
The patch titled
Subject: mshv_vtl: convert mmap hooks to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: mshv_vtl: convert mmap hooks to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:46 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook for both
the mshv_vtl and mshv_vtl_low devices. These only set VMA operations and
flags.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-3-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Tested-by: Kameron Carr <kameroncarr@linux.microsoft.com>
Reviewed-by: Kameron Carr <kameroncarr@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
drivers/hv/mshv_vtl_main.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- a/drivers/hv/mshv_vtl_main.c~mshv_vtl-convert-mmap-hooks-to-mmap_prepare
+++ a/drivers/hv/mshv_vtl_main.c
@@ -873,9 +873,9 @@ static const struct vm_operations_struct
.fault = mshv_vtl_fault,
};
-static int mshv_vtl_mmap(struct file *filp, struct vm_area_struct *vma)
+static int mshv_vtl_mmap_prepare(struct vm_area_desc *desc)
{
- vma->vm_ops = &mshv_vtl_vm_ops;
+ desc->vm_ops = &mshv_vtl_vm_ops;
return 0;
}
@@ -893,7 +893,7 @@ static const struct file_operations mshv
.owner = THIS_MODULE,
.unlocked_ioctl = mshv_vtl_ioctl,
.release = mshv_vtl_release,
- .mmap = mshv_vtl_mmap,
+ .mmap_prepare = mshv_vtl_mmap_prepare,
};
static void mshv_vtl_synic_mask_vmbus_sint(void *info)
@@ -1324,10 +1324,10 @@ static const struct vm_operations_struct
.huge_fault = mshv_vtl_low_huge_fault,
};
-static int mshv_vtl_low_mmap(struct file *filp, struct vm_area_struct *vma)
+static int mshv_vtl_low_mmap_prepare(struct vm_area_desc *desc)
{
- vma->vm_ops = &mshv_vtl_low_vm_ops;
- vm_flags_set(vma, VM_HUGEPAGE | VM_MIXEDMAP);
+ desc->vm_ops = &mshv_vtl_low_vm_ops;
+ vma_desc_set_flags(desc, VMA_HUGEPAGE_BIT, VMA_MIXEDMAP_BIT);
return 0;
}
@@ -1335,7 +1335,7 @@ static int mshv_vtl_low_mmap(struct file
static const struct file_operations mshv_vtl_low_file_ops = {
.owner = THIS_MODULE,
.open = mshv_vtl_low_open,
- .mmap = mshv_vtl_low_mmap,
+ .mmap_prepare = mshv_vtl_low_mmap_prepare,
};
static struct miscdevice mshv_vtl_low = {
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 04/13] x86/sgx: convert vepc mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only checks that the mapping is shared and sets VMA flags, operations and
private data.
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
arch/x86/kernel/cpu/sgx/virt.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/cpu/sgx/virt.c b/arch/x86/kernel/cpu/sgx/virt.c
index 6a1933ddc6fc..850990519ca5 100644
--- a/arch/x86/kernel/cpu/sgx/virt.c
+++ b/arch/x86/kernel/cpu/sgx/virt.c
@@ -98,17 +98,18 @@ static const struct vm_operations_struct sgx_vepc_vm_ops = {
.fault = sgx_vepc_fault,
};
-static int sgx_vepc_mmap(struct file *file, struct vm_area_struct *vma)
+static int sgx_vepc_mmap_prepare(struct vm_area_desc *desc)
{
- struct sgx_vepc *vepc = file->private_data;
+ struct sgx_vepc *vepc = desc->file->private_data;
- if (!(vma->vm_flags & VM_SHARED))
+ if (!vma_desc_test(desc, VMA_SHARED_BIT))
return -EINVAL;
- vma->vm_ops = &sgx_vepc_vm_ops;
+ desc->vm_ops = &sgx_vepc_vm_ops;
/* Don't copy VMA in fork() */
- vm_flags_set(vma, VM_PFNMAP | VM_IO | VM_DONTDUMP | VM_DONTCOPY);
- vma->vm_private_data = vepc;
+ vma_desc_set_flags(desc, VMA_PFNMAP_BIT, VMA_IO_BIT, VMA_DONTDUMP_BIT,
+ VMA_DONTCOPY_BIT);
+ desc->private_data = vepc;
return 0;
}
@@ -315,7 +316,7 @@ static const struct file_operations sgx_vepc_fops = {
.unlocked_ioctl = sgx_vepc_ioctl,
.compat_ioctl = sgx_vepc_ioctl,
.release = sgx_vepc_release,
- .mmap = sgx_vepc_mmap,
+ .mmap_prepare = sgx_vepc_mmap_prepare,
};
static struct miscdevice sgx_vepc_dev = {
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 04/13] x86/sgx: convert vepc mmap hook to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only checks that the mapping is shared and sets VMA flags, operations and
private data.
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
arch/x86/kernel/cpu/sgx/virt.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/cpu/sgx/virt.c b/arch/x86/kernel/cpu/sgx/virt.c
index 6a1933ddc6fc..850990519ca5 100644
--- a/arch/x86/kernel/cpu/sgx/virt.c
+++ b/arch/x86/kernel/cpu/sgx/virt.c
@@ -98,17 +98,18 @@ static const struct vm_operations_struct sgx_vepc_vm_ops = {
.fault = sgx_vepc_fault,
};
-static int sgx_vepc_mmap(struct file *file, struct vm_area_struct *vma)
+static int sgx_vepc_mmap_prepare(struct vm_area_desc *desc)
{
- struct sgx_vepc *vepc = file->private_data;
+ struct sgx_vepc *vepc = desc->file->private_data;
- if (!(vma->vm_flags & VM_SHARED))
+ if (!vma_desc_test(desc, VMA_SHARED_BIT))
return -EINVAL;
- vma->vm_ops = &sgx_vepc_vm_ops;
+ desc->vm_ops = &sgx_vepc_vm_ops;
/* Don't copy VMA in fork() */
- vm_flags_set(vma, VM_PFNMAP | VM_IO | VM_DONTDUMP | VM_DONTCOPY);
- vma->vm_private_data = vepc;
+ vma_desc_set_flags(desc, VMA_PFNMAP_BIT, VMA_IO_BIT, VMA_DONTDUMP_BIT,
+ VMA_DONTCOPY_BIT);
+ desc->private_data = vepc;
return 0;
}
@@ -315,7 +316,7 @@ static const struct file_operations sgx_vepc_fops = {
.unlocked_ioctl = sgx_vepc_ioctl,
.compat_ioctl = sgx_vepc_ioctl,
.release = sgx_vepc_release,
- .mmap = sgx_vepc_mmap,
+ .mmap_prepare = sgx_vepc_mmap_prepare,
};
static struct miscdevice sgx_vepc_dev = {
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* Re: [PATCH v2 04/13] x86/sgx: convert vepc mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 15:05 ` Dave Hansen
-1 siblings, 0 replies; 58+ messages in thread
From: Dave Hansen @ 2026-11-24 15:05 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM), Andrew Morton, Juergen Gross,
Stefano Stabellini, Oleksandr Tyshchenko, Madhavan Srinivasan,
Nicholas Piggin, Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
On 11/24/26 06:02, Lorenzo Stoakes (ARM) wrote:
> Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
> only checks that the mapping is shared and sets VMA flags, operations and
> private data.
>
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com> # x86 bits
^ permalink raw reply [flat|nested] 58+ messages in thread
* + x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
(?)
@ 2026-11-24 19:08 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:08 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, dave.hansen, chleroy,
bp, billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7404 bytes --]
The patch titled
Subject: x86/sgx: convert vepc mmap hook to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: x86/sgx: convert vepc mmap hook to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:47 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only checks that the mapping is shared and sets VMA flags, operations and
private data.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-4-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com> # x86 bits
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Dave Hansen <dave.hansen@intel.com>
arch/x86/kernel/cpu/sgx/virt.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
--- a/arch/x86/kernel/cpu/sgx/virt.c~x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare
+++ a/arch/x86/kernel/cpu/sgx/virt.c
@@ -98,17 +98,18 @@ static const struct vm_operations_struct
.fault = sgx_vepc_fault,
};
-static int sgx_vepc_mmap(struct file *file, struct vm_area_struct *vma)
+static int sgx_vepc_mmap_prepare(struct vm_area_desc *desc)
{
- struct sgx_vepc *vepc = file->private_data;
+ struct sgx_vepc *vepc = desc->file->private_data;
- if (!(vma->vm_flags & VM_SHARED))
+ if (!vma_desc_test(desc, VMA_SHARED_BIT))
return -EINVAL;
- vma->vm_ops = &sgx_vepc_vm_ops;
+ desc->vm_ops = &sgx_vepc_vm_ops;
/* Don't copy VMA in fork() */
- vm_flags_set(vma, VM_PFNMAP | VM_IO | VM_DONTDUMP | VM_DONTCOPY);
- vma->vm_private_data = vepc;
+ vma_desc_set_flags(desc, VMA_PFNMAP_BIT, VMA_IO_BIT, VMA_DONTDUMP_BIT,
+ VMA_DONTCOPY_BIT);
+ desc->private_data = vepc;
return 0;
}
@@ -315,7 +316,7 @@ static const struct file_operations sgx_
.unlocked_ioctl = sgx_vepc_ioctl,
.compat_ioctl = sgx_vepc_ioctl,
.release = sgx_vepc_release,
- .mmap = sgx_vepc_mmap,
+ .mmap_prepare = sgx_vepc_mmap_prepare,
};
static struct miscdevice sgx_vepc_dev = {
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 05/13] udf: convert mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm, Jan Kara
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only updates the access time and sets the VMA operations.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
fs/udf/file.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 02e9314818dc..d5e80c6cae96 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -190,10 +190,10 @@ static int udf_release_file(struct inode *inode, struct file *filp)
return 0;
}
-static int udf_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int udf_file_mmap_prepare(struct vm_area_desc *desc)
{
- file_accessed(file);
- vma->vm_ops = &udf_file_vm_ops;
+ file_accessed(desc->file);
+ desc->vm_ops = &udf_file_vm_ops;
return 0;
}
@@ -202,7 +202,7 @@ const struct file_operations udf_file_operations = {
.read_iter = generic_file_read_iter,
.unlocked_ioctl = udf_ioctl,
.open = generic_file_open,
- .mmap = udf_file_mmap,
+ .mmap_prepare = udf_file_mmap_prepare,
.write_iter = udf_file_write_iter,
.release = udf_release_file,
.fsync = simple_fsync,
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 05/13] udf: convert mmap hook to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm, Jan Kara
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only updates the access time and sets the VMA operations.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
fs/udf/file.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 02e9314818dc..d5e80c6cae96 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -190,10 +190,10 @@ static int udf_release_file(struct inode *inode, struct file *filp)
return 0;
}
-static int udf_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int udf_file_mmap_prepare(struct vm_area_desc *desc)
{
- file_accessed(file);
- vma->vm_ops = &udf_file_vm_ops;
+ file_accessed(desc->file);
+ desc->vm_ops = &udf_file_vm_ops;
return 0;
}
@@ -202,7 +202,7 @@ const struct file_operations udf_file_operations = {
.read_iter = generic_file_read_iter,
.unlocked_ioctl = udf_ioctl,
.open = generic_file_open,
- .mmap = udf_file_mmap,
+ .mmap_prepare = udf_file_mmap_prepare,
.write_iter = udf_file_write_iter,
.release = udf_release_file,
.fsync = simple_fsync,
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* + udf-convert-mmap-hook-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 19:08 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:08 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, jack, hpa, haiyangz, gregkh,
eperezma, edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 6872 bytes --]
The patch titled
Subject: udf: convert mmap hook to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
udf-convert-mmap-hook-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/udf-convert-mmap-hook-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: udf: convert mmap hook to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:48 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only updates the access time and sets the VMA operations.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-5-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Kara <jack@suse.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
fs/udf/file.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/fs/udf/file.c~udf-convert-mmap-hook-to-mmap_prepare
+++ a/fs/udf/file.c
@@ -190,10 +190,10 @@ static int udf_release_file(struct inode
return 0;
}
-static int udf_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int udf_file_mmap_prepare(struct vm_area_desc *desc)
{
- file_accessed(file);
- vma->vm_ops = &udf_file_vm_ops;
+ file_accessed(desc->file);
+ desc->vm_ops = &udf_file_vm_ops;
return 0;
}
@@ -202,7 +202,7 @@ const struct file_operations udf_file_op
.read_iter = generic_file_read_iter,
.unlocked_ioctl = udf_ioctl,
.open = generic_file_open,
- .mmap = udf_file_mmap,
+ .mmap_prepare = udf_file_mmap_prepare,
.write_iter = udf_file_write_iter,
.release = udf_release_file,
.fsync = simple_fsync,
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook for the
policy and status files.
The policy file only sets VMA flags and operations. The status file remaps
a single page, so use the PFN remap mmap action to do so.
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
security/selinux/selinuxfs.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 310e19efff1d..e78c65685020 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -236,27 +236,25 @@ static ssize_t sel_read_handle_status(struct file *filp, char __user *buf,
sizeof(struct selinux_kernel_status));
}
-static int sel_mmap_handle_status(struct file *filp,
- struct vm_area_struct *vma)
+static int sel_mmap_prepare_handle_status(struct vm_area_desc *desc)
{
- struct page *status = filp->private_data;
- unsigned long size = vma->vm_end - vma->vm_start;
+ struct page *status = desc->file->private_data;
BUG_ON(!status);
/* only allows one page from the head */
- if (vma->vm_pgoff > 0 || size != PAGE_SIZE)
+ if (desc->pgoff > 0 || vma_desc_size(desc) != PAGE_SIZE)
return -EIO;
- return remap_pfn_range(vma, vma->vm_start,
- page_to_pfn(status),
- size, vma->vm_page_prot);
+ mmap_action_remap_full(desc, page_to_pfn(status));
+
+ return 0;
}
static const struct file_operations sel_handle_status_ops = {
.open = sel_open_handle_status,
.read = sel_read_handle_status,
- .mmap = sel_mmap_handle_status,
+ .mmap_prepare = sel_mmap_prepare_handle_status,
.llseek = generic_file_llseek,
};
@@ -419,10 +417,10 @@ static const struct vm_operations_struct sel_mmap_policy_ops = {
.page_mkwrite = sel_mmap_policy_fault,
};
-static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma)
+static int sel_mmap_prepare_policy(struct vm_area_desc *desc)
{
- vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &sel_mmap_policy_ops;
+ vma_desc_set_flags(desc, VMA_DONTEXPAND_BIT, VMA_DONTDUMP_BIT);
+ desc->vm_ops = &sel_mmap_policy_ops;
return 0;
}
@@ -430,7 +428,7 @@ static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma)
static const struct file_operations sel_policy_ops = {
.open = sel_open_policy,
.read = sel_read_policy,
- .mmap = sel_mmap_policy,
+ .mmap_prepare = sel_mmap_prepare_policy,
.release = sel_release_policy,
.llseek = generic_file_llseek,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook for the
policy and status files.
The policy file only sets VMA flags and operations. The status file remaps
a single page, so use the PFN remap mmap action to do so.
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
security/selinux/selinuxfs.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 310e19efff1d..e78c65685020 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -236,27 +236,25 @@ static ssize_t sel_read_handle_status(struct file *filp, char __user *buf,
sizeof(struct selinux_kernel_status));
}
-static int sel_mmap_handle_status(struct file *filp,
- struct vm_area_struct *vma)
+static int sel_mmap_prepare_handle_status(struct vm_area_desc *desc)
{
- struct page *status = filp->private_data;
- unsigned long size = vma->vm_end - vma->vm_start;
+ struct page *status = desc->file->private_data;
BUG_ON(!status);
/* only allows one page from the head */
- if (vma->vm_pgoff > 0 || size != PAGE_SIZE)
+ if (desc->pgoff > 0 || vma_desc_size(desc) != PAGE_SIZE)
return -EIO;
- return remap_pfn_range(vma, vma->vm_start,
- page_to_pfn(status),
- size, vma->vm_page_prot);
+ mmap_action_remap_full(desc, page_to_pfn(status));
+
+ return 0;
}
static const struct file_operations sel_handle_status_ops = {
.open = sel_open_handle_status,
.read = sel_read_handle_status,
- .mmap = sel_mmap_handle_status,
+ .mmap_prepare = sel_mmap_prepare_handle_status,
.llseek = generic_file_llseek,
};
@@ -419,10 +417,10 @@ static const struct vm_operations_struct sel_mmap_policy_ops = {
.page_mkwrite = sel_mmap_policy_fault,
};
-static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma)
+static int sel_mmap_prepare_policy(struct vm_area_desc *desc)
{
- vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &sel_mmap_policy_ops;
+ vma_desc_set_flags(desc, VMA_DONTEXPAND_BIT, VMA_DONTDUMP_BIT);
+ desc->vm_ops = &sel_mmap_policy_ops;
return 0;
}
@@ -430,7 +428,7 @@ static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma)
static const struct file_operations sel_policy_ops = {
.open = sel_open_policy,
.read = sel_read_policy,
- .mmap = sel_mmap_policy,
+ .mmap_prepare = sel_mmap_prepare_policy,
.release = sel_release_policy,
.llseek = generic_file_llseek,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* + selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 19:09 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:09 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 8194 bytes --]
The patch titled
Subject: selinuxfs: convert mmap hooks to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: selinuxfs: convert mmap hooks to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:49 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook for the
policy and status files.
The policy file only sets VMA flags and operations. The status file remaps
a single page, so use the PFN remap mmap action to do so.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-6-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
security/selinux/selinuxfs.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
--- a/security/selinux/selinuxfs.c~selinuxfs-convert-mmap-hooks-to-mmap_prepare
+++ a/security/selinux/selinuxfs.c
@@ -236,27 +236,25 @@ static ssize_t sel_read_handle_status(st
sizeof(struct selinux_kernel_status));
}
-static int sel_mmap_handle_status(struct file *filp,
- struct vm_area_struct *vma)
+static int sel_mmap_prepare_handle_status(struct vm_area_desc *desc)
{
- struct page *status = filp->private_data;
- unsigned long size = vma->vm_end - vma->vm_start;
+ struct page *status = desc->file->private_data;
BUG_ON(!status);
/* only allows one page from the head */
- if (vma->vm_pgoff > 0 || size != PAGE_SIZE)
+ if (desc->pgoff > 0 || vma_desc_size(desc) != PAGE_SIZE)
return -EIO;
- return remap_pfn_range(vma, vma->vm_start,
- page_to_pfn(status),
- size, vma->vm_page_prot);
+ mmap_action_remap_full(desc, page_to_pfn(status));
+
+ return 0;
}
static const struct file_operations sel_handle_status_ops = {
.open = sel_open_handle_status,
.read = sel_read_handle_status,
- .mmap = sel_mmap_handle_status,
+ .mmap_prepare = sel_mmap_prepare_handle_status,
.llseek = generic_file_llseek,
};
@@ -419,10 +417,10 @@ static const struct vm_operations_struct
.page_mkwrite = sel_mmap_policy_fault,
};
-static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma)
+static int sel_mmap_prepare_policy(struct vm_area_desc *desc)
{
- vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &sel_mmap_policy_ops;
+ vma_desc_set_flags(desc, VMA_DONTEXPAND_BIT, VMA_DONTDUMP_BIT);
+ desc->vm_ops = &sel_mmap_policy_ops;
return 0;
}
@@ -430,7 +428,7 @@ static int sel_mmap_policy(struct file *
static const struct file_operations sel_policy_ops = {
.open = sel_open_policy,
.read = sel_read_policy,
- .mmap = sel_mmap_policy,
+ .mmap_prepare = sel_mmap_prepare_policy,
.release = sel_release_policy,
.llseek = generic_file_llseek,
};
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread* Re: [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
(?)
@ 2026-12-02 3:53 ` Paul Moore
2026-12-02 11:45 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 1 reply; 58+ messages in thread
From: Paul Moore @ 2026-12-02 3:53 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM)
Cc: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Stephen Smalley, Ondrej Mosnáček, Joel Stanley,
Andrew Jeffery, Ryan Chen, Billy Tsai, Bjorn Andersson,
Konrad Dybcio, Abel Vesa, Jens Wiklander, Sumit Garg,
Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, xen-devel, linux-kernel,
linuxppc-dev, kvm, linux-hyperv, virtualization, linux-sgx,
selinux, linux-arm-kernel, linux-aspeed, linux-arm-msm, op-tee,
netdev, linux-mm
On Tue, Nov 24, 2026 at 9:04 AM Lorenzo Stoakes (ARM) <ljs@kernel.org> wrote:
>
> Move from the deprecated mmap hook to the new mmap_prepare hook for the
> policy and status files.
>
> The policy file only sets VMA flags and operations. The status file remaps
> a single page, so use the PFN remap mmap action to do so.
>
> Acked-by: Paul Moore <paul@paul-moore.com>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
> security/selinux/selinuxfs.c | 24 +++++++++++-------------
> 1 file changed, 11 insertions(+), 13 deletions(-)
Similar to the vma_flags_t patch, I didn't see this get picked up so I
just merged it into the selinux/dev branch. If you are merging this
via another route let me know so I can drop it.
--
paul-moore.com
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
2026-12-02 3:53 ` [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare Paul Moore
@ 2026-12-02 11:45 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-12-02 11:45 UTC (permalink / raw)
To: Paul Moore
Cc: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Stephen Smalley, Ondrej Mosnáček, Joel Stanley,
Andrew Jeffery, Ryan Chen, Billy Tsai, Bjorn Andersson,
Konrad Dybcio, Abel Vesa, Jens Wiklander, Sumit Garg,
Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, xen-devel, linux-kernel,
linuxppc-dev, kvm, linux-hyperv, virtualization, linux-sgx,
selinux, linux-arm-kernel, linux-aspeed, linux-arm-msm, op-tee,
netdev, linux-mm
On Tue, Dec 01, 2026 at 10:53:18PM -0500, Paul Moore wrote:
> On Tue, Nov 24, 2026 at 9:04 AM Lorenzo Stoakes (ARM) <ljs@kernel.org> wrote:
> >
> > Move from the deprecated mmap hook to the new mmap_prepare hook for the
> > policy and status files.
> >
> > The policy file only sets VMA flags and operations. The status file remaps
> > a single page, so use the PFN remap mmap action to do so.
> >
> > Acked-by: Paul Moore <paul@paul-moore.com>
> > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> > ---
> > security/selinux/selinuxfs.c | 24 +++++++++++-------------
> > 1 file changed, 11 insertions(+), 13 deletions(-)
>
> Similar to the vma_flags_t patch, I didn't see this get picked up so I
> just merged it into the selinux/dev branch. If you are merging this
> via another route let me know so I can drop it.
Andrew's taken it, but I guess similar to vma_flags_t stuff he can drop it so
you can keep this in your tree?
Andrew?
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
@ 2026-12-02 11:45 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-12-02 11:45 UTC (permalink / raw)
To: Paul Moore
Cc: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara
On Tue, Dec 01, 2026 at 10:53:18PM -0500, Paul Moore wrote:
> On Tue, Nov 24, 2026 at 9:04 AM Lorenzo Stoakes (ARM) <ljs@kernel.org> wrote:
> >
> > Move from the deprecated mmap hook to the new mmap_prepare hook for the
> > policy and status files.
> >
> > The policy file only sets VMA flags and operations. The status file remaps
> > a single page, so use the PFN remap mmap action to do so.
> >
> > Acked-by: Paul Moore <paul@paul-moore.com>
> > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> > ---
> > security/selinux/selinuxfs.c | 24 +++++++++++-------------
> > 1 file changed, 11 insertions(+), 13 deletions(-)
>
> Similar to the vma_flags_t patch, I didn't see this get picked up so I
> just merged it into the selinux/dev branch. If you are merging this
> via another route let me know so I can drop it.
Andrew's taken it, but I guess similar to vma_flags_t stuff he can drop it so
you can keep this in your tree?
Andrew?
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
2026-12-02 11:45 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-12-02 16:47 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-12-02 16:47 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM)
Cc: Paul Moore, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Stephen Smalley, Ondrej Mosnáček, Joel Stanley,
Andrew Jeffery, Ryan Chen, Billy Tsai, Bjorn Andersson,
Konrad Dybcio, Abel Vesa, Jens Wiklander, Sumit Garg,
Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, xen-devel, linux-kernel,
linuxppc-dev, kvm, linux-hyperv, virtualization, linux-sgx,
selinux, linux-arm-kernel, linux-aspeed, linux-arm-msm, op-tee,
netdev, linux-mm
On Wed, 2 Dec 2026 11:45:40 +0000 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:
> On Tue, Dec 01, 2026 at 10:53:18PM -0500, Paul Moore wrote:
> > On Tue, Nov 24, 2026 at 9:04 AM Lorenzo Stoakes (ARM) <ljs@kernel.org> wrote:
> > >
> > > Move from the deprecated mmap hook to the new mmap_prepare hook for the
> > > policy and status files.
> > >
> > > The policy file only sets VMA flags and operations. The status file remaps
> > > a single page, so use the PFN remap mmap action to do so.
> > >
> > > Acked-by: Paul Moore <paul@paul-moore.com>
> > > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> > > ---
> > > security/selinux/selinuxfs.c | 24 +++++++++++-------------
> > > 1 file changed, 11 insertions(+), 13 deletions(-)
> >
> > Similar to the vma_flags_t patch, I didn't see this get picked up so I
> > just merged it into the selinux/dev branch. If you are merging this
> > via another route let me know so I can drop it.
>
> Andrew's taken it, but I guess similar to vma_flags_t stuff he can drop it so
> you can keep this in your tree?
>
> Andrew?
Yep, I've dropped "selinux: convert VMA flag tests to use vma_flags_t"
and "selinuxfs: convert mmap hooks to mmap_prepare" "because it was
merged into selinux/dev".
- assumes that the patches weren't dependent on other things in that
series
- assumes that Paul doesn't lose the patch ;) Not a very trusting
soul, sorry.
Traditionally when this happens I hang on to the mm.git copy until broonie
says "duplicate!", just to make sure it's safe. I'll come up with a
less disruptive way of doing this check-it-didnt-get-lost thing.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
@ 2026-12-02 16:47 ` Andrew Morton
0 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-12-02 16:47 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM)
Cc: Paul Moore, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Stephen Smalley, Ondrej Mosnáček, Joel Stanley,
Andrew Jeffery, Ryan Chen, Billy Tsai, Bjorn Andersson,
Konrad Dybcio, Abel Vesa, Jens Wiklander, Sumit Garg,
Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, xen-devel, linux-kernel,
linuxppc-dev, kvm
On Wed, 2 Dec 2026 11:45:40 +0000 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:
> On Tue, Dec 01, 2026 at 10:53:18PM -0500, Paul Moore wrote:
> > On Tue, Nov 24, 2026 at 9:04 AM Lorenzo Stoakes (ARM) <ljs@kernel.org> wrote:
> > >
> > > Move from the deprecated mmap hook to the new mmap_prepare hook for the
> > > policy and status files.
> > >
> > > The policy file only sets VMA flags and operations. The status file remaps
> > > a single page, so use the PFN remap mmap action to do so.
> > >
> > > Acked-by: Paul Moore <paul@paul-moore.com>
> > > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> > > ---
> > > security/selinux/selinuxfs.c | 24 +++++++++++-------------
> > > 1 file changed, 11 insertions(+), 13 deletions(-)
> >
> > Similar to the vma_flags_t patch, I didn't see this get picked up so I
> > just merged it into the selinux/dev branch. If you are merging this
> > via another route let me know so I can drop it.
>
> Andrew's taken it, but I guess similar to vma_flags_t stuff he can drop it so
> you can keep this in your tree?
>
> Andrew?
Yep, I've dropped "selinux: convert VMA flag tests to use vma_flags_t"
and "selinuxfs: convert mmap hooks to mmap_prepare" "because it was
merged into selinux/dev".
- assumes that the patches weren't dependent on other things in that
series
- assumes that Paul doesn't lose the patch ;) Not a very trusting
soul, sorry.
Traditionally when this happens I hang on to the mm.git copy until broonie
says "duplicate!", just to make sure it's safe. I'll come up with a
less disruptive way of doing this check-it-didnt-get-lost thing.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
2026-12-02 16:47 ` Andrew Morton
(?)
@ 2026-12-02 21:04 ` Paul Moore
2026-12-02 21:05 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 1 reply; 58+ messages in thread
From: Paul Moore @ 2026-12-02 21:04 UTC (permalink / raw)
To: Andrew Morton
Cc: Lorenzo Stoakes (ARM), Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Stephen Smalley, Ondrej Mosnáček, Joel Stanley,
Andrew Jeffery, Ryan Chen, Billy Tsai, Bjorn Andersson,
Konrad Dybcio, Abel Vesa, Jens Wiklander, Sumit Garg,
Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, xen-devel, linux-kernel,
linuxppc-dev, kvm, linux-hyperv, virtualization, linux-sgx,
selinux, linux-arm-kernel, linux-aspeed, linux-arm-msm, op-tee,
netdev, linux-mm
On Wed, Dec 2, 2026 at 11:47 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 2 Dec 2026 11:45:40 +0000 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:
> > On Tue, Dec 01, 2026 at 10:53:18PM -0500, Paul Moore wrote:
> > > On Tue, Nov 24, 2026 at 9:04 AM Lorenzo Stoakes (ARM) <ljs@kernel.org> wrote:
> > > >
> > > > Move from the deprecated mmap hook to the new mmap_prepare hook for the
> > > > policy and status files.
> > > >
> > > > The policy file only sets VMA flags and operations. The status file remaps
> > > > a single page, so use the PFN remap mmap action to do so.
> > > >
> > > > Acked-by: Paul Moore <paul@paul-moore.com>
> > > > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> > > > ---
> > > > security/selinux/selinuxfs.c | 24 +++++++++++-------------
> > > > 1 file changed, 11 insertions(+), 13 deletions(-)
> > >
> > > Similar to the vma_flags_t patch, I didn't see this get picked up so I
> > > just merged it into the selinux/dev branch. If you are merging this
> > > via another route let me know so I can drop it.
> >
> > Andrew's taken it, but I guess similar to vma_flags_t stuff he can drop it so
> > you can keep this in your tree?
> >
> > Andrew?
>
> Yep, I've dropped "selinux: convert VMA flag tests to use vma_flags_t"
> and "selinuxfs: convert mmap hooks to mmap_prepare" "because it was
> merged into selinux/dev".
>
> - assumes that the patches weren't dependent on other things in that
> series
>
> - assumes that Paul doesn't lose the patch ;) Not a very trusting
> soul, sorry.
>
> Traditionally when this happens I hang on to the mm.git copy until broonie
> says "duplicate!", just to make sure it's safe. I'll come up with a
> less disruptive way of doing this check-it-didnt-get-lost thing.
I'm sure Andrew sent an email when he merged the patches into his
tree, but I didn't see any comments in the patchwork series saying
they had been picked up so I merged them last night while trying to
make a dent in the review backlog. My apologies for the confusion.
Regardless, both are now in the selinux/dev branch and will be sent up
to Linus during the next merge window. Please note the small tweak to
the selinuxfs/mmap patch's subject line.
7826de2fcd50 selinux: convert selinuxfs mmap hooks to mmap_prepare
cae5ac463902 selinux: convert VMA flag tests to use vma_flags_t
--
paul-moore.com
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
2026-12-02 21:04 ` Paul Moore
@ 2026-12-02 21:05 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-12-02 21:05 UTC (permalink / raw)
To: Paul Moore
Cc: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Stephen Smalley, Ondrej Mosnáček, Joel Stanley,
Andrew Jeffery, Ryan Chen, Billy Tsai, Bjorn Andersson,
Konrad Dybcio, Abel Vesa, Jens Wiklander, Sumit Garg,
Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, xen-devel, linux-kernel,
linuxppc-dev, kvm, linux-hyperv, virtualization, linux-sgx,
selinux, linux-arm-kernel, linux-aspeed, linux-arm-msm, op-tee,
netdev, linux-mm
On Wed, Dec 02, 2026 at 04:04:18PM -0500, Paul Moore wrote:
> On Wed, Dec 2, 2026 at 11:47 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Wed, 2 Dec 2026 11:45:40 +0000 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:
> > > On Tue, Dec 01, 2026 at 10:53:18PM -0500, Paul Moore wrote:
> > > > On Tue, Nov 24, 2026 at 9:04 AM Lorenzo Stoakes (ARM) <ljs@kernel.org> wrote:
> > > > >
> > > > > Move from the deprecated mmap hook to the new mmap_prepare hook for the
> > > > > policy and status files.
> > > > >
> > > > > The policy file only sets VMA flags and operations. The status file remaps
> > > > > a single page, so use the PFN remap mmap action to do so.
> > > > >
> > > > > Acked-by: Paul Moore <paul@paul-moore.com>
> > > > > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> > > > > ---
> > > > > security/selinux/selinuxfs.c | 24 +++++++++++-------------
> > > > > 1 file changed, 11 insertions(+), 13 deletions(-)
> > > >
> > > > Similar to the vma_flags_t patch, I didn't see this get picked up so I
> > > > just merged it into the selinux/dev branch. If you are merging this
> > > > via another route let me know so I can drop it.
> > >
> > > Andrew's taken it, but I guess similar to vma_flags_t stuff he can drop it so
> > > you can keep this in your tree?
> > >
> > > Andrew?
> >
> > Yep, I've dropped "selinux: convert VMA flag tests to use vma_flags_t"
> > and "selinuxfs: convert mmap hooks to mmap_prepare" "because it was
> > merged into selinux/dev".
> >
> > - assumes that the patches weren't dependent on other things in that
> > series
> >
> > - assumes that Paul doesn't lose the patch ;) Not a very trusting
> > soul, sorry.
> >
> > Traditionally when this happens I hang on to the mm.git copy until broonie
> > says "duplicate!", just to make sure it's safe. I'll come up with a
> > less disruptive way of doing this check-it-didnt-get-lost thing.
>
> I'm sure Andrew sent an email when he merged the patches into his
> tree, but I didn't see any comments in the patchwork series saying
> they had been picked up so I merged them last night while trying to
> make a dent in the review backlog. My apologies for the confusion.
>
> Regardless, both are now in the selinux/dev branch and will be sent up
> to Linus during the next merge window. Please note the small tweak to
> the selinuxfs/mmap patch's subject line.
>
> 7826de2fcd50 selinux: convert selinuxfs mmap hooks to mmap_prepare
> cae5ac463902 selinux: convert VMA flag tests to use vma_flags_t
LGTM and thanks very much for taking these :)
>
> --
> paul-moore.com
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 06/13] selinuxfs: convert mmap hooks to mmap_prepare
@ 2026-12-02 21:05 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-12-02 21:05 UTC (permalink / raw)
To: Paul Moore
Cc: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara
On Wed, Dec 02, 2026 at 04:04:18PM -0500, Paul Moore wrote:
> On Wed, Dec 2, 2026 at 11:47 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Wed, 2 Dec 2026 11:45:40 +0000 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:
> > > On Tue, Dec 01, 2026 at 10:53:18PM -0500, Paul Moore wrote:
> > > > On Tue, Nov 24, 2026 at 9:04 AM Lorenzo Stoakes (ARM) <ljs@kernel.org> wrote:
> > > > >
> > > > > Move from the deprecated mmap hook to the new mmap_prepare hook for the
> > > > > policy and status files.
> > > > >
> > > > > The policy file only sets VMA flags and operations. The status file remaps
> > > > > a single page, so use the PFN remap mmap action to do so.
> > > > >
> > > > > Acked-by: Paul Moore <paul@paul-moore.com>
> > > > > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> > > > > ---
> > > > > security/selinux/selinuxfs.c | 24 +++++++++++-------------
> > > > > 1 file changed, 11 insertions(+), 13 deletions(-)
> > > >
> > > > Similar to the vma_flags_t patch, I didn't see this get picked up so I
> > > > just merged it into the selinux/dev branch. If you are merging this
> > > > via another route let me know so I can drop it.
> > >
> > > Andrew's taken it, but I guess similar to vma_flags_t stuff he can drop it so
> > > you can keep this in your tree?
> > >
> > > Andrew?
> >
> > Yep, I've dropped "selinux: convert VMA flag tests to use vma_flags_t"
> > and "selinuxfs: convert mmap hooks to mmap_prepare" "because it was
> > merged into selinux/dev".
> >
> > - assumes that the patches weren't dependent on other things in that
> > series
> >
> > - assumes that Paul doesn't lose the patch ;) Not a very trusting
> > soul, sorry.
> >
> > Traditionally when this happens I hang on to the mm.git copy until broonie
> > says "duplicate!", just to make sure it's safe. I'll come up with a
> > less disruptive way of doing this check-it-didnt-get-lost thing.
>
> I'm sure Andrew sent an email when he merged the patches into his
> tree, but I didn't see any comments in the patchwork series saying
> they had been picked up so I merged them last night while trying to
> make a dent in the review backlog. My apologies for the confusion.
>
> Regardless, both are now in the selinux/dev branch and will be sent up
> to Linus during the next merge window. Please note the small tweak to
> the selinuxfs/mmap patch's subject line.
>
> 7826de2fcd50 selinux: convert selinuxfs mmap hooks to mmap_prepare
> cae5ac463902 selinux: convert VMA flag tests to use vma_flags_t
LGTM and thanks very much for taking these :)
>
> --
> paul-moore.com
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 58+ messages in thread
* [merged selinux/dev] selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch removed from -mm tree
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
` (2 preceding siblings ...)
(?)
@ 2026-12-02 4:08 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-12-02 4:08 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jenswi, jasowangio,
jarkko, jack, hpa, haiyangz, gregkh, eperezma, edumazet, dwmw,
decui, davem, dave.hansen, chleroy, bp, billy_tsai, arnd,
andrew+netdev, andrew, andersson, abel.vesa, ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 6942 bytes --]
The quilt patch titled
Subject: selinuxfs: convert mmap hooks to mmap_prepare
has been removed from the -mm tree. Its filename was
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
This patch was dropped because it was merged into selinux/dev
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: selinuxfs: convert mmap hooks to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:49 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook for the
policy and status files.
The policy file only sets VMA flags and operations. The status file remaps
a single page, so use the PFN remap mmap action to do so.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-6-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Paul Moore <paul@paul-moore.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
security/selinux/selinuxfs.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
--- a/security/selinux/selinuxfs.c~selinuxfs-convert-mmap-hooks-to-mmap_prepare
+++ a/security/selinux/selinuxfs.c
@@ -236,27 +236,25 @@ static ssize_t sel_read_handle_status(st
sizeof(struct selinux_kernel_status));
}
-static int sel_mmap_handle_status(struct file *filp,
- struct vm_area_struct *vma)
+static int sel_mmap_prepare_handle_status(struct vm_area_desc *desc)
{
- struct page *status = filp->private_data;
- unsigned long size = vma->vm_end - vma->vm_start;
+ struct page *status = desc->file->private_data;
BUG_ON(!status);
/* only allows one page from the head */
- if (vma->vm_pgoff > 0 || size != PAGE_SIZE)
+ if (desc->pgoff > 0 || vma_desc_size(desc) != PAGE_SIZE)
return -EIO;
- return remap_pfn_range(vma, vma->vm_start,
- page_to_pfn(status),
- size, vma->vm_page_prot);
+ mmap_action_remap_full(desc, page_to_pfn(status));
+
+ return 0;
}
static const struct file_operations sel_handle_status_ops = {
.open = sel_open_handle_status,
.read = sel_read_handle_status,
- .mmap = sel_mmap_handle_status,
+ .mmap_prepare = sel_mmap_prepare_handle_status,
.llseek = generic_file_llseek,
};
@@ -419,10 +417,10 @@ static const struct vm_operations_struct
.page_mkwrite = sel_mmap_policy_fault,
};
-static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma)
+static int sel_mmap_prepare_policy(struct vm_area_desc *desc)
{
- vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &sel_mmap_policy_ops;
+ vma_desc_set_flags(desc, VMA_DONTEXPAND_BIT, VMA_DONTDUMP_BIT);
+ desc->vm_ops = &sel_mmap_policy_ops;
return 0;
}
@@ -430,7 +428,7 @@ static int sel_mmap_policy(struct file *
static const struct file_operations sel_policy_ops = {
.open = sel_open_policy,
.read = sel_read_policy,
- .mmap = sel_mmap_policy,
+ .mmap_prepare = sel_mmap_prepare_policy,
.release = sel_release_policy,
.llseek = generic_file_llseek,
};
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
mm-vma-error-out-on-invalid-bounds-in-unmapped_area_topdown.patch
mm-vma-lock-vmas-before-taking-mm_all_locks_mutex.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
coda-never-point-a-files-f_mapping-at-a-containers-mapping.patch
fs-proc-task_mmu-write-protect-only-with-ptrace-attach.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 07/13] xen: convert xenstore interface mmap hooks to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook for the
xenfs xsd_kva file and the xenbus_backend device, both of which remap the
xenstore interface page.
Use the PFN remap mmap action to do so, retaining the -EAGAIN error on
failure via the action error override.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/xen/xenbus/xenbus_dev_backend.c | 14 ++++++--------
drivers/xen/xenfs/xenstored.c | 14 ++++++--------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c
index edba5fecde4d..3e4cb267f411 100644
--- a/drivers/xen/xenbus/xenbus_dev_backend.c
+++ b/drivers/xen/xenbus/xenbus_dev_backend.c
@@ -89,27 +89,25 @@ static long xenbus_backend_ioctl(struct file *file, unsigned int cmd,
}
}
-static int xenbus_backend_mmap(struct file *file, struct vm_area_struct *vma)
+static int xenbus_backend_mmap_prepare(struct vm_area_desc *desc)
{
- size_t size = vma->vm_end - vma->vm_start;
+ size_t size = vma_desc_size(desc);
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
+ if ((size > PAGE_SIZE) || (desc->pgoff != 0))
return -EINVAL;
- if (remap_pfn_range(vma, vma->vm_start,
- virt_to_pfn(xen_store_interface),
- size, vma->vm_page_prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc, virt_to_pfn(xen_store_interface));
+ desc->action.error_override = -EAGAIN;
return 0;
}
static const struct file_operations xenbus_backend_fops = {
.open = xenbus_backend_open,
- .mmap = xenbus_backend_mmap,
+ .mmap_prepare = xenbus_backend_mmap_prepare,
.unlocked_ioctl = xenbus_backend_ioctl,
};
diff --git a/drivers/xen/xenfs/xenstored.c b/drivers/xen/xenfs/xenstored.c
index f59235f9f8a2..0cf57c286adb 100644
--- a/drivers/xen/xenfs/xenstored.c
+++ b/drivers/xen/xenfs/xenstored.c
@@ -31,24 +31,22 @@ static int xsd_kva_open(struct inode *inode, struct file *file)
return 0;
}
-static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
+static int xsd_kva_mmap_prepare(struct vm_area_desc *desc)
{
- size_t size = vma->vm_end - vma->vm_start;
+ size_t size = vma_desc_size(desc);
- if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
+ if ((size > PAGE_SIZE) || (desc->pgoff != 0))
return -EINVAL;
- if (remap_pfn_range(vma, vma->vm_start,
- virt_to_pfn(xen_store_interface),
- size, vma->vm_page_prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc, virt_to_pfn(xen_store_interface));
+ desc->action.error_override = -EAGAIN;
return 0;
}
const struct file_operations xsd_kva_file_ops = {
.open = xsd_kva_open,
- .mmap = xsd_kva_mmap,
+ .mmap_prepare = xsd_kva_mmap_prepare,
.read = xsd_read,
.release = xsd_release,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 07/13] xen: convert xenstore interface mmap hooks to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook for the
xenfs xsd_kva file and the xenbus_backend device, both of which remap the
xenstore interface page.
Use the PFN remap mmap action to do so, retaining the -EAGAIN error on
failure via the action error override.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/xen/xenbus/xenbus_dev_backend.c | 14 ++++++--------
drivers/xen/xenfs/xenstored.c | 14 ++++++--------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c
index edba5fecde4d..3e4cb267f411 100644
--- a/drivers/xen/xenbus/xenbus_dev_backend.c
+++ b/drivers/xen/xenbus/xenbus_dev_backend.c
@@ -89,27 +89,25 @@ static long xenbus_backend_ioctl(struct file *file, unsigned int cmd,
}
}
-static int xenbus_backend_mmap(struct file *file, struct vm_area_struct *vma)
+static int xenbus_backend_mmap_prepare(struct vm_area_desc *desc)
{
- size_t size = vma->vm_end - vma->vm_start;
+ size_t size = vma_desc_size(desc);
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
+ if ((size > PAGE_SIZE) || (desc->pgoff != 0))
return -EINVAL;
- if (remap_pfn_range(vma, vma->vm_start,
- virt_to_pfn(xen_store_interface),
- size, vma->vm_page_prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc, virt_to_pfn(xen_store_interface));
+ desc->action.error_override = -EAGAIN;
return 0;
}
static const struct file_operations xenbus_backend_fops = {
.open = xenbus_backend_open,
- .mmap = xenbus_backend_mmap,
+ .mmap_prepare = xenbus_backend_mmap_prepare,
.unlocked_ioctl = xenbus_backend_ioctl,
};
diff --git a/drivers/xen/xenfs/xenstored.c b/drivers/xen/xenfs/xenstored.c
index f59235f9f8a2..0cf57c286adb 100644
--- a/drivers/xen/xenfs/xenstored.c
+++ b/drivers/xen/xenfs/xenstored.c
@@ -31,24 +31,22 @@ static int xsd_kva_open(struct inode *inode, struct file *file)
return 0;
}
-static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
+static int xsd_kva_mmap_prepare(struct vm_area_desc *desc)
{
- size_t size = vma->vm_end - vma->vm_start;
+ size_t size = vma_desc_size(desc);
- if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
+ if ((size > PAGE_SIZE) || (desc->pgoff != 0))
return -EINVAL;
- if (remap_pfn_range(vma, vma->vm_start,
- virt_to_pfn(xen_store_interface),
- size, vma->vm_page_prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc, virt_to_pfn(xen_store_interface));
+ desc->action.error_override = -EAGAIN;
return 0;
}
const struct file_operations xsd_kva_file_ops = {
.open = xsd_kva_open,
- .mmap = xsd_kva_mmap,
+ .mmap_prepare = xsd_kva_mmap_prepare,
.read = xsd_read,
.release = xsd_release,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* Re: [PATCH v2 07/13] xen: convert xenstore interface mmap hooks to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 15:14 ` Jürgen Groß via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Jürgen Groß @ 2026-11-24 15:14 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM), Andrew Morton, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
[-- Attachment #1.1: Type: text/plain, Size: 466 bytes --]
On 24.11.26 15:02, Lorenzo Stoakes (ARM) wrote:
> Move from the deprecated mmap hook to the new mmap_prepare hook for the
> xenfs xsd_kva file and the xenbus_backend device, both of which remap the
> xenstore interface page.
>
> Use the PFN remap mmap action to do so, retaining the -EAGAIN error on
> failure via the action error override.
>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 07/13] xen: convert xenstore interface mmap hooks to mmap_prepare
@ 2026-11-24 15:14 ` Jürgen Groß via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Jürgen Groß via OP-TEE @ 2026-11-24 15:14 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM), Andrew Morton, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
[-- Attachment #1.1: Type: text/plain, Size: 466 bytes --]
On 24.11.26 15:02, Lorenzo Stoakes (ARM) wrote:
> Move from the deprecated mmap hook to the new mmap_prepare hook for the
> xenfs xsd_kva file and the xenbus_backend device, both of which remap the
> xenstore interface page.
>
> Use the PFN remap mmap action to do so, retaining the -EAGAIN error on
> failure via the action error override.
>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 58+ messages in thread
* + xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
(?)
@ 2026-11-24 19:09 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:09 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 8506 bytes --]
The patch titled
Subject: xen: convert xenstore interface mmap hooks to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: xen: convert xenstore interface mmap hooks to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:50 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook for the
xenfs xsd_kva file and the xenbus_backend device, both of which remap the
xenstore interface page.
Use the PFN remap mmap action to do so, retaining the -EAGAIN error on
failure via the action error override.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-7-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
drivers/xen/xenbus/xenbus_dev_backend.c | 14 ++++++--------
drivers/xen/xenfs/xenstored.c | 14 ++++++--------
2 files changed, 12 insertions(+), 16 deletions(-)
--- a/drivers/xen/xenbus/xenbus_dev_backend.c~xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare
+++ a/drivers/xen/xenbus/xenbus_dev_backend.c
@@ -89,27 +89,25 @@ static long xenbus_backend_ioctl(struct
}
}
-static int xenbus_backend_mmap(struct file *file, struct vm_area_struct *vma)
+static int xenbus_backend_mmap_prepare(struct vm_area_desc *desc)
{
- size_t size = vma->vm_end - vma->vm_start;
+ size_t size = vma_desc_size(desc);
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
+ if ((size > PAGE_SIZE) || (desc->pgoff != 0))
return -EINVAL;
- if (remap_pfn_range(vma, vma->vm_start,
- virt_to_pfn(xen_store_interface),
- size, vma->vm_page_prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc, virt_to_pfn(xen_store_interface));
+ desc->action.error_override = -EAGAIN;
return 0;
}
static const struct file_operations xenbus_backend_fops = {
.open = xenbus_backend_open,
- .mmap = xenbus_backend_mmap,
+ .mmap_prepare = xenbus_backend_mmap_prepare,
.unlocked_ioctl = xenbus_backend_ioctl,
};
--- a/drivers/xen/xenfs/xenstored.c~xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare
+++ a/drivers/xen/xenfs/xenstored.c
@@ -31,24 +31,22 @@ static int xsd_kva_open(struct inode *in
return 0;
}
-static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
+static int xsd_kva_mmap_prepare(struct vm_area_desc *desc)
{
- size_t size = vma->vm_end - vma->vm_start;
+ size_t size = vma_desc_size(desc);
- if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
+ if ((size > PAGE_SIZE) || (desc->pgoff != 0))
return -EINVAL;
- if (remap_pfn_range(vma, vma->vm_start,
- virt_to_pfn(xen_store_interface),
- size, vma->vm_page_prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc, virt_to_pfn(xen_store_interface));
+ desc->action.error_override = -EAGAIN;
return 0;
}
const struct file_operations xsd_kva_file_ops = {
.open = xsd_kva_open,
- .mmap = xsd_kva_mmap,
+ .mmap_prepare = xsd_kva_mmap_prepare,
.read = xsd_read,
.release = xsd_release,
};
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 08/13] soc: aspeed: convert LPC and P2A control mmap hooks to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook for both
the LPC control and P2A control drivers.
Both remap a range of their reserved memory region, so use the PFN remap
mmap action to do so, retaining the -EAGAIN error on failure via the action
error override.
Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/soc/aspeed/aspeed-lpc-ctrl.c | 20 +++++++++-----------
drivers/soc/aspeed/aspeed-p2a-ctrl.c | 22 ++++++++--------------
2 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
index 5d91ba2038d5..702fb3e85472 100644
--- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c
+++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
@@ -47,22 +47,20 @@ static struct aspeed_lpc_ctrl *file_aspeed_lpc_ctrl(struct file *file)
miscdev);
}
-static int aspeed_lpc_ctrl_mmap(struct file *file, struct vm_area_struct *vma)
+static int aspeed_lpc_ctrl_mmap_prepare(struct vm_area_desc *desc)
{
- struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(file);
- unsigned long vsize = vma->vm_end - vma->vm_start;
- pgprot_t prot = vma->vm_page_prot;
+ struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(desc->file);
- if (vma->vm_pgoff + vma_pages(vma) > lpc_ctrl->mem_size >> PAGE_SHIFT)
+ if (desc->pgoff + vma_desc_pages(desc) >
+ lpc_ctrl->mem_size >> PAGE_SHIFT)
return -EINVAL;
/* ast2400/2500 AHB accesses are not cache coherent */
- prot = pgprot_noncached(prot);
+ desc->page_prot = pgprot_noncached(desc->page_prot);
- if (remap_pfn_range(vma, vma->vm_start,
- (lpc_ctrl->mem_base >> PAGE_SHIFT) + vma->vm_pgoff,
- vsize, prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc,
+ (lpc_ctrl->mem_base >> PAGE_SHIFT) + desc->pgoff);
+ desc->action.error_override = -EAGAIN;
return 0;
}
@@ -216,7 +214,7 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd,
static const struct file_operations aspeed_lpc_ctrl_fops = {
.owner = THIS_MODULE,
- .mmap = aspeed_lpc_ctrl_mmap,
+ .mmap_prepare = aspeed_lpc_ctrl_mmap_prepare,
.unlocked_ioctl = aspeed_lpc_ctrl_ioctl,
};
diff --git a/drivers/soc/aspeed/aspeed-p2a-ctrl.c b/drivers/soc/aspeed/aspeed-p2a-ctrl.c
index efa106d37bd7..7387b0cd8666 100644
--- a/drivers/soc/aspeed/aspeed-p2a-ctrl.c
+++ b/drivers/soc/aspeed/aspeed-p2a-ctrl.c
@@ -97,29 +97,23 @@ static void aspeed_p2a_disable_bridge(struct aspeed_p2a_ctrl *p2a_ctrl)
regmap_update_bits(p2a_ctrl->regmap, SCU180, SCU180_ENP2A, 0);
}
-static int aspeed_p2a_mmap(struct file *file, struct vm_area_struct *vma)
+static int aspeed_p2a_mmap_prepare(struct vm_area_desc *desc)
{
- unsigned long vsize;
- pgprot_t prot;
- struct aspeed_p2a_user *priv = file->private_data;
+ struct aspeed_p2a_user *priv = desc->file->private_data;
struct aspeed_p2a_ctrl *ctrl = priv->parent;
if (ctrl->mem_base == 0 && ctrl->mem_size == 0)
return -EINVAL;
- vsize = vma->vm_end - vma->vm_start;
- prot = vma->vm_page_prot;
-
- if (vma->vm_pgoff + vma_pages(vma) > ctrl->mem_size >> PAGE_SHIFT)
+ if (desc->pgoff + vma_desc_pages(desc) > ctrl->mem_size >> PAGE_SHIFT)
return -EINVAL;
/* ast2400/2500 AHB accesses are not cache coherent */
- prot = pgprot_noncached(prot);
+ desc->page_prot = pgprot_noncached(desc->page_prot);
- if (remap_pfn_range(vma, vma->vm_start,
- (ctrl->mem_base >> PAGE_SHIFT) + vma->vm_pgoff,
- vsize, prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc,
+ (ctrl->mem_base >> PAGE_SHIFT) + desc->pgoff);
+ desc->action.error_override = -EAGAIN;
return 0;
}
@@ -308,7 +302,7 @@ static int aspeed_p2a_release(struct inode *inode, struct file *file)
static const struct file_operations aspeed_p2a_ctrl_fops = {
.owner = THIS_MODULE,
- .mmap = aspeed_p2a_mmap,
+ .mmap_prepare = aspeed_p2a_mmap_prepare,
.unlocked_ioctl = aspeed_p2a_ioctl,
.open = aspeed_p2a_open,
.release = aspeed_p2a_release,
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 08/13] soc: aspeed: convert LPC and P2A control mmap hooks to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook for both
the LPC control and P2A control drivers.
Both remap a range of their reserved memory region, so use the PFN remap
mmap action to do so, retaining the -EAGAIN error on failure via the action
error override.
Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/soc/aspeed/aspeed-lpc-ctrl.c | 20 +++++++++-----------
drivers/soc/aspeed/aspeed-p2a-ctrl.c | 22 ++++++++--------------
2 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
index 5d91ba2038d5..702fb3e85472 100644
--- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c
+++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
@@ -47,22 +47,20 @@ static struct aspeed_lpc_ctrl *file_aspeed_lpc_ctrl(struct file *file)
miscdev);
}
-static int aspeed_lpc_ctrl_mmap(struct file *file, struct vm_area_struct *vma)
+static int aspeed_lpc_ctrl_mmap_prepare(struct vm_area_desc *desc)
{
- struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(file);
- unsigned long vsize = vma->vm_end - vma->vm_start;
- pgprot_t prot = vma->vm_page_prot;
+ struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(desc->file);
- if (vma->vm_pgoff + vma_pages(vma) > lpc_ctrl->mem_size >> PAGE_SHIFT)
+ if (desc->pgoff + vma_desc_pages(desc) >
+ lpc_ctrl->mem_size >> PAGE_SHIFT)
return -EINVAL;
/* ast2400/2500 AHB accesses are not cache coherent */
- prot = pgprot_noncached(prot);
+ desc->page_prot = pgprot_noncached(desc->page_prot);
- if (remap_pfn_range(vma, vma->vm_start,
- (lpc_ctrl->mem_base >> PAGE_SHIFT) + vma->vm_pgoff,
- vsize, prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc,
+ (lpc_ctrl->mem_base >> PAGE_SHIFT) + desc->pgoff);
+ desc->action.error_override = -EAGAIN;
return 0;
}
@@ -216,7 +214,7 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd,
static const struct file_operations aspeed_lpc_ctrl_fops = {
.owner = THIS_MODULE,
- .mmap = aspeed_lpc_ctrl_mmap,
+ .mmap_prepare = aspeed_lpc_ctrl_mmap_prepare,
.unlocked_ioctl = aspeed_lpc_ctrl_ioctl,
};
diff --git a/drivers/soc/aspeed/aspeed-p2a-ctrl.c b/drivers/soc/aspeed/aspeed-p2a-ctrl.c
index efa106d37bd7..7387b0cd8666 100644
--- a/drivers/soc/aspeed/aspeed-p2a-ctrl.c
+++ b/drivers/soc/aspeed/aspeed-p2a-ctrl.c
@@ -97,29 +97,23 @@ static void aspeed_p2a_disable_bridge(struct aspeed_p2a_ctrl *p2a_ctrl)
regmap_update_bits(p2a_ctrl->regmap, SCU180, SCU180_ENP2A, 0);
}
-static int aspeed_p2a_mmap(struct file *file, struct vm_area_struct *vma)
+static int aspeed_p2a_mmap_prepare(struct vm_area_desc *desc)
{
- unsigned long vsize;
- pgprot_t prot;
- struct aspeed_p2a_user *priv = file->private_data;
+ struct aspeed_p2a_user *priv = desc->file->private_data;
struct aspeed_p2a_ctrl *ctrl = priv->parent;
if (ctrl->mem_base == 0 && ctrl->mem_size == 0)
return -EINVAL;
- vsize = vma->vm_end - vma->vm_start;
- prot = vma->vm_page_prot;
-
- if (vma->vm_pgoff + vma_pages(vma) > ctrl->mem_size >> PAGE_SHIFT)
+ if (desc->pgoff + vma_desc_pages(desc) > ctrl->mem_size >> PAGE_SHIFT)
return -EINVAL;
/* ast2400/2500 AHB accesses are not cache coherent */
- prot = pgprot_noncached(prot);
+ desc->page_prot = pgprot_noncached(desc->page_prot);
- if (remap_pfn_range(vma, vma->vm_start,
- (ctrl->mem_base >> PAGE_SHIFT) + vma->vm_pgoff,
- vsize, prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc,
+ (ctrl->mem_base >> PAGE_SHIFT) + desc->pgoff);
+ desc->action.error_override = -EAGAIN;
return 0;
}
@@ -308,7 +302,7 @@ static int aspeed_p2a_release(struct inode *inode, struct file *file)
static const struct file_operations aspeed_p2a_ctrl_fops = {
.owner = THIS_MODULE,
- .mmap = aspeed_p2a_mmap,
+ .mmap_prepare = aspeed_p2a_mmap_prepare,
.unlocked_ioctl = aspeed_p2a_ioctl,
.open = aspeed_p2a_open,
.release = aspeed_p2a_release,
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* Re: [PATCH v2 08/13] soc: aspeed: convert LPC and P2A control mmap hooks to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 18:53 ` Arnd Bergmann
-1 siblings, 0 replies; 58+ messages in thread
From: Arnd Bergmann @ 2026-11-24 18:53 UTC (permalink / raw)
To: Lorenzo Stoakes, Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy, Ritesh Harjani (IBM),
Shrikanth Hegde, Haiyang Zhang, Wei Liu, Dexuan Cui,
Michael S. Tsirkin, Jason Wang, Eugenio Pérez, Xuan Zhuo,
Jarkko Sakkinen, Dave Hansen, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, x86, H. Peter Anvin, Jan Kara, Paul Moore,
Stephen Smalley, Ondrej Mosnáček, Joel Stanley,
Andrew Jeffery, Ryan Chen, 'billy_tsai@aspeedtech.com',
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Greg Kroah-Hartman, Richard Cochran, David Woodhouse, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, Netdev, linux-mm
On Tue, Nov 24, 2026, at 15:02, Lorenzo Stoakes (ARM) wrote:
> Move from the deprecated mmap hook to the new mmap_prepare hook for both
> the LPC control and P2A control drivers.
>
> Both remap a range of their reserved memory region, so use the PFN remap
> mmap action to do so, retaining the -EAGAIN error on failure via the action
> error override.
>
> Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 58+ messages in thread
* + soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
(?)
@ 2026-11-24 19:09 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:09 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 9602 bytes --]
The patch titled
Subject: soc: aspeed: convert LPC and P2A control mmap hooks to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: soc: aspeed: convert LPC and P2A control mmap hooks to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:51 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook for both
the LPC control and P2A control drivers.
Both remap a range of their reserved memory region, so use the PFN remap
mmap action to do so, retaining the -EAGAIN error on failure via the action
error override.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-8-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
drivers/soc/aspeed/aspeed-lpc-ctrl.c | 20 +++++++++-----------
drivers/soc/aspeed/aspeed-p2a-ctrl.c | 22 ++++++++--------------
2 files changed, 17 insertions(+), 25 deletions(-)
--- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c~soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare
+++ a/drivers/soc/aspeed/aspeed-lpc-ctrl.c
@@ -47,22 +47,20 @@ static struct aspeed_lpc_ctrl *file_aspe
miscdev);
}
-static int aspeed_lpc_ctrl_mmap(struct file *file, struct vm_area_struct *vma)
+static int aspeed_lpc_ctrl_mmap_prepare(struct vm_area_desc *desc)
{
- struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(file);
- unsigned long vsize = vma->vm_end - vma->vm_start;
- pgprot_t prot = vma->vm_page_prot;
+ struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(desc->file);
- if (vma->vm_pgoff + vma_pages(vma) > lpc_ctrl->mem_size >> PAGE_SHIFT)
+ if (desc->pgoff + vma_desc_pages(desc) >
+ lpc_ctrl->mem_size >> PAGE_SHIFT)
return -EINVAL;
/* ast2400/2500 AHB accesses are not cache coherent */
- prot = pgprot_noncached(prot);
+ desc->page_prot = pgprot_noncached(desc->page_prot);
- if (remap_pfn_range(vma, vma->vm_start,
- (lpc_ctrl->mem_base >> PAGE_SHIFT) + vma->vm_pgoff,
- vsize, prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc,
+ (lpc_ctrl->mem_base >> PAGE_SHIFT) + desc->pgoff);
+ desc->action.error_override = -EAGAIN;
return 0;
}
@@ -216,7 +214,7 @@ static long aspeed_lpc_ctrl_ioctl(struct
static const struct file_operations aspeed_lpc_ctrl_fops = {
.owner = THIS_MODULE,
- .mmap = aspeed_lpc_ctrl_mmap,
+ .mmap_prepare = aspeed_lpc_ctrl_mmap_prepare,
.unlocked_ioctl = aspeed_lpc_ctrl_ioctl,
};
--- a/drivers/soc/aspeed/aspeed-p2a-ctrl.c~soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare
+++ a/drivers/soc/aspeed/aspeed-p2a-ctrl.c
@@ -97,29 +97,23 @@ static void aspeed_p2a_disable_bridge(st
regmap_update_bits(p2a_ctrl->regmap, SCU180, SCU180_ENP2A, 0);
}
-static int aspeed_p2a_mmap(struct file *file, struct vm_area_struct *vma)
+static int aspeed_p2a_mmap_prepare(struct vm_area_desc *desc)
{
- unsigned long vsize;
- pgprot_t prot;
- struct aspeed_p2a_user *priv = file->private_data;
+ struct aspeed_p2a_user *priv = desc->file->private_data;
struct aspeed_p2a_ctrl *ctrl = priv->parent;
if (ctrl->mem_base == 0 && ctrl->mem_size == 0)
return -EINVAL;
- vsize = vma->vm_end - vma->vm_start;
- prot = vma->vm_page_prot;
-
- if (vma->vm_pgoff + vma_pages(vma) > ctrl->mem_size >> PAGE_SHIFT)
+ if (desc->pgoff + vma_desc_pages(desc) > ctrl->mem_size >> PAGE_SHIFT)
return -EINVAL;
/* ast2400/2500 AHB accesses are not cache coherent */
- prot = pgprot_noncached(prot);
+ desc->page_prot = pgprot_noncached(desc->page_prot);
- if (remap_pfn_range(vma, vma->vm_start,
- (ctrl->mem_base >> PAGE_SHIFT) + vma->vm_pgoff,
- vsize, prot))
- return -EAGAIN;
+ mmap_action_remap_full(desc,
+ (ctrl->mem_base >> PAGE_SHIFT) + desc->pgoff);
+ desc->action.error_override = -EAGAIN;
return 0;
}
@@ -308,7 +302,7 @@ static int aspeed_p2a_release(struct ino
static const struct file_operations aspeed_p2a_ctrl_fops = {
.owner = THIS_MODULE,
- .mmap = aspeed_p2a_mmap,
+ .mmap_prepare = aspeed_p2a_mmap_prepare,
.unlocked_ioctl = aspeed_p2a_ioctl,
.open = aspeed_p2a_open,
.release = aspeed_p2a_release,
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 09/13] soc: qcom: rmtfs_mem: convert mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm, Abel Vesa
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
PFN remap mmap action to map the region.
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/soc/qcom/rmtfs_mem.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
index 342c0845134e..5e2ac75f41d5 100644
--- a/drivers/soc/qcom/rmtfs_mem.c
+++ b/drivers/soc/qcom/rmtfs_mem.c
@@ -129,24 +129,22 @@ static const struct class rmtfs_class = {
.name = "rmtfs",
};
-static int qcom_rmtfs_mem_mmap(struct file *filep, struct vm_area_struct *vma)
+static int qcom_rmtfs_mem_mmap_prepare(struct vm_area_desc *desc)
{
- struct qcom_rmtfs_mem *rmtfs_mem = filep->private_data;
+ struct qcom_rmtfs_mem *rmtfs_mem = desc->file->private_data;
- if (vma->vm_end - vma->vm_start > rmtfs_mem->size) {
+ if (vma_desc_size(desc) > rmtfs_mem->size) {
dev_dbg(&rmtfs_mem->dev,
"vm_end[%lu] - vm_start[%lu] [%lu] > mem->size[%pa]\n",
- vma->vm_end, vma->vm_start,
- (vma->vm_end - vma->vm_start), &rmtfs_mem->size);
+ desc->end, desc->start, vma_desc_size(desc),
+ &rmtfs_mem->size);
return -EINVAL;
}
- vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
- return remap_pfn_range(vma,
- vma->vm_start,
- rmtfs_mem->addr >> PAGE_SHIFT,
- vma->vm_end - vma->vm_start,
- vma->vm_page_prot);
+ desc->page_prot = pgprot_writecombine(desc->page_prot);
+ mmap_action_remap_full(desc, rmtfs_mem->addr >> PAGE_SHIFT);
+
+ return 0;
}
static const struct file_operations qcom_rmtfs_mem_fops = {
@@ -156,7 +154,7 @@ static const struct file_operations qcom_rmtfs_mem_fops = {
.write = qcom_rmtfs_mem_write,
.release = qcom_rmtfs_mem_release,
.llseek = default_llseek,
- .mmap = qcom_rmtfs_mem_mmap,
+ .mmap_prepare = qcom_rmtfs_mem_mmap_prepare,
};
static void qcom_rmtfs_mem_release_device(struct device *dev)
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 09/13] soc: qcom: rmtfs_mem: convert mmap hook to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm, Abel Vesa
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
PFN remap mmap action to map the region.
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/soc/qcom/rmtfs_mem.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
index 342c0845134e..5e2ac75f41d5 100644
--- a/drivers/soc/qcom/rmtfs_mem.c
+++ b/drivers/soc/qcom/rmtfs_mem.c
@@ -129,24 +129,22 @@ static const struct class rmtfs_class = {
.name = "rmtfs",
};
-static int qcom_rmtfs_mem_mmap(struct file *filep, struct vm_area_struct *vma)
+static int qcom_rmtfs_mem_mmap_prepare(struct vm_area_desc *desc)
{
- struct qcom_rmtfs_mem *rmtfs_mem = filep->private_data;
+ struct qcom_rmtfs_mem *rmtfs_mem = desc->file->private_data;
- if (vma->vm_end - vma->vm_start > rmtfs_mem->size) {
+ if (vma_desc_size(desc) > rmtfs_mem->size) {
dev_dbg(&rmtfs_mem->dev,
"vm_end[%lu] - vm_start[%lu] [%lu] > mem->size[%pa]\n",
- vma->vm_end, vma->vm_start,
- (vma->vm_end - vma->vm_start), &rmtfs_mem->size);
+ desc->end, desc->start, vma_desc_size(desc),
+ &rmtfs_mem->size);
return -EINVAL;
}
- vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
- return remap_pfn_range(vma,
- vma->vm_start,
- rmtfs_mem->addr >> PAGE_SHIFT,
- vma->vm_end - vma->vm_start,
- vma->vm_page_prot);
+ desc->page_prot = pgprot_writecombine(desc->page_prot);
+ mmap_action_remap_full(desc, rmtfs_mem->addr >> PAGE_SHIFT);
+
+ return 0;
}
static const struct file_operations qcom_rmtfs_mem_fops = {
@@ -156,7 +154,7 @@ static const struct file_operations qcom_rmtfs_mem_fops = {
.write = qcom_rmtfs_mem_write,
.release = qcom_rmtfs_mem_release,
.llseek = default_llseek,
- .mmap = qcom_rmtfs_mem_mmap,
+ .mmap_prepare = qcom_rmtfs_mem_mmap_prepare,
};
static void qcom_rmtfs_mem_release_device(struct device *dev)
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* + soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 19:09 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:09 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
abelvesa, ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7799 bytes --]
The patch titled
Subject: soc: qcom: rmtfs_mem: convert mmap hook to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: soc: qcom: rmtfs_mem: convert mmap hook to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:52 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
PFN remap mmap action to map the region.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-9-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Abel Vesa <abelvesa@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
drivers/soc/qcom/rmtfs_mem.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
--- a/drivers/soc/qcom/rmtfs_mem.c~soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare
+++ a/drivers/soc/qcom/rmtfs_mem.c
@@ -129,24 +129,22 @@ static const struct class rmtfs_class =
.name = "rmtfs",
};
-static int qcom_rmtfs_mem_mmap(struct file *filep, struct vm_area_struct *vma)
+static int qcom_rmtfs_mem_mmap_prepare(struct vm_area_desc *desc)
{
- struct qcom_rmtfs_mem *rmtfs_mem = filep->private_data;
+ struct qcom_rmtfs_mem *rmtfs_mem = desc->file->private_data;
- if (vma->vm_end - vma->vm_start > rmtfs_mem->size) {
+ if (vma_desc_size(desc) > rmtfs_mem->size) {
dev_dbg(&rmtfs_mem->dev,
"vm_end[%lu] - vm_start[%lu] [%lu] > mem->size[%pa]\n",
- vma->vm_end, vma->vm_start,
- (vma->vm_end - vma->vm_start), &rmtfs_mem->size);
+ desc->end, desc->start, vma_desc_size(desc),
+ &rmtfs_mem->size);
return -EINVAL;
}
- vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
- return remap_pfn_range(vma,
- vma->vm_start,
- rmtfs_mem->addr >> PAGE_SHIFT,
- vma->vm_end - vma->vm_start,
- vma->vm_page_prot);
+ desc->page_prot = pgprot_writecombine(desc->page_prot);
+ mmap_action_remap_full(desc, rmtfs_mem->addr >> PAGE_SHIFT);
+
+ return 0;
}
static const struct file_operations qcom_rmtfs_mem_fops = {
@@ -156,7 +154,7 @@ static const struct file_operations qcom
.write = qcom_rmtfs_mem_write,
.release = qcom_rmtfs_mem_release,
.llseek = default_llseek,
- .mmap = qcom_rmtfs_mem_mmap,
+ .mmap_prepare = qcom_rmtfs_mem_mmap_prepare,
};
static void qcom_rmtfs_mem_release_device(struct device *dev)
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 10/13] tee: convert shm mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm,
Jens Wiklander
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
PFN remap mmap action to map the shared memory.
Reviewed-by: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/tee/tee_shm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index daa4af1e089e..8fcbf0232aeb 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -567,10 +567,9 @@ static int tee_shm_fop_release(struct inode *inode, struct file *filp)
return 0;
}
-static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
+static int tee_shm_fop_mmap_prepare(struct vm_area_desc *desc)
{
- struct tee_shm *shm = filp->private_data;
- size_t size = vma->vm_end - vma->vm_start;
+ struct tee_shm *shm = desc->file->private_data;
/* Refuse sharing shared memory provided by application */
if (shm->flags & TEE_SHM_USER_MAPPED)
@@ -580,17 +579,18 @@ static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
return -EINVAL;
/* check for overflowing the buffer's size */
- if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT)
+ if (desc->pgoff + vma_desc_pages(desc) > shm->size >> PAGE_SHIFT)
return -EINVAL;
- return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
- size, vma->vm_page_prot);
+ mmap_action_remap_full(desc, shm->paddr >> PAGE_SHIFT);
+
+ return 0;
}
static const struct file_operations tee_shm_fops = {
.owner = THIS_MODULE,
.release = tee_shm_fop_release,
- .mmap = tee_shm_fop_mmap,
+ .mmap_prepare = tee_shm_fop_mmap_prepare,
};
/**
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 10/13] tee: convert shm mmap hook to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm,
Jens Wiklander
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
PFN remap mmap action to map the shared memory.
Reviewed-by: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/tee/tee_shm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index daa4af1e089e..8fcbf0232aeb 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -567,10 +567,9 @@ static int tee_shm_fop_release(struct inode *inode, struct file *filp)
return 0;
}
-static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
+static int tee_shm_fop_mmap_prepare(struct vm_area_desc *desc)
{
- struct tee_shm *shm = filp->private_data;
- size_t size = vma->vm_end - vma->vm_start;
+ struct tee_shm *shm = desc->file->private_data;
/* Refuse sharing shared memory provided by application */
if (shm->flags & TEE_SHM_USER_MAPPED)
@@ -580,17 +579,18 @@ static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
return -EINVAL;
/* check for overflowing the buffer's size */
- if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT)
+ if (desc->pgoff + vma_desc_pages(desc) > shm->size >> PAGE_SHIFT)
return -EINVAL;
- return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
- size, vma->vm_page_prot);
+ mmap_action_remap_full(desc, shm->paddr >> PAGE_SHIFT);
+
+ return 0;
}
static const struct file_operations tee_shm_fops = {
.owner = THIS_MODULE,
.release = tee_shm_fop_release,
- .mmap = tee_shm_fop_mmap,
+ .mmap_prepare = tee_shm_fop_mmap_prepare,
};
/**
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* Re: [PATCH v2 10/13] tee: convert shm mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 18:54 ` Arnd Bergmann
-1 siblings, 0 replies; 58+ messages in thread
From: Arnd Bergmann @ 2026-11-24 18:54 UTC (permalink / raw)
To: Lorenzo Stoakes, Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy, Ritesh Harjani (IBM),
Shrikanth Hegde, Haiyang Zhang, Wei Liu, Dexuan Cui,
Michael S. Tsirkin, Jason Wang, Eugenio Pérez, Xuan Zhuo,
Jarkko Sakkinen, Dave Hansen, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, x86, H. Peter Anvin, Jan Kara, Paul Moore,
Stephen Smalley, Ondrej Mosnáček, Joel Stanley,
Andrew Jeffery, Ryan Chen, 'billy_tsai@aspeedtech.com',
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Greg Kroah-Hartman, Richard Cochran, David Woodhouse, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, Netdev, linux-mm,
Jens Wiklander
On Tue, Nov 24, 2026, at 15:02, Lorenzo Stoakes (ARM) wrote:
> Move from the deprecated mmap hook to the new mmap_prepare hook, using the
> PFN remap mmap action to map the shared memory.
>
> Reviewed-by: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 58+ messages in thread
* + tee-convert-shm-mmap-hook-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
(?)
@ 2026-11-24 19:09 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:09 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7334 bytes --]
The patch titled
Subject: tee: convert shm mmap hook to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/tee-convert-shm-mmap-hook-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: tee: convert shm mmap hook to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:53 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
PFN remap mmap action to map the shared memory.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-10-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
drivers/tee/tee_shm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- a/drivers/tee/tee_shm.c~tee-convert-shm-mmap-hook-to-mmap_prepare
+++ a/drivers/tee/tee_shm.c
@@ -567,10 +567,9 @@ static int tee_shm_fop_release(struct in
return 0;
}
-static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
+static int tee_shm_fop_mmap_prepare(struct vm_area_desc *desc)
{
- struct tee_shm *shm = filp->private_data;
- size_t size = vma->vm_end - vma->vm_start;
+ struct tee_shm *shm = desc->file->private_data;
/* Refuse sharing shared memory provided by application */
if (shm->flags & TEE_SHM_USER_MAPPED)
@@ -580,17 +579,18 @@ static int tee_shm_fop_mmap(struct file
return -EINVAL;
/* check for overflowing the buffer's size */
- if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT)
+ if (desc->pgoff + vma_desc_pages(desc) > shm->size >> PAGE_SHIFT)
return -EINVAL;
- return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
- size, vma->vm_page_prot);
+ mmap_action_remap_full(desc, shm->paddr >> PAGE_SHIFT);
+
+ return 0;
}
static const struct file_operations tee_shm_fops = {
.owner = THIS_MODULE,
.release = tee_shm_fop_release,
- .mmap = tee_shm_fop_mmap,
+ .mmap_prepare = tee_shm_fop_mmap_prepare,
};
/**
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 11/13] misc: bcm-vk: convert mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
I/O PFN remap mmap action to map the BAR.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/misc/bcm-vk/bcm_vk_dev.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/misc/bcm-vk/bcm_vk_dev.c b/drivers/misc/bcm-vk/bcm_vk_dev.c
index 88ee3a417616..25a2b46ebad9 100644
--- a/drivers/misc/bcm-vk/bcm_vk_dev.c
+++ b/drivers/misc/bcm-vk/bcm_vk_dev.c
@@ -1201,9 +1201,9 @@ static long bcm_vk_reset(struct bcm_vk *vk, struct vk_reset __user *arg)
return ret;
}
-static int bcm_vk_mmap(struct file *file, struct vm_area_struct *vma)
+static int bcm_vk_mmap_prepare(struct vm_area_desc *desc)
{
- struct bcm_vk_ctx *ctx = file->private_data;
+ struct bcm_vk_ctx *ctx = desc->file->private_data;
struct bcm_vk *vk = container_of(ctx->miscdev, struct bcm_vk, miscdev);
unsigned long pg_size;
@@ -1212,16 +1212,16 @@ static int bcm_vk_mmap(struct file *file, struct vm_area_struct *vma)
pg_size = ((pci_resource_len(vk->pdev, VK_MMAPABLE_BAR) - 1)
>> PAGE_SHIFT) + 1;
- if (vma->vm_pgoff + vma_pages(vma) > pg_size)
+ if (desc->pgoff + vma_desc_pages(desc) > pg_size)
return -EINVAL;
- vma->vm_pgoff += (pci_resource_start(vk->pdev, VK_MMAPABLE_BAR)
- >> PAGE_SHIFT);
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+ desc->pgoff += (pci_resource_start(vk->pdev, VK_MMAPABLE_BAR)
+ >> PAGE_SHIFT);
+ desc->page_prot = pgprot_noncached(desc->page_prot);
+
+ mmap_action_ioremap_full(desc, desc->pgoff);
- return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
- vma->vm_end - vma->vm_start,
- vma->vm_page_prot);
+ return 0;
}
static long bcm_vk_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@@ -1262,7 +1262,7 @@ static const struct file_operations bcm_vk_fops = {
.write = bcm_vk_write,
.poll = bcm_vk_poll,
.release = bcm_vk_release,
- .mmap = bcm_vk_mmap,
+ .mmap_prepare = bcm_vk_mmap_prepare,
.unlocked_ioctl = bcm_vk_ioctl,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 11/13] misc: bcm-vk: convert mmap hook to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
I/O PFN remap mmap action to map the BAR.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/misc/bcm-vk/bcm_vk_dev.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/misc/bcm-vk/bcm_vk_dev.c b/drivers/misc/bcm-vk/bcm_vk_dev.c
index 88ee3a417616..25a2b46ebad9 100644
--- a/drivers/misc/bcm-vk/bcm_vk_dev.c
+++ b/drivers/misc/bcm-vk/bcm_vk_dev.c
@@ -1201,9 +1201,9 @@ static long bcm_vk_reset(struct bcm_vk *vk, struct vk_reset __user *arg)
return ret;
}
-static int bcm_vk_mmap(struct file *file, struct vm_area_struct *vma)
+static int bcm_vk_mmap_prepare(struct vm_area_desc *desc)
{
- struct bcm_vk_ctx *ctx = file->private_data;
+ struct bcm_vk_ctx *ctx = desc->file->private_data;
struct bcm_vk *vk = container_of(ctx->miscdev, struct bcm_vk, miscdev);
unsigned long pg_size;
@@ -1212,16 +1212,16 @@ static int bcm_vk_mmap(struct file *file, struct vm_area_struct *vma)
pg_size = ((pci_resource_len(vk->pdev, VK_MMAPABLE_BAR) - 1)
>> PAGE_SHIFT) + 1;
- if (vma->vm_pgoff + vma_pages(vma) > pg_size)
+ if (desc->pgoff + vma_desc_pages(desc) > pg_size)
return -EINVAL;
- vma->vm_pgoff += (pci_resource_start(vk->pdev, VK_MMAPABLE_BAR)
- >> PAGE_SHIFT);
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+ desc->pgoff += (pci_resource_start(vk->pdev, VK_MMAPABLE_BAR)
+ >> PAGE_SHIFT);
+ desc->page_prot = pgprot_noncached(desc->page_prot);
+
+ mmap_action_ioremap_full(desc, desc->pgoff);
- return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
- vma->vm_end - vma->vm_start,
- vma->vm_page_prot);
+ return 0;
}
static long bcm_vk_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@@ -1262,7 +1262,7 @@ static const struct file_operations bcm_vk_fops = {
.write = bcm_vk_write,
.poll = bcm_vk_poll,
.release = bcm_vk_release,
- .mmap = bcm_vk_mmap,
+ .mmap_prepare = bcm_vk_mmap_prepare,
.unlocked_ioctl = bcm_vk_ioctl,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* + misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 19:09 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:09 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7719 bytes --]
The patch titled
Subject: misc: bcm-vk: convert mmap hook to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: misc: bcm-vk: convert mmap hook to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:54 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
I/O PFN remap mmap action to map the BAR.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-11-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
drivers/misc/bcm-vk/bcm_vk_dev.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
--- a/drivers/misc/bcm-vk/bcm_vk_dev.c~misc-bcm-vk-convert-mmap-hook-to-mmap_prepare
+++ a/drivers/misc/bcm-vk/bcm_vk_dev.c
@@ -1201,9 +1201,9 @@ err_exit:
return ret;
}
-static int bcm_vk_mmap(struct file *file, struct vm_area_struct *vma)
+static int bcm_vk_mmap_prepare(struct vm_area_desc *desc)
{
- struct bcm_vk_ctx *ctx = file->private_data;
+ struct bcm_vk_ctx *ctx = desc->file->private_data;
struct bcm_vk *vk = container_of(ctx->miscdev, struct bcm_vk, miscdev);
unsigned long pg_size;
@@ -1212,16 +1212,16 @@ static int bcm_vk_mmap(struct file *file
pg_size = ((pci_resource_len(vk->pdev, VK_MMAPABLE_BAR) - 1)
>> PAGE_SHIFT) + 1;
- if (vma->vm_pgoff + vma_pages(vma) > pg_size)
+ if (desc->pgoff + vma_desc_pages(desc) > pg_size)
return -EINVAL;
- vma->vm_pgoff += (pci_resource_start(vk->pdev, VK_MMAPABLE_BAR)
- >> PAGE_SHIFT);
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-
- return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
- vma->vm_end - vma->vm_start,
- vma->vm_page_prot);
+ desc->pgoff += (pci_resource_start(vk->pdev, VK_MMAPABLE_BAR)
+ >> PAGE_SHIFT);
+ desc->page_prot = pgprot_noncached(desc->page_prot);
+
+ mmap_action_ioremap_full(desc, desc->pgoff);
+
+ return 0;
}
static long bcm_vk_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@@ -1262,7 +1262,7 @@ static const struct file_operations bcm_
.write = bcm_vk_write,
.poll = bcm_vk_poll,
.release = bcm_vk_release,
- .mmap = bcm_vk_mmap,
+ .mmap_prepare = bcm_vk_mmap_prepare,
.unlocked_ioctl = bcm_vk_ioctl,
};
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 12/13] ptp: vmclock: convert mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm,
David Woodhouse
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
I/O PFN remap mmap action to map the clock page and retaining the -EAGAIN
error on failure via the action error override.
Acked-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/ptp/ptp_vmclock.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c
index 7f25fe6c2ce2..6a1d5f40a566 100644
--- a/drivers/ptp/ptp_vmclock.c
+++ b/drivers/ptp/ptp_vmclock.c
@@ -364,27 +364,26 @@ struct vmclock_file_state {
atomic_t seq;
};
-static int vmclock_miscdev_mmap(struct file *fp, struct vm_area_struct *vma)
+static int vmclock_miscdev_mmap_prepare(struct vm_area_desc *desc)
{
- struct vmclock_file_state *fst = fp->private_data;
+ struct vmclock_file_state *fst = desc->file->private_data;
struct vmclock_state *st = fst->st;
- if ((vma->vm_flags & (VM_READ|VM_WRITE)) != VM_READ)
+ if (!vma_desc_test(desc, VMA_READ_BIT) ||
+ vma_desc_test(desc, VMA_WRITE_BIT))
return -EROFS;
/*
* Restrict the read-only mapping so it cannot be upgraded to
* writable later with mprotect().
*/
- vm_flags_clear(vma, VM_MAYWRITE);
+ vma_desc_clear_flags(desc, VMA_MAYWRITE_BIT);
- if (vma->vm_end - vma->vm_start != PAGE_SIZE || vma->vm_pgoff)
+ if (vma_desc_size(desc) != PAGE_SIZE || desc->pgoff)
return -EINVAL;
- if (io_remap_pfn_range(vma, vma->vm_start,
- st->res.start >> PAGE_SHIFT, PAGE_SIZE,
- vma->vm_page_prot))
- return -EAGAIN;
+ mmap_action_ioremap_full(desc, st->res.start >> PAGE_SHIFT);
+ desc->action.error_override = -EAGAIN;
return 0;
}
@@ -484,7 +483,7 @@ static const struct file_operations vmclock_miscdev_fops = {
.owner = THIS_MODULE,
.open = vmclock_miscdev_open,
.release = vmclock_miscdev_release,
- .mmap = vmclock_miscdev_mmap,
+ .mmap_prepare = vmclock_miscdev_mmap_prepare,
.read = vmclock_miscdev_read,
.poll = vmclock_miscdev_poll,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 12/13] ptp: vmclock: convert mmap hook to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm,
David Woodhouse
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
I/O PFN remap mmap action to map the clock page and retaining the -EAGAIN
error on failure via the action error override.
Acked-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/ptp/ptp_vmclock.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c
index 7f25fe6c2ce2..6a1d5f40a566 100644
--- a/drivers/ptp/ptp_vmclock.c
+++ b/drivers/ptp/ptp_vmclock.c
@@ -364,27 +364,26 @@ struct vmclock_file_state {
atomic_t seq;
};
-static int vmclock_miscdev_mmap(struct file *fp, struct vm_area_struct *vma)
+static int vmclock_miscdev_mmap_prepare(struct vm_area_desc *desc)
{
- struct vmclock_file_state *fst = fp->private_data;
+ struct vmclock_file_state *fst = desc->file->private_data;
struct vmclock_state *st = fst->st;
- if ((vma->vm_flags & (VM_READ|VM_WRITE)) != VM_READ)
+ if (!vma_desc_test(desc, VMA_READ_BIT) ||
+ vma_desc_test(desc, VMA_WRITE_BIT))
return -EROFS;
/*
* Restrict the read-only mapping so it cannot be upgraded to
* writable later with mprotect().
*/
- vm_flags_clear(vma, VM_MAYWRITE);
+ vma_desc_clear_flags(desc, VMA_MAYWRITE_BIT);
- if (vma->vm_end - vma->vm_start != PAGE_SIZE || vma->vm_pgoff)
+ if (vma_desc_size(desc) != PAGE_SIZE || desc->pgoff)
return -EINVAL;
- if (io_remap_pfn_range(vma, vma->vm_start,
- st->res.start >> PAGE_SHIFT, PAGE_SIZE,
- vma->vm_page_prot))
- return -EAGAIN;
+ mmap_action_ioremap_full(desc, st->res.start >> PAGE_SHIFT);
+ desc->action.error_override = -EAGAIN;
return 0;
}
@@ -484,7 +483,7 @@ static const struct file_operations vmclock_miscdev_fops = {
.owner = THIS_MODULE,
.open = vmclock_miscdev_open,
.release = vmclock_miscdev_release,
- .mmap = vmclock_miscdev_mmap,
+ .mmap_prepare = vmclock_miscdev_mmap_prepare,
.read = vmclock_miscdev_read,
.poll = vmclock_miscdev_poll,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* + ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 19:09 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:09 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, dwmw2, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7798 bytes --]
The patch titled
Subject: ptp: vmclock: convert mmap hook to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: ptp: vmclock: convert mmap hook to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:55 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
I/O PFN remap mmap action to map the clock page and retaining the -EAGAIN
error on failure via the action error override.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-12-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Woodhouse <dwmw@amazon.co.uk>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
drivers/ptp/ptp_vmclock.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
--- a/drivers/ptp/ptp_vmclock.c~ptp-vmclock-convert-mmap-hook-to-mmap_prepare
+++ a/drivers/ptp/ptp_vmclock.c
@@ -364,27 +364,26 @@ struct vmclock_file_state {
atomic_t seq;
};
-static int vmclock_miscdev_mmap(struct file *fp, struct vm_area_struct *vma)
+static int vmclock_miscdev_mmap_prepare(struct vm_area_desc *desc)
{
- struct vmclock_file_state *fst = fp->private_data;
+ struct vmclock_file_state *fst = desc->file->private_data;
struct vmclock_state *st = fst->st;
- if ((vma->vm_flags & (VM_READ|VM_WRITE)) != VM_READ)
+ if (!vma_desc_test(desc, VMA_READ_BIT) ||
+ vma_desc_test(desc, VMA_WRITE_BIT))
return -EROFS;
/*
* Restrict the read-only mapping so it cannot be upgraded to
* writable later with mprotect().
*/
- vm_flags_clear(vma, VM_MAYWRITE);
+ vma_desc_clear_flags(desc, VMA_MAYWRITE_BIT);
- if (vma->vm_end - vma->vm_start != PAGE_SIZE || vma->vm_pgoff)
+ if (vma_desc_size(desc) != PAGE_SIZE || desc->pgoff)
return -EINVAL;
- if (io_remap_pfn_range(vma, vma->vm_start,
- st->res.start >> PAGE_SHIFT, PAGE_SIZE,
- vma->vm_page_prot))
- return -EAGAIN;
+ mmap_action_ioremap_full(desc, st->res.start >> PAGE_SHIFT);
+ desc->action.error_override = -EAGAIN;
return 0;
}
@@ -484,7 +483,7 @@ static const struct file_operations vmcl
.owner = THIS_MODULE,
.open = vmclock_miscdev_open,
.release = vmclock_miscdev_release,
- .mmap = vmclock_miscdev_mmap,
+ .mmap_prepare = vmclock_miscdev_mmap_prepare,
.read = vmclock_miscdev_read,
.poll = vmclock_miscdev_poll,
};
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* [PATCH v2 13/13] vhost-vdpa: convert mmap hook to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
-1 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only validates the request and sets the VMA flags, operations and page
protection.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/vhost/vdpa.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index c912ac40ca37..c729efd108d0 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1617,19 +1617,19 @@ static const struct vm_operations_struct vhost_vdpa_vm_ops = {
.fault = vhost_vdpa_fault,
};
-static int vhost_vdpa_mmap(struct file *file, struct vm_area_struct *vma)
+static int vhost_vdpa_mmap_prepare(struct vm_area_desc *desc)
{
- struct vhost_vdpa *v = vma->vm_file->private_data;
+ struct vhost_vdpa *v = desc->file->private_data;
struct vdpa_device *vdpa = v->vdpa;
const struct vdpa_config_ops *ops = vdpa->config;
struct vdpa_notification_area notify;
- unsigned long index = vma->vm_pgoff;
+ unsigned long index = desc->pgoff;
- if (vma->vm_end - vma->vm_start != PAGE_SIZE)
+ if (vma_desc_size(desc) != PAGE_SIZE)
return -EINVAL;
- if ((vma->vm_flags & VM_SHARED) == 0)
+ if (!vma_desc_test(desc, VMA_SHARED_BIT))
return -EINVAL;
- if (vma->vm_flags & VM_READ)
+ if (vma_desc_test(desc, VMA_READ_BIT))
return -EINVAL;
if (!ops->get_vq_notification)
return -ENOTSUPP;
@@ -1642,12 +1642,13 @@ static int vhost_vdpa_mmap(struct file *file, struct vm_area_struct *vma)
return -EINVAL;
if (notify.addr & (PAGE_SIZE - 1))
return -EINVAL;
- if (vma->vm_end - vma->vm_start != notify.size)
+ if (vma_desc_size(desc) != notify.size)
return -ENOTSUPP;
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
- vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &vhost_vdpa_vm_ops;
+ desc->page_prot = pgprot_noncached(desc->page_prot);
+ vma_desc_set_flags(desc, VMA_IO_BIT, VMA_PFNMAP_BIT, VMA_DONTEXPAND_BIT,
+ VMA_DONTDUMP_BIT);
+ desc->vm_ops = &vhost_vdpa_vm_ops;
return 0;
}
#endif /* CONFIG_MMU */
@@ -1659,7 +1660,7 @@ static const struct file_operations vhost_vdpa_fops = {
.write_iter = vhost_vdpa_chr_write_iter,
.unlocked_ioctl = vhost_vdpa_unlocked_ioctl,
#ifdef CONFIG_MMU
- .mmap = vhost_vdpa_mmap,
+ .mmap_prepare = vhost_vdpa_mmap_prepare,
#endif /* CONFIG_MMU */
.compat_ioctl = compat_ptr_ioctl,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* [PATCH v2 13/13] vhost-vdpa: convert mmap hook to mmap_prepare
@ 2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
0 siblings, 0 replies; 58+ messages in thread
From: Lorenzo Stoakes (ARM) via OP-TEE @ 2026-11-24 14:02 UTC (permalink / raw)
To: Andrew Morton, Juergen Gross, Stefano Stabellini,
Oleksandr Tyshchenko, Madhavan Srinivasan, Nicholas Piggin,
Michael Ellerman, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Haiyang Zhang, Wei Liu,
Dexuan Cui, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Jarkko Sakkinen, Dave Hansen, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Jan Kara,
Paul Moore, Stephen Smalley, Ondrej Mosnáček,
Joel Stanley, Andrew Jeffery, Ryan Chen, Billy Tsai,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Jens Wiklander,
Sumit Garg, Scott Branden, Broadcom internal kernel review list,
Arnd Bergmann, Greg Kroah-Hartman, Richard Cochran,
David Woodhouse, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: ljs, xen-devel, linux-kernel, linuxppc-dev, kvm, linux-hyperv,
virtualization, linux-sgx, selinux, linux-arm-kernel,
linux-aspeed, linux-arm-msm, op-tee, netdev, linux-mm
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only validates the request and sets the VMA flags, operations and page
protection.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
drivers/vhost/vdpa.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index c912ac40ca37..c729efd108d0 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1617,19 +1617,19 @@ static const struct vm_operations_struct vhost_vdpa_vm_ops = {
.fault = vhost_vdpa_fault,
};
-static int vhost_vdpa_mmap(struct file *file, struct vm_area_struct *vma)
+static int vhost_vdpa_mmap_prepare(struct vm_area_desc *desc)
{
- struct vhost_vdpa *v = vma->vm_file->private_data;
+ struct vhost_vdpa *v = desc->file->private_data;
struct vdpa_device *vdpa = v->vdpa;
const struct vdpa_config_ops *ops = vdpa->config;
struct vdpa_notification_area notify;
- unsigned long index = vma->vm_pgoff;
+ unsigned long index = desc->pgoff;
- if (vma->vm_end - vma->vm_start != PAGE_SIZE)
+ if (vma_desc_size(desc) != PAGE_SIZE)
return -EINVAL;
- if ((vma->vm_flags & VM_SHARED) == 0)
+ if (!vma_desc_test(desc, VMA_SHARED_BIT))
return -EINVAL;
- if (vma->vm_flags & VM_READ)
+ if (vma_desc_test(desc, VMA_READ_BIT))
return -EINVAL;
if (!ops->get_vq_notification)
return -ENOTSUPP;
@@ -1642,12 +1642,13 @@ static int vhost_vdpa_mmap(struct file *file, struct vm_area_struct *vma)
return -EINVAL;
if (notify.addr & (PAGE_SIZE - 1))
return -EINVAL;
- if (vma->vm_end - vma->vm_start != notify.size)
+ if (vma_desc_size(desc) != notify.size)
return -ENOTSUPP;
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
- vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &vhost_vdpa_vm_ops;
+ desc->page_prot = pgprot_noncached(desc->page_prot);
+ vma_desc_set_flags(desc, VMA_IO_BIT, VMA_PFNMAP_BIT, VMA_DONTEXPAND_BIT,
+ VMA_DONTDUMP_BIT);
+ desc->vm_ops = &vhost_vdpa_vm_ops;
return 0;
}
#endif /* CONFIG_MMU */
@@ -1659,7 +1660,7 @@ static const struct file_operations vhost_vdpa_fops = {
.write_iter = vhost_vdpa_chr_write_iter,
.unlocked_ioctl = vhost_vdpa_unlocked_ioctl,
#ifdef CONFIG_MMU
- .mmap = vhost_vdpa_mmap,
+ .mmap_prepare = vhost_vdpa_mmap_prepare,
#endif /* CONFIG_MMU */
.compat_ioctl = compat_ptr_ioctl,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 58+ messages in thread* + vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch added to mm-new branch
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
(?)
@ 2026-11-24 19:09 ` Andrew Morton
-1 siblings, 0 replies; 58+ messages in thread
From: Andrew Morton @ 2026-11-24 19:09 UTC (permalink / raw)
To: mm-commits, xuanzhuo, wei.liu, tglx, sumit.garg,
stephen.smalley.work, sstabellini, sshegde, scott.branden,
ryan_chen, ritesh.list, richardcochran, paul, pabeni, omosnacek,
oleksandr_tyshchenko, npiggin, mst, mpe, mingo, mhklinux, maddy,
kuba, konradybcio, kameroncarr, joel, jgross, jens.wiklander,
jenswi, jasowangio, jarkko, jack, hpa, haiyangz, gregkh, eperezma,
edumazet, dwmw, decui, davem, dave.hansen, chleroy, bp,
billy_tsai, arnd, andrew+netdev, andrew, andersson, abel.vesa,
ljs, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 8123 bytes --]
The patch titled
Subject: vhost-vdpa: convert mmap hook to mmap_prepare
has been added to the -mm mm-new branch. Its filename is
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: vhost-vdpa: convert mmap hook to mmap_prepare
Date: Tue, 24 Nov 2026 14:02:56 +0000
Move from the deprecated mmap hook to the new mmap_prepare hook. The hook
only validates the request and sets the VMA flags, operations and page
protection.
Link: https://patch.msgid.link/20261124-late-2026-mmap_prepare-v2-13-0b0d99d655f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Ondrej Mosnáček <omosnacek@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Jens Wiklander <jenswi@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
drivers/vhost/vdpa.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
--- a/drivers/vhost/vdpa.c~vhost-vdpa-convert-mmap-hook-to-mmap_prepare
+++ a/drivers/vhost/vdpa.c
@@ -1617,19 +1617,19 @@ static const struct vm_operations_struct
.fault = vhost_vdpa_fault,
};
-static int vhost_vdpa_mmap(struct file *file, struct vm_area_struct *vma)
+static int vhost_vdpa_mmap_prepare(struct vm_area_desc *desc)
{
- struct vhost_vdpa *v = vma->vm_file->private_data;
+ struct vhost_vdpa *v = desc->file->private_data;
struct vdpa_device *vdpa = v->vdpa;
const struct vdpa_config_ops *ops = vdpa->config;
struct vdpa_notification_area notify;
- unsigned long index = vma->vm_pgoff;
+ unsigned long index = desc->pgoff;
- if (vma->vm_end - vma->vm_start != PAGE_SIZE)
+ if (vma_desc_size(desc) != PAGE_SIZE)
return -EINVAL;
- if ((vma->vm_flags & VM_SHARED) == 0)
+ if (!vma_desc_test(desc, VMA_SHARED_BIT))
return -EINVAL;
- if (vma->vm_flags & VM_READ)
+ if (vma_desc_test(desc, VMA_READ_BIT))
return -EINVAL;
if (!ops->get_vq_notification)
return -ENOTSUPP;
@@ -1642,12 +1642,13 @@ static int vhost_vdpa_mmap(struct file *
return -EINVAL;
if (notify.addr & (PAGE_SIZE - 1))
return -EINVAL;
- if (vma->vm_end - vma->vm_start != notify.size)
+ if (vma_desc_size(desc) != notify.size)
return -ENOTSUPP;
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
- vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP);
- vma->vm_ops = &vhost_vdpa_vm_ops;
+ desc->page_prot = pgprot_noncached(desc->page_prot);
+ vma_desc_set_flags(desc, VMA_IO_BIT, VMA_PFNMAP_BIT, VMA_DONTEXPAND_BIT,
+ VMA_DONTDUMP_BIT);
+ desc->vm_ops = &vhost_vdpa_vm_ops;
return 0;
}
#endif /* CONFIG_MMU */
@@ -1659,7 +1660,7 @@ static const struct file_operations vhos
.write_iter = vhost_vdpa_chr_write_iter,
.unlocked_ioctl = vhost_vdpa_unlocked_ioctl,
#ifdef CONFIG_MMU
- .mmap = vhost_vdpa_mmap,
+ .mmap_prepare = vhost_vdpa_mmap_prepare,
#endif /* CONFIG_MMU */
.compat_ioctl = compat_ptr_ioctl,
};
_
Patches currently in -mm which might be from ljs@kernel.org are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch
mm-vma-drop-mm-asynchronously-in-vma_start_read.patch
mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch
mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch
mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch
mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch
mm-madvise-zap-markers-from-guard-regions.patch
mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch
percpu-fix-contig-hints-that-are-too-low.patch
percpu-search-the-whole-reserved-chunk.patch
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
xen-privcmd-convert-mmap-hook-to-mmap_prepare.patch
kvm-ppc-book3s-convert-spapr-tce-mmap-hook-to-mmap_prepare.patch
mshv_vtl-convert-mmap-hooks-to-mmap_prepare.patch
x86-sgx-convert-vepc-mmap-hook-to-mmap_prepare.patch
udf-convert-mmap-hook-to-mmap_prepare.patch
selinuxfs-convert-mmap-hooks-to-mmap_prepare.patch
xen-convert-xenstore-interface-mmap-hooks-to-mmap_prepare.patch
soc-aspeed-convert-lpc-and-p2a-control-mmap-hooks-to-mmap_prepare.patch
soc-qcom-rmtfs_mem-convert-mmap-hook-to-mmap_prepare.patch
tee-convert-shm-mmap-hook-to-mmap_prepare.patch
misc-bcm-vk-convert-mmap-hook-to-mmap_prepare.patch
ptp-vmclock-convert-mmap-hook-to-mmap_prepare.patch
vhost-vdpa-convert-mmap-hook-to-mmap_prepare.patch
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [PATCH v2 00/13] mm: convert further simple mmap hooks to mmap_prepare
2026-11-24 14:02 ` Lorenzo Stoakes (ARM) via OP-TEE
` (13 preceding siblings ...)
(?)
@ 2026-11-24 14:14 ` sashiko-bot
-1 siblings, 0 replies; 58+ messages in thread
From: sashiko-bot @ 2026-11-24 14:14 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM)
Cc: virtualization, selinux, Michael S. Tsirkin, Eugenio Perez
Sashiko has reviewed this 13-patch series and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-late-2026-mmap_prepare-v2-0-0b0d99d655f9@kernel.org
^ permalink raw reply [flat|nested] 58+ messages in thread