linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Derrick, Jonathan" <jonathan.derrick@intel.com>
To: "hch@lst.de" <hch@lst.de>, "helgaas@kernel.org" <helgaas@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"brouer@redhat.com" <brouer@redhat.com>,
	"Yu, Fenghua" <fenghua.yu@intel.com>,
	"tariqt@mellanox.com" <tariqt@mellanox.com>,
	"toke@toke.dk" <toke@toke.dk>,
	"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
	"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-ia64@vger.kernel.org" <linux-ia64@vger.kernel.org>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"ilias.apalodimas@linaro.org" <ilias.apalodimas@linaro.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"Luck, Tony" <tony.luck@intel.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"Busch, Keith" <keith.busch@intel.com>
Subject: Re: [PATCH 14/15] vmd: use the proper dma_* APIs instead of direct methods calls
Date: Fri, 14 Dec 2018 21:34:52 +0000	[thread overview]
Message-ID: <1544823277.19764.1.camel@intel.com> (raw)
In-Reply-To: <20181214211757.GF20725@google.com>

[-- Attachment #1: Type: text/plain, Size: 5993 bytes --]

Looks good to me
Thanks Christoph

Acked-by: Jon Derrick <jonathan.derrick@intel.com>

On Fri, 2018-12-14 at 15:17 -0600, Bjorn Helgaas wrote:
> Conventional spelling in subject is
> 
>   PCI: vmd: Use dma_* APIs instead of direct method calls
> 
> On Fri, Dec 07, 2018 at 11:07:19AM -0800, Christoph Hellwig wrote:
> > With the bypass support for the direct mapping we might not always have
> > methods to call, so use the proper APIs instead.  The only downside is
> > that we will create two dma-debug entries for each mapping if
> > CONFIG_DMA_DEBUG is enabled.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> You cc'd the VMD maintainers already, and I have no objection to this
> from a PCI core point of view, so:
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> > ---
> >  drivers/pci/controller/vmd.c | 42 +++++++++++++++---------------------
> >  1 file changed, 17 insertions(+), 25 deletions(-)
> > 
> > diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> > index 98ce79eac128..3890812cdf87 100644
> > --- a/drivers/pci/controller/vmd.c
> > +++ b/drivers/pci/controller/vmd.c
> > @@ -307,39 +307,32 @@ static struct device *to_vmd_dev(struct device *dev)
> >  	return &vmd->dev->dev;
> >  }
> >  
> > -static const struct dma_map_ops *vmd_dma_ops(struct device *dev)
> > -{
> > -	return get_dma_ops(to_vmd_dev(dev));
> > -}
> > -
> >  static void *vmd_alloc(struct device *dev, size_t size, dma_addr_t *addr,
> >  		       gfp_t flag, unsigned long attrs)
> >  {
> > -	return vmd_dma_ops(dev)->alloc(to_vmd_dev(dev), size, addr, flag,
> > -				       attrs);
> > +	return dma_alloc_attrs(to_vmd_dev(dev), size, addr, flag, attrs);
> >  }
> >  
> >  static void vmd_free(struct device *dev, size_t size, void *vaddr,
> >  		     dma_addr_t addr, unsigned long attrs)
> >  {
> > -	return vmd_dma_ops(dev)->free(to_vmd_dev(dev), size, vaddr, addr,
> > -				      attrs);
> > +	return dma_free_attrs(to_vmd_dev(dev), size, vaddr, addr, attrs);
> >  }
> >  
> >  static int vmd_mmap(struct device *dev, struct vm_area_struct *vma,
> >  		    void *cpu_addr, dma_addr_t addr, size_t size,
> >  		    unsigned long attrs)
> >  {
> > -	return vmd_dma_ops(dev)->mmap(to_vmd_dev(dev), vma, cpu_addr, addr,
> > -				      size, attrs);
> > +	return dma_mmap_attrs(to_vmd_dev(dev), vma, cpu_addr, addr, size,
> > +			attrs);
> >  }
> >  
> >  static int vmd_get_sgtable(struct device *dev, struct sg_table *sgt,
> >  			   void *cpu_addr, dma_addr_t addr, size_t size,
> >  			   unsigned long attrs)
> >  {
> > -	return vmd_dma_ops(dev)->get_sgtable(to_vmd_dev(dev), sgt, cpu_addr,
> > -					     addr, size, attrs);
> > +	return dma_get_sgtable_attrs(to_vmd_dev(dev), sgt, cpu_addr, addr, size,
> > +			attrs);
> >  }
> >  
> >  static dma_addr_t vmd_map_page(struct device *dev, struct page *page,
> > @@ -347,61 +340,60 @@ static dma_addr_t vmd_map_page(struct device *dev, struct page *page,
> >  			       enum dma_data_direction dir,
> >  			       unsigned long attrs)
> >  {
> > -	return vmd_dma_ops(dev)->map_page(to_vmd_dev(dev), page, offset, size,
> > -					  dir, attrs);
> > +	return dma_map_page_attrs(to_vmd_dev(dev), page, offset, size, dir,
> > +			attrs);
> >  }
> >  
> >  static void vmd_unmap_page(struct device *dev, dma_addr_t addr, size_t size,
> >  			   enum dma_data_direction dir, unsigned long attrs)
> >  {
> > -	vmd_dma_ops(dev)->unmap_page(to_vmd_dev(dev), addr, size, dir, attrs);
> > +	dma_unmap_page_attrs(to_vmd_dev(dev), addr, size, dir, attrs);
> >  }
> >  
> >  static int vmd_map_sg(struct device *dev, struct scatterlist *sg, int nents,
> >  		      enum dma_data_direction dir, unsigned long attrs)
> >  {
> > -	return vmd_dma_ops(dev)->map_sg(to_vmd_dev(dev), sg, nents, dir, attrs);
> > +	return dma_map_sg_attrs(to_vmd_dev(dev), sg, nents, dir, attrs);
> >  }
> >  
> >  static void vmd_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
> >  			 enum dma_data_direction dir, unsigned long attrs)
> >  {
> > -	vmd_dma_ops(dev)->unmap_sg(to_vmd_dev(dev), sg, nents, dir, attrs);
> > +	dma_unmap_sg_attrs(to_vmd_dev(dev), sg, nents, dir, attrs);
> >  }
> >  
> >  static void vmd_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
> >  				    size_t size, enum dma_data_direction dir)
> >  {
> > -	vmd_dma_ops(dev)->sync_single_for_cpu(to_vmd_dev(dev), addr, size, dir);
> > +	dma_sync_single_for_cpu(to_vmd_dev(dev), addr, size, dir);
> >  }
> >  
> >  static void vmd_sync_single_for_device(struct device *dev, dma_addr_t addr,
> >  				       size_t size, enum dma_data_direction dir)
> >  {
> > -	vmd_dma_ops(dev)->sync_single_for_device(to_vmd_dev(dev), addr, size,
> > -						 dir);
> > +	dma_sync_single_for_device(to_vmd_dev(dev), addr, size, dir);
> >  }
> >  
> >  static void vmd_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
> >  				int nents, enum dma_data_direction dir)
> >  {
> > -	vmd_dma_ops(dev)->sync_sg_for_cpu(to_vmd_dev(dev), sg, nents, dir);
> > +	dma_sync_sg_for_cpu(to_vmd_dev(dev), sg, nents, dir);
> >  }
> >  
> >  static void vmd_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
> >  				   int nents, enum dma_data_direction dir)
> >  {
> > -	vmd_dma_ops(dev)->sync_sg_for_device(to_vmd_dev(dev), sg, nents, dir);
> > +	dma_sync_sg_for_device(to_vmd_dev(dev), sg, nents, dir);
> >  }
> >  
> >  static int vmd_dma_supported(struct device *dev, u64 mask)
> >  {
> > -	return vmd_dma_ops(dev)->dma_supported(to_vmd_dev(dev), mask);
> > +	return dma_supported(to_vmd_dev(dev), mask);
> >  }
> >  
> >  static u64 vmd_get_required_mask(struct device *dev)
> >  {
> > -	return vmd_dma_ops(dev)->get_required_mask(to_vmd_dev(dev));
> > +	return dma_get_required_mask(to_vmd_dev(dev));
> >  }
> >  
> >  static void vmd_teardown_dma_ops(struct vmd_dev *vmd)
> > -- 
> > 2.19.1
> > 

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3278 bytes --]

  reply	other threads:[~2018-12-14 21:34 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-07 19:07 [RFC] avoid indirect calls for DMA direct mappings v2 Christoph Hellwig
2018-12-07 19:07 ` [PATCH 01/15] swiotlb: remove SWIOTLB_MAP_ERROR Christoph Hellwig
2018-12-07 19:07 ` [PATCH 02/15] swiotlb: remove dma_mark_clean Christoph Hellwig
2019-01-02 21:53   ` Tony Luck
2019-01-03  7:23     ` Christoph Hellwig
2019-01-03 17:35       ` Tony Luck
2019-01-04  8:09         ` Christoph Hellwig
2018-12-07 19:07 ` [PATCH 03/15] dma-direct: improve addressability error reporting Christoph Hellwig
2018-12-07 19:07 ` [PATCH 04/15] dma-direct: use dma_direct_map_page to implement dma_direct_map_sg Christoph Hellwig
2018-12-07 19:07 ` [PATCH 05/15] dma-direct: merge swiotlb_dma_ops into the dma_direct code Christoph Hellwig
2018-12-07 19:07 ` [PATCH 06/15] dma-mapping: simplify the dma_sync_single_range_for_{cpu,device} implementation Christoph Hellwig
2018-12-07 19:07 ` [PATCH 07/15] dma-mapping: merge dma_unmap_page_attrs and dma_unmap_single_attrs Christoph Hellwig
2018-12-07 19:07 ` [PATCH 08/15] dma-mapping: move dma_get_required_mask to kernel/dma Christoph Hellwig
2018-12-07 19:07 ` [PATCH 09/15] dma-mapping: move various slow path functions out of line Christoph Hellwig
2018-12-07 19:07 ` [PATCH 10/15] dma-mapping: move dma_cache_sync " Christoph Hellwig
2018-12-07 19:07 ` [PATCH 11/15] dma-mapping: always build the direct mapping code Christoph Hellwig
2018-12-07 19:07 ` [PATCH 12/15] dma-mapping: factor out dummy DMA ops Christoph Hellwig
2018-12-07 19:07 ` [PATCH 13/15] ACPI / scan: Refactor _CCA enforcement Christoph Hellwig
2018-12-14 21:15   ` Bjorn Helgaas
2018-12-07 19:07 ` [PATCH 14/15] vmd: use the proper dma_* APIs instead of direct methods calls Christoph Hellwig
2018-12-14 21:17   ` Bjorn Helgaas
2018-12-14 21:34     ` Derrick, Jonathan [this message]
2018-12-07 19:07 ` [PATCH 15/15] dma-mapping: bypass indirect calls for dma-direct Christoph Hellwig
2018-12-14 14:11   ` Marek Szyprowski
2018-12-14 14:24     ` Christoph Hellwig
2018-12-14 14:32       ` Marek Szyprowski
2018-12-15 17:46   ` [15/15] " Guenter Roeck
2018-12-16  9:02     ` Christoph Hellwig
2018-12-18 20:34   ` Guillaume Tucker
2018-12-18 20:42     ` Robin Murphy
2018-12-19  6:42       ` Christoph Hellwig
2018-12-20 16:44   ` [PATCH 15/15] " Thierry Reding
2018-12-20 16:46     ` Christoph Hellwig
2018-12-08 16:06 ` [RFC] avoid indirect calls for DMA direct mappings v2 Jesper Dangaard Brouer
2018-12-08 16:50   ` Christoph Hellwig
2018-12-10 21:51 ` Luck, Tony
2018-12-11  6:51   ` Christoph Hellwig
2018-12-11 16:42     ` Luck, Tony
2018-12-11 17:13     ` Luck, Tony
2018-12-11 17:15       ` Christoph Hellwig
2018-12-13 20:08 ` 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=1544823277.19764.1.camel@intel.com \
    --to=jonathan.derrick@intel.com \
    --cc=brouer@redhat.com \
    --cc=fenghua.yu@intel.com \
    --cc=hch@lst.de \
    --cc=helgaas@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=keith.busch@intel.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=tariqt@mellanox.com \
    --cc=toke@toke.dk \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).