From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Kommula Shiva Shankar <kshankar@marvell.com>,
Jason Wang <jasowang@redhat.com>,
Jason Gunthorpe <jgg@nvidia.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Sasha Levin <sashal@kernel.org>,
kvm@vger.kernel.org, virtualization@lists.linux.dev,
netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 6.19-6.6] vhost: fix caching attributes of MMIO regions by setting them explicitly
Date: Sun, 15 Feb 2026 10:03:24 -0500 [thread overview]
Message-ID: <20260215150333.2150455-7-sashal@kernel.org> (raw)
In-Reply-To: <20260215150333.2150455-1-sashal@kernel.org>
From: Kommula Shiva Shankar <kshankar@marvell.com>
[ Upstream commit 5145b277309f3818e2db507f525d19ac3b910922 ]
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>
---
LLM Generated explanations, may be completely bogus:
The mmap functionality has been there since `ddd89d0a059d8` which
introduced doorbell mapping. This fix would apply to all stable trees
that have this function.
### Summary
This is a textbook stable kernel fix:
1. **Obviously correct**: MMIO must be mapped non-cacheable; this is a
fundamental hardware requirement. Every other MMIO mmap in the kernel
uses `pgprot_noncached()` or similar.
2. **Fixes a real bug**: Invalid reads/writes on ARM64 — this causes
device malfunction and potential data corruption.
3. **Small and contained**: Single line addition, no side effects.
4. **No new features**: Just corrects existing mmap behavior to follow
hardware requirements.
5. **Low risk**: `pgprot_noncached()` is the standard, well-understood
kernel API for this exact purpose.
6. **High-quality review**: Three expert maintainers
reviewed/acked/committed.
7. **Self-contained**: No dependencies on other commits.
**YES**
drivers/vhost/vdpa.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 05a481e4c385a..b0179e8567aba 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1527,6 +1527,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;
--
2.51.0
parent reply other threads:[~2026-02-15 15:03 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20260215150333.2150455-1-sashal@kernel.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260215150333.2150455-7-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=jasowang@redhat.com \
--cc=jgg@nvidia.com \
--cc=kshankar@marvell.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox