From: Leon Romanovsky <leon@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Easwar Hariharan <eahariha@linux.microsoft.com>,
linux-kernel@vger.kernel.org, iommu@lists.linux.dev,
Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH v2 2/2] dma: add IOMMU static calls with clear default ops
Date: Thu, 18 Jul 2024 16:26:13 +0300 [thread overview]
Message-ID: <20240718132613.GA1265781@unreal> (raw)
In-Reply-To: <20240718123038.GA27055@lst.de>
On Thu, Jul 18, 2024 at 02:30:38PM +0200, Christoph Hellwig wrote:
> On Thu, Jul 18, 2024 at 10:04:06AM +0300, Leon Romanovsky wrote:
> > Whom should I add?
>
> Greg as the device model maintainer.
No problem, I will add him to the next version.
>
> > > The normal style would be to move the ifdefs outside the helper
> > > function.
> >
> > I think you are talking about the style of functions declarations in
> > header files. This function is inside c-file and it is much easier
> > to write it this way.
>
> But also much harder to read, which will happen much more often.
I'll change.
>
> > > > #ifdef CONFIG_DMA_OPS_BYPASS
> > > > + WARN_ON_ONCE(dev->dma_ops_bypass && dma_is_default_iommu(dev));
> > > > if (dev->dma_ops_bypass)
> > >
> > > Let's skip this and think about it if we ever use the bypass for
> > > something that is not powerpc with it's own dma ops.
> >
> > I wanted to catch misconfigurations, but I can remove it. Is this what
> > you are suggesting?
> >
> > 126 static bool dma_go_direct(struct device *dev, dma_addr_t mask,
> > 127 const struct dma_map_ops *ops)
> > 128 {
> > 129 if (likely(!ops && !dma_is_default_iommu(dev)))
> > 130 return true;
> > 131
> > 132 if (dma_is_default_iommu(dev))
> > 133 return false;
>
> I'd go for:
>
> if (use_dma_iommu(dev))
> return false;
> if (likely(!ops))
> return true;
> ...
>
I will change.
Thanks
next prev parent reply other threads:[~2024-07-18 13:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-17 12:37 [PATCH v2 0/2] DMA IOMMU static calls Leon Romanovsky
2024-07-17 12:37 ` [PATCH v2 1/2] dma: call unconditionally to unmap_page and unmap_sg callbacks Leon Romanovsky
2024-07-18 3:49 ` Christoph Hellwig
2024-07-18 6:33 ` Leon Romanovsky
2024-07-17 12:37 ` [PATCH v2 2/2] dma: add IOMMU static calls with clear default ops Leon Romanovsky
2024-07-18 3:48 ` Christoph Hellwig
2024-07-18 7:04 ` Leon Romanovsky
2024-07-18 12:30 ` Christoph Hellwig
2024-07-18 13:26 ` Leon Romanovsky [this message]
2024-07-29 12:41 ` Mostafa Saleh
2024-07-29 14:07 ` Leon Romanovsky
2024-07-29 17:15 ` Christoph Hellwig
2024-07-30 8:16 ` Leon Romanovsky
2024-07-30 15:26 ` Christoph Hellwig
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=20240718132613.GA1265781@unreal \
--to=leon@kernel.org \
--cc=eahariha@linux.microsoft.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--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 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.