RE: [PATCH 03/14] mshv_vtl: convert mmap hooks to mmap_prepare

From: Michael Kelley

Date: Sun Nov 22 2026 - 16:38:45 EST


From: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx> Sent: Thursday, November 5, 2026 1:06 PM
>
> 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.
>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>

Reviewed-by: Michael Kelley <mhklinux@xxxxxxxxxxx>

> ---
> 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 d8225242c73f..e372d4c0188d 100644
> --- a/drivers/hv/mshv_vtl_main.c
> +++ b/drivers/hv/mshv_vtl_main.c
> @@ -832,9 +832,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;
> }
> @@ -852,7 +852,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)
> @@ -1283,10 +1283,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;
> }
> @@ -1294,7 +1294,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.0
>