[PATCH v2 03/13] mshv_vtl: convert mmap hooks to mmap_prepare

From: Lorenzo Stoakes (ARM)

Date: Tue Nov 24 2026 - 09:05:06 EST


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@xxxxxxxxxxxxxxxxxxx>
Reviewed-by: Kameron Carr <kameroncarr@xxxxxxxxxxxxxxxxxxx>
Reviewed-by: Michael Kelley <mhklinux@xxxxxxxxxxx>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
---
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