[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/14] tee: convert shm mmap hook to mmap_prepare
- To: Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Madhavan Srinivasan <maddy@xxxxxxxxxxxxx>, Nicholas Piggin <npiggin@xxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, "Christophe Leroy (CS GROUP)" <chleroy@xxxxxxxxxx>, "Ritesh Harjani (IBM)" <ritesh.list@xxxxxxxxx>, Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Dexuan Cui <decui@xxxxxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Jason Wang <jasowangio@xxxxxxxxx>, Eugenio Pérez <eperezma@xxxxxxxxxx>, Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>, Jarkko Sakkinen <jarkko@xxxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, x86@xxxxxxxxxx, "H. Peter Anvin" <hpa@xxxxxxxxx>, Jan Kara <jack@xxxxxxxx>, Paul Moore <paul@xxxxxxxxxxxxxx>, Stephen Smalley <stephen.smalley.work@xxxxxxxxx>, Ondrej Mosnáček <omosnacek@xxxxxxxxx>, Joel Stanley <joel@xxxxxxxxx>, Andrew Jeffery <andrew@xxxxxxxxxxxxxxxxxxxx>, Ryan Chen <ryan_chen@xxxxxxxxxxxxxx>, Billy Tsai <billy_tsai@xxxxxxxxxxxxxx>, Bjorn Andersson <andersson@xxxxxxxxxx>, Konrad Dybcio <konradybcio@xxxxxxxxxx>, Abel Vesa <abelvesa@xxxxxxxxxx>, Jens Wiklander <jenswi@xxxxxxxxxx>, Sumit Garg <sumit.garg@xxxxxxxxxx>, Scott Branden <scott.branden@xxxxxxxxxxxx>, Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Richard Cochran <richardcochran@xxxxxxxxx>, David Woodhouse <dwmw2@xxxxxxxxxxxxx>, Andrew Lunn <andrew+netdev@xxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>
- From: "Lorenzo Stoakes (ARM)" <ljs@xxxxxxxxxx>
- Date: Thu, 05 Nov 2026 21:05:42 +0000
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=k20260515 header.d=kernel.org header.i="@kernel.org" header.h="From:Date:Subject:References:In-Reply-To:To:Cc"
- Cc: ljs@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, linux-hyperv@xxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxx, linux-sgx@xxxxxxxxxxxxxxx, selinux@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-aspeed@xxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx, op-tee@xxxxxxxxxxxxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx
- Delivery-date: Thu, 05 Nov 2026 21:12:20 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Move from the deprecated mmap hook to the new mmap_prepare hook, using the
PFN remap mmap action to map the shared memory.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
---
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.0
|