Commit 5145b277 authored by Kommula Shiva Shankar's avatar Kommula Shiva Shankar Committed by Michael S. Tsirkin
Browse files

vhost: fix caching attributes of MMIO regions by setting them explicitly



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: default avatarKommula Shiva Shankar <kshankar@marvell.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Message-Id: <20260102065703.656255-1-kshankar@marvell.com>
parent 503ef41e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1529,6 +1529,7 @@ static int vhost_vdpa_mmap(struct file *file, struct vm_area_struct *vma)
	if (vma->vm_end - vma->vm_start != 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;
	return 0;