public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Jason Gunthorpe <jgg@ziepe.ca>
Subject: Re: [PATCH] iommu/dma: add missing support for DMA_ATTR_MMIO for dma_iova_unlink()
Date: Mon, 24 Nov 2025 17:40:24 +0000	[thread overview]
Message-ID: <fed2bf95-4edd-4517-9e00-4252595d0eb9@arm.com> (raw)
In-Reply-To: <20251124172038.GD12483@unreal>

On 2025-11-24 5:20 pm, Leon Romanovsky wrote:
> On Mon, Nov 24, 2025 at 05:15:48PM +0000, Robin Murphy wrote:
>> On 2025-11-24 5:09 pm, Marek Szyprowski wrote:
>>> Commit c288d657dd51 added support for DMA_ATTR_MMIO attribute in the
>>> dma_iova_link() code path, but missed that the CPU cache is being also
>>> touched in the dma_iova_unlink() path. Fix this.
>>>
>>> Fixes: c288d657dd51 ("iommu/dma: implement DMA_ATTR_MMIO for dma_iova_link().")
>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>> ---
>>>    drivers/iommu/dma-iommu.c | 5 +++--
>>>    1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
>>> index e52d19d2e833..c92088855450 100644
>>> --- a/drivers/iommu/dma-iommu.c
>>> +++ b/drivers/iommu/dma-iommu.c
>>> @@ -2008,7 +2008,7 @@ static void iommu_dma_iova_unlink_range_slow(struct device *dev,
>>>    			end - addr, iovad->granule - iova_start_pad);
>>>    		if (!dev_is_dma_coherent(dev) &&
>>> -		    !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
>>> +		    !(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO)))
>>>    			arch_sync_dma_for_cpu(phys, len, dir);
>>>    		swiotlb_tbl_unmap_single(dev, phys, len, dir, attrs);
>>> @@ -2032,7 +2032,8 @@ static void __iommu_dma_iova_unlink(struct device *dev,
>>>    	size_t unmapped;
>>>    	if ((state->__size & DMA_IOVA_USE_SWIOTLB) ||
>>> -	    (!dev_is_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)))
>>> +	    (!dev_is_dma_coherent(dev) &&
>>> +	     !(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO))))
>>
>> This isn't needed, since there's no way an MMIO mapping could have used
>> SWIOTLB.
> 
> This "if" is taken even for non-SWIOTLB path, because of "||" operator
> in line above.

Oof, clearly it's already time to stop trying to read code and go home... :)

Thanks,
Robin.

  reply	other threads:[~2025-11-24 17:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20251124171014eucas1p21d3a0f2c10b43bfdb7861ee804f09951@eucas1p2.samsung.com>
2025-11-24 17:09 ` [PATCH] iommu/dma: add missing support for DMA_ATTR_MMIO for dma_iova_unlink() Marek Szyprowski
2025-11-24 17:15   ` Robin Murphy
2025-11-24 17:20     ` Leon Romanovsky
2025-11-24 17:40       ` Robin Murphy [this message]
2025-11-24 17:26   ` Leon Romanovsky
2025-11-25 12:20     ` Marek Szyprowski
2025-11-24 18:17   ` Jason Gunthorpe
2025-11-24 18:46     ` Marek Szyprowski

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=fed2bf95-4edd-4517-9e00-4252595d0eb9@arm.com \
    --to=robin.murphy@arm.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.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