Skip to content
/ linux Public

Commit 25c429d

Browse files
ShivaShankarKommulaSasha Levin
authored andcommitted
vhost: fix caching attributes of MMIO regions by setting them explicitly
[ Upstream commit 5145b27 ] Explicitly set non-cached caching attributes for MMIO regions. Default write-back mode can cause CPU to cache device memory, causing invalid reads and unpredictable behavior. Invalid read and write issues were observed on ARM64 when mapping the notification area to userspace via mmap. Signed-off-by: Kommula Shiva Shankar <kshankar@marvell.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260102065703.656255-1-kshankar@marvell.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 59e14a1 commit 25c429d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/vhost/vdpa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,7 @@ static int vhost_vdpa_mmap(struct file *file, struct vm_area_struct *vma)
15271527
if (vma->vm_end - vma->vm_start != notify.size)
15281528
return -ENOTSUPP;
15291529

1530+
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
15301531
vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP);
15311532
vma->vm_ops = &vhost_vdpa_vm_ops;
15321533
return 0;

0 commit comments

Comments
 (0)