[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240718123038.GA27055@lst.de>
Date: Thu, 18 Jul 2024 14:30:38 +0200
From: Christoph Hellwig <hch@....de>
To: Leon Romanovsky <leon@...nel.org>
Cc: Christoph Hellwig <hch@....de>, 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 10:04:06AM +0300, Leon Romanovsky wrote:
> Whom should I add?
Greg as the device model maintainer.
> > 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.
> > > #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;
...
Powered by blists - more mailing lists