Linux IOMMU Development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Cc: "Leon Romanovsky" <leonro@nvidia.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Subject: [PATCH] dma-mapping: reliably inform about DMA support for IOMMU
Date: Wed, 11 Sep 2024 13:15:00 +0300	[thread overview]
Message-ID: <7bbedc085ce87b121b9d0cb33eca8fba2fbdddbc.1726049194.git.leonro@nvidia.com> (raw)

From: Leon Romanovsky <leonro@nvidia.com>

If the DMA IOMMU path is going to be used, the appropriate check should
return that DMA is supported.

Fixes: b5c58b2fdc42 ("dma-mapping: direct calls for dma-iommu")
Closes: https://lore.kernel.org/all/181e06ff-35a3-434f-b505-672f430bd1cb@notapiano
Reported-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> #KernelCI
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 kernel/dma/mapping.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index 1a7de37bd643..38d7b3239dbb 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -824,6 +824,9 @@ static int dma_supported(struct device *dev, u64 mask)
 
 	if (WARN_ON(ops && use_dma_iommu(dev)))
 		return false;
+
+	if (use_dma_iommu(dev))
+		return true;
 	/*
 	 * ->dma_supported sets the bypass flag, so we must always call
 	 * into the method here unless the device is truly direct mapped.
-- 
2.46.0


             reply	other threads:[~2024-09-11 10:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11 10:15 Leon Romanovsky [this message]
2024-09-11 12:54 ` [PATCH] dma-mapping: reliably inform about DMA support for IOMMU Robin Murphy
2024-09-11 12:54 ` Nícolas F. R. A. Prado
2024-09-12  7:29 ` Christoph Hellwig
2024-09-12 10:50   ` Leon Romanovsky

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=7bbedc085ce87b121b9d0cb33eca8fba2fbdddbc.1726049194.git.leonro@nvidia.com \
    --to=leon@kernel.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=nfraprado@collabora.com \
    --cc=robin.murphy@arm.com \
    --cc=will@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