Re: [RFC PATCH v2 07/11] dma-mapping: Add flags to dma_map_ops to indicate PCI P2PDMA support

2021-03-16 Thread Christoph Hellwig
On Thu, Mar 11, 2021 at 04:31:37PM -0700, Logan Gunthorpe wrote: > +int dma_pci_p2pdma_supported(struct device *dev) > +{ > + const struct dma_map_ops *ops = get_dma_ops(dev); > + > + return !ops || ops->flags & DMA_F_PCI_P2PDMA_SUPPORTED; > +} > +EXPORT_SYMBOL(dma_pci_p2pdma_supported);

Re: [RFC PATCH v2 07/11] dma-mapping: Add flags to dma_map_ops to indicate PCI P2PDMA support

2021-03-16 Thread Christoph Hellwig
On Mon, Mar 15, 2021 at 10:33:13AM -0600, Logan Gunthorpe wrote: > >> + return !ops || ops->flags & DMA_F_PCI_P2PDMA_SUPPORTED; > > > > Is this logic correct? I would have expected. > > > > return (ops && ops->flags & DMA_F_PCI_P2PDMA_SUPPORTED); > > > If ops is NULL then the operations

Re: [RFC PATCH v2 07/11] dma-mapping: Add flags to dma_map_ops to indicate PCI P2PDMA support

2021-03-15 Thread Logan Gunthorpe
On 2021-03-12 7:36 p.m., Ira Weiny wrote: > On Thu, Mar 11, 2021 at 04:31:37PM -0700, Logan Gunthorpe wrote: > >> +int dma_pci_p2pdma_supported(struct device *dev) >^^^ > bool? Sure. > >> +{ >> +const struct dma_map_ops *ops = get_dma_ops(dev); >> + >> +return !ops ||

Re: [RFC PATCH v2 07/11] dma-mapping: Add flags to dma_map_ops to indicate PCI P2PDMA support

2021-03-12 Thread Ira Weiny
On Thu, Mar 11, 2021 at 04:31:37PM -0700, Logan Gunthorpe wrote: > +int dma_pci_p2pdma_supported(struct device *dev) ^^^ bool? > +{ > + const struct dma_map_ops *ops = get_dma_ops(dev); > + > + return !ops || ops->flags & DMA_F_PCI_P2PDMA_SUPPORTED; Is this logic correct? I would

[RFC PATCH v2 07/11] dma-mapping: Add flags to dma_map_ops to indicate PCI P2PDMA support

2021-03-11 Thread Logan Gunthorpe
Add a flags member to the dma_map_ops structure with one flag to indicate support for PCI P2PDMA. Also, add a helper to check if a device supports PCI P2PDMA. Signed-off-by: Logan Gunthorpe --- include/linux/dma-map-ops.h | 3 +++ include/linux/dma-mapping.h | 5 + kernel/dma/mapping.c