All of lore.kernel.org
 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: Thu, 17 Jul 2025 17:52:13 +0300	[thread overview]
Message-ID: <20250717145213.GB402218@unreal> (raw)
In-Reply-To: <20250717134435.GA2206214@ziepe.ca>

On Thu, Jul 17, 2025 at 10:44:35AM -0300, Jason Gunthorpe wrote:
> On Thu, Jul 17, 2025 at 09:47:09AM +0300, Leon Romanovsky wrote:
> 
> > @@ -183,7 +187,11 @@ dma_addr_t dma_map_phys(struct device *dev, phys_addr_t phys, size_t size,
> >  		 * All platforms which implement .map_page() don't support
> >  		 * non-struct page backed addresses.
> >  		 */
> > -		addr = ops->map_page(dev, page, offset, size, dir, attrs);
> > +		if (ops->map_phys)
> > +			addr = ops->map_phys(dev, phys, size, dir, attrs);
> > +		if (ops->map_page)
> > +			addr = ops->map_page(dev, page, offset, size, dir,
> > +					     attrs);
> 
> 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.

> 
> > @@ -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.

Thanks

  reply	other threads:[~2025-07-17 14: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 [this message]
2025-07-17 17:07       ` Jason Gunthorpe
2025-07-20  6:52         ` Leon Romanovsky
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=20250717145213.GB402218@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.