From: Akhil R <akhilrajeev@nvidia.com>
To: Laxman Dewangan <ldewangan@nvidia.com>,
Dmitry Osipenko <digetx@gmail.com>,
Andi Shyti <andi.shyti@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
"Kartik Rajput" <kkartik@nvidia.com>,
Wolfram Sang <wsa@kernel.org>, <linux-i2c@vger.kernel.org>,
<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <mochs@nvidia.com>, Akhil R <akhilrajeev@nvidia.com>
Subject: [PATCH 1/4] i2c: tegra: use dmaengine_get_dma_device() for DMA buffer allocation
Date: Tue, 5 May 2026 16:29:25 +0530 [thread overview]
Message-ID: <20260505105928.38457-2-akhilrajeev@nvidia.com> (raw)
In-Reply-To: <20260505105928.38457-1-akhilrajeev@nvidia.com>
Use dmaengine_get_dma_device() to obtain the correct struct device
pointer for dma_alloc_coherent() instead of directly dereferencing
chan->device->dev.
The dmaengine_get_dma_device() helper checks whether the DMA channel
has a per-channel DMA device (chan->dev->chan_dma_dev) and returns it
when available, falling back to the controller device otherwise. On
platforms where the DMA controller sits behind an IOMMU with
per-channel IOVA spaces (e.g. Tegra264 GPC DMA), the per-channel
device carries the correct DMA mapping context. Using the controller
device directly would allocate DMA buffers against the wrong IOMMU
domain, leading to SMMU faults at runtime.
On platforms without per-channel DMA devices the helper returns the
same pointer as before, so there is no change in behavior for existing
hardware.
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Assisted-by: Cursor:claude-4.6-opus
---
drivers/i2c/busses/i2c-tegra.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 9fd5ade774a0..a21f6457d41b 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -712,7 +712,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
goto err_out;
}
- i2c_dev->dma_dev = i2c_dev->dma_chan->device->dev;
+ i2c_dev->dma_dev = dmaengine_get_dma_device(i2c_dev->dma_chan);
i2c_dev->dma_buf_size = i2c_dev->hw->quirks->max_write_len +
I2C_PACKET_HEADER_SIZE;
--
2.50.1
next prev parent reply other threads:[~2026-05-05 11:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 10:59 [PATCH 0/4] i2c: tegra: Improve DMA mapping, latency, and power management Akhil R
2026-05-05 10:59 ` Akhil R [this message]
2026-05-05 10:59 ` [PATCH 2/4] i2c: tegra: Disable fair arbitration for non-MCTP buses Akhil R
2026-05-05 10:59 ` [PATCH 3/4] i2c: tegra: Update Tegra410 I2C timing parameters Akhil R
2026-05-05 10:59 ` [PATCH 4/4] i2c: tegra: Fix NOIRQ suspend/resume Akhil R
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=20260505105928.38457-2-akhilrajeev@nvidia.com \
--to=akhilrajeev@nvidia.com \
--cc=andi.shyti@kernel.org \
--cc=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=kkartik@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mochs@nvidia.com \
--cc=thierry.reding@kernel.org \
--cc=wsa@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