[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240718132613.GA1265781@unreal>
Date: Thu, 18 Jul 2024 16:26:13 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Christoph Hellwig <hch@....de>
Cc: Robin Murphy <robin.murphy@....com>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Easwar Hariharan <eahariha@...ux.microsoft.com>,
linux-kernel@...r.kernel.org, iommu@...ts.linux.dev,
Jason Gunthorpe <jgg@...dia.com>
Subject: Re: [PATCH v2 2/2] dma: add IOMMU static calls with clear default ops
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
Powered by blists - more mailing lists