mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Jianfeng Liu <liujianfeng1994@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: "Rob Clark" <robin.clark@oss.qualcomm.com>,
	freedreno@lists.freedesktop.org, iommu@lists.linux.dev,
	"Dmitry Baryshkov" <lumag@kernel.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	linux-media@vger.kernel.org,
	"Bryan O'Donoghue" <bod.linux@nxsw.ie>,
	"Joerg Roedel" <joro@8bytes.org>, "Will Deacon" <will@kernel.org>
Subject: Re: [PATCH v1 1/2] iommu: export iommu_get_dma_domain()
Date: Mon, 28 Sep 2026 12:26:14 +0100	[thread overview]
Message-ID: <47bf9a4c-2a47-4e93-bcdf-8d953c9a5ab8@arm.com> (raw)
In-Reply-To: <20260928053901.7270-2-liujianfeng1994@gmail.com>

On 28/09/2026 6:38 am, Jianfeng Liu wrote:
> drm/msm needs to recover the physical address behind a DMA address of
> imported dma-bufs: with CONFIG_DMABUF_DEBUG=y the attachment sg_table
> it hands to importers carries no struct page, and msm has to translate
> sg_dma_address() back to a physical address through the attaching
> device's DMA-API domain to map such buffers into its own pagetables
> (see the follow-up drm/msm patch).
> 
> Export the helper so modularized drivers can use it.

NAK. Read the comment - this is an internal helper for iommu-dma 
(currently the only IOMMU_DOMAIN_DMA implementation) and is definitely 
not for random drivers to abuse. In fact it should really move to 
iommu-priv.h now that we have that.

If you want to do sketchy things with your device's DMA domain then use 
the public iommu_get_domain_for_dev() interface like everyone else.

Thanks,
Robin.

> 
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Will Deacon <will@kernel.org>
> Cc: iommu@lists.linux.dev
> 
> Signed-off-by: Jianfeng Liu <liujianfeng1994@gmail.com>
> ---
> 
>   drivers/iommu/iommu.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index cd1bca7ede9af..330f9a79248bd 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2327,6 +2327,7 @@ struct iommu_domain *iommu_get_dma_domain(struct device *dev)
>   {
>   	return dev->iommu_group->default_domain;
>   }
> +EXPORT_SYMBOL_GPL(iommu_get_dma_domain);
>   
>   static void *iommu_make_pasid_array_entry(struct iommu_domain *domain,
>   					  struct iommu_attach_handle *handle)


  reply	other threads:[~2026-09-28 11:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  5:38 [PATCH v1 0/2] drm/msm: followup - map page-less imported sg_tables Jianfeng Liu
2026-09-28  5:38 ` [PATCH v1 1/2] iommu: export iommu_get_dma_domain() Jianfeng Liu
2026-09-28 11:26   ` Robin Murphy [this message]
2026-09-28  5:38 ` [PATCH v1 2/2] drm/msm: map page-less imported sg_tables from their DMA addresses Jianfeng Liu
2026-09-28 10:09   ` Christian König

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=47bf9a4c-2a47-4e93-bcdf-8d953c9a5ab8@arm.com \
    --to=robin.murphy@arm.com \
    --cc=bod.linux@nxsw.ie \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=liujianfeng1994@gmail.com \
    --cc=lumag@kernel.org \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=sumit.semwal@linaro.org \
    --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

all inboxes | Powered by JetHome®