From: Florian Krischer <florian.krischer@fkr.dev>
To: Dmitry Osipenko <digetx@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
linux-media@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/2] media: tegra-vde: match DMA direction on cache reuse
Date: Sun, 29 Nov 2026 18:46:50 +0100 [thread overview]
Message-ID: <20261129174651.4117938-1-florian.krischer@fkr.dev> (raw)
The DMA-BUF cache can reuse an attachment mapped in a different
direction. Updating the cached direction does not change the mapping,
and later unmap then uses a direction different from the original map.
Match both the DMA-BUF and its mapping direction before reusing a
cached attachment. This preserves the original direction for unmap
and keeps same-direction cache hits.
Signed-off-by: Florian Krischer <florian.krischer@fkr.dev>
---
Build-tested for ARM with W=1 on media-committers/next with the
separately submitted mutex fix applied.
Hardware testing of cross-direction DMA-BUF reuse is pending.
diff --git a/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c b/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c
--- a/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c
+++ b/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c
@@ -76,14 +76,11 @@
mutex_lock(&vde->map_lock);
list_for_each_entry(entry, &vde->map_list, list) {
- if (entry->a->dmabuf != dmabuf)
+ if (entry->a->dmabuf != dmabuf || entry->dma_dir != dma_dir)
continue;
if (!cancel_delayed_work(&entry->dwork))
continue;
-
- if (entry->dma_dir != dma_dir)
- entry->dma_dir = DMA_BIDIRECTIONAL;
dma_buf_put(dmabuf);
next reply other threads:[~2026-11-29 17:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 17:46 Florian Krischer [this message]
2026-11-29 17:46 ` [RFC PATCH 2/2] media: tegra-vde: map capture planes bidirectionally Florian Krischer
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=20261129174651.4117938-1-florian.krischer@fkr.dev \
--to=florian.krischer@fkr.dev \
--cc=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=thierry.reding@kernel.org \
/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