mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Damato <joe@dama.to>
To: Robin Murphy <robin.murphy@arm.com>
Cc: "Joerg Roedel (AMD)" <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] iommu/dma: Add helper for coherent devs without swiotlb
Date: Wed, 2 Dec 2026 07:18:28 -0800	[thread overview]
Message-ID: <axA2xIjFB42bhYbD@devvm20253.cco0.facebook.com> (raw)
In-Reply-To: <2ca7331a-68b0-4751-a014-f430782e34ca@arm.com>

On Tue, Dec 01, 2026 at 08:30:38PM +0000, Robin Murphy wrote:
> On 2026-11-06 5:57 pm, Joe Damato wrote:
> > Factor out some repeated logic which checks if a device is coherent and
> > if there is a swiotlb.
> > 
> > Replace repeated instances of this logic with a call to the helper
> > instead.
> 
> dev_use_swiotlb() itself already contains a frankly confusing number of
> levels of indirection. I guess I can buy the argument for patch #2, but
> please just make it the trivial 2-liner that doesn't obfuscate the
> conditions (and thus correlates even more clearly to those same
> conditions in the map path) i.e.:
> 
> @@ -1280,7 +1280,8 @@ void iommu_dma_unmap_phys(struct device *dev, dma_addr_t dma_handle,
>  {
>  	phys_addr_t phys;
> -	if (attrs & (DMA_ATTR_MMIO | DMA_ATTR_REQUIRE_COHERENT)) {
> +	if ((attrs & (DMA_ATTR_MMIO | DMA_ATTR_REQUIRE_COHERENT)) ||
> +	    (dev_is_dma_coherent(dev) && !dev_use_swiotlb(dev, size, dir))) {
>  		__iommu_dma_unmap(dev, dma_handle, size);
>  		return;
>  	}

OK, will do. I'll respin this as a single patch. Thanks a lot for the review,
I appreciate your time!

  reply	other threads:[~2026-12-02 15:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 17:57 [PATCH 0/2] iommu/dma: Skip iova_to_phys() on unmap for coherent devices Joe Damato
2026-11-06 17:57 ` [PATCH 1/2] iommu/dma: Add helper for coherent devs without swiotlb Joe Damato
2026-12-01 20:30   ` Robin Murphy
2026-12-02 15:18     ` Joe Damato [this message]
2026-11-06 17:57 ` [PATCH 2/2] iommu/dma: Skip iova_to_phys() on unmap when unneeded Joe Damato
2026-12-01 17:48 ` [PATCH 0/2] iommu/dma: Skip iova_to_phys() on unmap for coherent devices Joe Damato

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=axA2xIjFB42bhYbD@devvm20253.cco0.facebook.com \
    --to=joe@dama.to \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®