Linux IOMMU Development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>, iommu@lists.linux.dev
Subject: Re: [PATCH 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address
Date: Sun, 20 Jul 2025 09:52:55 +0300	[thread overview]
Message-ID: <20250720065255.GC402218@unreal> (raw)
In-Reply-To: <20250717170758.GB2206214@ziepe.ca>

On Thu, Jul 17, 2025 at 02:07:58PM -0300, Jason Gunthorpe wrote:
> On Thu, Jul 17, 2025 at 05:52:13PM +0300, Leon Romanovsky wrote:
> > > I would expect 'else if'
> > 
> > I don't expect both of them to exist. There is WARN_ON_ONCE() to catch it.
> > If it is important, I can add else.
> 
> Compiler generates better code with the else.
> 
> > > > @@ -213,8 +221,16 @@ void dma_unmap_phys(struct device *dev, dma_addr_t addr, size_t size,
> > > >  		dma_direct_unmap_phys(dev, addr, size, dir, attrs);
> > > >  	else if (use_dma_iommu(dev))
> > > >  		iommu_dma_unmap_phys(dev, addr, size, dir, attrs);
> > > > -	else
> > > > -		ops->unmap_page(dev, addr, size, dir, attrs);
> > > > +	else {
> > > > +		if (IS_ENABLED(CONFIG_DMA_API_DEBUG))
> > > > +			/* We shouldn't have both functions */
> > > > +			WARN_ON_ONCE(ops->unmap_page && ops->unmap_phys);
> > > > +
> > > > +		if (ops->unmap_phys)
> > > > +			ops->unmap_phys(dev, addr, size, dir, attrs);
> > > > +		if (ops->unmap_page)
> > > > +			ops->unmap_page(dev, addr, size, dir, attrs);
> > > 
> > > Here too
> > > 
> > > What is the practical difference between unmap_phys and unmap_page?
> > 
> > There is no difference. It is provided to provide symmetrical interface
> > to .map_phys, simple rename.
> 
> We really should not be converting phys to page without knowing there
> is a page available..

I didn't want. See this email and followup discussion.
https://lore.kernel.org/all/20250627170213.GL17401@unreal/

Thanks

  reply	other threads:[~2025-07-20  6:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17  6:47 [PATCH 0/2] Preparation to .map_page and .unmap_page removal Leon Romanovsky
2025-07-17  6:47 ` [PATCH 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address Leon Romanovsky
2025-07-17 13:44   ` Jason Gunthorpe
2025-07-17 14:52     ` Leon Romanovsky
2025-07-17 17:07       ` Jason Gunthorpe
2025-07-20  6:52         ` Leon Romanovsky [this message]
2025-07-17  6:47 ` [PATCH 2/2] dma-mapping: convert dummy ops to physical address mapping 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=20250720065255.GC402218@unreal \
    --to=leon@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=m.szyprowski@samsung.com \
    /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